Skip to content

Commit ee5bba0

Browse files
Hui ShiTobiHartmann
authored andcommitted
8265767: compiler/eliminateAutobox/TestIntBoxing.java crashes on arm32 after 8264649 in debug VMs
Reviewed-by: kvn, thartmann
1 parent 05e6017 commit ee5bba0

File tree

2 files changed

+22
-19
lines changed

2 files changed

+22
-19
lines changed

src/hotspot/share/opto/memnode.cpp

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1367,10 +1367,10 @@ Node* StoreNode::convert_to_reinterpret_store(PhaseGVN& gvn, Node* val, const Ty
13671367
// merging a newly allocated object and a load from the cache.
13681368
// We want to replace this load with the original incoming
13691369
// argument to the valueOf call.
1370-
Node* LoadNode::eliminate_autobox(PhaseGVN* phase) {
1371-
assert(phase->C->eliminate_boxing(), "sanity");
1370+
Node* LoadNode::eliminate_autobox(PhaseIterGVN* igvn) {
1371+
assert(igvn->C->eliminate_boxing(), "sanity");
13721372
intptr_t ignore = 0;
1373-
Node* base = AddPNode::Ideal_base_and_offset(in(Address), phase, ignore);
1373+
Node* base = AddPNode::Ideal_base_and_offset(in(Address), igvn, ignore);
13741374
if ((base == NULL) || base->is_Phi()) {
13751375
// Push the loads from the phi that comes from valueOf up
13761376
// through it to allow elimination of the loads and the recovery
@@ -1404,7 +1404,7 @@ Node* LoadNode::eliminate_autobox(PhaseGVN* phase) {
14041404
if (count > 0 && elements[0]->is_Con() &&
14051405
(count == 1 ||
14061406
(count == 2 && elements[1]->Opcode() == Op_LShiftX &&
1407-
elements[1]->in(2) == phase->intcon(shift)))) {
1407+
elements[1]->in(2) == igvn->intcon(shift)))) {
14081408
ciObjArray* array = base_type->const_oop()->as_obj_array();
14091409
// Fetch the box object cache[0] at the base of the array and get its value
14101410
ciInstance* box = array->obj_at(0)->as_instance();
@@ -1431,43 +1431,45 @@ Node* LoadNode::eliminate_autobox(PhaseGVN* phase) {
14311431
// Add up all the offsets making of the address of the load
14321432
Node* result = elements[0];
14331433
for (int i = 1; i < count; i++) {
1434-
result = phase->transform(new AddXNode(result, elements[i]));
1434+
result = igvn->transform(new AddXNode(result, elements[i]));
14351435
}
14361436
// Remove the constant offset from the address and then
1437-
result = phase->transform(new AddXNode(result, phase->MakeConX(-(int)offset)));
1437+
result = igvn->transform(new AddXNode(result, igvn->MakeConX(-(int)offset)));
14381438
// remove the scaling of the offset to recover the original index.
1439-
if (result->Opcode() == Op_LShiftX && result->in(2) == phase->intcon(shift)) {
1439+
if (result->Opcode() == Op_LShiftX && result->in(2) == igvn->intcon(shift)) {
14401440
// Peel the shift off directly but wrap it in a dummy node
14411441
// since Ideal can't return existing nodes
1442-
result = new RShiftXNode(result->in(1), phase->intcon(0));
1442+
igvn->_worklist.push(result); // remove dead node later
1443+
result = new RShiftXNode(result->in(1), igvn->intcon(0));
14431444
} else if (result->is_Add() && result->in(2)->is_Con() &&
14441445
result->in(1)->Opcode() == Op_LShiftX &&
1445-
result->in(1)->in(2) == phase->intcon(shift)) {
1446+
result->in(1)->in(2) == igvn->intcon(shift)) {
14461447
// We can't do general optimization: ((X<<Z) + Y) >> Z ==> X + (Y>>Z)
14471448
// but for boxing cache access we know that X<<Z will not overflow
14481449
// (there is range check) so we do this optimizatrion by hand here.
1449-
Node* add_con = new RShiftXNode(result->in(2), phase->intcon(shift));
1450-
result = new AddXNode(result->in(1)->in(1), phase->transform(add_con));
1450+
igvn->_worklist.push(result); // remove dead node later
1451+
Node* add_con = new RShiftXNode(result->in(2), igvn->intcon(shift));
1452+
result = new AddXNode(result->in(1)->in(1), igvn->transform(add_con));
14511453
} else {
1452-
result = new RShiftXNode(result, phase->intcon(shift));
1454+
result = new RShiftXNode(result, igvn->intcon(shift));
14531455
}
14541456
#ifdef _LP64
14551457
if (bt != T_LONG) {
1456-
result = new ConvL2INode(phase->transform(result));
1458+
result = new ConvL2INode(igvn->transform(result));
14571459
}
14581460
#else
14591461
if (bt == T_LONG) {
1460-
result = new ConvI2LNode(phase->transform(result));
1462+
result = new ConvI2LNode(igvn->transform(result));
14611463
}
14621464
#endif
14631465
// Boxing/unboxing can be done from signed & unsigned loads (e.g. LoadUB -> ... -> LoadB pair).
14641466
// Need to preserve unboxing load type if it is unsigned.
14651467
switch(this->Opcode()) {
14661468
case Op_LoadUB:
1467-
result = new AndINode(phase->transform(result), phase->intcon(0xFF));
1469+
result = new AndINode(igvn->transform(result), igvn->intcon(0xFF));
14681470
break;
14691471
case Op_LoadUS:
1470-
result = new AndINode(phase->transform(result), phase->intcon(0xFFFF));
1472+
result = new AndINode(igvn->transform(result), igvn->intcon(0xFFFF));
14711473
break;
14721474
}
14731475
return result;
@@ -1760,7 +1762,8 @@ Node *LoadNode::Ideal(PhaseGVN *phase, bool can_reshape) {
17601762
(t_oop->is_known_instance_field() ||
17611763
t_oop->is_ptr_to_boxed_value())) {
17621764
PhaseIterGVN *igvn = phase->is_IterGVN();
1763-
if (igvn != NULL && igvn->_worklist.member(opt_mem)) {
1765+
assert(igvn != NULL, "must be PhaseIterGVN when can_reshape is true");
1766+
if (igvn->_worklist.member(opt_mem)) {
17641767
// Delay this transformation until memory Phi is processed.
17651768
igvn->_worklist.push(this);
17661769
return NULL;
@@ -1770,7 +1773,7 @@ Node *LoadNode::Ideal(PhaseGVN *phase, bool can_reshape) {
17701773
if (result != NULL) return result;
17711774

17721775
if (t_oop->is_ptr_to_boxed_value()) {
1773-
Node* result = eliminate_autobox(phase);
1776+
Node* result = eliminate_autobox(igvn);
17741777
if (result != NULL) return result;
17751778
}
17761779
}

src/hotspot/share/opto/memnode.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ class LoadNode : public MemNode {
248248
Node* split_through_phi(PhaseGVN *phase);
249249

250250
// Recover original value from boxed values
251-
Node *eliminate_autobox(PhaseGVN *phase);
251+
Node *eliminate_autobox(PhaseIterGVN *igvn);
252252

253253
// Compute a new Type for this node. Basically we just do the pre-check,
254254
// then call the virtual add() to set the type.

0 commit comments

Comments
 (0)