提交 18c95895 编写于 作者: T twisti

6975855: don't emit deopt MH handler in C1 if not required

Summary: This CR implements the same for C1 as 6926782 for C2.
Reviewed-by: never
上级 612f62f3
...@@ -220,11 +220,13 @@ void Compilation::emit_code_epilog(LIR_Assembler* assembler) { ...@@ -220,11 +220,13 @@ void Compilation::emit_code_epilog(LIR_Assembler* assembler) {
code_offsets->set_value(CodeOffsets::Deopt, assembler->emit_deopt_handler()); code_offsets->set_value(CodeOffsets::Deopt, assembler->emit_deopt_handler());
CHECK_BAILOUT(); CHECK_BAILOUT();
// Generate code for MethodHandle deopt handler. We can use the // Emit the MethodHandle deopt handler code (if required).
// same code as for the normal deopt handler, we just need a if (has_method_handle_invokes()) {
// different entry point address. // We can use the same code as for the normal deopt handler, we
code_offsets->set_value(CodeOffsets::DeoptMH, assembler->emit_deopt_handler()); // just need a different entry point address.
CHECK_BAILOUT(); code_offsets->set_value(CodeOffsets::DeoptMH, assembler->emit_deopt_handler());
CHECK_BAILOUT();
}
// Emit the handler to remove the activation from the stack and // Emit the handler to remove the activation from the stack and
// dispatch to the caller. // dispatch to the caller.
...@@ -446,6 +448,7 @@ Compilation::Compilation(AbstractCompiler* compiler, ciEnv* env, ciMethod* metho ...@@ -446,6 +448,7 @@ Compilation::Compilation(AbstractCompiler* compiler, ciEnv* env, ciMethod* metho
, _has_exception_handlers(false) , _has_exception_handlers(false)
, _has_fpu_code(true) // pessimistic assumption , _has_fpu_code(true) // pessimistic assumption
, _has_unsafe_access(false) , _has_unsafe_access(false)
, _has_method_handle_invokes(false)
, _bailout_msg(NULL) , _bailout_msg(NULL)
, _exception_info_list(NULL) , _exception_info_list(NULL)
, _allocator(NULL) , _allocator(NULL)
......
...@@ -69,6 +69,7 @@ class Compilation: public StackObj { ...@@ -69,6 +69,7 @@ class Compilation: public StackObj {
bool _has_exception_handlers; bool _has_exception_handlers;
bool _has_fpu_code; bool _has_fpu_code;
bool _has_unsafe_access; bool _has_unsafe_access;
bool _has_method_handle_invokes; // True if this method has MethodHandle invokes.
const char* _bailout_msg; const char* _bailout_msg;
ExceptionInfoList* _exception_info_list; ExceptionInfoList* _exception_info_list;
ExceptionHandlerTable _exception_handler_table; ExceptionHandlerTable _exception_handler_table;
...@@ -147,6 +148,10 @@ class Compilation: public StackObj { ...@@ -147,6 +148,10 @@ class Compilation: public StackObj {
// Statistics gathering // Statistics gathering
void notice_inlined_method(ciMethod* method); void notice_inlined_method(ciMethod* method);
// JSR 292
bool has_method_handle_invokes() const { return _has_method_handle_invokes; }
void set_has_method_handle_invokes(bool z) { _has_method_handle_invokes = z; }
DebugInformationRecorder* debug_info_recorder() const; // = _env->debug_info(); DebugInformationRecorder* debug_info_recorder() const; // = _env->debug_info();
Dependencies* dependency_recorder() const; // = _env->dependencies() Dependencies* dependency_recorder() const; // = _env->dependencies()
ImplicitExceptionTable* implicit_exception_table() { return &_implicit_exception_table; } ImplicitExceptionTable* implicit_exception_table() { return &_implicit_exception_table; }
......
...@@ -438,6 +438,12 @@ void LIR_Assembler::emit_call(LIR_OpJavaCall* op) { ...@@ -438,6 +438,12 @@ void LIR_Assembler::emit_call(LIR_OpJavaCall* op) {
default: ShouldNotReachHere(); default: ShouldNotReachHere();
} }
// JSR 292
// Record if this method has MethodHandle invokes.
if (op->is_method_handle_invoke()) {
compilation()->set_has_method_handle_invokes(true);
}
#if defined(X86) && defined(TIERED) #if defined(X86) && defined(TIERED)
// C2 leave fpu stack dirty clean it // C2 leave fpu stack dirty clean it
if (UseSSE < 2) { if (UseSSE < 2) {
......
...@@ -2472,8 +2472,12 @@ void nmethod::print_nmethod_labels(outputStream* stream, address block_begin) { ...@@ -2472,8 +2472,12 @@ void nmethod::print_nmethod_labels(outputStream* stream, address block_begin) {
if (block_begin == exception_begin()) stream->print_cr("[Exception Handler]"); if (block_begin == exception_begin()) stream->print_cr("[Exception Handler]");
if (block_begin == stub_begin()) stream->print_cr("[Stub Code]"); if (block_begin == stub_begin()) stream->print_cr("[Stub Code]");
if (block_begin == deopt_handler_begin()) stream->print_cr("[Deopt Handler Code]"); if (block_begin == deopt_handler_begin()) stream->print_cr("[Deopt Handler Code]");
if (block_begin == deopt_mh_handler_begin()) stream->print_cr("[Deopt MH Handler Code]");
if (has_method_handle_invokes())
if (block_begin == deopt_mh_handler_begin()) stream->print_cr("[Deopt MH Handler Code]");
if (block_begin == consts_begin()) stream->print_cr("[Constants]"); if (block_begin == consts_begin()) stream->print_cr("[Constants]");
if (block_begin == entry_point()) { if (block_begin == entry_point()) {
methodHandle m = method(); methodHandle m = method();
if (m.not_null()) { if (m.not_null()) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册