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 EXECUTE_FROM_FLASH
40 if (!is_initialized_idx (pc[0]))
42 if (dispatch_static_initializer (get_class_record (pc[0]), pc - 1))
43 goto LABEL_ENGINELOOP;
45 fieldRecord = ((STATICFIELD *) get_static_fields_base())[pc[1]];
47 fieldType = (fieldRecord >> 12) & 0x0F;
49 isRef = (fieldType == T_REFERENCE);
51 fieldSize = typeSize[fieldType];
59 fbase1 = get_static_state_base() + get_static_field_offset (fieldRecord);
62 printf ("fieldSize = %d\n", (int) fieldSize);
63 printf ("fbase1 = %d\n", (int) fbase1);
66 if (*(pc-1) == OP_GETSTATIC)
68 make_word (fbase1, fieldSize, &tempStackWord);
72 push_ref(tempStackWord);
75 push_word (tempStackWord);
78 make_word (fbase1 + 4, 4, &tempStackWord);
79 push_word (tempStackWord);
85 store_word (fbase1 + 4, 4, pop_word());
88 store_word (fbase1, fieldSize, pop_ref());
91 store_word (fbase1, fieldSize, pop_word());
97 goto LABEL_ENGINELOOP;
105 tempStackWord = get_top_ref();
106 if (tempStackWord == JNULL)
108 throw_exception (nullPointerException);
109 goto LABEL_ENGINELOOP;
111 fieldType = get_pgfield_type(pc[0]);
112 fieldSize = typeSize[fieldType];
113 wideWord = fieldSize > 4;
119 fbase2 = ((byte *) word2ptr (tempStackWord)) +
120 get_pgfield_offset(pc[0], pc[1]);
123 printf ("--- GETFIELD ---\n");
124 printf ("fieldType: %d\n", (int) fieldType);
125 printf ("fieldSize: %d\n", (int) fieldSize);
126 printf ("wideWord: %d\n", (int) wideWord);
127 printf ("reference: %d\n", (int) tempStackWord);
128 printf ("stackTop: %d\n", (int) stackTop);
132 printf ("### get_field base=%d size=%d pushed=%d\n", (int) fbase2, (int) fieldSize, (int) tempStackWord);
135 make_word (fbase2, fieldSize, &tempStackWord);
138 printf ("### get_field base=%d size=%d pushed=%d\n", (int) fbase2, (int) fieldSize, (int) tempStackWord);
141 #ifdef RECORD_REFERENCES
142 if (fieldType == T_REFERENCE)
143 set_top_ref (tempStackWord);
146 set_top_word (tempStackWord);
148 printf("Set top word done\n");
150 printf("Wide word\n");
154 make_word (fbase2 + 4, 4, &tempStackWord);
155 push_word (tempStackWord);
160 printf("Going home\n");
162 goto LABEL_ENGINELOOP;
170 fieldType = get_pgfield_type(pc[0]);
171 fieldSize = typeSize[fieldType];
172 wideWord = (fieldSize > 4);
175 tempStackWord = get_ref_at (wideWord ? 2 : 1);
178 printf ("--- PUTFIELD ---\n");
179 printf ("fieldType: %d\n", (int) fieldType);
180 printf ("fieldSize: %d\n", (int) fieldSize);
181 printf ("wideWord: %d\n", (int) wideWord);
182 printf ("reference: %d\n", (int) tempStackWord);
186 if (tempStackWord == JNULL)
188 throw_exception (nullPointerException);
189 goto LABEL_ENGINELOOP;
191 fbase3 = ((byte *) word2ptr (tempStackWord)) +
192 get_pgfield_offset (pc[0], pc[1]);
194 store_word (fbase3 + 4, 4, pop_word());
197 printf ("### put_field base=%d size=%d stored=%d\n", (int) fbase3, (int) fieldSize, (int) get_top_word());
200 #ifdef RECORD_REFERENCES
201 if (fieldType == T_REFERENCE)
202 store_word (fbase3, fieldSize, pop_ref());
205 store_word (fbase3, fieldSize, pop_word());
209 goto LABEL_ENGINELOOP;
214 set_top_word (instance_of (word2obj (get_top_ref()), pc[1]));
216 goto LABEL_ENGINELOOP;
218 // Stack: -1 +1 (same)
222 tempStackWord = get_top_ref();
223 if (tempStackWord != JNULL && !instance_of (word2obj (tempStackWord), pc[0]))
224 throw_exception (classCastException);
226 goto LABEL_ENGINELOOP;
229 // - NEW, INSTANCEOF, CHECKCAST: 8 bits ignored, 8-bit class index
230 // - GETSTATIC and PUTSTATIC: 8-bit class index, 8-bit static field record
231 // - GETFIELD and PUTFIELD: 4-bit field type, 12-bit field data offset