|
Project Information
|
.class public Contest .super java/lang/Object ; ; Team members: Bianca Cutler ; ; ; ; ; Your assignment is to fill in the fibs method below ; so that it creates (exactly) the output you see in ; fibsgolden.txt ; ; The contest will be won by those entries that compute the ; correct output and whose bytecode files are smallest ; ; For reference, a solution in Java is presented in Fibs.java ; ; ; ; standard initializer ; .method public <init>()V aload_0
invokenonvirtual java/lang/Object/.end method .method public static fibs()V ; set limits used by this method.limit locals 7 .limit stack 3 ;local variables ;obj getstatic java/lang/System/out Ljava/io/PrintStream; astore_1 ;counter for loop bipush 1 istore 2 bipush 1 istore 4 bipush 44 istore 5 bipush 3 istore 6 aload 1 ldc "The fib of 0 is 0" invokevirtual java/io/PrintStream/println(Ljava/lang/String;)V aload 1 ldc "The fib of 1 is 1" invokevirtual java/io/PrintStream/println(Ljava/lang/String;)V aload 1 ldc "The fib of 2 is 1" invokevirtual java/io/PrintStream/println(Ljava/lang/String;)VLoop:iload 4iload 2iaddiload 4 istore 2 istore 4 iload 4
aload 1 ;push objldc "The fib of "invokevirtual java/io/PrintStream/print(Ljava/lang/String;)V iload 6 invokestatic java/lang/String/valueOf(I)Ljava/lang/String; astore 3 aload 1 ;push obj aload 3 ;push string invokevirtual java/io/PrintStream/print(Ljava/lang/String;)V aload 1 ; push objectldc " is "invokevirtual java/io/PrintStream/print(Ljava/lang/String;)V invokestatic java/lang/String/valueOf(I)Ljava/lang/String; astore 3 ;prints aload 1 ;push obj aload 3 ;push string invokevirtual java/io/PrintStream/println(Ljava/lang/String;)V iinc 5 -1 iinc 6 1ifne Loopiload 5 ; done returnreturn .end method ; ; You should not need to change anything below this line. ; .method public static main([Ljava/lang/String;)V ; set limits used by this method .limit locals 1 ; = parameters + locals.end methodinvokestatic Contest/fibs()V return |