HW9: bonus working and optimized
This commit is contained in:
parent
522dafe05a
commit
7535965955
1 changed files with 4 additions and 9 deletions
|
@ -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
|
||||||
|
|
Reference in a new issue