History

My first initial commit with all of mine experimental changes.

Dmitry Kabak (userdima committed 13 years ago

Commit d37b88d1 parent 3f5b46618352 files · +2598093 −-8690Browse files

Showing the changes to java/appl/j2d/java.m (1 of 18352 files). Show all

Unified · Split

java/appl/j2d/java.m+343−0
@@ -0,0 +1,343 @@
1# Java constant pool tags
2
3CON_Utf8: con 1;
4# CON_Unicode: con 2; # obsolete
5CON_Integer: con 3;
6CON_Float: con 4;
7CON_Long: con 5;
8CON_Double: con 6;
9CON_Class: con 7;
10CON_String: con 8;
11CON_Fieldref: con 9;
12CON_Methodref: con 10;
13CON_InterfaceMref: con 11;
14CON_NameAndType: con 12;
15# since 49.0
16CON_MethodHandle: con 15;
17CON_MethodType: con 16;
18CON_InvokeDynamic: con 18;
19
20# Java access flags
21
22ACC_PUBLIC: con 16r0001;
23ACC_PRIVATE: con 16r0002;
24ACC_PROTECTED: con 16r0004;
25ACC_STATIC: con 16r0008;
26ACC_FINAL: con 16r0010;
27ACC_SUPER: con 16r0020;
28ACC_SYNCHRONIZED: con 16r0020; # sic
29ACC_VOLATILE: con 16r0040;
30ACC_TRANSIENT: con 16r0080;
31ACC_NATIVE: con 16r0100;
32ACC_INTERFACE: con 16r0200;
33ACC_ABSTRACT: con 16r0400;
34
35_MUSTCOMPILE: con MUSTCOMPILE<<16;
36_DONTCOMPILE: con DONTCOMPILE<<16;
37
38# basic block flags
39
40BB_LDR, # set for all leaders
41BB_ENTRY, # method entry point
42BB_FINALLY, # finally block entry point
43BB_HANDLER, # EH entry point
44BB_REACHABLE: con byte(1 << iota); # reachable basic block */
45
46# basic block states
47
48BB_PRESIM, # not simulated yet
49BB_ACTIVE, # simulating or being unified
50BB_POSTSIM, # simulated
51BB_POSTUNIFY: con byte(1 << iota); # unified
52
53# Dis operand classification
54
55Anone,
56Aimm,
57Amp,
58Ampind,
59Afp,
60Afpind,
61Aend: con byte iota;
62
63# Dis n(fp) types
64
65DIS_X, # not yet typed
66DIS_W, # 'B', 'Z', 'C', 'S', 'I'
67DIS_L, # 'F', 'J', 'D'
68DIS_P: con byte iota; # 'L', '['
69
70# inferno/vm/Array
71
72ARY_DATA: con IBY2WD; # Array data (Dis array)
73ARY_NDIM: con 2*IBY2WD; # number of dimensions
74ARY_ADT: con 3*IBY2WD; # 'ref Class' of element type
75ARY_ETYPE: con 4*IBY2WD; # primitive element type code
76
77# java/lang/String
78
79STR_DISSTR: con IBY2WD; # offset to Dis string in a String
80
81# miscellaneous
82
83#REFSYSEX: con 24; # 24(fp) is a 'ref Sys->Exception'
84EXOBJ: con 28; # 28(fp) is exception object
85THISOFF: con 32; # 32(fp) is "this" pointer
86REGSIZE: con 32; # 32(fp) is first usable frame cell
87Hashsize: con 31;
88ALLOCINCR: con 16;
89
90Const_ci: adt {
91 name_index: int;
92};
93
94Const_fmiref: adt {
95 class_index: int;
96 name_type_index: int;
97};
98
99Const_nat: adt {
100 name_index: int;
101 sig_index: int;
102};
103
104Const_utf8: adt {
105 ln: int;
106 utf8: string;
107};
108
109# since 49.0
110
111Const_methodhandle: adt {
112 ref_kind: int;
113 ref_index: int;
114};
115
116Const_methodtype: adt {
117 descriptor_index: int;
118};
119
120Const_invokedyn: adt {
121 bs_method_attr_index: int;
122 name_type_index: int;
123};
124
125Const: adt {
126 pick {
127 # CONSTANT_[Float|Double]_info
128 Ptdouble =>
129 tdouble: real;
130 # CONSTANT_Long_info
131 Ptvlong =>
132 tvlong: big;
133 # CONSTANT_Integer_info
134 Ptint =>
135 tint: int;
136 # CONSTANT_String_info
137 Pstring_index =>
138 string_index: int;
139 # CONSTANT_Class_info
140 Pci =>
141 ci: ref Const_ci;
142 # CONSTANT_[Fieldref|Methodref|InterfaceMethodref]_info
143 Pfmiref =>
144 fmiref: ref Const_fmiref;
145 # CONSTANT_NameAndType
146 Pnat =>
147 nat: ref Const_nat;
148 # CONSTANT_Utf8_info
149 Putf8 =>
150 utf8: ref Const_utf8;
151
152 # since 49.0
153
154 # CONSTANT_MethodHandle_info
155 Pmethodhandle =>
156 mh: ref Const_methodhandle;
157 # CONSTANT_MethodType_info
158 Pmethodtype =>
159 mt: ref Const_methodtype;
160 # CONSTANT_InvokeDynamic_info
161 Pinvokedyn =>
162 invokedyn: ref Const_invokedyn;
163 }
164};
165
166Attr: adt { # attribute_info
167 name: int;
168 ln: int;
169 info: array of byte;
170};
171
172Field: adt { # field_info
173 access_flags: int;
174 name_index: int;
175 sig_index: int;
176 attr_count: int;
177 attr_info: array of ref Attr; # ConstantValue attributes
178};
179
180Method: adt { # method_info
181 access_flags: int;
182 name_index: int;
183 sig_index: int;
184 attr_count: int;
185 attr_info: array of ref Attr; # Code, Exceptions attributes
186};
187
188Class: adt { # ClassFile
189# magic int; # 0xcafebabe
190 min: int;
191 maj: int;
192 cp_count: int;
193 cps: array of ref Const;
194 cts: array of byte;
195 access_flags: int;
196 this_class: int;
197 super_class: int;
198 interfaces_count: int;
199 interfaces: array of int;
200 fields_count: int;
201 fields: array of ref Field;
202 methods_count: int;
203 methods: array of ref Method;
204 source_file: int;
205};
206
207Addr: adt { # Dis operand
208 mode: byte; # Anone, Aimm, Amp, etc.
209 ival: int; # immediate, $ival
210 offset: int; # single indirect, offset(fp)
211 # double indirect, offset(ival(fp))
212};
213
214Jinst_x1c: adt { # iinc
215 ix: int;
216 icon: int;
217};
218
219Jinst_x2c0: adt { # invokeinterface
220 ix: int;
221 narg: int;
222 zero: int;
223};
224
225Jinst_x2d: adt { # multianewarray
226 ix: int;
227 dim: int;
228};
229
230Jinst_t1: adt { # tableswitch
231 dflt: int;
232 lb: int;
233 hb: int;
234 tbl: array of int;
235};
236
237Jinst_t2: adt { # lookupswitch
238 dflt: int;
239 np: int;
240 tbl: array of int;
241};
242
243Jinst_w: adt { # wide
244 op: byte;
245 ix: int;
246 icon: int;
247};
248
249Jinst: adt { # Java instruction
250 op: byte; # op code
251 jtype: byte; # Java type of dst ('I', '[', etc.)
252 pc: int; # pc offset
253 pcdis: int; # pc offset counted in dis instructions
254 line: int; # source line number
255 size: int; # size of this instruction
256 dis: cyclic ref Inst; # Dis code for this instruction
257 bb: cyclic ref BB; # the instruction's basic block
258 nsrc: int; # 0 or more source operands
259 src: array of int; # the source operands
260 dst: ref Addr; # usual destination operand
261 movsrc: ref Addr; # source operand if mov generated for load
262 pick {
263 Pz =>
264 dummy: int; # Z
265 Pi =>
266 i: int; # AT, X1, X2, B2, B4, V1, V2
267 Px1c =>
268 x1c: ref Jinst_x1c; # iinc
269 Px2c0 =>
270 x2c0: ref Jinst_x2c0; # invokeinterface
271 Px2d =>
272 x2d: ref Jinst_x2d; # multianewarray
273 Pt1 =>
274 t1: ref Jinst_t1; # tableswitch
275 Pt2 =>
276 t2: ref Jinst_t2; # lookupswitch
277 Pw =>
278 w: ref Jinst_w; # wide
279 }
280};
281
282Handler: adt { # exception_table entry
283 start_pc: int;
284 end_pc: int;
285 handler_pc: int;
286 catch_type: int;
287};
288
289Code: adt { # one Java method
290 max_stack: int;
291 max_locals: int;
292 code_length: int;
293 j: array of ref Jinst;
294 nex: int;
295 ex: array of ref Handler;
296};
297
298PCode: adt {
299 code: ref Code;
300 name: string;
301 sig: string;
302};
303
304StkSnap: adt { # snapshot of simulated Java VM stack
305 jtype: byte;
306 npc: int;
307 pc: array of int;
308};
309
310BB: adt { # basic block
311 js: ref Jinst; # first instruction in basic block
312 je: cyclic ref Jinst; # last instruction in basic block
313 nsucc: int; # number of successors
314 succ: cyclic array of ref BB; # successors
315 flags: byte; # basic block leader flags
316 state: byte; # BB_PRESIM, etc.
317 entrysz: int; # size of saved entry stack
318 entrystk: array of ref StkSnap; # snapshot of entry stack
319 exitsz: int; # size of saved exit stack
320 exitstk: array of ref StkSnap; # snapshot of exit stack
321};
322
323Inst: adt { # Dis instruction
324 op: byte; # op code
325 s: ref Addr; # source
326 m: ref Addr; # middle
327 d: ref Addr; # destination
328 pc: int; # 0-based instruction offset
329 j: ref Jinst;
330 next: cyclic ref Inst;
331};
332
333# Bytecode Behaviors for Method Handles (see section 5.4.3.5 of jvm 1.7 specs)
334REF_getfield: con 1;
335REF_getstatic: con 2;
336REF_putfield: con 3;
337REF_putstatic: con 4;
338REF_invokevirtual: con 5;
339REF_invokestatic: con 6;
340REF_invokespecial: con 7;
341REF_newinvokespecial: con 8;
342REF_invokeinterface: con 9;
343