Skip to content

Commit c891ed0

Browse files
author
Vicente Romero
committed
Merge lworld
2 parents 43b4d35 + 7d2e929 commit c891ed0

File tree

14 files changed

+261
-544
lines changed

14 files changed

+261
-544
lines changed

src/hotspot/share/ci/ciReplay.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -866,7 +866,7 @@ class CompileReplay : public StackObj {
866866
if (had_error()) {
867867
return;
868868
}
869-
if (Arguments::is_valhalla_enabled() && _version >= 3 && k != nullptr && k->is_objArray_klass()) {
869+
if (_version >= 3 && k != nullptr && k->is_objArray_klass()) {
870870
k = create_concrete_object_array_klass(ObjArrayKlass::cast(k), THREAD);
871871
}
872872
rec->_classes_offsets[i] = offset;
@@ -892,11 +892,16 @@ class CompileReplay : public StackObj {
892892
ObjArrayKlass* create_concrete_object_array_klass(ObjArrayKlass* obj_array_klass, TRAPS) {
893893
ArrayKlass::ArrayProperties array_properties =
894894
static_cast<ArrayKlass::ArrayProperties>(parse_int("array_properties"));
895+
if (!Arguments::is_valhalla_enabled()) {
896+
// Ignore array properties.
897+
return obj_array_klass;
898+
}
899+
895900
if (array_properties != ArrayKlass::DEFAULT &&
896901
array_properties != ArrayKlass::NULL_RESTRICTED &&
897902
array_properties != ArrayKlass::NON_ATOMIC &&
898903
array_properties != (ArrayKlass::NULL_RESTRICTED | ArrayKlass::NON_ATOMIC)) {
899-
guarantee(false, "invalid array_properties: %d, fall back to DEFAULT", array_properties);
904+
guarantee(false, "invalid array_properties: %d", array_properties);
900905
}
901906

902907
return obj_array_klass->klass_with_properties(array_properties, THREAD);

src/hotspot/share/code/nmethod.cpp

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1443,14 +1443,21 @@ nmethod::nmethod(const nmethod &nm) : CodeBlob(nm._name, nm._kind, nm._size, nm.
14431443
_oops_do_mark_link = nullptr;
14441444
_compiled_ic_data = nullptr;
14451445

1446-
if (nm._osr_entry_point != nullptr) {
1447-
_osr_entry_point = (nm._osr_entry_point - (address) &nm) + (address) this;
1448-
} else {
1449-
_osr_entry_point = nullptr;
1450-
}
1451-
1446+
auto relocate_address = [&nm, this](address old_addr) -> address {
1447+
if (old_addr == nullptr) return nullptr;
1448+
address new_addr = old_addr - (address) &nm + (address) this;
1449+
assert(new_addr >= code_begin() && new_addr < code_end(),
1450+
"relocated address must be within code bounds");
1451+
return new_addr;
1452+
};
1453+
1454+
_osr_entry_point = relocate_address(nm._osr_entry_point);
14521455
_entry_offset = nm._entry_offset;
14531456
_verified_entry_offset = nm._verified_entry_offset;
1457+
_inline_entry_point = relocate_address(nm._inline_entry_point);
1458+
_verified_inline_entry_point = relocate_address(nm._verified_inline_entry_point);
1459+
_verified_inline_ro_entry_point = relocate_address(nm._verified_inline_ro_entry_point);
1460+
14541461
_entry_bci = nm._entry_bci;
14551462
_immutable_data_size = nm._immutable_data_size;
14561463

src/hotspot/share/opto/c2compiler.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
#include "opto/optoreg.hpp"
3333
#include "opto/output.hpp"
3434
#include "opto/runtime.hpp"
35+
#include "runtime/arguments.hpp"
3536
#include "runtime/globals_extension.hpp"
3637
#include "runtime/handles.inline.hpp"
3738
#include "runtime/stubRoutines.hpp"
@@ -131,7 +132,7 @@ void C2Compiler::compile_method(ciEnv* env, ciMethod* target, int entry_bci, boo
131132
bool do_iterative_escape_analysis = DoEscapeAnalysis;
132133
bool do_reduce_allocation_merges = ReduceAllocationMerges && EliminateAllocations;
133134
// TODO 8328675 Re-enable
134-
bool eliminate_boxing = false; // EliminateAutoBox;
135+
bool eliminate_boxing = EliminateAutoBox && !Arguments::is_valhalla_enabled();
135136
bool do_locks_coarsening = EliminateLocks;
136137
bool do_superword = UseSuperWord;
137138

src/hotspot/share/opto/callnode.cpp

Lines changed: 52 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
#include "opto/locknode.hpp"
4141
#include "opto/machnode.hpp"
4242
#include "opto/matcher.hpp"
43-
#include "opto/memnode.hpp"
4443
#include "opto/movenode.hpp"
4544
#include "opto/parse.hpp"
4645
#include "opto/regalloc.hpp"
@@ -1185,14 +1184,58 @@ Node* CallStaticJavaNode::Ideal(PhaseGVN* phase, bool can_reshape) {
11851184
}
11861185
}
11871186

1188-
// Try to replace the runtime call to the substitutability test emitted by acmp if we can reason
1189-
// about the operands
1190-
if (can_reshape && !control()->is_top() && method() != nullptr &&
1191-
method()->holder() == phase->C->env()->ValueObjectMethods_klass() &&
1192-
method()->name() == ciSymbols::isSubstitutable_name()) {
1193-
Node* res = replace_is_substitutable(phase->is_IterGVN());
1194-
if (res != nullptr) {
1195-
return res;
1187+
// Try to replace the runtime call to the substitutability test emitted by acmp if (at least) one operand is a known type
1188+
if (can_reshape && !control()->is_top() && method() != nullptr && method()->holder() == phase->C->env()->ValueObjectMethods_klass() &&
1189+
(method()->name() == ciSymbols::isSubstitutable_name())) {
1190+
Node* left = in(TypeFunc::Parms);
1191+
Node* right = in(TypeFunc::Parms + 1);
1192+
if (!left->is_top() && !right->is_top() && (left->is_InlineType() || right->is_InlineType())) {
1193+
if (!left->is_InlineType()) {
1194+
swap(left, right);
1195+
}
1196+
InlineTypeNode* vt = left->as_InlineType();
1197+
1198+
// Check if the field layout can be optimized
1199+
if (vt->can_emit_substitutability_check(right)) {
1200+
PhaseIterGVN* igvn = phase->is_IterGVN();
1201+
1202+
Node* ctrl = control();
1203+
RegionNode* region = new RegionNode(1);
1204+
Node* phi = new PhiNode(region, TypeInt::POS);
1205+
1206+
Node* base = right;
1207+
Node* ptr = right;
1208+
if (!base->is_InlineType()) {
1209+
// Parse time checks guarantee that both operands are non-null and have the same type
1210+
base = igvn->register_new_node_with_optimizer(new CheckCastPPNode(ctrl, base, vt->bottom_type()));
1211+
ptr = base;
1212+
}
1213+
// Emit IR for field-wise comparison
1214+
vt->check_substitutability(igvn, region, phi, &ctrl, in(MemNode::Memory), base, ptr);
1215+
1216+
// Equals
1217+
region->add_req(ctrl);
1218+
phi->add_req(igvn->intcon(1));
1219+
1220+
ctrl = igvn->register_new_node_with_optimizer(region);
1221+
Node* res = igvn->register_new_node_with_optimizer(phi);
1222+
1223+
// Kill exception projections and return a tuple that will replace the call
1224+
CallProjections* projs = extract_projections(false /*separate_io_proj*/);
1225+
if (projs->fallthrough_catchproj != nullptr) {
1226+
igvn->replace_node(projs->fallthrough_catchproj, ctrl);
1227+
}
1228+
if (projs->catchall_memproj != nullptr) {
1229+
igvn->replace_node(projs->catchall_memproj, igvn->C->top());
1230+
}
1231+
if (projs->catchall_ioproj != nullptr) {
1232+
igvn->replace_node(projs->catchall_ioproj, igvn->C->top());
1233+
}
1234+
if (projs->catchall_catchproj != nullptr) {
1235+
igvn->replace_node(projs->catchall_catchproj, igvn->C->top());
1236+
}
1237+
return TupleNode::make(tf()->range_cc(), ctrl, i_o(), memory(), frameptr(), returnadr(), res);
1238+
}
11961239
}
11971240
}
11981241

@@ -1382,52 +1425,6 @@ bool CallStaticJavaNode::remove_unknown_flat_array_load(PhaseIterGVN* igvn, Node
13821425
return true;
13831426
}
13841427

1385-
// Try to replace a runtime call to the substitutability test by either a simple pointer comparison
1386-
// if either operand is not a value object, or comparing their fields if either operand is an
1387-
// object of a known value type
1388-
Node* CallStaticJavaNode::replace_is_substitutable(PhaseIterGVN* igvn) {
1389-
// Delay IGVN during macro expansion
1390-
assert(!igvn->delay_transform(), "must not delay during Ideal");
1391-
igvn->set_delay_transform(true);
1392-
1393-
// Prepare to inline, clone the jvms
1394-
JVMState* jvms = this->jvms()->clone_shallow(igvn->C);
1395-
assert(jvms->map()->next_exception() == nullptr, "this call does not throw");
1396-
SafePointNode* map = new SafePointNode(req(), jvms);
1397-
igvn->register_new_node_with_optimizer(map);
1398-
for (uint i = 0; i < req(); i++) {
1399-
map->init_req(i, in(i));
1400-
}
1401-
MergeMemNode* mem = MergeMemNode::make(map->memory());
1402-
igvn->register_new_node_with_optimizer(mem);
1403-
map->set_memory(mem);
1404-
jvms->set_map(map);
1405-
GraphKit kit(jvms, igvn);
1406-
1407-
Node* left = in(TypeFunc::Parms);
1408-
Node* right = in(TypeFunc::Parms + 1);
1409-
Node* replace = InlineTypeNode::emit_substitutability_check(&kit, left, right);
1410-
igvn->set_delay_transform(false);
1411-
if (replace == nullptr) {
1412-
return nullptr;
1413-
}
1414-
1415-
// Kill exception projections and return a tuple that will replace the call
1416-
CallProjections* projs = extract_projections(false /*separate_io_proj*/);
1417-
if (projs->fallthrough_catchproj != nullptr) {
1418-
igvn->replace_node(projs->fallthrough_catchproj, kit.control());
1419-
}
1420-
if (projs->catchall_memproj != nullptr) {
1421-
igvn->replace_node(projs->catchall_memproj, igvn->C->top());
1422-
}
1423-
if (projs->catchall_ioproj != nullptr) {
1424-
igvn->replace_node(projs->catchall_ioproj, igvn->C->top());
1425-
}
1426-
if (projs->catchall_catchproj != nullptr) {
1427-
igvn->replace_node(projs->catchall_catchproj, igvn->C->top());
1428-
}
1429-
return TupleNode::make(tf()->range_cc(), igvn->C->top(), kit.i_o(), kit.reset_memory(), kit.frameptr(), kit.returnadr(), replace);
1430-
}
14311428

14321429
#ifndef PRODUCT
14331430
void CallStaticJavaNode::dump_spec(outputStream *st) const {

src/hotspot/share/opto/callnode.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -841,7 +841,6 @@ class CallStaticJavaNode : public CallJavaNode {
841841
virtual uint size_of() const; // Size is bigger
842842

843843
bool remove_unknown_flat_array_load(PhaseIterGVN* igvn, Node* ctl, Node* mem, Node* unc_arg);
844-
Node* replace_is_substitutable(PhaseIterGVN* igvn);
845844

846845
public:
847846
CallStaticJavaNode(Compile* C, const TypeFunc* tf, address addr, ciMethod* method)

src/hotspot/share/opto/graphKit.cpp

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1497,22 +1497,19 @@ Node* GraphKit::null_check_common(Node* value, BasicType type,
14971497
//------------------------------cast_not_null----------------------------------
14981498
// Cast obj to not-null on this path
14991499
Node* GraphKit::cast_not_null(Node* obj, bool do_replace_in_map) {
1500-
const Type* t = _gvn.type(obj);
1501-
const Type* t_not_null = t->join_speculative(TypePtr::NOTNULL);
1502-
if (t == t_not_null) {
1503-
return obj;
1504-
}
1505-
15061500
if (obj->is_InlineType()) {
1507-
InlineTypeNode* vt = obj->isa_InlineType()->clone_if_required(&gvn(), map(), do_replace_in_map);
1508-
vt->set_null_marker(_gvn);
1509-
vt->set_type(t_not_null);
1510-
vt = _gvn.transform(vt)->as_InlineType();
1501+
Node* vt = obj->isa_InlineType()->clone_if_required(&gvn(), map(), do_replace_in_map);
1502+
vt->as_InlineType()->set_null_marker(_gvn);
1503+
vt = _gvn.transform(vt);
15111504
if (do_replace_in_map) {
15121505
replace_in_map(obj, vt);
15131506
}
15141507
return vt;
15151508
}
1509+
const Type *t = _gvn.type(obj);
1510+
const Type *t_not_null = t->join_speculative(TypePtr::NOTNULL);
1511+
// Object is already not-null?
1512+
if( t == t_not_null ) return obj;
15161513

15171514
Node* cast = new CastPPNode(control(), obj,t_not_null);
15181515
cast = _gvn.transform( cast );

0 commit comments

Comments
 (0)