extern "C" void popStackHandles(char* nextFrame) { DeltaProcess* active = DeltaProcess::active(); if (active->thread_id() != os::current_thread_id()) { active = Processes::find_from_thread_id(os::current_thread_id()); } BaseHandle* current = active->firstHandle(); while (current && (char*) current < nextFrame) { current->pop(); current = active->firstHandle(); } }
extern "C" volatile void* handleCallBack(int index, int params) { DeltaProcess* proc = NULL; if (Universe::callBack_receiver()->is_nil()) { warning("callBack receiver is not set"); } int low = get_unsigned_bitfield(params, 0, 16); int high = get_unsigned_bitfield(params, 16, 16); if (DeltaProcess::active()->thread_id() != os::current_thread_id()) { // We'are now back in a asynchronous DLL call so give up the control // Fix this: // remove warning when it has been tested proc = Processes::find_from_thread_id(os::current_thread_id()); assert(proc, "process must be present"); DLLs::exit_async_call(&proc); } DeltaProcess::active()->setIsCallback(true); oop res = Delta::call(Universe::callBack_receiver(), Universe::callBack_selector(), as_smiOop(index), as_smiOop(high), as_smiOop(low)); assert(DeltaProcess::active()->thread_id() == os::current_thread_id(), "check for process torch"); void* result; // convert return result if (have_nlr_through_C) { // Continues the NLR after at the next Delta frame BaseHandle* handle = DeltaProcess::active()->firstHandle(); if (handle && ((char*) handle < (char*)DeltaProcess::active()->last_Delta_fp())) handle->pop(); ErrorHandler::continue_nlr_in_delta(); } if (res->is_smi()) { result = (void*) smiOop(res)->value(); } else if (res->is_proxy()) { result = (void*) proxyOop(res)->get_pointer(); } else { warning("Wrong return type for call back, returning NULL"); result = NULL; } // Return value has to be converted before we transfer control to another // thread. if (proc) { // We'are now back in a asynchronous DLL call so give up the control proc->resetStepping(); proc->transfer_and_continue(); } // Call Delta level error routine return result; }