mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-26 14:24:46 +02:00
8252058: [JVMCI] Rework setting is_method_handle_invoke flag in jvmciCodeInstaller
Reviewed-by: kvn, dlong
This commit is contained in:
parent
afce1f4ebd
commit
13c176bee4
6 changed files with 45 additions and 17 deletions
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -330,7 +330,7 @@ public:
|
||||||
// Deopt
|
// Deopt
|
||||||
// Return true is the PC is one would expect if the frame is being deopted.
|
// Return true is the PC is one would expect if the frame is being deopted.
|
||||||
inline bool is_deopt_pc(address pc);
|
inline bool is_deopt_pc(address pc);
|
||||||
bool is_deopt_mh_entry(address pc) { return pc == deopt_mh_handler_begin(); }
|
inline bool is_deopt_mh_entry(address pc);
|
||||||
inline bool is_deopt_entry(address pc);
|
inline bool is_deopt_entry(address pc);
|
||||||
|
|
||||||
virtual bool can_convert_to_zombie() = 0;
|
virtual bool can_convert_to_zombie() = 0;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -41,6 +41,14 @@ inline bool CompiledMethod::is_deopt_entry(address pc) {
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline bool CompiledMethod::is_deopt_mh_entry(address pc) {
|
||||||
|
return pc == deopt_mh_handler_begin()
|
||||||
|
#if INCLUDE_JVMCI
|
||||||
|
|| (is_compiled_by_jvmci() && pc == (deopt_mh_handler_begin() + NativeCall::instruction_size))
|
||||||
|
#endif
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
// CompiledMethod::get_deopt_original_pc
|
// CompiledMethod::get_deopt_original_pc
|
||||||
//
|
//
|
||||||
|
|
|
@ -1043,7 +1043,7 @@ GrowableArray<ScopeValue*>* CodeInstaller::record_virtual_objects(JVMCIObject de
|
||||||
return objects;
|
return objects;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CodeInstaller::record_scope(jint pc_offset, JVMCIObject debug_info, ScopeMode scope_mode, bool return_oop, JVMCI_TRAPS) {
|
void CodeInstaller::record_scope(jint pc_offset, JVMCIObject debug_info, ScopeMode scope_mode, bool is_mh_invoke, bool return_oop, JVMCI_TRAPS) {
|
||||||
JVMCIObject position = jvmci_env()->get_DebugInfo_bytecodePosition(debug_info);
|
JVMCIObject position = jvmci_env()->get_DebugInfo_bytecodePosition(debug_info);
|
||||||
if (position.is_null()) {
|
if (position.is_null()) {
|
||||||
// Stubs do not record scope info, just oop maps
|
// Stubs do not record scope info, just oop maps
|
||||||
|
@ -1056,7 +1056,7 @@ void CodeInstaller::record_scope(jint pc_offset, JVMCIObject debug_info, ScopeMo
|
||||||
} else {
|
} else {
|
||||||
objectMapping = NULL;
|
objectMapping = NULL;
|
||||||
}
|
}
|
||||||
record_scope(pc_offset, position, scope_mode, objectMapping, return_oop, JVMCI_CHECK);
|
record_scope(pc_offset, position, scope_mode, objectMapping, is_mh_invoke, return_oop, JVMCI_CHECK);
|
||||||
}
|
}
|
||||||
|
|
||||||
int CodeInstaller::map_jvmci_bci(int bci) {
|
int CodeInstaller::map_jvmci_bci(int bci) {
|
||||||
|
@ -1079,7 +1079,7 @@ int CodeInstaller::map_jvmci_bci(int bci) {
|
||||||
return bci;
|
return bci;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CodeInstaller::record_scope(jint pc_offset, JVMCIObject position, ScopeMode scope_mode, GrowableArray<ScopeValue*>* objects, bool return_oop, JVMCI_TRAPS) {
|
void CodeInstaller::record_scope(jint pc_offset, JVMCIObject position, ScopeMode scope_mode, GrowableArray<ScopeValue*>* objects, bool is_mh_invoke, bool return_oop, JVMCI_TRAPS) {
|
||||||
JVMCIObject frame;
|
JVMCIObject frame;
|
||||||
if (scope_mode == CodeInstaller::FullFrame) {
|
if (scope_mode == CodeInstaller::FullFrame) {
|
||||||
if (!jvmci_env()->isa_BytecodeFrame(position)) {
|
if (!jvmci_env()->isa_BytecodeFrame(position)) {
|
||||||
|
@ -1089,7 +1089,7 @@ void CodeInstaller::record_scope(jint pc_offset, JVMCIObject position, ScopeMode
|
||||||
}
|
}
|
||||||
JVMCIObject caller_frame = jvmci_env()->get_BytecodePosition_caller(position);
|
JVMCIObject caller_frame = jvmci_env()->get_BytecodePosition_caller(position);
|
||||||
if (caller_frame.is_non_null()) {
|
if (caller_frame.is_non_null()) {
|
||||||
record_scope(pc_offset, caller_frame, scope_mode, objects, return_oop, JVMCI_CHECK);
|
record_scope(pc_offset, caller_frame, scope_mode, objects, is_mh_invoke, return_oop, JVMCI_CHECK);
|
||||||
}
|
}
|
||||||
|
|
||||||
JVMCIObject hotspot_method = jvmci_env()->get_BytecodePosition_method(position);
|
JVMCIObject hotspot_method = jvmci_env()->get_BytecodePosition_method(position);
|
||||||
|
@ -1181,7 +1181,7 @@ void CodeInstaller::record_scope(jint pc_offset, JVMCIObject position, ScopeMode
|
||||||
throw_exception = jvmci_env()->get_BytecodeFrame_rethrowException(frame) == JNI_TRUE;
|
throw_exception = jvmci_env()->get_BytecodeFrame_rethrowException(frame) == JNI_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
_debug_recorder->describe_scope(pc_offset, method, NULL, bci, reexecute, throw_exception, false, return_oop,
|
_debug_recorder->describe_scope(pc_offset, method, NULL, bci, reexecute, throw_exception, is_mh_invoke, return_oop,
|
||||||
locals_token, expressions_token, monitors_token);
|
locals_token, expressions_token, monitors_token);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1236,9 +1236,19 @@ void CodeInstaller::site_Call(CodeBuffer& buffer, jint pc_offset, JVMCIObject si
|
||||||
OopMap *map = create_oop_map(debug_info, JVMCI_CHECK);
|
OopMap *map = create_oop_map(debug_info, JVMCI_CHECK);
|
||||||
_debug_recorder->add_safepoint(next_pc_offset, map);
|
_debug_recorder->add_safepoint(next_pc_offset, map);
|
||||||
|
|
||||||
bool return_oop = hotspot_method.is_non_null() && jvmci_env()->asMethod(hotspot_method)->is_returning_oop();
|
if (hotspot_method.is_non_null()) {
|
||||||
|
Method *method = jvmci_env()->asMethod(hotspot_method);
|
||||||
record_scope(next_pc_offset, debug_info, CodeInstaller::FullFrame, return_oop, JVMCI_CHECK);
|
vmIntrinsics::ID iid = method->intrinsic_id();
|
||||||
|
bool is_mh_invoke = false;
|
||||||
|
if (jvmci_env()->get_site_Call_direct(site)) {
|
||||||
|
is_mh_invoke = !method->is_static() && (iid == vmIntrinsics::_compiledLambdaForm ||
|
||||||
|
(MethodHandles::is_signature_polymorphic(iid) && MethodHandles::is_signature_polymorphic_intrinsic(iid)));
|
||||||
|
}
|
||||||
|
bool return_oop = method->is_returning_oop();
|
||||||
|
record_scope(next_pc_offset, debug_info, CodeInstaller::FullFrame, is_mh_invoke, return_oop, JVMCI_CHECK);
|
||||||
|
} else {
|
||||||
|
record_scope(next_pc_offset, debug_info, CodeInstaller::FullFrame, JVMCI_CHECK);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (foreign_call.is_non_null()) {
|
if (foreign_call.is_non_null()) {
|
||||||
|
@ -1347,6 +1357,9 @@ void CodeInstaller::site_Mark(CodeBuffer& buffer, jint pc_offset, JVMCIObject si
|
||||||
case DEOPT_HANDLER_ENTRY:
|
case DEOPT_HANDLER_ENTRY:
|
||||||
_offsets.set_value(CodeOffsets::Deopt, pc_offset);
|
_offsets.set_value(CodeOffsets::Deopt, pc_offset);
|
||||||
break;
|
break;
|
||||||
|
case DEOPT_MH_HANDLER_ENTRY:
|
||||||
|
_offsets.set_value(CodeOffsets::DeoptMH, pc_offset);
|
||||||
|
break;
|
||||||
case FRAME_COMPLETE:
|
case FRAME_COMPLETE:
|
||||||
_offsets.set_value(CodeOffsets::Frame_Complete, pc_offset);
|
_offsets.set_value(CodeOffsets::Frame_Complete, pc_offset);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2011, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -159,6 +159,7 @@ private:
|
||||||
CRC_TABLE_ADDRESS,
|
CRC_TABLE_ADDRESS,
|
||||||
LOG_OF_HEAP_REGION_GRAIN_BYTES,
|
LOG_OF_HEAP_REGION_GRAIN_BYTES,
|
||||||
INLINE_CONTIGUOUS_ALLOCATION_SUPPORTED,
|
INLINE_CONTIGUOUS_ALLOCATION_SUPPORTED,
|
||||||
|
DEOPT_MH_HANDLER_ENTRY,
|
||||||
INVOKE_INVALID = -1
|
INVOKE_INVALID = -1
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -297,11 +298,11 @@ protected:
|
||||||
|
|
||||||
int map_jvmci_bci(int bci);
|
int map_jvmci_bci(int bci);
|
||||||
|
|
||||||
void record_scope(jint pc_offset, JVMCIObject debug_info, ScopeMode scope_mode, bool return_oop, JVMCI_TRAPS);
|
void record_scope(jint pc_offset, JVMCIObject debug_info, ScopeMode scope_mode, bool is_mh_invoke, bool return_oop, JVMCI_TRAPS);
|
||||||
void record_scope(jint pc_offset, JVMCIObject debug_info, ScopeMode scope_mode, JVMCI_TRAPS) {
|
void record_scope(jint pc_offset, JVMCIObject debug_info, ScopeMode scope_mode, JVMCI_TRAPS) {
|
||||||
record_scope(pc_offset, debug_info, scope_mode, false /* return_oop */, JVMCIENV);
|
record_scope(pc_offset, debug_info, scope_mode, false /* is_mh_invoke */, false /* return_oop */, JVMCIENV);
|
||||||
}
|
}
|
||||||
void record_scope(jint pc_offset, JVMCIObject position, ScopeMode scope_mode, GrowableArray<ScopeValue*>* objects, bool return_oop, JVMCI_TRAPS);
|
void record_scope(jint pc_offset, JVMCIObject position, ScopeMode scope_mode, GrowableArray<ScopeValue*>* objects, bool is_mh_invoke, bool return_oop, JVMCI_TRAPS);
|
||||||
void record_object_value(ObjectValue* sv, JVMCIObject value, GrowableArray<ScopeValue*>* objects, JVMCI_TRAPS);
|
void record_object_value(ObjectValue* sv, JVMCIObject value, GrowableArray<ScopeValue*>* objects, JVMCI_TRAPS);
|
||||||
|
|
||||||
GrowableArray<ScopeValue*>* record_virtual_objects(JVMCIObject debug_info, JVMCI_TRAPS);
|
GrowableArray<ScopeValue*>* record_virtual_objects(JVMCIObject debug_info, JVMCI_TRAPS);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2011, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -175,6 +175,7 @@
|
||||||
end_class \
|
end_class \
|
||||||
start_class(site_Call, jdk_vm_ci_code_site_Call) \
|
start_class(site_Call, jdk_vm_ci_code_site_Call) \
|
||||||
object_field(site_Call, target, "Ljdk/vm/ci/meta/InvokeTarget;") \
|
object_field(site_Call, target, "Ljdk/vm/ci/meta/InvokeTarget;") \
|
||||||
|
boolean_field(site_Call, direct) \
|
||||||
end_class \
|
end_class \
|
||||||
start_class(site_DataPatch, jdk_vm_ci_code_site_DataPatch) \
|
start_class(site_DataPatch, jdk_vm_ci_code_site_DataPatch) \
|
||||||
object_field(site_DataPatch, reference, "Ljdk/vm/ci/code/site/Reference;") \
|
object_field(site_DataPatch, reference, "Ljdk/vm/ci/code/site/Reference;") \
|
||||||
|
|
|
@ -471,8 +471,14 @@
|
||||||
declare_constant(CodeInstaller::CRC_TABLE_ADDRESS) \
|
declare_constant(CodeInstaller::CRC_TABLE_ADDRESS) \
|
||||||
declare_constant(CodeInstaller::LOG_OF_HEAP_REGION_GRAIN_BYTES) \
|
declare_constant(CodeInstaller::LOG_OF_HEAP_REGION_GRAIN_BYTES) \
|
||||||
declare_constant(CodeInstaller::INLINE_CONTIGUOUS_ALLOCATION_SUPPORTED) \
|
declare_constant(CodeInstaller::INLINE_CONTIGUOUS_ALLOCATION_SUPPORTED) \
|
||||||
|
declare_constant(CodeInstaller::DEOPT_MH_HANDLER_ENTRY) \
|
||||||
declare_constant(CodeInstaller::INVOKE_INVALID) \
|
declare_constant(CodeInstaller::INVOKE_INVALID) \
|
||||||
\
|
\
|
||||||
|
declare_constant(vmIntrinsics::FIRST_MH_SIG_POLY) \
|
||||||
|
declare_constant(vmIntrinsics::LAST_MH_SIG_POLY) \
|
||||||
|
declare_constant(vmIntrinsics::_invokeGeneric) \
|
||||||
|
declare_constant(vmIntrinsics::_compiledLambdaForm) \
|
||||||
|
\
|
||||||
declare_constant(CollectedHeap::Serial) \
|
declare_constant(CollectedHeap::Serial) \
|
||||||
declare_constant(CollectedHeap::Parallel) \
|
declare_constant(CollectedHeap::Parallel) \
|
||||||
declare_constant(CollectedHeap::G1) \
|
declare_constant(CollectedHeap::G1) \
|
||||||
|
@ -966,4 +972,3 @@ void jvmci_vmStructs_init() {
|
||||||
JVMCIVMStructs::init();
|
JVMCIVMStructs::init();
|
||||||
}
|
}
|
||||||
#endif // ASSERT
|
#endif // ASSERT
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue