-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMultiArrays.j
More file actions
55 lines (45 loc) · 1.23 KB
/
Copy pathMultiArrays.j
File metadata and controls
55 lines (45 loc) · 1.23 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
; --- Copyright Jonathan Meyer 1996. All rights reserved. -----------------
; File: jasmin/examples/MultiArrays.j
; Author: Jonathan Meyer, 10 July 1996
; Purpose: Examples involving multi-dimensional arrays
; -------------------------------------------------------------------------
;
; This illustrates how to use multi-dimensional arrays in the Java VM
; (though it doesn't actually do anything very interesting with the arrays.)
;
.class public examples/MultiArrays
.super java/lang/Object
; standard initializer
.method public <init>()V
aload_0
invokenonvirtual java/lang/Object/<init>()V
return
.end method
.method public static main([Ljava/lang/String;)V
.limit locals 4
.limit stack 5
; this is like:
; new int[2][5][]
iconst_2
iconst_5
multianewarray [[[I 2
; store the result in local variable 1
astore_1
aload_1
iconst_1
aaload ; stack now contains x[0]
astore_2 ; store the array in local variable 2
; create a new array of 50 ints and store it in x[1][1]
aload_2
iconst_1
bipush 50
newarray int
aastore
; create a new array of 60 ints and store it in x[1][2]
aload_2
iconst_2
bipush 60
newarray int
aastore
return
.end method