- /* synchronize instruction cache */
-
- asm_sync_instruction_cache();
-
- PATCHER_MARK_PATCHED_MONITOREXIT;
-
- return true;
-}
-
-
-/* patcher_checkcast_instanceof_class ******************************************
-
- Machine code:
-
- <patched call position>
- a7940000 ldq at,0(a4)
- a7bbff28 ldq gp,-216(pv)
-
-*******************************************************************************/
-
-bool patcher_checkcast_instanceof_class(u1 *sp)
-{
- u1 *ra;
- java_objectheader *o;
- u4 mcode;
- constant_classref *cr;
- s4 disp;
- u1 *pv;
- classinfo *c;
-
- /* get stuff from the stack */
-
- ra = (u1 *) *((ptrint *) (sp + 5 * 8));
- o = (java_objectheader *) *((ptrint *) (sp + 4 * 8));
- mcode = *((u4 *) (sp + 3 * 8));
- cr = (constant_classref *) *((ptrint *) (sp + 2 * 8));
- disp = *((s4 *) (sp + 1 * 8));
- pv = (u1 *) *((ptrint *) (sp + 0 * 8));
-
- /* calculate and set the new return address */
-
- ra = ra - 1 * 4;
- *((ptrint *) (sp + 5 * 8)) = (ptrint) ra;
-
- PATCHER_MONITORENTER;
-
- /* get the fieldinfo */
-
- if (!(c = resolve_classref_eager(cr))) {
- PATCHER_MONITOREXIT;
-
- return false;
- }
-
- /* patch back original code */
-
- *((u4 *) ra) = mcode;
-
- /* synchronize instruction cache */
-
- asm_sync_instruction_cache();
-
- /* patch super class' vftbl */
-
- *((ptrint *) (pv + disp)) = (ptrint) c->vftbl;
-
- PATCHER_MARK_PATCHED_MONITOREXIT;
-
- return true;
-}
-
-
-/* patcher_clinit **************************************************************
-
- XXX
-
-*******************************************************************************/
-
-bool patcher_clinit(u1 *sp)
-{
- u1 *ra;
- java_objectheader *o;
- u4 mcode;
- classinfo *c;
-
- /* get stuff from the stack */
-
- ra = (u1 *) *((ptrint *) (sp + 5 * 8));
- o = (java_objectheader *) *((ptrint *) (sp + 4 * 8));
- mcode = *((u4 *) (sp + 3 * 8));
- c = (classinfo *) *((ptrint *) (sp + 2 * 8));
-
- /* calculate and set the new return address */
-
- ra = ra - 1 * 4;
- *((ptrint *) (sp + 5 * 8)) = (ptrint) ra;
-
- PATCHER_MONITORENTER;
-
- /* check if the class is initialized */
-
- if (!(c->state & CLASS_INITIALIZED)) {
- if (!initialize_class(c)) {
- PATCHER_MONITOREXIT;
-
- return false;
- }
- }
-
- /* patch back original code */
-
- *((u4 *) ra) = mcode;
-
- /* synchronize instruction cache */
-
- asm_sync_instruction_cache();
-
- PATCHER_MARK_PATCHED_MONITOREXIT;
-
- return true;
-}
-
-
-/* patcher_athrow_areturn ******************************************************
-
- Machine code:
-
- <patched call position>
-
-*******************************************************************************/
-
-#ifdef ENABLE_VERIFIER
-bool patcher_athrow_areturn(u1 *sp)
-{
- u1 *ra;
- java_objectheader *o;
- u4 mcode;
- unresolved_class *uc;
- classinfo *c;
-
- /* get stuff from the stack */
-
- ra = (u1 *) *((ptrint *) (sp + 5 * 8));
- o = (java_objectheader *) *((ptrint *) (sp + 4 * 8));
- mcode = *((u4 *) (sp + 3 * 8));
- uc = (unresolved_class *) *((ptrint *) (sp + 2 * 8));
-
- /* calculate and set the new return address */
-
- ra = ra - 1 * 4;
- *((ptrint *) (sp + 5 * 8)) = (ptrint) ra;
-
- PATCHER_MONITORENTER;
-
- /* resolve the class */
-
- if (!resolve_class(uc, resolveEager, false, &c)) {
- PATCHER_MONITOREXIT;
-
- return false;
- }
-
- /* patch back original code */
-
- *((u4 *) ra) = mcode;
-
- /* synchronize instruction cache */
-
- asm_sync_instruction_cache();
-
- PATCHER_MARK_PATCHED_MONITOREXIT;