Mercurial > hg > truffle
comparison src/share/vm/opto/parse2.cpp @ 14521:29ccc4cbabca
Merge
author | Gilles Duboscq <duboscq@ssw.jku.at> |
---|---|
date | Wed, 12 Mar 2014 13:30:08 +0100 |
parents | 45467c53f178 |
children | 4ca6dc0799b6 78bbf4d43a14 |
comparison
equal
deleted
inserted
replaced
14520:f84115370178 | 14521:29ccc4cbabca |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved. | 2 * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | 4 * |
5 * This code is free software; you can redistribute it and/or modify it | 5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as | 6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
48 const Type* elem = Type::TOP; | 48 const Type* elem = Type::TOP; |
49 Node* adr = array_addressing(elem_type, 0, &elem); | 49 Node* adr = array_addressing(elem_type, 0, &elem); |
50 if (stopped()) return; // guaranteed null or range check | 50 if (stopped()) return; // guaranteed null or range check |
51 dec_sp(2); // Pop array and index | 51 dec_sp(2); // Pop array and index |
52 const TypeAryPtr* adr_type = TypeAryPtr::get_array_body_type(elem_type); | 52 const TypeAryPtr* adr_type = TypeAryPtr::get_array_body_type(elem_type); |
53 Node* ld = make_load(control(), adr, elem, elem_type, adr_type); | 53 Node* ld = make_load(control(), adr, elem, elem_type, adr_type, MemNode::unordered); |
54 push(ld); | 54 push(ld); |
55 } | 55 } |
56 | 56 |
57 | 57 |
58 //--------------------------------array_store---------------------------------- | 58 //--------------------------------array_store---------------------------------- |
60 Node* adr = array_addressing(elem_type, 1); | 60 Node* adr = array_addressing(elem_type, 1); |
61 if (stopped()) return; // guaranteed null or range check | 61 if (stopped()) return; // guaranteed null or range check |
62 Node* val = pop(); | 62 Node* val = pop(); |
63 dec_sp(2); // Pop array and index | 63 dec_sp(2); // Pop array and index |
64 const TypeAryPtr* adr_type = TypeAryPtr::get_array_body_type(elem_type); | 64 const TypeAryPtr* adr_type = TypeAryPtr::get_array_body_type(elem_type); |
65 store_to_memory(control(), adr, val, elem_type, adr_type); | 65 store_to_memory(control(), adr, val, elem_type, adr_type, StoreNode::release_if_reference(elem_type)); |
66 } | 66 } |
67 | 67 |
68 | 68 |
69 //------------------------------array_addressing------------------------------- | 69 //------------------------------array_addressing------------------------------- |
70 // Pull array and index from the stack. Compute pointer-to-element. | 70 // Pull array and index from the stack. Compute pointer-to-element. |
86 if (el && el->isa_instptr()) { | 86 if (el && el->isa_instptr()) { |
87 const TypeInstPtr* toop = el->is_instptr(); | 87 const TypeInstPtr* toop = el->is_instptr(); |
88 if (toop->klass()->as_instance_klass()->unique_concrete_subklass()) { | 88 if (toop->klass()->as_instance_klass()->unique_concrete_subklass()) { |
89 // If we load from "AbstractClass[]" we must see "ConcreteSubClass". | 89 // If we load from "AbstractClass[]" we must see "ConcreteSubClass". |
90 const Type* subklass = Type::get_const_type(toop->klass()); | 90 const Type* subklass = Type::get_const_type(toop->klass()); |
91 elemtype = subklass->join(el); | 91 elemtype = subklass->join_speculative(el); |
92 } | 92 } |
93 } | 93 } |
94 } | 94 } |
95 | 95 |
96 // Check for big class initializers with all constant offsets | 96 // Check for big class initializers with all constant offsets |
1276 if (obj != NULL && (con_type->isa_instptr() || con_type->isa_aryptr())) { | 1276 if (obj != NULL && (con_type->isa_instptr() || con_type->isa_aryptr())) { |
1277 // Found: | 1277 // Found: |
1278 // Bool(CmpP(LoadKlass(obj._klass), ConP(Foo.klass)), [eq]) | 1278 // Bool(CmpP(LoadKlass(obj._klass), ConP(Foo.klass)), [eq]) |
1279 // or the narrowOop equivalent. | 1279 // or the narrowOop equivalent. |
1280 const Type* obj_type = _gvn.type(obj); | 1280 const Type* obj_type = _gvn.type(obj); |
1281 const TypeOopPtr* tboth = obj_type->join(con_type)->isa_oopptr(); | 1281 const TypeOopPtr* tboth = obj_type->join_speculative(con_type)->isa_oopptr(); |
1282 if (tboth != NULL && tboth->klass_is_exact() && tboth != obj_type && | 1282 if (tboth != NULL && tboth->klass_is_exact() && tboth != obj_type && |
1283 tboth->higher_equal(obj_type)) { | 1283 tboth->higher_equal(obj_type)) { |
1284 // obj has to be of the exact type Foo if the CmpP succeeds. | 1284 // obj has to be of the exact type Foo if the CmpP succeeds. |
1285 int obj_in_map = map()->find_edge(obj); | 1285 int obj_in_map = map()->find_edge(obj); |
1286 JVMState* jvms = this->jvms(); | 1286 JVMState* jvms = this->jvms(); |
1287 if (obj_in_map >= 0 && | 1287 if (obj_in_map >= 0 && |
1288 (jvms->is_loc(obj_in_map) || jvms->is_stk(obj_in_map))) { | 1288 (jvms->is_loc(obj_in_map) || jvms->is_stk(obj_in_map))) { |
1289 TypeNode* ccast = new (C) CheckCastPPNode(control(), obj, tboth); | 1289 TypeNode* ccast = new (C) CheckCastPPNode(control(), obj, tboth); |
1290 const Type* tcc = ccast->as_Type()->type(); | 1290 const Type* tcc = ccast->as_Type()->type(); |
1291 assert(tcc != obj_type && tcc->higher_equal(obj_type), "must improve"); | 1291 assert(tcc != obj_type && tcc->higher_equal_speculative(obj_type), "must improve"); |
1292 // Delay transform() call to allow recovery of pre-cast value | 1292 // Delay transform() call to allow recovery of pre-cast value |
1293 // at the control merge. | 1293 // at the control merge. |
1294 _gvn.set_type_bottom(ccast); | 1294 _gvn.set_type_bottom(ccast); |
1295 record_for_igvn(ccast); | 1295 record_for_igvn(ccast); |
1296 // Here's the payoff. | 1296 // Here's the payoff. |
1316 Node* cast = NULL; | 1316 Node* cast = NULL; |
1317 | 1317 |
1318 switch (btest) { | 1318 switch (btest) { |
1319 case BoolTest::eq: // Constant test? | 1319 case BoolTest::eq: // Constant test? |
1320 { | 1320 { |
1321 const Type* tboth = tcon->join(tval); | 1321 const Type* tboth = tcon->join_speculative(tval); |
1322 if (tboth == tval) break; // Nothing to gain. | 1322 if (tboth == tval) break; // Nothing to gain. |
1323 if (tcon->isa_int()) { | 1323 if (tcon->isa_int()) { |
1324 ccast = new (C) CastIINode(val, tboth); | 1324 ccast = new (C) CastIINode(val, tboth); |
1325 } else if (tcon == TypePtr::NULL_PTR) { | 1325 } else if (tcon == TypePtr::NULL_PTR) { |
1326 // Cast to null, but keep the pointer identity temporarily live. | 1326 // Cast to null, but keep the pointer identity temporarily live. |
1350 break; | 1350 break; |
1351 } | 1351 } |
1352 | 1352 |
1353 if (ccast != NULL) { | 1353 if (ccast != NULL) { |
1354 const Type* tcc = ccast->as_Type()->type(); | 1354 const Type* tcc = ccast->as_Type()->type(); |
1355 assert(tcc != tval && tcc->higher_equal(tval), "must improve"); | 1355 assert(tcc != tval && tcc->higher_equal_speculative(tval), "must improve"); |
1356 // Delay transform() call to allow recovery of pre-cast value | 1356 // Delay transform() call to allow recovery of pre-cast value |
1357 // at the control merge. | 1357 // at the control merge. |
1358 ccast->set_req(0, control()); | 1358 ccast->set_req(0, control()); |
1359 _gvn.set_type_bottom(ccast); | 1359 _gvn.set_type_bottom(ccast); |
1360 record_for_igvn(ccast); | 1360 record_for_igvn(ccast); |
1718 case Bytecodes::_aaload: array_load(T_OBJECT); break; | 1718 case Bytecodes::_aaload: array_load(T_OBJECT); break; |
1719 case Bytecodes::_laload: { | 1719 case Bytecodes::_laload: { |
1720 a = array_addressing(T_LONG, 0); | 1720 a = array_addressing(T_LONG, 0); |
1721 if (stopped()) return; // guaranteed null or range check | 1721 if (stopped()) return; // guaranteed null or range check |
1722 dec_sp(2); // Pop array and index | 1722 dec_sp(2); // Pop array and index |
1723 push_pair(make_load(control(), a, TypeLong::LONG, T_LONG, TypeAryPtr::LONGS)); | 1723 push_pair(make_load(control(), a, TypeLong::LONG, T_LONG, TypeAryPtr::LONGS, MemNode::unordered)); |
1724 break; | 1724 break; |
1725 } | 1725 } |
1726 case Bytecodes::_daload: { | 1726 case Bytecodes::_daload: { |
1727 a = array_addressing(T_DOUBLE, 0); | 1727 a = array_addressing(T_DOUBLE, 0); |
1728 if (stopped()) return; // guaranteed null or range check | 1728 if (stopped()) return; // guaranteed null or range check |
1729 dec_sp(2); // Pop array and index | 1729 dec_sp(2); // Pop array and index |
1730 push_pair(make_load(control(), a, Type::DOUBLE, T_DOUBLE, TypeAryPtr::DOUBLES)); | 1730 push_pair(make_load(control(), a, Type::DOUBLE, T_DOUBLE, TypeAryPtr::DOUBLES, MemNode::unordered)); |
1731 break; | 1731 break; |
1732 } | 1732 } |
1733 case Bytecodes::_bastore: array_store(T_BYTE); break; | 1733 case Bytecodes::_bastore: array_store(T_BYTE); break; |
1734 case Bytecodes::_castore: array_store(T_CHAR); break; | 1734 case Bytecodes::_castore: array_store(T_CHAR); break; |
1735 case Bytecodes::_iastore: array_store(T_INT); break; | 1735 case Bytecodes::_iastore: array_store(T_INT); break; |
1742 c = pop(); // Oop to store | 1742 c = pop(); // Oop to store |
1743 b = pop(); // index (already used) | 1743 b = pop(); // index (already used) |
1744 a = pop(); // the array itself | 1744 a = pop(); // the array itself |
1745 const TypeOopPtr* elemtype = _gvn.type(a)->is_aryptr()->elem()->make_oopptr(); | 1745 const TypeOopPtr* elemtype = _gvn.type(a)->is_aryptr()->elem()->make_oopptr(); |
1746 const TypeAryPtr* adr_type = TypeAryPtr::OOPS; | 1746 const TypeAryPtr* adr_type = TypeAryPtr::OOPS; |
1747 Node* store = store_oop_to_array(control(), a, d, adr_type, c, elemtype, T_OBJECT); | 1747 Node* store = store_oop_to_array(control(), a, d, adr_type, c, elemtype, T_OBJECT, MemNode::release); |
1748 break; | 1748 break; |
1749 } | 1749 } |
1750 case Bytecodes::_lastore: { | 1750 case Bytecodes::_lastore: { |
1751 a = array_addressing(T_LONG, 2); | 1751 a = array_addressing(T_LONG, 2); |
1752 if (stopped()) return; // guaranteed null or range check | 1752 if (stopped()) return; // guaranteed null or range check |
1753 c = pop_pair(); | 1753 c = pop_pair(); |
1754 dec_sp(2); // Pop array and index | 1754 dec_sp(2); // Pop array and index |
1755 store_to_memory(control(), a, c, T_LONG, TypeAryPtr::LONGS); | 1755 store_to_memory(control(), a, c, T_LONG, TypeAryPtr::LONGS, MemNode::unordered); |
1756 break; | 1756 break; |
1757 } | 1757 } |
1758 case Bytecodes::_dastore: { | 1758 case Bytecodes::_dastore: { |
1759 a = array_addressing(T_DOUBLE, 2); | 1759 a = array_addressing(T_DOUBLE, 2); |
1760 if (stopped()) return; // guaranteed null or range check | 1760 if (stopped()) return; // guaranteed null or range check |
1761 c = pop_pair(); | 1761 c = pop_pair(); |
1762 dec_sp(2); // Pop array and index | 1762 dec_sp(2); // Pop array and index |
1763 c = dstore_rounding(c); | 1763 c = dstore_rounding(c); |
1764 store_to_memory(control(), a, c, T_DOUBLE, TypeAryPtr::DOUBLES); | 1764 store_to_memory(control(), a, c, T_DOUBLE, TypeAryPtr::DOUBLES, MemNode::unordered); |
1765 break; | 1765 break; |
1766 } | 1766 } |
1767 case Bytecodes::_getfield: | 1767 case Bytecodes::_getfield: |
1768 do_getfield(); | 1768 do_getfield(); |
1769 break; | 1769 break; |