-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathopAddInts.j
More file actions
33 lines (26 loc) · 805 Bytes
/
Copy pathopAddInts.j
File metadata and controls
33 lines (26 loc) · 805 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
.class public opAddInts
.super java/lang/Object
; standard initializer
; default constructor
.method public <init>()V
aload_0 ; push this
invokespecial java/lang/Object/<init>()V ; call super
return
.end method
.method public static main([Ljava/lang/String;)V
; allocate stack big enough to hold 3 items
.limit stack 3
.limit locals 2 ; should be fine with 2
; push java.lang.System.out (type PrintStream)
getstatic java/lang/System/out Ljava/io/PrintStream;
; push ints to be printed
ldc 10 ; load int
ldc 5 ; load int
iadd ; add ints
istore_0 ; store result in variable
iload 0 ; load variable, push to top of stack
; invoke println
invokevirtual java/io/PrintStream/println(I)V ; int print result
; terminate main
return
.end method