/** * @return Method record or null. */ MethodRecord *find_method (ClassRecord *classRecord, TWOBYTES methodSignature) { tempByte = classRecord->numMethods; while (tempByte--) { tempMethodRecord = get_method_record (classRecord, tempByte); if (tempMethodRecord->signatureId == methodSignature) return tempMethodRecord; } return null; }
/** * Calls static initializer if necessary before * dispatching with dispatch_special(). * @param retAddr Return bytecode address. * @param btAddr Backtrack bytecode address (in case * static initializer is executed). */ void dispatch_special_checked (byte classIndex, byte methodIndex, byte *retAddr, byte *btAddr) { ClassRecord *classRecord; #if DEBUG_METHODS printf ("dispatch_special_checked: %d, %d, %d, %d\n", classIndex, methodIndex, (int) retAddr, (int) btAddr); #endif classRecord = get_class_record (classIndex); if (dispatch_static_initializer (classRecord, btAddr)) return; dispatch_special (get_method_record (classRecord, methodIndex), retAddr); }
/** * Calls static initializer if necessary before * dispatching with dispatch_special(). * @param retAddr Return bytecode address. * @param btAddr Backtrack bytecode address (in case * static initializer is executed). */ void dispatch_special_checked (byte classIndex, byte methodIndex, byte *retAddr, byte *btAddr) { ClassRecord *classRecord; MethodRecord *methodRecord; #if DEBUG_METHODS printf ("dispatch_special_checked: %d, %d, %d, %d\n", classIndex, methodIndex, (int) retAddr, (int) btAddr); #endif // If we need to run the initializer then the real method will get called // later, when we re-run the current instruction. classRecord = get_class_record (classIndex); if (!is_initialized_idx (classIndex)) if (dispatch_static_initializer (classRecord, btAddr) != EXEC_CONTINUE) return; methodRecord = get_method_record (classRecord, methodIndex); if(dispatch_special (methodRecord, retAddr)) { if (is_synchronized(methodRecord)) { if (!is_static(methodRecord)) { Object *ref = (Object *)curLocalsBase[0]; current_stackframe()->monitor = ref; enter_monitor (currentThread, ref); } else { Object *ref = (Object *)classRecord; current_stackframe()->monitor = ref; enter_monitor (currentThread, ref); } } } }