提交 986ec8ca 编写于 作者: C cfang

6868269: CompileTheWorld assertion failure introduced by the reexecute bit implementation

Summary: Improvement on reexecute implementation to fix the assertion failure
Reviewed-by: kvn, never
上级 698c3d9b
...@@ -3169,21 +3169,25 @@ bool LibraryCallKit::inline_array_copyOf(bool is_copyOfRange) { ...@@ -3169,21 +3169,25 @@ bool LibraryCallKit::inline_array_copyOf(bool is_copyOfRange) {
Node* end = is_copyOfRange? argument(2): argument(1); Node* end = is_copyOfRange? argument(2): argument(1);
Node* array_type_mirror = is_copyOfRange? argument(3): argument(2); Node* array_type_mirror = is_copyOfRange? argument(3): argument(2);
_sp += nargs; // set original stack for use by uncommon_trap Node* newcopy;
//set the original stack and the reexecute bit for the interpreter to reexecute
//the bytecode that invokes Arrays.copyOf if deoptimization happens
{ PreserveReexecuteState preexecs(this);
_sp += nargs;
jvms()->set_should_reexecute(true);
array_type_mirror = do_null_check(array_type_mirror, T_OBJECT); array_type_mirror = do_null_check(array_type_mirror, T_OBJECT);
original = do_null_check(original, T_OBJECT); original = do_null_check(original, T_OBJECT);
_sp -= nargs;
// Check if a null path was taken unconditionally. // Check if a null path was taken unconditionally.
if (stopped()) return true; if (stopped()) return true;
Node* orig_length = load_array_length(original); Node* orig_length = load_array_length(original);
Node* klass_node = load_klass_from_mirror(array_type_mirror, false, nargs, Node* klass_node = load_klass_from_mirror(array_type_mirror, false, 0,
NULL, 0); NULL, 0);
_sp += nargs; // set original stack for use by uncommon_trap
klass_node = do_null_check(klass_node, T_OBJECT); klass_node = do_null_check(klass_node, T_OBJECT);
_sp -= nargs;
RegionNode* bailout = new (C, 1) RegionNode(1); RegionNode* bailout = new (C, 1) RegionNode(1);
record_for_igvn(bailout); record_for_igvn(bailout);
...@@ -3216,18 +3220,11 @@ bool LibraryCallKit::inline_array_copyOf(bool is_copyOfRange) { ...@@ -3216,18 +3220,11 @@ bool LibraryCallKit::inline_array_copyOf(bool is_copyOfRange) {
if (bailout->req() > 1) { if (bailout->req() > 1) {
PreserveJVMState pjvms(this); PreserveJVMState pjvms(this);
set_control( _gvn.transform(bailout) ); set_control( _gvn.transform(bailout) );
_sp += nargs; // push the arguments back on the stack
uncommon_trap(Deoptimization::Reason_intrinsic, uncommon_trap(Deoptimization::Reason_intrinsic,
Deoptimization::Action_maybe_recompile); Deoptimization::Action_maybe_recompile);
} }
if (!stopped()) { if (!stopped()) {
Node *newcopy;
//set the original stack and the reexecute bit for the interpreter to reexecute
//the bytecode that invokes Arrays.copyOf if deoptimization happens
{ PreserveReexecuteState preexecs(this);
_sp += nargs;
jvms()->set_should_reexecute(true);
// How many elements will we copy from the original? // How many elements will we copy from the original?
// The answer is MinI(orig_length - start, length). // The answer is MinI(orig_length - start, length).
...@@ -3247,8 +3244,10 @@ bool LibraryCallKit::inline_array_copyOf(bool is_copyOfRange) { ...@@ -3247,8 +3244,10 @@ bool LibraryCallKit::inline_array_copyOf(bool is_copyOfRange) {
generate_arraycopy(TypeAryPtr::OOPS, T_OBJECT, generate_arraycopy(TypeAryPtr::OOPS, T_OBJECT,
original, start, newcopy, intcon(0), moved, original, start, newcopy, intcon(0), moved,
disjoint_bases, length_never_negative); disjoint_bases, length_never_negative);
}
} //original reexecute and sp are set back here } //original reexecute and sp are set back here
if(!stopped()) {
push(newcopy); push(newcopy);
} }
...@@ -4000,8 +3999,19 @@ void LibraryCallKit::copy_to_clone(Node* obj, Node* alloc_obj, Node* obj_size, b ...@@ -4000,8 +3999,19 @@ void LibraryCallKit::copy_to_clone(Node* obj, Node* alloc_obj, Node* obj_size, b
// //
bool LibraryCallKit::inline_native_clone(bool is_virtual) { bool LibraryCallKit::inline_native_clone(bool is_virtual) {
int nargs = 1; int nargs = 1;
PhiNode* result_val;
//set the original stack and the reexecute bit for the interpreter to reexecute
//the bytecode that invokes Object.clone if deoptimization happens
{ PreserveReexecuteState preexecs(this);
jvms()->set_should_reexecute(true);
//null_check_receiver will adjust _sp (push and pop)
Node* obj = null_check_receiver(callee()); Node* obj = null_check_receiver(callee());
if (stopped()) return true; if (stopped()) return true;
_sp += nargs;
Node* obj_klass = load_object_klass(obj); Node* obj_klass = load_object_klass(obj);
const TypeKlassPtr* tklass = _gvn.type(obj_klass)->isa_klassptr(); const TypeKlassPtr* tklass = _gvn.type(obj_klass)->isa_klassptr();
const TypeOopPtr* toop = ((tklass != NULL) const TypeOopPtr* toop = ((tklass != NULL)
...@@ -4021,7 +4031,7 @@ bool LibraryCallKit::inline_native_clone(bool is_virtual) { ...@@ -4021,7 +4031,7 @@ bool LibraryCallKit::inline_native_clone(bool is_virtual) {
PATH_LIMIT PATH_LIMIT
}; };
RegionNode* result_reg = new(C, PATH_LIMIT) RegionNode(PATH_LIMIT); RegionNode* result_reg = new(C, PATH_LIMIT) RegionNode(PATH_LIMIT);
PhiNode* result_val = new(C, PATH_LIMIT) PhiNode(result_reg, result_val = new(C, PATH_LIMIT) PhiNode(result_reg,
TypeInstPtr::NOTNULL); TypeInstPtr::NOTNULL);
PhiNode* result_i_o = new(C, PATH_LIMIT) PhiNode(result_reg, Type::ABIO); PhiNode* result_i_o = new(C, PATH_LIMIT) PhiNode(result_reg, Type::ABIO);
PhiNode* result_mem = new(C, PATH_LIMIT) PhiNode(result_reg, Type::MEMORY, PhiNode* result_mem = new(C, PATH_LIMIT) PhiNode(result_reg, Type::MEMORY,
...@@ -4032,11 +4042,6 @@ bool LibraryCallKit::inline_native_clone(bool is_virtual) { ...@@ -4032,11 +4042,6 @@ bool LibraryCallKit::inline_native_clone(bool is_virtual) {
int raw_adr_idx = Compile::AliasIdxRaw; int raw_adr_idx = Compile::AliasIdxRaw;
const bool raw_mem_only = true; const bool raw_mem_only = true;
//set the original stack and the reexecute bit for the interpreter to reexecute
//the bytecode that invokes Object.clone if deoptimization happens
{ PreserveReexecuteState preexecs(this);
_sp += nargs;
jvms()->set_should_reexecute(true);
Node* array_ctl = generate_array_guard(obj_klass, (RegionNode*)NULL); Node* array_ctl = generate_array_guard(obj_klass, (RegionNode*)NULL);
if (array_ctl != NULL) { if (array_ctl != NULL) {
...@@ -4141,12 +4146,12 @@ bool LibraryCallKit::inline_native_clone(bool is_virtual) { ...@@ -4141,12 +4146,12 @@ bool LibraryCallKit::inline_native_clone(bool is_virtual) {
result_i_o ->set_req(_slow_path, i_o()); result_i_o ->set_req(_slow_path, i_o());
result_mem ->set_req(_slow_path, reset_memory()); result_mem ->set_req(_slow_path, reset_memory());
} }
} //original reexecute and sp are set back here
// Return the combined state. // Return the combined state.
set_control( _gvn.transform(result_reg) ); set_control( _gvn.transform(result_reg) );
set_i_o( _gvn.transform(result_i_o) ); set_i_o( _gvn.transform(result_i_o) );
set_all_memory( _gvn.transform(result_mem) ); set_all_memory( _gvn.transform(result_mem) );
} //original reexecute and sp are set back here
push(_gvn.transform(result_val)); push(_gvn.transform(result_val));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册