< prev index next >

src/cpu/x86/vm/sharedRuntime_x86_64.cpp

Print this page

        

*** 3966,3975 **** --- 3966,4028 ---- // return the blob // frame_size_words or bytes?? return RuntimeStub::new_runtime_stub(name, &buffer, frame_complete, frame_size_in_words, oop_maps, true); } + // + // generate_memento_stack_trace_blob - trampoline for memento stack trace + // + void SharedRuntime::generate_memento_stack_trace_blob() { + // allocate space for the code + ResourceMark rm; + + CodeBuffer buffer("memento_stack_trace_blob", 1000, 512); + MacroAssembler* masm = new MacroAssembler(&buffer); + + // Entry point for function returns + int return_offset = __ offset(); + + __ movptr(rscratch1, Address(r15_thread, Thread::memento_original_return_address_offset())); + __ movptr(Address(r15_thread, Thread::memento_original_return_address_offset()), (int32_t) 0); + __ jmp(rscratch1); + + // Exception handler entry point + int exception_offset = __ offset(); + + // return address of handler in rdx, overwrite with original return address + __ movptr(rdx, Address(r15_thread, Thread::memento_original_return_address_offset())); + __ movptr(Address(r15_thread, Thread::memento_original_return_address_offset()), (int32_t) 0); + + // Inbetween activations - previous activation type unknown yet + // compute continuation point - the continuation point expects + // the following registers set up: + // + // rax: exception + // rdx: return address/pc that threw exception + // rsp: expression stack of caller + // rbp: rbp, of caller + __ push(rax); // save exception + __ push(rdx); // save return address + __ super_call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::exception_handler_for_return_address), r15_thread, rdx); + __ mov(rbx, rax); // save exception handler + __ pop(rdx); // restore return address + __ pop(rax); // restore exception + // Note that an "issuing PC" is actually the next PC after the call + __ jmp(rbx); // jump to exception handler of caller + + // ------------- + // make sure all code is generated + masm->flush(); + + // return the blob + // frame_size_words or bytes?? + RuntimeStub* stub = RuntimeStub::new_runtime_stub("memento_stack_trace_blob", &buffer, return_offset, 0, NULL, true); + + _memento_stack_trace_return_handler = stub->code_begin() + return_offset; + _memento_stack_trace_exception_handler = stub->code_begin() + exception_offset; + } + //------------------------------Montgomery multiplication------------------------ // #ifndef _WINDOWS
< prev index next >