src/share/vm/c1/c1_GraphBuilder.cpp

changeset 894
3a86a8dcf27c
parent 435
a61af66fc99e
child 905
ad8c8ca4ab0f
equal deleted inserted replaced
878:b5e603f2e024 894:3a86a8dcf27c
671 _max_inline_size = MaxInlineSize; 671 _max_inline_size = MaxInlineSize;
672 } 672 }
673 if (_max_inline_size < MaxTrivialSize) { 673 if (_max_inline_size < MaxTrivialSize) {
674 _max_inline_size = MaxTrivialSize; 674 _max_inline_size = MaxTrivialSize;
675 } 675 }
676 }
677
678
679 void GraphBuilder::kill_field(ciField* field) {
680 if (UseLocalValueNumbering) {
681 vmap()->kill_field(field);
682 }
683 }
684
685
686 void GraphBuilder::kill_array(Value value) {
687 if (UseLocalValueNumbering) {
688 vmap()->kill_array(value->type());
689 }
690 _memory->store_value(value);
691 } 676 }
692 677
693 678
694 void GraphBuilder::kill_all() { 679 void GraphBuilder::kill_all() {
695 if (UseLocalValueNumbering) { 680 if (UseLocalValueNumbering) {
985 (array->as_AccessField() && array->as_AccessField()->field()->is_constant()) || 970 (array->as_AccessField() && array->as_AccessField()->field()->is_constant()) ||
986 (array->as_NewArray() && array->as_NewArray()->length() && array->as_NewArray()->length()->type()->is_constant())) { 971 (array->as_NewArray() && array->as_NewArray()->length() && array->as_NewArray()->length()->type()->is_constant())) {
987 length = append(new ArrayLength(array, lock_stack())); 972 length = append(new ArrayLength(array, lock_stack()));
988 } 973 }
989 StoreIndexed* result = new StoreIndexed(array, index, length, type, value, lock_stack()); 974 StoreIndexed* result = new StoreIndexed(array, index, length, type, value, lock_stack());
990 kill_array(value); // invalidate all CSEs that are memory accesses of the same type
991 append(result); 975 append(result);
976 _memory->store_value(value);
992 } 977 }
993 978
994 979
995 void GraphBuilder::stack_op(Bytecodes::Code code) { 980 void GraphBuilder::stack_op(Bytecodes::Code code) {
996 switch (code) { 981 switch (code) {
1476 break; 1461 break;
1477 } 1462 }
1478 case Bytecodes::_putstatic: 1463 case Bytecodes::_putstatic:
1479 { Value val = pop(type); 1464 { Value val = pop(type);
1480 append(new StoreField(append(obj), offset, field, val, true, lock_stack(), state_copy, is_loaded, is_initialized)); 1465 append(new StoreField(append(obj), offset, field, val, true, lock_stack(), state_copy, is_loaded, is_initialized));
1481 if (UseLocalValueNumbering) {
1482 vmap()->kill_field(field); // invalidate all CSEs that are memory accesses
1483 }
1484 } 1466 }
1485 break; 1467 break;
1486 case Bytecodes::_getfield : 1468 case Bytecodes::_getfield :
1487 { 1469 {
1488 LoadField* load = new LoadField(apop(), offset, field, false, lock_stack(), state_copy, is_loaded, true); 1470 LoadField* load = new LoadField(apop(), offset, field, false, lock_stack(), state_copy, is_loaded, true);
1501 { Value val = pop(type); 1483 { Value val = pop(type);
1502 StoreField* store = new StoreField(apop(), offset, field, val, false, lock_stack(), state_copy, is_loaded, true); 1484 StoreField* store = new StoreField(apop(), offset, field, val, false, lock_stack(), state_copy, is_loaded, true);
1503 if (is_loaded) store = _memory->store(store); 1485 if (is_loaded) store = _memory->store(store);
1504 if (store != NULL) { 1486 if (store != NULL) {
1505 append(store); 1487 append(store);
1506 kill_field(field); // invalidate all CSEs that are accesses of this field
1507 } 1488 }
1508 } 1489 }
1509 break; 1490 break;
1510 default : 1491 default :
1511 ShouldNotReachHere(); 1492 ShouldNotReachHere();
1898 if (i2 != i1) { 1879 if (i2 != i1) {
1899 // found an entry in the value map, so just return it. 1880 // found an entry in the value map, so just return it.
1900 assert(i2->bci() != -1, "should already be linked"); 1881 assert(i2->bci() != -1, "should already be linked");
1901 return i2; 1882 return i2;
1902 } 1883 }
1884 ValueNumberingEffects vne(vmap());
1885 i1->visit(&vne);
1903 } 1886 }
1904 1887
1905 if (i1->as_Phi() == NULL && i1->as_Local() == NULL) { 1888 if (i1->as_Phi() == NULL && i1->as_Local() == NULL) {
1906 // i1 was not eliminated => append it 1889 // i1 was not eliminated => append it
1907 assert(i1->next() == NULL, "shouldn't already be linked"); 1890 assert(i1->next() == NULL, "shouldn't already be linked");
1924 } 1907 }
1925 #endif 1908 #endif
1926 assert(_last == i1, "adjust code below"); 1909 assert(_last == i1, "adjust code below");
1927 StateSplit* s = i1->as_StateSplit(); 1910 StateSplit* s = i1->as_StateSplit();
1928 if (s != NULL && i1->as_BlockEnd() == NULL) { 1911 if (s != NULL && i1->as_BlockEnd() == NULL) {
1929 // Continue CSE across certain intrinsics
1930 Intrinsic* intrinsic = s->as_Intrinsic();
1931 if (UseLocalValueNumbering) {
1932 if (intrinsic == NULL || !intrinsic->preserves_state()) {
1933 vmap()->kill_all(); // for now, hopefully we need this only for calls eventually
1934 }
1935 }
1936 if (EliminateFieldAccess) { 1912 if (EliminateFieldAccess) {
1913 Intrinsic* intrinsic = s->as_Intrinsic();
1937 if (s->as_Invoke() != NULL || (intrinsic && !intrinsic->preserves_state())) { 1914 if (s->as_Invoke() != NULL || (intrinsic && !intrinsic->preserves_state())) {
1938 _memory->kill(); 1915 _memory->kill();
1939 } 1916 }
1940 } 1917 }
1941 s->set_state(state()->copy()); 1918 s->set_state(state()->copy());

mercurial