mirror of
https://github.com/openjdk/jdk.git
synced 2026-03-03 20:50:19 +00:00
8339466: Enumerate shared stubs and define static fields and names via declarations
Reviewed-by: kvn, fyang
This commit is contained in:
parent
9ebc2ecbf6
commit
0df10bbd96
@ -2181,7 +2181,8 @@ void SharedRuntime::generate_deopt_blob() {
|
||||
pad += 512; // Increase the buffer size when compiling for JVMCI
|
||||
}
|
||||
#endif
|
||||
CodeBuffer buffer("deopt_blob", 2048+pad, 1024);
|
||||
const char* name = SharedRuntime::stub_name(SharedStubId::deopt_id);
|
||||
CodeBuffer buffer(name, 2048+pad, 1024);
|
||||
MacroAssembler* masm = new MacroAssembler(&buffer);
|
||||
int frame_size_in_words;
|
||||
OopMap* map = nullptr;
|
||||
@ -2565,20 +2566,23 @@ uint SharedRuntime::out_preserve_stack_slots() {
|
||||
// Generate a special Compile2Runtime blob that saves all registers,
|
||||
// and setup oopmap.
|
||||
//
|
||||
SafepointBlob* SharedRuntime::generate_handler_blob(address call_ptr, int poll_type) {
|
||||
SafepointBlob* SharedRuntime::generate_handler_blob(SharedStubId id, address call_ptr) {
|
||||
assert(is_polling_page_id(id), "expected a polling page stub id");
|
||||
|
||||
ResourceMark rm;
|
||||
OopMapSet *oop_maps = new OopMapSet();
|
||||
OopMap* map;
|
||||
|
||||
// Allocate space for the code. Setup code generation tools.
|
||||
CodeBuffer buffer("handler_blob", 2048, 1024);
|
||||
const char* name = SharedRuntime::stub_name(id);
|
||||
CodeBuffer buffer(name, 2048, 1024);
|
||||
MacroAssembler* masm = new MacroAssembler(&buffer);
|
||||
|
||||
address start = __ pc();
|
||||
address call_pc = nullptr;
|
||||
int frame_size_in_words;
|
||||
bool cause_return = (poll_type == POLL_AT_RETURN);
|
||||
RegisterSaver reg_save(poll_type == POLL_AT_VECTOR_LOOP /* save_vectors */);
|
||||
bool cause_return = (id == SharedStubId::polling_page_return_handler_id);
|
||||
RegisterSaver reg_save(id == SharedStubId::polling_page_vectors_safepoint_handler_id /* save_vectors */);
|
||||
|
||||
// When the signal occurred, the LR was either signed and stored on the stack (in which
|
||||
// case it will be restored from the stack before being used) or unsigned and not stored
|
||||
@ -2690,12 +2694,14 @@ SafepointBlob* SharedRuntime::generate_handler_blob(address call_ptr, int poll_t
|
||||
// but since this is generic code we don't know what they are and the caller
|
||||
// must do any gc of the args.
|
||||
//
|
||||
RuntimeStub* SharedRuntime::generate_resolve_blob(address destination, const char* name) {
|
||||
RuntimeStub* SharedRuntime::generate_resolve_blob(SharedStubId id, address destination) {
|
||||
assert (StubRoutines::forward_exception_entry() != nullptr, "must be generated before");
|
||||
assert(is_resolve_id(id), "expected a resolve stub id");
|
||||
|
||||
// allocate space for the code
|
||||
ResourceMark rm;
|
||||
|
||||
const char* name = SharedRuntime::stub_name(id);
|
||||
CodeBuffer buffer(name, 1000, 512);
|
||||
MacroAssembler* masm = new MacroAssembler(&buffer);
|
||||
|
||||
@ -2787,7 +2793,11 @@ RuntimeStub* SharedRuntime::generate_resolve_blob(address destination, const cha
|
||||
// otherwise assume that stack unwinding will be initiated, so
|
||||
// caller saved registers were assumed volatile in the compiler.
|
||||
|
||||
RuntimeStub* SharedRuntime::generate_throw_exception(const char* name, address runtime_entry) {
|
||||
RuntimeStub* SharedRuntime::generate_throw_exception(SharedStubId id, address runtime_entry) {
|
||||
assert(is_throw_id(id), "expected a throw stub id");
|
||||
|
||||
const char* name = SharedRuntime::stub_name(id);
|
||||
|
||||
// Information about frame layout at time of blocking runtime call.
|
||||
// Note that we only have to preserve callee-saved registers since
|
||||
// the compilers are responsible for supplying a continuation point
|
||||
@ -2896,7 +2906,8 @@ RuntimeStub* SharedRuntime::generate_jfr_write_checkpoint() {
|
||||
|
||||
int insts_size = 1024;
|
||||
int locs_size = 64;
|
||||
CodeBuffer code("jfr_write_checkpoint", insts_size, locs_size);
|
||||
const char* name = SharedRuntime::stub_name(SharedStubId::jfr_write_checkpoint_id);
|
||||
CodeBuffer code(name, insts_size, locs_size);
|
||||
OopMapSet* oop_maps = new OopMapSet();
|
||||
MacroAssembler* masm = new MacroAssembler(&code);
|
||||
|
||||
@ -2915,7 +2926,7 @@ RuntimeStub* SharedRuntime::generate_jfr_write_checkpoint() {
|
||||
oop_maps->add_gc_map(the_pc - start, map);
|
||||
|
||||
RuntimeStub* stub = // codeBlob framesize is in words (not VMRegImpl::slot_size)
|
||||
RuntimeStub::new_runtime_stub("jfr_write_checkpoint", &code, frame_complete,
|
||||
RuntimeStub::new_runtime_stub(name, &code, frame_complete,
|
||||
(framesize >> (LogBytesPerWord - LogBytesPerInt)),
|
||||
oop_maps, false);
|
||||
return stub;
|
||||
@ -2934,7 +2945,8 @@ RuntimeStub* SharedRuntime::generate_jfr_return_lease() {
|
||||
int insts_size = 1024;
|
||||
int locs_size = 64;
|
||||
|
||||
CodeBuffer code("jfr_return_lease", insts_size, locs_size);
|
||||
const char* name = SharedRuntime::stub_name(SharedStubId::jfr_return_lease_id);
|
||||
CodeBuffer code(name, insts_size, locs_size);
|
||||
OopMapSet* oop_maps = new OopMapSet();
|
||||
MacroAssembler* masm = new MacroAssembler(&code);
|
||||
|
||||
@ -2953,7 +2965,7 @@ RuntimeStub* SharedRuntime::generate_jfr_return_lease() {
|
||||
oop_maps->add_gc_map(the_pc - start, map);
|
||||
|
||||
RuntimeStub* stub = // codeBlob framesize is in words (not VMRegImpl::slot_size)
|
||||
RuntimeStub::new_runtime_stub("jfr_return_lease", &code, frame_complete,
|
||||
RuntimeStub::new_runtime_stub(name, &code, frame_complete,
|
||||
(framesize >> (LogBytesPerWord - LogBytesPerInt)),
|
||||
oop_maps, false);
|
||||
return stub;
|
||||
|
||||
@ -1360,7 +1360,8 @@ uint SharedRuntime::out_preserve_stack_slots() {
|
||||
//------------------------------generate_deopt_blob----------------------------
|
||||
void SharedRuntime::generate_deopt_blob() {
|
||||
ResourceMark rm;
|
||||
CodeBuffer buffer("deopt_blob", 1024, 1024);
|
||||
const char* name = SharedRuntime::stub_name(SharedStubId::deopt_id);
|
||||
CodeBuffer buffer(name, 1024, 1024);
|
||||
int frame_size_in_words;
|
||||
OopMapSet* oop_maps;
|
||||
int reexecute_offset;
|
||||
@ -1601,15 +1602,17 @@ void SharedRuntime::generate_deopt_blob() {
|
||||
// setup oopmap, and calls safepoint code to stop the compiled code for
|
||||
// a safepoint.
|
||||
//
|
||||
SafepointBlob* SharedRuntime::generate_handler_blob(address call_ptr, int poll_type) {
|
||||
SafepointBlob* SharedRuntime::generate_handler_blob(SharedStubId id, address call_ptr) {
|
||||
assert(StubRoutines::forward_exception_entry() != nullptr, "must be generated before");
|
||||
assert(is_polling_page_id(id), "expected a polling page stub id");
|
||||
|
||||
ResourceMark rm;
|
||||
CodeBuffer buffer("handler_blob", 256, 256);
|
||||
const char* name = SharedRuntime::stub_name(id);
|
||||
CodeBuffer buffer(name, 256, 256);
|
||||
int frame_size_words;
|
||||
OopMapSet* oop_maps;
|
||||
|
||||
bool cause_return = (poll_type == POLL_AT_RETURN);
|
||||
bool cause_return = (id == SharedStubId::polling_page_return_handler_id);
|
||||
|
||||
MacroAssembler* masm = new MacroAssembler(&buffer);
|
||||
address start = __ pc();
|
||||
@ -1671,10 +1674,12 @@ SafepointBlob* SharedRuntime::generate_handler_blob(address call_ptr, int poll_t
|
||||
return SafepointBlob::create(&buffer, oop_maps, frame_size_words);
|
||||
}
|
||||
|
||||
RuntimeStub* SharedRuntime::generate_resolve_blob(address destination, const char* name) {
|
||||
RuntimeStub* SharedRuntime::generate_resolve_blob(SharedStubId id, address destination) {
|
||||
assert(StubRoutines::forward_exception_entry() != nullptr, "must be generated before");
|
||||
assert(is_resolve_id(id), "expected a resolve stub id");
|
||||
|
||||
ResourceMark rm;
|
||||
const char* name = SharedRuntime::stub_name(id);
|
||||
CodeBuffer buffer(name, 1000, 512);
|
||||
int frame_size_words;
|
||||
OopMapSet *oop_maps;
|
||||
@ -1733,7 +1738,11 @@ RuntimeStub* SharedRuntime::generate_resolve_blob(address destination, const cha
|
||||
// Continuation point for throwing of implicit exceptions that are not handled in
|
||||
// the current activation. Fabricates an exception oop and initiates normal
|
||||
// exception dispatching in this frame.
|
||||
RuntimeStub* SharedRuntime::generate_throw_exception(const char* name, address runtime_entry) {
|
||||
RuntimeStub* SharedRuntime::generate_throw_exception(SharedStubId id, address runtime_entry) {
|
||||
assert(is_throw_id(id), "expected a throw stub id");
|
||||
|
||||
const char* name = SharedRuntime::stub_name(id);
|
||||
|
||||
int insts_size = 128;
|
||||
int locs_size = 32;
|
||||
|
||||
@ -1793,7 +1802,8 @@ RuntimeStub* SharedRuntime::generate_jfr_write_checkpoint() {
|
||||
framesize // inclusive of return address
|
||||
};
|
||||
|
||||
CodeBuffer code("jfr_write_checkpoint", 512, 64);
|
||||
const char* name = SharedRuntime::stub_name(SharedStubId::jfr_write_checkpoint_id);
|
||||
CodeBuffer code(name, 512, 64);
|
||||
MacroAssembler* masm = new MacroAssembler(&code);
|
||||
|
||||
address start = __ pc();
|
||||
@ -1818,7 +1828,7 @@ RuntimeStub* SharedRuntime::generate_jfr_write_checkpoint() {
|
||||
oop_maps->add_gc_map(frame_complete, map);
|
||||
|
||||
RuntimeStub* stub =
|
||||
RuntimeStub::new_runtime_stub(code.name(),
|
||||
RuntimeStub::new_runtime_stub(name,
|
||||
&code,
|
||||
frame_complete,
|
||||
(framesize >> (LogBytesPerWord - LogBytesPerInt)),
|
||||
@ -1836,7 +1846,8 @@ RuntimeStub* SharedRuntime::generate_jfr_return_lease() {
|
||||
framesize // inclusive of return address
|
||||
};
|
||||
|
||||
CodeBuffer code("jfr_return_lease", 512, 64);
|
||||
const char* name = SharedRuntime::stub_name(SharedStubId::jfr_return_lease_id);
|
||||
CodeBuffer code(name, 512, 64);
|
||||
MacroAssembler* masm = new MacroAssembler(&code);
|
||||
|
||||
address start = __ pc();
|
||||
@ -1858,7 +1869,7 @@ RuntimeStub* SharedRuntime::generate_jfr_return_lease() {
|
||||
oop_maps->add_gc_map(frame_complete, map);
|
||||
|
||||
RuntimeStub* stub =
|
||||
RuntimeStub::new_runtime_stub(code.name(),
|
||||
RuntimeStub::new_runtime_stub(name,
|
||||
&code,
|
||||
frame_complete,
|
||||
(framesize >> (LogBytesPerWord - LogBytesPerInt)),
|
||||
|
||||
@ -2856,7 +2856,8 @@ void SharedRuntime::generate_deopt_blob() {
|
||||
// Allocate space for the code
|
||||
ResourceMark rm;
|
||||
// Setup code generation tools
|
||||
CodeBuffer buffer("deopt_blob", 2048, 1024);
|
||||
const char* name = SharedRuntime::stub_name(SharedStubId::deopt_id);
|
||||
CodeBuffer buffer(name, 2048, 1024);
|
||||
InterpreterMacroAssembler* masm = new InterpreterMacroAssembler(&buffer);
|
||||
Label exec_mode_initialized;
|
||||
int frame_size_in_words;
|
||||
@ -3206,23 +3207,25 @@ void OptoRuntime::generate_uncommon_trap_blob() {
|
||||
#endif // COMPILER2
|
||||
|
||||
// Generate a special Compile2Runtime blob that saves all registers, and setup oopmap.
|
||||
SafepointBlob* SharedRuntime::generate_handler_blob(address call_ptr, int poll_type) {
|
||||
SafepointBlob* SharedRuntime::generate_handler_blob(SharedStubId id, address call_ptr) {
|
||||
assert(StubRoutines::forward_exception_entry() != nullptr,
|
||||
"must be generated before");
|
||||
assert(is_polling_page_id(id), "expected a polling page stub id");
|
||||
|
||||
ResourceMark rm;
|
||||
OopMapSet *oop_maps = new OopMapSet();
|
||||
OopMap* map;
|
||||
|
||||
// Allocate space for the code. Setup code generation tools.
|
||||
CodeBuffer buffer("handler_blob", 2048, 1024);
|
||||
const char* name = SharedRuntime::stub_name(id);
|
||||
CodeBuffer buffer(name, 2048, 1024);
|
||||
MacroAssembler* masm = new MacroAssembler(&buffer);
|
||||
|
||||
address start = __ pc();
|
||||
int frame_size_in_bytes = 0;
|
||||
|
||||
RegisterSaver::ReturnPCLocation return_pc_location;
|
||||
bool cause_return = (poll_type == POLL_AT_RETURN);
|
||||
bool cause_return = (id == SharedStubId::polling_page_return_handler_id);
|
||||
if (cause_return) {
|
||||
// Nothing to do here. The frame has already been popped in MachEpilogNode.
|
||||
// Register LR already contains the return pc.
|
||||
@ -3232,7 +3235,7 @@ SafepointBlob* SharedRuntime::generate_handler_blob(address call_ptr, int poll_t
|
||||
return_pc_location = RegisterSaver::return_pc_is_thread_saved_exception_pc;
|
||||
}
|
||||
|
||||
bool save_vectors = (poll_type == POLL_AT_VECTOR_LOOP);
|
||||
bool save_vectors = (id == SharedStubId::polling_page_vectors_safepoint_handler_id);
|
||||
|
||||
// Save registers, fpu state, and flags. Set R31 = return pc.
|
||||
map = RegisterSaver::push_frame_reg_args_and_save_live_registers(masm,
|
||||
@ -3319,11 +3322,13 @@ SafepointBlob* SharedRuntime::generate_handler_blob(address call_ptr, int poll_t
|
||||
// but since this is generic code we don't know what they are and the caller
|
||||
// must do any gc of the args.
|
||||
//
|
||||
RuntimeStub* SharedRuntime::generate_resolve_blob(address destination, const char* name) {
|
||||
RuntimeStub* SharedRuntime::generate_resolve_blob(SharedStubId id, address destination) {
|
||||
assert(is_resolve_id(id), "expected a resolve stub id");
|
||||
|
||||
// allocate space for the code
|
||||
ResourceMark rm;
|
||||
|
||||
const char* name = SharedRuntime::stub_name(id);
|
||||
CodeBuffer buffer(name, 1000, 512);
|
||||
MacroAssembler* masm = new MacroAssembler(&buffer);
|
||||
|
||||
@ -3421,7 +3426,11 @@ RuntimeStub* SharedRuntime::generate_resolve_blob(address destination, const cha
|
||||
// Note: the routine set_pc_not_at_call_for_caller in
|
||||
// SharedRuntime.cpp requires that this code be generated into a
|
||||
// RuntimeStub.
|
||||
RuntimeStub* SharedRuntime::generate_throw_exception(const char* name, address runtime_entry) {
|
||||
RuntimeStub* SharedRuntime::generate_throw_exception(SharedStubId id, address runtime_entry) {
|
||||
assert(is_throw_id(id), "expected a throw stub id");
|
||||
|
||||
const char* name = SharedRuntime::stub_name(id);
|
||||
|
||||
ResourceMark rm;
|
||||
const char* timer_msg = "SharedRuntime generate_throw_exception";
|
||||
TraceTime timer(timer_msg, TRACETIME_LOG(Info, startuptime));
|
||||
@ -3740,7 +3749,8 @@ void SharedRuntime::montgomery_square(jint *a_ints, jint *n_ints,
|
||||
// It returns a jobject handle to the event writer.
|
||||
// The handle is dereferenced and the return value is the event writer oop.
|
||||
RuntimeStub* SharedRuntime::generate_jfr_write_checkpoint() {
|
||||
CodeBuffer code("jfr_write_checkpoint", 512, 64);
|
||||
const char* name = SharedRuntime::stub_name(SharedStubId::jfr_write_checkpoint_id);
|
||||
CodeBuffer code(name, 512, 64);
|
||||
MacroAssembler* masm = new MacroAssembler(&code);
|
||||
|
||||
Register tmp1 = R10_ARG8;
|
||||
@ -3768,8 +3778,7 @@ RuntimeStub* SharedRuntime::generate_jfr_write_checkpoint() {
|
||||
oop_maps->add_gc_map(calls_return_pc - start, map);
|
||||
|
||||
RuntimeStub* stub = // codeBlob framesize is in words (not VMRegImpl::slot_size)
|
||||
RuntimeStub::new_runtime_stub(code.name(),
|
||||
&code, frame_complete,
|
||||
RuntimeStub::new_runtime_stub(name, &code, frame_complete,
|
||||
(framesize >> (LogBytesPerWord - LogBytesPerInt)),
|
||||
oop_maps, false);
|
||||
return stub;
|
||||
@ -3777,7 +3786,8 @@ RuntimeStub* SharedRuntime::generate_jfr_write_checkpoint() {
|
||||
|
||||
// For c2: call to return a leased buffer.
|
||||
RuntimeStub* SharedRuntime::generate_jfr_return_lease() {
|
||||
CodeBuffer code("jfr_return_lease", 512, 64);
|
||||
const char* name = SharedRuntime::stub_name(SharedStubId::jfr_return_lease_id);
|
||||
CodeBuffer code(name, 512, 64);
|
||||
MacroAssembler* masm = new MacroAssembler(&code);
|
||||
|
||||
Register tmp1 = R10_ARG8;
|
||||
@ -3803,8 +3813,7 @@ RuntimeStub* SharedRuntime::generate_jfr_return_lease() {
|
||||
oop_maps->add_gc_map(calls_return_pc - start, map);
|
||||
|
||||
RuntimeStub* stub = // codeBlob framesize is in words (not VMRegImpl::slot_size)
|
||||
RuntimeStub::new_runtime_stub(code.name(),
|
||||
&code, frame_complete,
|
||||
RuntimeStub::new_runtime_stub(name, &code, frame_complete,
|
||||
(framesize >> (LogBytesPerWord - LogBytesPerInt)),
|
||||
oop_maps, false);
|
||||
return stub;
|
||||
|
||||
@ -2057,7 +2057,8 @@ void SharedRuntime::generate_deopt_blob() {
|
||||
pad += 512; // Increase the buffer size when compiling for JVMCI
|
||||
}
|
||||
#endif
|
||||
CodeBuffer buffer("deopt_blob", 2048 + pad, 1024);
|
||||
const char* name = SharedRuntime::stub_name(SharedStubId::deopt_id);
|
||||
CodeBuffer buffer(name, 2048 + pad, 1024);
|
||||
MacroAssembler* masm = new MacroAssembler(&buffer);
|
||||
int frame_size_in_words = -1;
|
||||
OopMap* map = nullptr;
|
||||
@ -2435,22 +2436,25 @@ uint SharedRuntime::out_preserve_stack_slots() {
|
||||
// Generate a special Compile2Runtime blob that saves all registers,
|
||||
// and setup oopmap.
|
||||
//
|
||||
SafepointBlob* SharedRuntime::generate_handler_blob(address call_ptr, int poll_type) {
|
||||
SafepointBlob* SharedRuntime::generate_handler_blob(SharedStubId id, address call_ptr) {
|
||||
assert(is_polling_page_id(id), "expected a polling page stub id");
|
||||
|
||||
ResourceMark rm;
|
||||
OopMapSet *oop_maps = new OopMapSet();
|
||||
assert_cond(oop_maps != nullptr);
|
||||
OopMap* map = nullptr;
|
||||
|
||||
// Allocate space for the code. Setup code generation tools.
|
||||
CodeBuffer buffer("handler_blob", 2048, 1024);
|
||||
const char* name = SharedRuntime::stub_name(id);
|
||||
CodeBuffer buffer(name, 2048, 1024);
|
||||
MacroAssembler* masm = new MacroAssembler(&buffer);
|
||||
assert_cond(masm != nullptr);
|
||||
|
||||
address start = __ pc();
|
||||
address call_pc = nullptr;
|
||||
int frame_size_in_words = -1;
|
||||
bool cause_return = (poll_type == POLL_AT_RETURN);
|
||||
RegisterSaver reg_saver(poll_type == POLL_AT_VECTOR_LOOP /* save_vectors */);
|
||||
bool cause_return = (id == SharedStubId::polling_page_return_handler_id);
|
||||
RegisterSaver reg_saver(id == SharedStubId::polling_page_vectors_safepoint_handler_id /* save_vectors */);
|
||||
|
||||
// Save Integer and Float registers.
|
||||
map = reg_saver.save_live_registers(masm, 0, &frame_size_in_words);
|
||||
@ -2556,12 +2560,14 @@ SafepointBlob* SharedRuntime::generate_handler_blob(address call_ptr, int poll_t
|
||||
// but since this is generic code we don't know what they are and the caller
|
||||
// must do any gc of the args.
|
||||
//
|
||||
RuntimeStub* SharedRuntime::generate_resolve_blob(address destination, const char* name) {
|
||||
RuntimeStub* SharedRuntime::generate_resolve_blob(SharedStubId id, address destination) {
|
||||
assert(StubRoutines::forward_exception_entry() != nullptr, "must be generated before");
|
||||
assert(is_resolve_id(id), "expected a resolve stub id");
|
||||
|
||||
// allocate space for the code
|
||||
ResourceMark rm;
|
||||
|
||||
const char* name = SharedRuntime::stub_name(id);
|
||||
CodeBuffer buffer(name, 1000, 512);
|
||||
MacroAssembler* masm = new MacroAssembler(&buffer);
|
||||
assert_cond(masm != nullptr);
|
||||
@ -2652,7 +2658,11 @@ RuntimeStub* SharedRuntime::generate_resolve_blob(address destination, const cha
|
||||
// otherwise assume that stack unwinding will be initiated, so
|
||||
// caller saved registers were assumed volatile in the compiler.
|
||||
|
||||
RuntimeStub* SharedRuntime::generate_throw_exception(const char* name, address runtime_entry) {
|
||||
RuntimeStub* SharedRuntime::generate_throw_exception(SharedStubId id, address runtime_entry) {
|
||||
assert(is_throw_id(id), "expected a throw stub id");
|
||||
|
||||
const char* name = SharedRuntime::stub_name(id);
|
||||
|
||||
// Information about frame layout at time of blocking runtime call.
|
||||
// Note that we only have to preserve callee-saved registers since
|
||||
// the compilers are responsible for supplying a continuation point
|
||||
@ -2759,7 +2769,8 @@ RuntimeStub* SharedRuntime::generate_jfr_write_checkpoint() {
|
||||
|
||||
int insts_size = 1024;
|
||||
int locs_size = 64;
|
||||
CodeBuffer code("jfr_write_checkpoint", insts_size, locs_size);
|
||||
const char* name = SharedRuntime::stub_name(SharedStubId::jfr_write_checkpoint_id);
|
||||
CodeBuffer code(name, insts_size, locs_size);
|
||||
OopMapSet* oop_maps = new OopMapSet();
|
||||
MacroAssembler* masm = new MacroAssembler(&code);
|
||||
|
||||
@ -2779,7 +2790,7 @@ RuntimeStub* SharedRuntime::generate_jfr_write_checkpoint() {
|
||||
oop_maps->add_gc_map(the_pc - start, map);
|
||||
|
||||
RuntimeStub* stub = // codeBlob framesize is in words (not VMRegImpl::slot_size)
|
||||
RuntimeStub::new_runtime_stub("jfr_write_checkpoint", &code, frame_complete,
|
||||
RuntimeStub::new_runtime_stub(name, &code, frame_complete,
|
||||
(framesize >> (LogBytesPerWord - LogBytesPerInt)),
|
||||
oop_maps, false);
|
||||
return stub;
|
||||
@ -2797,7 +2808,8 @@ RuntimeStub* SharedRuntime::generate_jfr_return_lease() {
|
||||
|
||||
int insts_size = 1024;
|
||||
int locs_size = 64;
|
||||
CodeBuffer code("jfr_return_lease", insts_size, locs_size);
|
||||
const char* name = SharedRuntime::stub_name(SharedStubId::jfr_return_lease_id);
|
||||
CodeBuffer code(name, insts_size, locs_size);
|
||||
OopMapSet* oop_maps = new OopMapSet();
|
||||
MacroAssembler* masm = new MacroAssembler(&code);
|
||||
|
||||
@ -2816,7 +2828,7 @@ RuntimeStub* SharedRuntime::generate_jfr_return_lease() {
|
||||
oop_maps->add_gc_map(the_pc - start, map);
|
||||
|
||||
RuntimeStub* stub = // codeBlob framesize is in words (not VMRegImpl::slot_size)
|
||||
RuntimeStub::new_runtime_stub("jfr_return_lease", &code, frame_complete,
|
||||
RuntimeStub::new_runtime_stub(name, &code, frame_complete,
|
||||
(framesize >> (LogBytesPerWord - LogBytesPerInt)),
|
||||
oop_maps, false);
|
||||
return stub;
|
||||
|
||||
@ -2488,7 +2488,8 @@ void SharedRuntime::generate_deopt_blob() {
|
||||
// Allocate space for the code.
|
||||
ResourceMark rm;
|
||||
// Setup code generation tools.
|
||||
CodeBuffer buffer("deopt_blob", 2048, 1024);
|
||||
const char* name = SharedRuntime::stub_name(SharedStubId::deopt_id);
|
||||
CodeBuffer buffer(name, 2048, 1024);
|
||||
InterpreterMacroAssembler* masm = new InterpreterMacroAssembler(&buffer);
|
||||
Label exec_mode_initialized;
|
||||
OopMap* map = nullptr;
|
||||
@ -2834,23 +2835,25 @@ void OptoRuntime::generate_uncommon_trap_blob() {
|
||||
//
|
||||
// Generate a special Compile2Runtime blob that saves all registers,
|
||||
// and setup oopmap.
|
||||
SafepointBlob* SharedRuntime::generate_handler_blob(address call_ptr, int poll_type) {
|
||||
SafepointBlob* SharedRuntime::generate_handler_blob(SharedStubId id, address call_ptr) {
|
||||
assert(StubRoutines::forward_exception_entry() != nullptr,
|
||||
"must be generated before");
|
||||
assert(is_polling_page_id(id), "expected a polling page stub id");
|
||||
|
||||
ResourceMark rm;
|
||||
OopMapSet *oop_maps = new OopMapSet();
|
||||
OopMap* map;
|
||||
|
||||
// Allocate space for the code. Setup code generation tools.
|
||||
CodeBuffer buffer("handler_blob", 2048, 1024);
|
||||
const char* name = SharedRuntime::stub_name(id);
|
||||
CodeBuffer buffer(name, 2048, 1024);
|
||||
MacroAssembler* masm = new MacroAssembler(&buffer);
|
||||
|
||||
unsigned int start_off = __ offset();
|
||||
address call_pc = nullptr;
|
||||
int frame_size_in_bytes;
|
||||
|
||||
bool cause_return = (poll_type == POLL_AT_RETURN);
|
||||
bool cause_return = (id == SharedStubId::polling_page_return_handler_id);
|
||||
// Make room for return address (or push it again)
|
||||
if (!cause_return) {
|
||||
__ z_lg(Z_R14, Address(Z_thread, JavaThread::saved_exception_pc_offset()));
|
||||
@ -2935,12 +2938,14 @@ SafepointBlob* SharedRuntime::generate_handler_blob(address call_ptr, int poll_t
|
||||
// but since this is generic code we don't know what they are and the caller
|
||||
// must do any gc of the args.
|
||||
//
|
||||
RuntimeStub* SharedRuntime::generate_resolve_blob(address destination, const char* name) {
|
||||
RuntimeStub* SharedRuntime::generate_resolve_blob(SharedStubId id, address destination) {
|
||||
assert (StubRoutines::forward_exception_entry() != nullptr, "must be generated before");
|
||||
assert(is_resolve_id(id), "expected a resolve stub id");
|
||||
|
||||
// allocate space for the code
|
||||
ResourceMark rm;
|
||||
|
||||
const char* name = SharedRuntime::stub_name(id);
|
||||
CodeBuffer buffer(name, 1000, 512);
|
||||
MacroAssembler* masm = new MacroAssembler(&buffer);
|
||||
|
||||
@ -3032,7 +3037,10 @@ RuntimeStub* SharedRuntime::generate_resolve_blob(address destination, const cha
|
||||
// SharedRuntime.cpp requires that this code be generated into a
|
||||
// RuntimeStub.
|
||||
|
||||
RuntimeStub* SharedRuntime::generate_throw_exception(const char* name, address runtime_entry) {
|
||||
RuntimeStub* SharedRuntime::generate_throw_exception(SharedStubId id, address runtime_entry) {
|
||||
assert(is_throw_id(id), "expected a throw stub id");
|
||||
|
||||
const char* name = SharedRuntime::stub_name(id);
|
||||
|
||||
int insts_size = 256;
|
||||
int locs_size = 0;
|
||||
|
||||
@ -2062,7 +2062,8 @@ void SharedRuntime::generate_deopt_blob() {
|
||||
ResourceMark rm;
|
||||
// setup code generation tools
|
||||
// note: the buffer code size must account for StackShadowPages=50
|
||||
CodeBuffer buffer("deopt_blob", 1536, 1024);
|
||||
const char* name = SharedRuntime::stub_name(SharedStubId::deopt_id);
|
||||
CodeBuffer buffer(name, 1536, 1024);
|
||||
MacroAssembler* masm = new MacroAssembler(&buffer);
|
||||
int frame_size_in_words;
|
||||
OopMap* map = nullptr;
|
||||
@ -2403,13 +2404,14 @@ void SharedRuntime::generate_deopt_blob() {
|
||||
// setup oopmap, and calls safepoint code to stop the compiled code for
|
||||
// a safepoint.
|
||||
//
|
||||
SafepointBlob* SharedRuntime::generate_handler_blob(address call_ptr, int poll_type) {
|
||||
SafepointBlob* SharedRuntime::generate_handler_blob(SharedStubId id, address call_ptr) {
|
||||
|
||||
// Account for thread arg in our frame
|
||||
const int additional_words = 1;
|
||||
int frame_size_in_words;
|
||||
|
||||
assert (StubRoutines::forward_exception_entry() != nullptr, "must be generated before");
|
||||
assert(is_polling_page_id(id), "expected a polling page stub id");
|
||||
|
||||
ResourceMark rm;
|
||||
OopMapSet *oop_maps = new OopMapSet();
|
||||
@ -2417,14 +2419,15 @@ SafepointBlob* SharedRuntime::generate_handler_blob(address call_ptr, int poll_t
|
||||
|
||||
// allocate space for the code
|
||||
// setup code generation tools
|
||||
CodeBuffer buffer("handler_blob", 2048, 1024);
|
||||
const char* name = SharedRuntime::stub_name(id);
|
||||
CodeBuffer buffer(name, 2048, 1024);
|
||||
MacroAssembler* masm = new MacroAssembler(&buffer);
|
||||
|
||||
const Register java_thread = rdi; // callee-saved for VC++
|
||||
address start = __ pc();
|
||||
address call_pc = nullptr;
|
||||
bool cause_return = (poll_type == POLL_AT_RETURN);
|
||||
bool save_vectors = (poll_type == POLL_AT_VECTOR_LOOP);
|
||||
bool cause_return = (id == SharedStubId::polling_page_return_handler_id);
|
||||
bool save_vectors = (id == SharedStubId::polling_page_vectors_safepoint_handler_id);
|
||||
|
||||
// If cause_return is true we are at a poll_return and there is
|
||||
// the return address on the stack to the caller on the nmethod
|
||||
@ -2556,12 +2559,14 @@ SafepointBlob* SharedRuntime::generate_handler_blob(address call_ptr, int poll_t
|
||||
// but since this is generic code we don't know what they are and the caller
|
||||
// must do any gc of the args.
|
||||
//
|
||||
RuntimeStub* SharedRuntime::generate_resolve_blob(address destination, const char* name) {
|
||||
RuntimeStub* SharedRuntime::generate_resolve_blob(SharedStubId id, address destination) {
|
||||
assert (StubRoutines::forward_exception_entry() != nullptr, "must be generated before");
|
||||
assert(is_resolve_id(id), "expected a resolve stub id");
|
||||
|
||||
// allocate space for the code
|
||||
ResourceMark rm;
|
||||
|
||||
const char* name = SharedRuntime::stub_name(id);
|
||||
CodeBuffer buffer(name, 1000, 512);
|
||||
MacroAssembler* masm = new MacroAssembler(&buffer);
|
||||
|
||||
@ -2662,7 +2667,10 @@ RuntimeStub* SharedRuntime::generate_resolve_blob(address destination, const cha
|
||||
// exceptions (e.g., NullPointerException or AbstractMethodError on entry) are
|
||||
// either at call sites or otherwise assume that stack unwinding will be initiated,
|
||||
// so caller saved registers were assumed volatile in the compiler.
|
||||
RuntimeStub* SharedRuntime::generate_throw_exception(const char* name, address runtime_entry) {
|
||||
RuntimeStub* SharedRuntime::generate_throw_exception(SharedStubId id, address runtime_entry) {
|
||||
assert(is_throw_id(id), "expected a throw stub id");
|
||||
|
||||
const char* name = SharedRuntime::stub_name(id);
|
||||
|
||||
// Information about frame layout at time of blocking runtime call.
|
||||
// Note that we only have to preserve callee-saved registers since
|
||||
@ -2776,7 +2784,8 @@ RuntimeStub* SharedRuntime::generate_jfr_write_checkpoint() {
|
||||
|
||||
int insts_size = 1024;
|
||||
int locs_size = 64;
|
||||
CodeBuffer code("jfr_write_checkpoint", insts_size, locs_size);
|
||||
const char* name = SharedRuntime::stub_name(SharedStubId::jfr_write_checkpoint_id);
|
||||
CodeBuffer code(name, insts_size, locs_size);
|
||||
OopMapSet* oop_maps = new OopMapSet();
|
||||
MacroAssembler* masm = new MacroAssembler(&code);
|
||||
|
||||
@ -2795,7 +2804,7 @@ RuntimeStub* SharedRuntime::generate_jfr_write_checkpoint() {
|
||||
oop_maps->add_gc_map(the_pc - start, map);
|
||||
|
||||
RuntimeStub* stub = // codeBlob framesize is in words (not VMRegImpl::slot_size)
|
||||
RuntimeStub::new_runtime_stub("jfr_write_checkpoint", &code, frame_complete,
|
||||
RuntimeStub::new_runtime_stub(name, &code, frame_complete,
|
||||
(framesize >> (LogBytesPerWord - LogBytesPerInt)),
|
||||
oop_maps, false);
|
||||
return stub;
|
||||
@ -2817,7 +2826,8 @@ RuntimeStub* SharedRuntime::generate_jfr_return_lease() {
|
||||
|
||||
int insts_size = 1024;
|
||||
int locs_size = 64;
|
||||
CodeBuffer code("jfr_return_lease", insts_size, locs_size);
|
||||
const char* name = SharedRuntime::stub_name(SharedStubId::jfr_return_lease_id);
|
||||
CodeBuffer code(name, insts_size, locs_size);
|
||||
OopMapSet* oop_maps = new OopMapSet();
|
||||
MacroAssembler* masm = new MacroAssembler(&code);
|
||||
|
||||
@ -2835,7 +2845,7 @@ RuntimeStub* SharedRuntime::generate_jfr_return_lease() {
|
||||
oop_maps->add_gc_map(the_pc - start, map);
|
||||
|
||||
RuntimeStub* stub = // codeBlob framesize is in words (not VMRegImpl::slot_size)
|
||||
RuntimeStub::new_runtime_stub("jfr_return_lease", &code, frame_complete,
|
||||
RuntimeStub::new_runtime_stub(name, &code, frame_complete,
|
||||
(framesize >> (LogBytesPerWord - LogBytesPerInt)),
|
||||
oop_maps, false);
|
||||
return stub;
|
||||
|
||||
@ -2623,7 +2623,8 @@ void SharedRuntime::generate_deopt_blob() {
|
||||
pad += 512; // Increase the buffer size when compiling for JVMCI
|
||||
}
|
||||
#endif
|
||||
CodeBuffer buffer("deopt_blob", 2560+pad, 1024);
|
||||
const char* name = SharedRuntime::stub_name(SharedStubId::deopt_id);
|
||||
CodeBuffer buffer(name, 2560+pad, 1024);
|
||||
MacroAssembler* masm = new MacroAssembler(&buffer);
|
||||
int frame_size_in_words;
|
||||
OopMap* map = nullptr;
|
||||
@ -2981,23 +2982,25 @@ void SharedRuntime::generate_deopt_blob() {
|
||||
// Generate a special Compile2Runtime blob that saves all registers,
|
||||
// and setup oopmap.
|
||||
//
|
||||
SafepointBlob* SharedRuntime::generate_handler_blob(address call_ptr, int poll_type) {
|
||||
SafepointBlob* SharedRuntime::generate_handler_blob(SharedStubId id, address call_ptr) {
|
||||
assert(StubRoutines::forward_exception_entry() != nullptr,
|
||||
"must be generated before");
|
||||
assert(is_polling_page_id(id), "expected a polling page stub id");
|
||||
|
||||
ResourceMark rm;
|
||||
OopMapSet *oop_maps = new OopMapSet();
|
||||
OopMap* map;
|
||||
|
||||
// Allocate space for the code. Setup code generation tools.
|
||||
CodeBuffer buffer("handler_blob", 2348, 1024);
|
||||
const char* name = SharedRuntime::stub_name(id);
|
||||
CodeBuffer buffer(name, 2348, 1024);
|
||||
MacroAssembler* masm = new MacroAssembler(&buffer);
|
||||
|
||||
address start = __ pc();
|
||||
address call_pc = nullptr;
|
||||
int frame_size_in_words;
|
||||
bool cause_return = (poll_type == POLL_AT_RETURN);
|
||||
bool save_wide_vectors = (poll_type == POLL_AT_VECTOR_LOOP);
|
||||
bool cause_return = (id == SharedStubId::polling_page_return_handler_id);
|
||||
bool save_wide_vectors = (id == SharedStubId::polling_page_vectors_safepoint_handler_id);
|
||||
|
||||
// Make room for return address (or push it again)
|
||||
if (!cause_return) {
|
||||
@ -3140,12 +3143,14 @@ SafepointBlob* SharedRuntime::generate_handler_blob(address call_ptr, int poll_t
|
||||
// but since this is generic code we don't know what they are and the caller
|
||||
// must do any gc of the args.
|
||||
//
|
||||
RuntimeStub* SharedRuntime::generate_resolve_blob(address destination, const char* name) {
|
||||
RuntimeStub* SharedRuntime::generate_resolve_blob(SharedStubId id, address destination) {
|
||||
assert (StubRoutines::forward_exception_entry() != nullptr, "must be generated before");
|
||||
assert(is_resolve_id(id), "expected a resolve stub id");
|
||||
|
||||
// allocate space for the code
|
||||
ResourceMark rm;
|
||||
|
||||
const char* name = SharedRuntime::stub_name(id);
|
||||
CodeBuffer buffer(name, 1552, 512);
|
||||
MacroAssembler* masm = new MacroAssembler(&buffer);
|
||||
|
||||
@ -3232,7 +3237,11 @@ RuntimeStub* SharedRuntime::generate_resolve_blob(address destination, const cha
|
||||
// AbstractMethodError on entry) are either at call sites or
|
||||
// otherwise assume that stack unwinding will be initiated, so
|
||||
// caller saved registers were assumed volatile in the compiler.
|
||||
RuntimeStub* SharedRuntime::generate_throw_exception(const char* name, address runtime_entry) {
|
||||
RuntimeStub* SharedRuntime::generate_throw_exception(SharedStubId id, address runtime_entry) {
|
||||
assert(is_throw_id(id), "expected a throw stub id");
|
||||
|
||||
const char* name = SharedRuntime::stub_name(id);
|
||||
|
||||
// Information about frame layout at time of blocking runtime call.
|
||||
// Note that we only have to preserve callee-saved registers since
|
||||
// the compilers are responsible for supplying a continuation point
|
||||
@ -3591,7 +3600,8 @@ RuntimeStub* SharedRuntime::generate_jfr_write_checkpoint() {
|
||||
framesize // inclusive of return address
|
||||
};
|
||||
|
||||
CodeBuffer code("jfr_write_checkpoint", 1024, 64);
|
||||
const char* name = SharedRuntime::stub_name(SharedStubId::jfr_write_checkpoint_id);
|
||||
CodeBuffer code(name, 1024, 64);
|
||||
MacroAssembler* masm = new MacroAssembler(&code);
|
||||
address start = __ pc();
|
||||
|
||||
@ -3616,7 +3626,7 @@ RuntimeStub* SharedRuntime::generate_jfr_write_checkpoint() {
|
||||
oop_maps->add_gc_map(frame_complete, map);
|
||||
|
||||
RuntimeStub* stub =
|
||||
RuntimeStub::new_runtime_stub(code.name(),
|
||||
RuntimeStub::new_runtime_stub(name,
|
||||
&code,
|
||||
frame_complete,
|
||||
(framesize >> (LogBytesPerWord - LogBytesPerInt)),
|
||||
@ -3635,7 +3645,8 @@ RuntimeStub* SharedRuntime::generate_jfr_return_lease() {
|
||||
framesize // inclusive of return address
|
||||
};
|
||||
|
||||
CodeBuffer code("jfr_return_lease", 1024, 64);
|
||||
const char* name = SharedRuntime::stub_name(SharedStubId::jfr_return_lease_id);
|
||||
CodeBuffer code(name, 1024, 64);
|
||||
MacroAssembler* masm = new MacroAssembler(&code);
|
||||
address start = __ pc();
|
||||
|
||||
@ -3657,7 +3668,7 @@ RuntimeStub* SharedRuntime::generate_jfr_return_lease() {
|
||||
oop_maps->add_gc_map(frame_complete, map);
|
||||
|
||||
RuntimeStub* stub =
|
||||
RuntimeStub::new_runtime_stub(code.name(),
|
||||
RuntimeStub::new_runtime_stub(name,
|
||||
&code,
|
||||
frame_complete,
|
||||
(framesize >> (LogBytesPerWord - LogBytesPerInt)),
|
||||
|
||||
@ -105,15 +105,15 @@ void SharedRuntime::generate_deopt_blob() {
|
||||
_deopt_blob = generate_empty_deopt_blob();
|
||||
}
|
||||
|
||||
SafepointBlob* SharedRuntime::generate_handler_blob(address call_ptr, int poll_type) {
|
||||
SafepointBlob* SharedRuntime::generate_handler_blob(SharedStubId id, address call_ptr) {
|
||||
return generate_empty_safepoint_blob();
|
||||
}
|
||||
|
||||
RuntimeStub* SharedRuntime::generate_resolve_blob(address destination, const char* name) {
|
||||
RuntimeStub* SharedRuntime::generate_resolve_blob(SharedStubId id, address destination) {
|
||||
return generate_empty_runtime_stub();
|
||||
}
|
||||
|
||||
RuntimeStub* SharedRuntime::generate_throw_exception(const char* name, address runtime_entry) {
|
||||
RuntimeStub* SharedRuntime::generate_throw_exception(SharedStubId id, address runtime_entry) {
|
||||
return generate_empty_runtime_stub();
|
||||
}
|
||||
|
||||
|
||||
@ -92,61 +92,61 @@
|
||||
// Shared runtime stub routines reside in their own unique blob with a
|
||||
// single entry point
|
||||
|
||||
RuntimeStub* SharedRuntime::_wrong_method_blob;
|
||||
RuntimeStub* SharedRuntime::_wrong_method_abstract_blob;
|
||||
RuntimeStub* SharedRuntime::_ic_miss_blob;
|
||||
RuntimeStub* SharedRuntime::_resolve_opt_virtual_call_blob;
|
||||
RuntimeStub* SharedRuntime::_resolve_virtual_call_blob;
|
||||
RuntimeStub* SharedRuntime::_resolve_static_call_blob;
|
||||
|
||||
DeoptimizationBlob* SharedRuntime::_deopt_blob;
|
||||
SafepointBlob* SharedRuntime::_polling_page_vectors_safepoint_handler_blob;
|
||||
SafepointBlob* SharedRuntime::_polling_page_safepoint_handler_blob;
|
||||
SafepointBlob* SharedRuntime::_polling_page_return_handler_blob;
|
||||
|
||||
RuntimeStub* SharedRuntime::_throw_AbstractMethodError_blob;
|
||||
RuntimeStub* SharedRuntime::_throw_IncompatibleClassChangeError_blob;
|
||||
RuntimeStub* SharedRuntime::_throw_NullPointerException_at_call_blob;
|
||||
RuntimeStub* SharedRuntime::_throw_StackOverflowError_blob;
|
||||
RuntimeStub* SharedRuntime::_throw_delayed_StackOverflowError_blob;
|
||||
|
||||
#if INCLUDE_JFR
|
||||
RuntimeStub* SharedRuntime::_jfr_write_checkpoint_blob = nullptr;
|
||||
RuntimeStub* SharedRuntime::_jfr_return_lease_blob = nullptr;
|
||||
#endif
|
||||
#define SHARED_STUB_FIELD_DEFINE(name, type) \
|
||||
type SharedRuntime::BLOB_FIELD_NAME(name);
|
||||
SHARED_STUBS_DO(SHARED_STUB_FIELD_DEFINE)
|
||||
#undef SHARED_STUB_FIELD_DEFINE
|
||||
|
||||
nmethod* SharedRuntime::_cont_doYield_stub;
|
||||
|
||||
#define SHARED_STUB_NAME_DECLARE(name, type) "Shared Runtime " # name "_blob",
|
||||
const char *SharedRuntime::_stub_names[] = {
|
||||
SHARED_STUBS_DO(SHARED_STUB_NAME_DECLARE)
|
||||
};
|
||||
|
||||
//----------------------------generate_stubs-----------------------------------
|
||||
void SharedRuntime::generate_initial_stubs() {
|
||||
// Build this early so it's available for the interpreter.
|
||||
_throw_StackOverflowError_blob =
|
||||
generate_throw_exception("StackOverflowError throw_exception",
|
||||
generate_throw_exception(SharedStubId::throw_StackOverflowError_id,
|
||||
CAST_FROM_FN_PTR(address, SharedRuntime::throw_StackOverflowError));
|
||||
}
|
||||
|
||||
void SharedRuntime::generate_stubs() {
|
||||
_wrong_method_blob = generate_resolve_blob(CAST_FROM_FN_PTR(address, SharedRuntime::handle_wrong_method), "wrong_method_stub");
|
||||
_wrong_method_abstract_blob = generate_resolve_blob(CAST_FROM_FN_PTR(address, SharedRuntime::handle_wrong_method_abstract), "wrong_method_abstract_stub");
|
||||
_ic_miss_blob = generate_resolve_blob(CAST_FROM_FN_PTR(address, SharedRuntime::handle_wrong_method_ic_miss), "ic_miss_stub");
|
||||
_resolve_opt_virtual_call_blob = generate_resolve_blob(CAST_FROM_FN_PTR(address, SharedRuntime::resolve_opt_virtual_call_C), "resolve_opt_virtual_call");
|
||||
_resolve_virtual_call_blob = generate_resolve_blob(CAST_FROM_FN_PTR(address, SharedRuntime::resolve_virtual_call_C), "resolve_virtual_call");
|
||||
_resolve_static_call_blob = generate_resolve_blob(CAST_FROM_FN_PTR(address, SharedRuntime::resolve_static_call_C), "resolve_static_call");
|
||||
_wrong_method_blob =
|
||||
generate_resolve_blob(SharedStubId::wrong_method_id,
|
||||
CAST_FROM_FN_PTR(address, SharedRuntime::handle_wrong_method));
|
||||
_wrong_method_abstract_blob =
|
||||
generate_resolve_blob(SharedStubId::wrong_method_abstract_id,
|
||||
CAST_FROM_FN_PTR(address, SharedRuntime::handle_wrong_method_abstract));
|
||||
_ic_miss_blob =
|
||||
generate_resolve_blob(SharedStubId::ic_miss_id,
|
||||
CAST_FROM_FN_PTR(address, SharedRuntime::handle_wrong_method_ic_miss));
|
||||
_resolve_opt_virtual_call_blob =
|
||||
generate_resolve_blob(SharedStubId::resolve_opt_virtual_call_id,
|
||||
CAST_FROM_FN_PTR(address, SharedRuntime::resolve_opt_virtual_call_C));
|
||||
_resolve_virtual_call_blob =
|
||||
generate_resolve_blob(SharedStubId::resolve_virtual_call_id,
|
||||
CAST_FROM_FN_PTR(address, SharedRuntime::resolve_virtual_call_C));
|
||||
_resolve_static_call_blob =
|
||||
generate_resolve_blob(SharedStubId::resolve_static_call_id,
|
||||
CAST_FROM_FN_PTR(address, SharedRuntime::resolve_static_call_C));
|
||||
|
||||
_throw_delayed_StackOverflowError_blob =
|
||||
generate_throw_exception("delayed StackOverflowError throw_exception",
|
||||
generate_throw_exception(SharedStubId::throw_delayed_StackOverflowError_id,
|
||||
CAST_FROM_FN_PTR(address, SharedRuntime::throw_delayed_StackOverflowError));
|
||||
|
||||
_throw_AbstractMethodError_blob =
|
||||
generate_throw_exception("AbstractMethodError throw_exception",
|
||||
generate_throw_exception(SharedStubId::throw_AbstractMethodError_id,
|
||||
CAST_FROM_FN_PTR(address, SharedRuntime::throw_AbstractMethodError));
|
||||
|
||||
_throw_IncompatibleClassChangeError_blob =
|
||||
generate_throw_exception("IncompatibleClassChangeError throw_exception",
|
||||
generate_throw_exception(SharedStubId::throw_IncompatibleClassChangeError_id,
|
||||
CAST_FROM_FN_PTR(address, SharedRuntime::throw_IncompatibleClassChangeError));
|
||||
|
||||
_throw_NullPointerException_at_call_blob =
|
||||
generate_throw_exception("NullPointerException at call throw_exception",
|
||||
generate_throw_exception(SharedStubId::throw_NullPointerException_at_call_id,
|
||||
CAST_FROM_FN_PTR(address, SharedRuntime::throw_NullPointerException_at_call));
|
||||
|
||||
AdapterHandlerLibrary::initialize();
|
||||
@ -155,11 +155,17 @@ void SharedRuntime::generate_stubs() {
|
||||
// Vectors are generated only by C2 and JVMCI.
|
||||
bool support_wide = is_wide_vector(MaxVectorSize);
|
||||
if (support_wide) {
|
||||
_polling_page_vectors_safepoint_handler_blob = generate_handler_blob(CAST_FROM_FN_PTR(address, SafepointSynchronize::handle_polling_page_exception), POLL_AT_VECTOR_LOOP);
|
||||
_polling_page_vectors_safepoint_handler_blob =
|
||||
generate_handler_blob(SharedStubId::polling_page_vectors_safepoint_handler_id,
|
||||
CAST_FROM_FN_PTR(address, SafepointSynchronize::handle_polling_page_exception));
|
||||
}
|
||||
#endif // COMPILER2_OR_JVMCI
|
||||
_polling_page_safepoint_handler_blob = generate_handler_blob(CAST_FROM_FN_PTR(address, SafepointSynchronize::handle_polling_page_exception), POLL_AT_LOOP);
|
||||
_polling_page_return_handler_blob = generate_handler_blob(CAST_FROM_FN_PTR(address, SafepointSynchronize::handle_polling_page_exception), POLL_AT_RETURN);
|
||||
_polling_page_safepoint_handler_blob =
|
||||
generate_handler_blob(SharedStubId::polling_page_safepoint_handler_id,
|
||||
CAST_FROM_FN_PTR(address, SafepointSynchronize::handle_polling_page_exception));
|
||||
_polling_page_return_handler_blob =
|
||||
generate_handler_blob(SharedStubId::polling_page_return_handler_id,
|
||||
CAST_FROM_FN_PTR(address, SafepointSynchronize::handle_polling_page_exception));
|
||||
|
||||
generate_deopt_blob();
|
||||
}
|
||||
|
||||
@ -30,6 +30,7 @@
|
||||
#include "interpreter/linkResolver.hpp"
|
||||
#include "memory/allStatic.hpp"
|
||||
#include "memory/resourceArea.hpp"
|
||||
#include "runtime/stubDeclarations.hpp"
|
||||
#include "utilities/macros.hpp"
|
||||
|
||||
class AdapterHandlerEntry;
|
||||
@ -42,37 +43,57 @@ class vframeStream;
|
||||
// Java exceptions), locking/unlocking mechanisms, statistical
|
||||
// information, etc.
|
||||
|
||||
// define SharedStubId enum tags: wrong_method_id, etc
|
||||
|
||||
#define SHARED_STUB_ID_ENUM_DECLARE(name, type) STUB_ID_NAME(name),
|
||||
enum class SharedStubId :int {
|
||||
NO_STUBID = -1,
|
||||
SHARED_STUBS_DO(SHARED_STUB_ID_ENUM_DECLARE)
|
||||
NUM_STUBIDS
|
||||
};
|
||||
#undef SHARED_STUB_ID_ENUM_DECLARE
|
||||
|
||||
class SharedRuntime: AllStatic {
|
||||
friend class VMStructs;
|
||||
|
||||
private:
|
||||
// Shared stub locations
|
||||
// Declare shared stub fields
|
||||
#define SHARED_STUB_FIELD_DECLARE(name, type) \
|
||||
static type BLOB_FIELD_NAME(name);
|
||||
SHARED_STUBS_DO(SHARED_STUB_FIELD_DECLARE)
|
||||
#undef SHARED_STUB_FIELD_DECLARE
|
||||
|
||||
static RuntimeStub* _wrong_method_blob;
|
||||
static RuntimeStub* _wrong_method_abstract_blob;
|
||||
static RuntimeStub* _ic_miss_blob;
|
||||
static RuntimeStub* _resolve_opt_virtual_call_blob;
|
||||
static RuntimeStub* _resolve_virtual_call_blob;
|
||||
static RuntimeStub* _resolve_static_call_blob;
|
||||
|
||||
static DeoptimizationBlob* _deopt_blob;
|
||||
|
||||
static SafepointBlob* _polling_page_vectors_safepoint_handler_blob;
|
||||
static SafepointBlob* _polling_page_safepoint_handler_blob;
|
||||
static SafepointBlob* _polling_page_return_handler_blob;
|
||||
#ifdef ASSERT
|
||||
static bool is_resolve_id(SharedStubId id) {
|
||||
return (id == SharedStubId::wrong_method_id ||
|
||||
id == SharedStubId::wrong_method_abstract_id ||
|
||||
id == SharedStubId::ic_miss_id ||
|
||||
id == SharedStubId::resolve_opt_virtual_call_id ||
|
||||
id == SharedStubId::resolve_virtual_call_id ||
|
||||
id == SharedStubId::resolve_static_call_id);
|
||||
}
|
||||
static bool is_polling_page_id(SharedStubId id) {
|
||||
return (id == SharedStubId::polling_page_vectors_safepoint_handler_id ||
|
||||
id == SharedStubId::polling_page_safepoint_handler_id ||
|
||||
id == SharedStubId::polling_page_return_handler_id);
|
||||
}
|
||||
static bool is_throw_id(SharedStubId id) {
|
||||
return (id == SharedStubId::throw_AbstractMethodError_id ||
|
||||
id == SharedStubId::throw_IncompatibleClassChangeError_id ||
|
||||
id == SharedStubId::throw_NullPointerException_at_call_id ||
|
||||
id == SharedStubId::throw_StackOverflowError_id ||
|
||||
id == SharedStubId::throw_delayed_StackOverflowError_id);
|
||||
}
|
||||
#endif
|
||||
|
||||
// cont_doYieldStub is not yet folded into the general model for
|
||||
// shared stub/blob handling. It is actually a specially generated
|
||||
// native wrapper for a specific native method, as also is it's
|
||||
// counterpart the continuation do_enter method.
|
||||
static nmethod* _cont_doYield_stub;
|
||||
|
||||
static RuntimeStub* _throw_AbstractMethodError_blob;
|
||||
static RuntimeStub* _throw_IncompatibleClassChangeError_blob;
|
||||
static RuntimeStub* _throw_NullPointerException_at_call_blob;
|
||||
static RuntimeStub* _throw_StackOverflowError_blob;
|
||||
static RuntimeStub* _throw_delayed_StackOverflowError_blob;
|
||||
|
||||
#if INCLUDE_JFR
|
||||
static RuntimeStub* _jfr_write_checkpoint_blob;
|
||||
static RuntimeStub* _jfr_return_lease_blob;
|
||||
#endif
|
||||
// Stub names indexed by SharedStubId
|
||||
static const char *_stub_names[];
|
||||
|
||||
#ifndef PRODUCT
|
||||
// Counters
|
||||
@ -80,10 +101,9 @@ class SharedRuntime: AllStatic {
|
||||
#endif // !PRODUCT
|
||||
|
||||
private:
|
||||
enum { POLL_AT_RETURN, POLL_AT_LOOP, POLL_AT_VECTOR_LOOP };
|
||||
static SafepointBlob* generate_handler_blob(address call_ptr, int poll_type);
|
||||
static RuntimeStub* generate_resolve_blob(address destination, const char* name);
|
||||
static RuntimeStub* generate_throw_exception(const char* name, address runtime_entry);
|
||||
static SafepointBlob* generate_handler_blob(SharedStubId id, address call_ptr);
|
||||
static RuntimeStub* generate_resolve_blob(SharedStubId id, address destination);
|
||||
static RuntimeStub* generate_throw_exception(SharedStubId id, address runtime_entry);
|
||||
public:
|
||||
static void generate_initial_stubs(void);
|
||||
static void generate_stubs(void);
|
||||
@ -97,6 +117,11 @@ class SharedRuntime: AllStatic {
|
||||
static RuntimeStub* generate_jfr_return_lease();
|
||||
#endif
|
||||
|
||||
static const char *stub_name(SharedStubId id) {
|
||||
assert(id > SharedStubId::NO_STUBID && id < SharedStubId::NUM_STUBIDS, "stub id out of range");
|
||||
return _stub_names[(int)id];
|
||||
}
|
||||
|
||||
// max bytes for each dtrace string parameter
|
||||
enum { max_dtrace_string_size = 256 };
|
||||
|
||||
|
||||
86
src/hotspot/share/runtime/stubDeclarations.hpp
Normal file
86
src/hotspot/share/runtime/stubDeclarations.hpp
Normal file
@ -0,0 +1,86 @@
|
||||
/*
|
||||
* Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2024, Red Hat, Inc. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef SHARE_RUNTIME_STUBDECLARATIONS_HPP
|
||||
#define SHARE_RUNTIME_STUBDECLARATIONS_HPP
|
||||
|
||||
#include "utilities/macros.hpp"
|
||||
|
||||
// macros for generating definitions and declarations for shared, c1
|
||||
// and opto blob fields and associated stub ids
|
||||
|
||||
// Different shared stubs can have different blob types and may
|
||||
// include some JFR stubs
|
||||
//
|
||||
// n.b resolve, handler and throw stubs must remain grouped in the
|
||||
// same order to allow id values to be range checked
|
||||
|
||||
#if INCLUDE_JFR
|
||||
// do_blob(name, type)
|
||||
#define SHARED_JFR_STUBS_DO(do_blob) \
|
||||
do_blob(jfr_write_checkpoint, RuntimeStub*) \
|
||||
do_blob(jfr_return_lease, RuntimeStub*) \
|
||||
|
||||
#else
|
||||
#define SHARED_JFR_STUBS_DO(do_blob)
|
||||
#endif
|
||||
|
||||
// do_blob(name, type)
|
||||
#define SHARED_STUBS_DO(do_blob) \
|
||||
do_blob(deopt, DeoptimizationBlob*) \
|
||||
/* resolve stubs */ \
|
||||
do_blob(wrong_method, RuntimeStub*) \
|
||||
do_blob(wrong_method_abstract, RuntimeStub*) \
|
||||
do_blob(ic_miss, RuntimeStub*) \
|
||||
do_blob(resolve_opt_virtual_call, RuntimeStub*) \
|
||||
do_blob(resolve_virtual_call, RuntimeStub*) \
|
||||
do_blob(resolve_static_call, RuntimeStub*) \
|
||||
/* handler stubs */ \
|
||||
do_blob(polling_page_vectors_safepoint_handler, SafepointBlob*) \
|
||||
do_blob(polling_page_safepoint_handler, SafepointBlob*) \
|
||||
do_blob(polling_page_return_handler, SafepointBlob*) \
|
||||
/* throw stubs */ \
|
||||
do_blob(throw_AbstractMethodError, RuntimeStub*) \
|
||||
do_blob(throw_IncompatibleClassChangeError, RuntimeStub*) \
|
||||
do_blob(throw_NullPointerException_at_call, RuntimeStub*) \
|
||||
do_blob(throw_StackOverflowError, RuntimeStub*) \
|
||||
do_blob(throw_delayed_StackOverflowError, RuntimeStub*) \
|
||||
/* other stubs */ \
|
||||
SHARED_JFR_STUBS_DO(do_blob) \
|
||||
|
||||
// generate a stub id enum tag from a name
|
||||
|
||||
#define STUB_ID_NAME(base) base##_id
|
||||
|
||||
// generate a blob id enum tag from a name
|
||||
|
||||
#define BLOB_ID_NAME(base) base##_id
|
||||
|
||||
// generate a blob field name
|
||||
|
||||
#define BLOB_FIELD_NAME(base) _##base##_blob
|
||||
|
||||
#endif // SHARE_RUNTIME_STUBDECLARATIONS_HPP
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user