2 * This is included inside a switch statement.
9 tempBytePtr = (byte *) new_object_checked (pc[1], pc - 1);
10 if (tempBytePtr != JNULL)
13 trace (-1, (short) pc[1], 1);
14 trace (-1, (short) tempBytePtr, 2);
15 trace (-1, get_class_index((Object *) tempBytePtr), 3);
17 push_ref (ptr2ref(tempBytePtr));
20 goto LABEL_ENGINELOOP;
24 // Stack: +1 or +2 for GETSTATIC, -1 or -2 for PUTSTATIC
26 STATICFIELD fieldRecord;
36 printf ("--- GET/PUTSTATIC --- (%d, %d)\n", (int) pc[0], (int) pc[1]);
39 if (dispatch_static_initializer (get_class_record (pc[0]), pc - 1))
40 goto LABEL_ENGINELOOP;
42 fieldRecord = ((STATICFIELD *) get_static_fields_base())[pc[1]];
44 fieldType = (fieldRecord >> 12) & 0x0F;
46 isRef = (fieldType == T_REFERENCE);
48 fieldSize = typeSize[fieldType];
56 fbase1 = get_static_state_base() + get_static_field_offset (fieldRecord);
59 printf ("fieldSize = %d\n", (int) fieldSize);
60 printf ("fbase1 = %d\n", (int) fbase1);
63 if (*(pc-1) == OP_GETSTATIC)
65 make_word (fbase1, fieldSize, &tempStackWord);
69 push_ref(tempStackWord);
72 push_word (tempStackWord);
75 make_word (fbase1 + 4, 4, &tempStackWord);
76 push_word (tempStackWord);
82 store_word (fbase1 + 4, 4, pop_word());
85 store_word (fbase1, fieldSize, pop_ref());
88 store_word (fbase1, fieldSize, pop_word());
94 goto LABEL_ENGINELOOP;
102 tempStackWord = get_top_ref();
103 if (tempStackWord == JNULL)
105 throw_exception (nullPointerException);
106 goto LABEL_ENGINELOOP;
108 fieldType = get_pgfield_type(pc[0]);
109 fieldSize = typeSize[fieldType];
110 wideWord = fieldSize > 4;
116 fbase2 = ((byte *) word2ptr (tempStackWord)) +
117 get_pgfield_offset(pc[0], pc[1]);
120 printf ("--- GETFIELD ---\n");
121 printf ("fieldType: %d\n", (int) fieldType);
122 printf ("fieldSize: %d\n", (int) fieldSize);
123 printf ("wideWord: %d\n", (int) wideWord);
124 printf ("reference: %d\n", (int) tempStackWord);
125 printf ("stackTop: %d\n", (int) stackTop);
129 printf ("### get_field base=%d size=%d pushed=%d\n", (int) fbase2, (int) fieldSize, (int) tempStackWord);
132 make_word (fbase2, fieldSize, &tempStackWord);
135 printf ("### get_field base=%d size=%d pushed=%d\n", (int) fbase2, (int) fieldSize, (int) tempStackWord);
138 #ifdef RECORD_REFERENCES
139 if (fieldType == T_REFERENCE)
140 set_top_ref (tempStackWord);
143 set_top_word (tempStackWord);
145 printf("Set top word done\n");
147 printf("Wide word\n");
151 make_word (fbase2 + 4, 4, &tempStackWord);
152 push_word (tempStackWord);
157 printf("Going home\n");
159 goto LABEL_ENGINELOOP;
167 fieldType = get_pgfield_type(pc[0]);
168 fieldSize = typeSize[fieldType];
169 wideWord = (fieldSize > 4);
172 tempStackWord = get_ref_at (wideWord ? 2 : 1);
175 printf ("--- PUTFIELD ---\n");
176 printf ("fieldType: %d\n", (int) fieldType);
177 printf ("fieldSize: %d\n", (int) fieldSize);
178 printf ("wideWord: %d\n", (int) wideWord);
179 printf ("reference: %d\n", (int) tempStackWord);
183 if (tempStackWord == JNULL)
185 throw_exception (nullPointerException);
186 goto LABEL_ENGINELOOP;
188 fbase3 = ((byte *) word2ptr (tempStackWord)) +
189 get_pgfield_offset (pc[0], pc[1]);
191 store_word (fbase3 + 4, 4, pop_word());
194 printf ("### put_field base=%d size=%d stored=%d\n", (int) fbase3, (int) fieldSize, (int) get_top_word());
197 #ifdef RECORD_REFERENCES
198 if (fieldType == T_REFERENCE)
199 store_word (fbase3, fieldSize, pop_ref());
202 store_word (fbase3, fieldSize, pop_word());
206 goto LABEL_ENGINELOOP;
211 set_top_word (instance_of (word2obj (get_top_ref()), pc[1]));
213 goto LABEL_ENGINELOOP;
215 // Stack: -1 +1 (same)
219 tempStackWord = get_top_ref();
220 if (tempStackWord != JNULL && !instance_of (word2obj (tempStackWord), pc[0]))
221 throw_exception (classCastException);
223 goto LABEL_ENGINELOOP;
226 // - NEW, INSTANCEOF, CHECKCAST: 8 bits ignored, 8-bit class index
227 // - GETSTATIC and PUTSTATIC: 8-bit class index, 8-bit static field record
228 // - GETFIELD and PUTFIELD: 4-bit field type, 12-bit field data offset