aboutsummaryrefslogtreecommitdiff
path: root/nixpkgs/pkgs/development/compilers/jasmin/test-assemble-hello-world/HelloWorld.j
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/compilers/jasmin/test-assemble-hello-world/HelloWorld.j')
-rw-r--r--nixpkgs/pkgs/development/compilers/jasmin/test-assemble-hello-world/HelloWorld.j31
1 files changed, 31 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/compilers/jasmin/test-assemble-hello-world/HelloWorld.j b/nixpkgs/pkgs/development/compilers/jasmin/test-assemble-hello-world/HelloWorld.j
new file mode 100644
index 00000000000..564e6c8a9aa
--- /dev/null
+++ b/nixpkgs/pkgs/development/compilers/jasmin/test-assemble-hello-world/HelloWorld.j
@@ -0,0 +1,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
+