提交 c17f76e1 编写于 作者: T twisti

7132180: JSR 292: C1 JVM crash with ClassValue/MethodHandle

Reviewed-by: never
上级 4fc92aab
/* /*
* Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1999, 2012, 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
...@@ -3683,56 +3683,61 @@ bool GraphBuilder::for_method_handle_inline(ciMethod* callee) { ...@@ -3683,56 +3683,61 @@ bool GraphBuilder::for_method_handle_inline(ciMethod* callee) {
// Get the two MethodHandle inputs from the Phi. // Get the two MethodHandle inputs from the Phi.
Value op1 = phi->operand_at(0); Value op1 = phi->operand_at(0);
Value op2 = phi->operand_at(1); Value op2 = phi->operand_at(1);
ciMethodHandle* mh1 = op1->type()->as_ObjectType()->constant_value()->as_method_handle(); ObjectType* op1type = op1->type()->as_ObjectType();
ciMethodHandle* mh2 = op2->type()->as_ObjectType()->constant_value()->as_method_handle(); ObjectType* op2type = op2->type()->as_ObjectType();
// Set the callee to have access to the class and signature in if (op1type->is_constant() && op2type->is_constant()) {
// the MethodHandleCompiler. ciMethodHandle* mh1 = op1type->constant_value()->as_method_handle();
mh1->set_callee(callee); ciMethodHandle* mh2 = op2type->constant_value()->as_method_handle();
mh1->set_caller(method());
mh2->set_callee(callee); // Set the callee to have access to the class and signature in
mh2->set_caller(method()); // the MethodHandleCompiler.
mh1->set_callee(callee);
// Get adapters for the MethodHandles. mh1->set_caller(method());
ciMethod* mh1_adapter = mh1->get_method_handle_adapter(); mh2->set_callee(callee);
ciMethod* mh2_adapter = mh2->get_method_handle_adapter(); mh2->set_caller(method());
if (mh1_adapter != NULL && mh2_adapter != NULL) { // Get adapters for the MethodHandles.
set_inline_cleanup_info(); ciMethod* mh1_adapter = mh1->get_method_handle_adapter();
ciMethod* mh2_adapter = mh2->get_method_handle_adapter();
// Build the If guard
BlockBegin* one = new BlockBegin(next_bci()); if (mh1_adapter != NULL && mh2_adapter != NULL) {
BlockBegin* two = new BlockBegin(next_bci()); set_inline_cleanup_info();
BlockBegin* end = new BlockBegin(next_bci());
Instruction* iff = append(new If(phi, If::eql, false, op1, one, two, NULL, false)); // Build the If guard
block()->set_end(iff->as_BlockEnd()); BlockBegin* one = new BlockBegin(next_bci());
BlockBegin* two = new BlockBegin(next_bci());
// Connect up the states BlockBegin* end = new BlockBegin(next_bci());
one->merge(block()->end()->state()); Instruction* iff = append(new If(phi, If::eql, false, op1, one, two, NULL, false));
two->merge(block()->end()->state()); block()->set_end(iff->as_BlockEnd());
// Save the state for the second inlinee // Connect up the states
ValueStack* state_before = copy_state_before(); one->merge(block()->end()->state());
two->merge(block()->end()->state());
// Parse first adapter
_last = _block = one; // Save the state for the second inlinee
if (!try_inline_full(mh1_adapter, /*holder_known=*/ true, end)) { ValueStack* state_before = copy_state_before();
restore_inline_cleanup_info();
block()->clear_end(); // remove appended iff // Parse first adapter
return false; _last = _block = one;
} if (!try_inline_full(mh1_adapter, /*holder_known=*/ true, end)) {
restore_inline_cleanup_info();
block()->clear_end(); // remove appended iff
return false;
}
// Parse second adapter // Parse second adapter
_last = _block = two; _last = _block = two;
_state = state_before; _state = state_before;
if (!try_inline_full(mh2_adapter, /*holder_known=*/ true, end)) { if (!try_inline_full(mh2_adapter, /*holder_known=*/ true, end)) {
restore_inline_cleanup_info(); restore_inline_cleanup_info();
block()->clear_end(); // remove appended iff block()->clear_end(); // remove appended iff
return false; return false;
} }
connect_to_end(end); connect_to_end(end);
return true; return true;
}
} }
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册