HW9: bonus working and optimized

This commit is contained in:
Claudio Maggioni 2018-11-30 15:44:39 +01:00
parent 522dafe05a
commit 7535965955

View file

@ -4,28 +4,23 @@ OBJREF 0x40
.main .main
.var .var
a
b
min
.end-var .end-var
LDC_W OBJREF LDC_W OBJREF
INVOKEVIRTUAL getnum LDC_W OBJREF
ISTORE a
LDC_W OBJREF LDC_W OBJREF
INVOKEVIRTUAL getnum INVOKEVIRTUAL getnum
ISTORE b
ILOAD a
ILOAD b
LDC_W OBJREF LDC_W OBJREF
INVOKEVIRTUAL getnum
INVOKEVIRTUAL min INVOKEVIRTUAL min
INVOKEVIRTUAL print
HALT HALT
.end-main .end-main
.method min(x,y) .method min(x,y)
.var .var
.end-var .end-var
ILOAD x
ILOAD y ILOAD y
ILOAD x
ISUB ISUB
IFLT returny IFLT returny
ILOAD x ILOAD x