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+
3+CON_Utf8: con 1;
4+# CON_Unicode: con 2; # obsolete
5+CON_Integer: con 3;
6+CON_Float: con 4;
7+CON_Long: con 5;
8+CON_Double: con 6;
9+CON_Class: con 7;
10+CON_String: con 8;
11+CON_Fieldref: con 9;
12+CON_Methodref: con 10;
13+CON_InterfaceMref: con 11;
14+CON_NameAndType: con 12;
15+# since 49.0
16+CON_MethodHandle: con 15;
17+CON_MethodType: con 16;
18+CON_InvokeDynamic: con 18;
19+
20+# Java access flags
21+
22+ACC_PUBLIC: con 16r0001;
23+ACC_PRIVATE: con 16r0002;
24+ACC_PROTECTED: con 16r0004;
25+ACC_STATIC: con 16r0008;
26+ACC_FINAL: con 16r0010;
27+ACC_SUPER: con 16r0020;
28+ACC_SYNCHRONIZED: con 16r0020; # sic
29+ACC_VOLATILE: con 16r0040;
30+ACC_TRANSIENT: con 16r0080;
31+ACC_NATIVE: con 16r0100;
32+ACC_INTERFACE: con 16r0200;
33+ACC_ABSTRACT: con 16r0400;
34+
35+_MUSTCOMPILE: con MUSTCOMPILE<<16;
36+_DONTCOMPILE: con DONTCOMPILE<<16;
37+
38+# basic block flags
39+
40+BB_LDR, # set for all leaders
41+BB_ENTRY, # method entry point
42+BB_FINALLY, # finally block entry point
43+BB_HANDLER, # EH entry point
44+BB_REACHABLE: con byte(1 << iota); # reachable basic block */
45+
46+# basic block states
47+
48+BB_PRESIM, # not simulated yet
49+BB_ACTIVE, # simulating or being unified
50+BB_POSTSIM, # simulated
51+BB_POSTUNIFY: con byte(1 << iota); # unified
52+
53+# Dis operand classification
54+
55+Anone,
56+Aimm,
57+Amp,
58+Ampind,
59+Afp,
60+Afpind,
61+Aend: con byte iota;
62+
63+# Dis n(fp) types
64+
65+DIS_X, # not yet typed
66+DIS_W, # 'B', 'Z', 'C', 'S', 'I'
67+DIS_L, # 'F', 'J', 'D'
68+DIS_P: con byte iota; # 'L', '['
69+
70+# inferno/vm/Array
71+
72+ARY_DATA: con IBY2WD; # Array data (Dis array)
73+ARY_NDIM: con 2*IBY2WD; # number of dimensions
74+ARY_ADT: con 3*IBY2WD; # 'ref Class' of element type
75+ARY_ETYPE: con 4*IBY2WD; # primitive element type code
76+
77+# java/lang/String
78+
79+STR_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'
84+EXOBJ: con 28; # 28(fp) is exception object
85+THISOFF: con 32; # 32(fp) is "this" pointer
86+REGSIZE: con 32; # 32(fp) is first usable frame cell
87+Hashsize: con 31;
88+ALLOCINCR: con 16;
89+
90+Const_ci: adt {
91+ name_index: int;
92+};
93+
94+Const_fmiref: adt {
95+ class_index: int;
96+ name_type_index: int;
97+};
98+
99+Const_nat: adt {
100+ name_index: int;
101+ sig_index: int;
102+};
103+
104+Const_utf8: adt {
105+ ln: int;
106+ utf8: string;
107+};
108+
109+# since 49.0
110+
111+Const_methodhandle: adt {
112+ ref_kind: int;
113+ ref_index: int;
114+};
115+
116+Const_methodtype: adt {
117+ descriptor_index: int;
118+};
119+
120+Const_invokedyn: adt {
121+ bs_method_attr_index: int;
122+ name_type_index: int;
123+};
124+
125+Const: 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+
166+Attr: adt { # attribute_info
167+ name: int;
168+ ln: int;
169+ info: array of byte;
170+};
171+
172+Field: 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+
180+Method: 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+
188+Class: 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+
207+Addr: 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+
214+Jinst_x1c: adt { # iinc
215+ ix: int;
216+ icon: int;
217+};
218+
219+Jinst_x2c0: adt { # invokeinterface
220+ ix: int;
221+ narg: int;
222+ zero: int;
223+};
224+
225+Jinst_x2d: adt { # multianewarray
226+ ix: int;
227+ dim: int;
228+};
229+
230+Jinst_t1: adt { # tableswitch
231+ dflt: int;
232+ lb: int;
233+ hb: int;
234+ tbl: array of int;
235+};
236+
237+Jinst_t2: adt { # lookupswitch
238+ dflt: int;
239+ np: int;
240+ tbl: array of int;
241+};
242+
243+Jinst_w: adt { # wide
244+ op: byte;
245+ ix: int;
246+ icon: int;
247+};
248+
249+Jinst: 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+
282+Handler: adt { # exception_table entry
283+ start_pc: int;
284+ end_pc: int;
285+ handler_pc: int;
286+ catch_type: int;
287+};
288+
289+Code: 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+
298+PCode: adt {
299+ code: ref Code;
300+ name: string;
301+ sig: string;
302+};
303+
304+StkSnap: adt { # snapshot of simulated Java VM stack
305+ jtype: byte;
306+ npc: int;
307+ pc: array of int;
308+};
309+
310+BB: 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+
323+Inst: 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)
334+REF_getfield: con 1;
335+REF_getstatic: con 2;
336+REF_putfield: con 3;
337+REF_putstatic: con 4;
338+REF_invokevirtual: con 5;
339+REF_invokestatic: con 6;
340+REF_invokespecial: con 7;
341+REF_newinvokespecial: con 8;
342+REF_invokeinterface: con 9;
343+