8287233: Crash in Continuation.enterSpecial: stop: tried to execute native method as non-native

Reviewed-by: dholmes, pchilanomate
This commit is contained in:
Ron Pressler 2022-06-01 14:10:10 +00:00 committed by Patricio Chilano Mateo
parent 168b226b0f
commit b2b4ee212f
2 changed files with 19 additions and 10 deletions

View file

@ -1236,6 +1236,12 @@ void Method::link_method(const methodHandle& h_method, TRAPS) {
(void) make_adapters(h_method, CHECK);
// ONLY USE the h_method now as make_adapter may have blocked
if (h_method->is_continuation_enter_intrinsic()) {
// the entry points to this method will be set in set_code, called when first resolving this method
_from_interpreted_entry = NULL;
_from_compiled_entry = NULL;
}
}
address Method::make_adapters(const methodHandle& mh, TRAPS) {
@ -1317,12 +1323,16 @@ void Method::set_code(const methodHandle& mh, CompiledMethod *code) {
OrderAccess::storestore();
mh->_from_compiled_entry = code->verified_entry_point();
OrderAccess::storestore();
// Instantly compiled code can execute.
if (!mh->is_method_handle_intrinsic())
mh->_from_interpreted_entry = mh->get_i2c_entry();
if (mh->is_continuation_enter_intrinsic()) {
// this is the entry used when we're in interpreter-only mode; see InterpreterMacroAssembler::jump_from_interpreted
assert(mh->_from_interpreted_entry == NULL, "initialized incorrectly"); // see link_method
// This is the entry used when we're in interpreter-only mode; see InterpreterMacroAssembler::jump_from_interpreted
mh->_i2i_entry = mh->get_i2c_entry();
// This must come last, as it is what's tested in LinkResolver::resolve_static_call
Atomic::release_store(&mh->_from_interpreted_entry , mh->get_i2c_entry());
} else if (!mh->is_method_handle_intrinsic()) {
// Instantly compiled code can execute.
mh->_from_interpreted_entry = mh->get_i2c_entry();
}
}