-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathjava_types.go
203 lines (190 loc) · 3.31 KB
/
java_types.go
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
package bytecode
type JavaType struct {
Name string
Type string
Wide bool
Store map[int]Instruction
Load map[int]Instruction
Const map[interface{}]Instruction
}
var numberLoad = map[int]Instruction{
-1: Iload,
0: Iload_0,
1: Iload_1,
2: Iload_2,
3: Iload_3,
}
var numberStore = map[int]Instruction{
-1: Istore,
0: Istore_0,
1: Istore_1,
2: Istore_2,
3: Istore_3,
}
var Type_Byte = JavaType{
Name: "byte",
Type: "B",
Wide: false,
Store: numberStore,
Load: numberLoad,
Const: map[interface{}]Instruction{
int8(-1): Iconst_m1,
int8(0): Iconst_0,
int8(1): Iconst_1,
int8(2): Iconst_2,
int8(3): Iconst_3,
int8(4): Iconst_4,
int8(5): Iconst_5,
},
}
var Type_Short = JavaType{
Name: "short",
Type: "S",
Wide: false,
Store: numberStore,
Load: numberLoad,
Const: map[interface{}]Instruction{
int16(-1): Iconst_m1,
int16(0): Iconst_0,
int16(1): Iconst_1,
int16(2): Iconst_2,
int16(3): Iconst_3,
int16(4): Iconst_4,
int16(5): Iconst_5,
},
}
var Type_Int = JavaType{
Name: "int",
Type: "I",
Wide: false,
Store: numberStore,
Load: numberLoad,
Const: map[interface{}]Instruction{
-1: Iconst_m1,
0: Iconst_0,
1: Iconst_1,
2: Iconst_2,
3: Iconst_3,
4: Iconst_4,
5: Iconst_5,
},
}
var Type_Char = JavaType{
Name: "char",
Type: "C",
Wide: false,
Store: numberStore,
Load: numberLoad,
Const: make(map[interface{}]Instruction, 0),
}
var Type_Boolean = JavaType{
Name: "boolean",
Type: "Z",
Wide: false,
Store: numberStore,
Load: numberLoad,
Const: map[interface{}]Instruction{
true: Iconst_1,
false: Iconst_0,
},
}
var Type_Float = JavaType{
Name: "float",
Type: "F",
Wide: false,
Store: map[int]Instruction{
-1: Fstore,
0: Fstore_0,
1: Fstore_1,
2: Fstore_2,
3: Fstore_3,
},
Load: map[int]Instruction{
-1: Fload,
0: Fload_0,
1: Fload_1,
2: Fload_2,
3: Fload_3,
},
Const: map[interface{}]Instruction{
float32(0): Fconst_0,
float32(1): Fconst_1,
float32(2): Fconst_2,
},
}
var Type_Double = JavaType{
Name: "double",
Type: "D",
Wide: true,
Store: map[int]Instruction{
-1: Dstore,
0: Dstore_0,
1: Dstore_1,
2: Dstore_2,
3: Dstore_3,
},
Load: map[int]Instruction{
-1: Dload,
0: Dload_0,
1: Dload_1,
2: Dload_2,
3: Dload_3,
},
Const: map[interface{}]Instruction{
float64(0): Dconst_0,
float64(1): Dconst_1,
},
}
var Type_Long = JavaType{
Name: "long",
Type: "J",
Wide: true,
Store: map[int]Instruction{
-1: Lstore,
0: Lstore_0,
1: Lstore_1,
2: Lstore_2,
3: Lstore_3,
},
Load: map[int]Instruction{
-1: Lload,
0: Lload_0,
1: Lload_1,
2: Lload_2,
3: Lload_3,
},
Const: map[interface{}]Instruction{
int64(0): Lconst_0,
int64(1): Lconst_1,
},
}
var Type_Reference = JavaType{
Name: "reference",
Type: "L",
Wide: false,
Store: map[int]Instruction{
-1: Astore,
0: Astore_0,
1: Astore_1,
2: Astore_2,
3: Astore_3,
},
Load: map[int]Instruction{
-1: Aload,
0: Aload_0,
1: Aload_1,
2: Aload_2,
3: Aload_3,
},
Const: map[interface{}]Instruction{
nil: Aconst_null,
},
}
var Type_Array = JavaType{
Name: "array",
Type: "[",
Wide: false,
Store: make(map[int]Instruction, 0), // TODO
Load: make(map[int]Instruction, 0), // TODO
Const: make(map[interface{}]Instruction, 0), // TODO
}