@@ -54,7 +54,6 @@ bool ShenandoahBarrierC2Support::expand(Compile* C, PhaseIterGVN& igvn) {
54
54
PhaseIdealLoop::optimize (igvn, LoopOptsShenandoahExpand);
55
55
if (C->failing ()) return false ;
56
56
PhaseIdealLoop::verify (igvn);
57
- DEBUG_ONLY (verify_raw_mem (C->root ());)
58
57
if (attempt_more_loopopts) {
59
58
C->set_major_progress ();
60
59
if (!C->optimize_loops (igvn, LoopOptsShenandoahPostExpand)) {
@@ -964,18 +963,11 @@ void ShenandoahBarrierC2Support::test_in_cset(Node*& ctrl, Node*& not_cset_ctrl,
964
963
phase->register_new_node (cset_bool, old_ctrl);
965
964
}
966
965
967
- void ShenandoahBarrierC2Support::call_lrb_stub (Node*& ctrl, Node*& val, Node* load_addr, Node*& result_mem, Node* raw_mem,
966
+ void ShenandoahBarrierC2Support::call_lrb_stub (Node*& ctrl, Node*& val, Node* load_addr,
968
967
DecoratorSet decorators, PhaseIdealLoop* phase) {
969
968
IdealLoopTree*loop = phase->get_loop (ctrl);
970
969
const TypePtr* obj_type = phase->igvn ().type (val)->is_oopptr ();
971
970
972
- // The slow path stub consumes and produces raw memory in addition
973
- // to the existing memory edges
974
- Node* base = find_bottom_mem (ctrl, phase);
975
- MergeMemNode* mm = MergeMemNode::make (base);
976
- mm->set_memory_at (Compile::AliasIdxRaw, raw_mem);
977
- phase->register_new_node (mm, ctrl);
978
-
979
971
address calladdr = NULL ;
980
972
const char * name = NULL ;
981
973
bool is_strong = ShenandoahBarrierSet::is_strong_access (decorators);
@@ -1013,16 +1005,14 @@ void ShenandoahBarrierC2Support::call_lrb_stub(Node*& ctrl, Node*& val, Node* lo
1013
1005
1014
1006
call->init_req (TypeFunc::Control, ctrl);
1015
1007
call->init_req (TypeFunc::I_O, phase->C ->top ());
1016
- call->init_req (TypeFunc::Memory, mm );
1008
+ call->init_req (TypeFunc::Memory, phase-> C -> top () );
1017
1009
call->init_req (TypeFunc::FramePtr, phase->C ->top ());
1018
1010
call->init_req (TypeFunc::ReturnAdr, phase->C ->top ());
1019
1011
call->init_req (TypeFunc::Parms, val);
1020
1012
call->init_req (TypeFunc::Parms+1 , load_addr);
1021
1013
phase->register_control (call, loop, ctrl);
1022
1014
ctrl = new ProjNode (call, TypeFunc::Control);
1023
1015
phase->register_control (ctrl, loop, call);
1024
- result_mem = new ProjNode (call, TypeFunc::Memory);
1025
- phase->register_new_node (result_mem, call);
1026
1016
val = new ProjNode (call, TypeFunc::Parms);
1027
1017
phase->register_new_node (val, call);
1028
1018
val = new CheckCastPPNode (ctrl, val, obj_type);
@@ -1341,12 +1331,9 @@ void ShenandoahBarrierC2Support::pin_and_expand(PhaseIdealLoop* phase) {
1341
1331
Node* ctrl = phase->get_ctrl (lrb);
1342
1332
Node* val = lrb->in (ShenandoahLoadReferenceBarrierNode::ValueIn);
1343
1333
1344
-
1345
1334
Node* orig_ctrl = ctrl;
1346
1335
1347
1336
Node* raw_mem = fixer.find_mem (ctrl, lrb);
1348
- Node* init_raw_mem = raw_mem;
1349
- Node* raw_mem_for_ctrl = fixer.find_mem (ctrl, NULL );
1350
1337
1351
1338
IdealLoopTree *loop = phase->get_loop (ctrl);
1352
1339
@@ -1359,7 +1346,6 @@ void ShenandoahBarrierC2Support::pin_and_expand(PhaseIdealLoop* phase) {
1359
1346
enum { _heap_stable = 1 , _evac_path, _not_cset, PATH_LIMIT };
1360
1347
Node* region = new RegionNode (PATH_LIMIT);
1361
1348
Node* val_phi = new PhiNode (region, val->bottom_type ()->is_oopptr ());
1362
- Node* raw_mem_phi = PhiNode::make (region, raw_mem, Type::MEMORY, TypeRawPtr::BOTTOM);
1363
1349
1364
1350
// Stable path.
1365
1351
int flags = ShenandoahHeap::HAS_FORWARDED;
@@ -1372,7 +1358,6 @@ void ShenandoahBarrierC2Support::pin_and_expand(PhaseIdealLoop* phase) {
1372
1358
// Heap stable case
1373
1359
region->init_req (_heap_stable, heap_stable_ctrl);
1374
1360
val_phi->init_req (_heap_stable, val);
1375
- raw_mem_phi->init_req (_heap_stable, raw_mem);
1376
1361
1377
1362
// Test for in-cset, unless it's a native-LRB. Native LRBs need to return NULL
1378
1363
// even for non-cset objects to prevent ressurrection of such objects.
@@ -1384,11 +1369,9 @@ void ShenandoahBarrierC2Support::pin_and_expand(PhaseIdealLoop* phase) {
1384
1369
if (not_cset_ctrl != NULL ) {
1385
1370
region->init_req (_not_cset, not_cset_ctrl);
1386
1371
val_phi->init_req (_not_cset, val);
1387
- raw_mem_phi->init_req (_not_cset, raw_mem);
1388
1372
} else {
1389
1373
region->del_req (_not_cset);
1390
1374
val_phi->del_req (_not_cset);
1391
- raw_mem_phi->del_req (_not_cset);
1392
1375
}
1393
1376
1394
1377
// Resolve object when orig-value is in cset.
@@ -1429,15 +1412,13 @@ void ShenandoahBarrierC2Support::pin_and_expand(PhaseIdealLoop* phase) {
1429
1412
}
1430
1413
}
1431
1414
}
1432
- call_lrb_stub (ctrl, val, addr, result_mem, raw_mem, lrb->decorators (), phase);
1415
+ call_lrb_stub (ctrl, val, addr, lrb->decorators (), phase);
1433
1416
region->init_req (_evac_path, ctrl);
1434
1417
val_phi->init_req (_evac_path, val);
1435
- raw_mem_phi->init_req (_evac_path, result_mem);
1436
1418
1437
1419
phase->register_control (region, loop, heap_stable_iff);
1438
1420
Node* out_val = val_phi;
1439
1421
phase->register_new_node (val_phi, region);
1440
- phase->register_new_node (raw_mem_phi, region);
1441
1422
1442
1423
fix_ctrl (lrb, region, fixer, uses, uses_to_ignore, last, phase);
1443
1424
@@ -1450,18 +1431,10 @@ void ShenandoahBarrierC2Support::pin_and_expand(PhaseIdealLoop* phase) {
1450
1431
for (uint next = 0 ; next < uses.size (); next++ ) {
1451
1432
Node *n = uses.at (next);
1452
1433
assert (phase->get_ctrl (n) == ctrl, " bad control" );
1453
- assert (n != init_raw_mem , " should leave input raw mem above the barrier" );
1434
+ assert (n != raw_mem , " should leave input raw mem above the barrier" );
1454
1435
phase->set_ctrl (n, region);
1455
1436
follow_barrier_uses (n, ctrl, uses, phase);
1456
1437
}
1457
-
1458
- // The slow path call produces memory: hook the raw memory phi
1459
- // from the expanded load reference barrier with the rest of the graph
1460
- // which may require adding memory phis at every post dominated
1461
- // region and at enclosing loop heads. Use the memory state
1462
- // collected in memory_nodes to fix the memory graph. Update that
1463
- // memory state as we go.
1464
- fixer.fix_mem (ctrl, region, init_raw_mem, raw_mem_for_ctrl, raw_mem_phi, uses);
1465
1438
}
1466
1439
// Done expanding load-reference-barriers.
1467
1440
assert (ShenandoahBarrierSetC2::bsc2 ()->state ()->load_reference_barriers_count () == 0 , " all load reference barrier nodes should have been replaced" );
@@ -1902,105 +1875,6 @@ void ShenandoahBarrierC2Support::optimize_after_expansion(VectorSet &visited, No
1902
1875
}
1903
1876
}
1904
1877
1905
- #ifdef ASSERT
1906
- void ShenandoahBarrierC2Support::verify_raw_mem (RootNode* root) {
1907
- const bool trace = false ;
1908
- ResourceMark rm;
1909
- Unique_Node_List nodes;
1910
- Unique_Node_List controls;
1911
- Unique_Node_List memories;
1912
-
1913
- nodes.push (root);
1914
- for (uint next = 0 ; next < nodes.size (); next++) {
1915
- Node *n = nodes.at (next);
1916
- if (ShenandoahBarrierSetC2::is_shenandoah_lrb_call (n)) {
1917
- controls.push (n);
1918
- if (trace) { tty->print (" XXXXXX verifying" ); n->dump (); }
1919
- for (uint next2 = 0 ; next2 < controls.size (); next2++) {
1920
- Node *m = controls.at (next2);
1921
- for (DUIterator_Fast imax, i = m->fast_outs (imax); i < imax; i++) {
1922
- Node* u = m->fast_out (i);
1923
- if (u->is_CFG () && !u->is_Root () &&
1924
- !(u->Opcode () == Op_CProj && u->in (0 )->Opcode () == Op_NeverBranch && u->as_Proj ()->_con == 1 ) &&
1925
- !(u->is_Region () && u->unique_ctrl_out ()->Opcode () == Op_Halt)) {
1926
- if (trace) { tty->print (" XXXXXX pushing control" ); u->dump (); }
1927
- controls.push (u);
1928
- }
1929
- }
1930
- }
1931
- memories.push (n->as_Call ()->proj_out (TypeFunc::Memory));
1932
- for (uint next2 = 0 ; next2 < memories.size (); next2++) {
1933
- Node *m = memories.at (next2);
1934
- assert (m->bottom_type () == Type::MEMORY, " " );
1935
- for (DUIterator_Fast imax, i = m->fast_outs (imax); i < imax; i++) {
1936
- Node* u = m->fast_out (i);
1937
- if (u->bottom_type () == Type::MEMORY && (u->is_Mem () || u->is_ClearArray ())) {
1938
- if (trace) { tty->print (" XXXXXX pushing memory" ); u->dump (); }
1939
- memories.push (u);
1940
- } else if (u->is_LoadStore ()) {
1941
- if (trace) { tty->print (" XXXXXX pushing memory" ); u->find_out_with (Op_SCMemProj)->dump (); }
1942
- memories.push (u->find_out_with (Op_SCMemProj));
1943
- } else if (u->is_MergeMem () && u->as_MergeMem ()->memory_at (Compile::AliasIdxRaw) == m) {
1944
- if (trace) { tty->print (" XXXXXX pushing memory" ); u->dump (); }
1945
- memories.push (u);
1946
- } else if (u->is_Phi ()) {
1947
- assert (u->bottom_type () == Type::MEMORY, " " );
1948
- if (u->adr_type () == TypeRawPtr::BOTTOM || u->adr_type () == TypePtr::BOTTOM) {
1949
- assert (controls.member (u->in (0 )), " " );
1950
- if (trace) { tty->print (" XXXXXX pushing memory" ); u->dump (); }
1951
- memories.push (u);
1952
- }
1953
- } else if (u->is_SafePoint () || u->is_MemBar ()) {
1954
- for (DUIterator_Fast jmax, j = u->fast_outs (jmax); j < jmax; j++) {
1955
- Node* uu = u->fast_out (j);
1956
- if (uu->bottom_type () == Type::MEMORY) {
1957
- if (trace) { tty->print (" XXXXXX pushing memory" ); uu->dump (); }
1958
- memories.push (uu);
1959
- }
1960
- }
1961
- }
1962
- }
1963
- }
1964
- for (uint next2 = 0 ; next2 < controls.size (); next2++) {
1965
- Node *m = controls.at (next2);
1966
- if (m->is_Region ()) {
1967
- bool all_in = true ;
1968
- for (uint i = 1 ; i < m->req (); i++) {
1969
- if (!controls.member (m->in (i))) {
1970
- all_in = false ;
1971
- break ;
1972
- }
1973
- }
1974
- if (trace) { tty->print (" XXX verifying %s" , all_in ? " all in" : " " ); m->dump (); }
1975
- bool found_phi = false ;
1976
- for (DUIterator_Fast jmax, j = m->fast_outs (jmax); j < jmax && !found_phi; j++) {
1977
- Node* u = m->fast_out (j);
1978
- if (u->is_Phi () && memories.member (u)) {
1979
- found_phi = true ;
1980
- for (uint i = 1 ; i < u->req () && found_phi; i++) {
1981
- Node* k = u->in (i);
1982
- if (memories.member (k) != controls.member (m->in (i))) {
1983
- found_phi = false ;
1984
- }
1985
- }
1986
- }
1987
- }
1988
- assert (found_phi || all_in, " " );
1989
- }
1990
- }
1991
- controls.clear ();
1992
- memories.clear ();
1993
- }
1994
- for ( uint i = 0 ; i < n->len (); ++i ) {
1995
- Node *m = n->in (i);
1996
- if (m != NULL ) {
1997
- nodes.push (m);
1998
- }
1999
- }
2000
- }
2001
- }
2002
- #endif
2003
-
2004
1878
ShenandoahIUBarrierNode::ShenandoahIUBarrierNode (Node* val) : Node(NULL , val) {
2005
1879
ShenandoahBarrierSetC2::bsc2 ()->state ()->add_iu_barrier (this );
2006
1880
}
0 commit comments