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
|
||||
.var
|
||||
a
|
||||
b
|
||||
min
|
||||
.end-var
|
||||
LDC_W OBJREF
|
||||
INVOKEVIRTUAL getnum
|
||||
ISTORE a
|
||||
LDC_W OBJREF
|
||||
LDC_W OBJREF
|
||||
INVOKEVIRTUAL getnum
|
||||
ISTORE b
|
||||
ILOAD a
|
||||
ILOAD b
|
||||
LDC_W OBJREF
|
||||
INVOKEVIRTUAL getnum
|
||||
INVOKEVIRTUAL min
|
||||
INVOKEVIRTUAL print
|
||||
HALT
|
||||
.end-main
|
||||
|
||||
.method min(x,y)
|
||||
.var
|
||||
.end-var
|
||||
ILOAD x
|
||||
ILOAD y
|
||||
ILOAD x
|
||||
ISUB
|
||||
IFLT returny
|
||||
ILOAD x
|
||||
|
|
Reference in a new issue