about summary refs log tree commit diff
path: root/pkgs/development/compilers/jasmin/test-assemble-hello-world/HelloWorld.j
blob: 564e6c8a9aa293a665dacde45ff0e4f08a8c0452 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
.class public HelloWorld
.super java/lang/Object

;
; standard initializer (calls java.lang.Object's initializer)
;
.method public <init>()V
   aload_0
   invokenonvirtual java/lang/Object/<init>()V
   return
.end method

;
; main() - prints out Hello World
;
.method public static main([Ljava/lang/String;)V
   .limit stack 2   ; up to two items can be pushed

   ; push System.out onto the stack
   getstatic java/lang/System/out Ljava/io/PrintStream;

   ; push a string onto the stack
   ldc "Hello World!"

   ; call the PrintStream.println() method.
   invokevirtual java/io/PrintStream/println(Ljava/lang/String;)V

   ; done
   return
.end method