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(); } }
void FlatProfiler::record_tick() { // If we're idle forget about the tick. if (DeltaProcess::is_idle()) return; // check for special vm flags if (theCompiler) { FlatProfiler::compiler_ticks++; } if (GCInProgress) { FlatProfiler::gc_ticks++; return; } if (processSemaphore) { FlatProfiler::semaphore_ticks++; return; } { FlagSetting(processSemaphore, true); DeltaProcess* p = DeltaProcess::active(); if (p->last_Delta_fp()) { record_tick_for_calling_frame(p->last_frame()); } else { record_tick_for_running_frame(p->profile_top_frame()); } } }
// Code entry point for at Delta process int DeltaProcess::launch_delta(DeltaProcess* process) { // Wait until we get the torch process->suspend_at_creation(); // We have the torch assert(process == DeltaProcess::active(), "process consistency check"); assert(process->is_deltaProcess(), "this should be a deltaProcess"); DeltaProcess* p = (DeltaProcess*) process; oop result = Delta::call(p->receiver(), p->selector()); if (have_nlr_through_C) { if (nlr_home_id == ErrorHandler::aborting_nlr_home_id()) { p->set_state(aborted); } else { p->set_state(NLR_error); } } else { p->set_state(completed); } assert(process == DeltaProcess::active(), "process consistency check"); VM_TerminateProcess op(process); VMProcess::execute(&op); return 0; }
void ps() { // print stack // Retrieve the frame pointer of the current frame int* fp; __asm { mov fp, ebp } { Command c("ps"); // Prints the stack of the current Delta process DeltaProcess* p = DeltaProcess::active(); std->print(" for process: "); p->print(); std->cr(); if (p->last_Delta_fp() != NULL) { // If the last_Delta_fp is set we are in C land and // can call the standard stack_trace function. p->trace_stack(); } else { // fp point to the frame of the ps stub routine frame f(NULL, fp, NULL); f = f.sender(); p->trace_stack_from(vframe::new_vframe(&f)); } }
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; }