void set_exception_points(address npe_addr, address ame_addr) { _npe_offset = npe_addr - code_begin(); _ame_offset = ame_addr - code_begin(); assert(is_abstract_method_error(ame_addr), "offset must be correct"); assert(is_null_pointer_exception(npe_addr), "offset must be correct"); assert(!is_abstract_method_error(npe_addr), "offset must be correct"); assert(!is_null_pointer_exception(ame_addr), "offset must be correct"); }
void InterpreterCodelet::print_on(outputStream* st) const { if (PrintInterpreter) { st->cr(); st->print_cr("----------------------------------------------------------------------"); } if (description() != NULL) st->print("%s ", description()); if (bytecode() >= 0 ) st->print("%d %s ", bytecode(), Bytecodes::name(bytecode())); st->print_cr("[" INTPTR_FORMAT ", " INTPTR_FORMAT "] %d bytes", code_begin(), code_end(), code_size()); if (PrintInterpreter) { st->cr(); Disassembler::decode(code_begin(), code_end(), st); } }
void InterpreterCodelet::print_on(outputStream* st) const { ttyLocker ttyl; if (PrintInterpreter) { st->cr(); st->print_cr("----------------------------------------------------------------------"); } if (description() != NULL) st->print("%s ", description()); if (bytecode() >= 0 ) st->print("%d %s ", bytecode(), Bytecodes::name(bytecode())); st->print_cr("[" INTPTR_FORMAT ", " INTPTR_FORMAT "] %d bytes", p2i(code_begin()), p2i(code_end()), code_size()); if (PrintInterpreter) { st->cr(); Disassembler::decode(code_begin(), code_end(), st, DEBUG_ONLY(_strings) NOT_DEBUG(CodeStrings())); } }
void ICStub::set_stub(CompiledIC *ic, void* cached_val, address dest_addr) { // We cannot store a pointer to the 'ic' object, since it is resource allocated. Instead we // store the location of the inline cache. Then we have enough information recreate the CompiledIC // object when we need to remove the stub. _ic_site = ic->instruction_address(); // Assemble new stub InlineCacheBuffer::assemble_ic_buffer_code(code_begin(), cached_val, dest_addr); assert(destination() == dest_addr, "can recover destination"); assert(cached_value() == cached_val, "can recover destination"); }
// Interpreter-specific attributes int code_size() const { return code_end() - code_begin(); }
inline address ThreadCodeBuffer::capture_pc(address pc) { assert(captures(pc), "pc must point into original code for codebuffer") pc = code_begin() + (pc - real_pc()); assert(contains(pc), "result must be in codebuffer"); return pc; }
inline address ThreadCodeBuffer::compute_adjusted_pc(address pc) { assert(contains(pc), "pc must point into codebuffer") pc = real_pc() + (pc - code_begin()); assert(method()->contains(pc), "result must be in nmethod"); return pc; }
bool contains(address pc) const { return (code_begin() <= pc && pc < code_end()); }
bool in_code(address pc) const { return code_begin() <= pc && pc <= code_end(); }
void* ICStub::cached_value() const { return InlineCacheBuffer::ic_buffer_cached_value(code_begin()); }
address entry_point() const { return code_begin(); }
address code_end() const { return code_begin() + pd_code_size_limit(_is_vtable_stub); }
const ImmutableOopMap* CodeBlob::oop_map_for_return_address(address return_address) { assert(_oop_maps != NULL, "nope"); return _oop_maps->find_map_at_offset((intptr_t) return_address - (intptr_t) code_begin()); }
oop ICStub::cached_oop() const { return InlineCacheBuffer::ic_buffer_cached_oop(code_begin()); }
void VtableStub::print() { tty->print("vtable stub (index = %d, receiver_location = %d, code = [" INTPTR_FORMAT ", " INTPTR_FORMAT "[)", index(), receiver_location(), code_begin(), code_end()); }
void VtableStub::print_on(outputStream* st) const { st->print("vtable stub (index = %d, receiver_location = %d, code = [" INTPTR_FORMAT ", " INTPTR_FORMAT "[)", index(), receiver_location(), code_begin(), code_end()); }
address ICStub::destination() const { return InlineCacheBuffer::ic_buffer_entry_point(code_begin()); }
bool is_abstract_method_error(address epc) { return epc == code_begin()+_ame_offset; }
bool is_null_pointer_exception(address epc) { return epc == code_begin()+_npe_offset; }
// returns true if successful, false otherwise bool ThreadCodeBuffer::reposition_and_resume_thread(JavaThread* thread, ExtendedPC addr) { return os::set_thread_pc_and_resume(thread, addr, addr.adjust(method()->instructions_begin(), method()->instructions_end(), code_begin())); }