--- old/src/share/vm/opto/compile.cpp 2017-07-10 18:11:29.930552302 +0200 +++ new/src/share/vm/opto/compile.cpp 2017-07-10 18:11:25.106573910 +0200 @@ -404,6 +404,12 @@ remove_expensive_node(n); } } + for (int i = value_type_ptr_count() - 1; i >= 0; i--) { + ValueTypePtrNode* vtptr = value_type_ptr(i); + if (!useful.member(vtptr)) { + remove_value_type_ptr(vtptr); + } + } // clean up the late inline lists remove_useless_late_inlines(&_string_late_inlines, useful); remove_useless_late_inlines(&_boxing_late_inlines, useful); @@ -1177,6 +1183,7 @@ _predicate_opaqs = new(comp_arena()) GrowableArray(comp_arena(), 8, 0, NULL); _expensive_nodes = new(comp_arena()) GrowableArray(comp_arena(), 8, 0, NULL); _range_check_casts = new(comp_arena()) GrowableArray(comp_arena(), 8, 0, NULL); + _value_type_ptr_nodes = new(comp_arena()) GrowableArray(comp_arena(), 8, 0, NULL); register_library_intrinsics(); } @@ -1962,6 +1969,23 @@ assert(range_check_cast_count() == 0, "should be empty"); } +void Compile::add_value_type_ptr(ValueTypePtrNode* n) { + assert(!_value_type_ptr_nodes->contains(n), "duplicate entry"); + _value_type_ptr_nodes->append(n); +} + +void Compile::process_value_type_ptr_nodes(PhaseIterGVN &igvn) { + for (int i = value_type_ptr_count(); i > 0; i--) { + ValueTypePtrNode* vtptr = value_type_ptr(i-1); + // once all inlining is over otherwise debug info can get + // inconsistent + vtptr->make_scalar_in_safepoints(igvn.C->root(), &igvn); + igvn.replace_node(vtptr, vtptr->get_oop()); + } + assert(value_type_ptr_count() == 0, "should be empty"); + igvn.optimize(); +} + // StringOpts and late inlining of string methods void Compile::inline_string_calls(bool parse_time) { { @@ -2209,6 +2233,10 @@ igvn.optimize(); } + if (value_type_ptr_count() > 0) { + process_value_type_ptr_nodes(igvn); + } + // Perform escape analysis if (_do_escape_analysis && ConnectionGraph::has_candidates(this)) { if (has_loops()) { @@ -3438,12 +3466,16 @@ } case Op_ValueType: { ValueTypeNode* vt = n->as_ValueType(); - vt->make_scalar_in_safepoints(this); + vt->make_scalar_in_safepoints(root(), NULL); if (vt->outcnt() == 0) { vt->disconnect_inputs(NULL, this); } break; } + case Op_ValueTypePtr: { + ShouldNotReachHere(); + break; + } default: assert( !n->is_Call(), "" ); assert( !n->is_Mem(), "" );