- u1 *ra;
- java_objectheader *o;
- u8 mcode;
- unresolved_field *uf;
- fieldinfo *fi;
- u1 byte;
-
- /* get stuff from the stack */
-
- ra = (u1 *) *((ptrint *) (sp + 4 * 8));
- o = (java_objectheader *) *((ptrint *) (sp + 3 * 8));
- mcode = *((u8 *) (sp + 2 * 8));
- uf = (unresolved_field *) *((ptrint *) (sp + 1 * 8));
-
- /* calculate and set the new return address */
-
- ra = ra - 5;
- *((ptrint *) (sp + 4 * 8)) = (ptrint) ra;
-
- PATCHER_MONITORENTER;
-
- /* get the fieldinfo */
-
- if (!(fi = resolve_field_eager(uf))) {
- PATCHER_MONITOREXIT;
-
- return false;
- }
-
- /* patch back original code (instruction code is smaller than 8 bytes) */
-
- *((u4 *) (ra + 0)) = (u4) mcode;
- *((u1 *) (ra + 4)) = (u1) (mcode >> 32);
-
- /* if we show disassembly, we have to skip the nop's */
-
- if (opt_showdisassemble)
- ra = ra + 5;
-
- /* patch the field's offset: we check for the field type, because the */
- /* instructions have different lengths */
-
- if (IS_INT_LNG_TYPE(fi->type)) {
- /* check for special case: %rsp or %r12 as base register */
-
- byte = *(ra + 3);
-
- if (byte == 0x24)
- *((u4 *) (ra + 4)) = (u4) (fi->offset);
- else
- *((u4 *) (ra + 3)) = (u4) (fi->offset);
-
- } else {
- /* check for special case: %rsp or %r12 as base register */
-
- byte = *(ra + 5);
-
- if (byte == 0x24)
- *((u4 *) (ra + 6)) = (u4) (fi->offset);
- else
- *((u4 *) (ra + 5)) = (u4) (fi->offset);
- }
-
- PATCHER_MARK_PATCHED_MONITOREXIT;
-
- return true;