30 |
30 |
31 //---------------------------------array_load---------------------------------- |
31 //---------------------------------array_load---------------------------------- |
32 void Parse::array_load(BasicType elem_type) { |
32 void Parse::array_load(BasicType elem_type) { |
33 const Type* elem = Type::TOP; |
33 const Type* elem = Type::TOP; |
34 Node* adr = array_addressing(elem_type, 0, &elem); |
34 Node* adr = array_addressing(elem_type, 0, &elem); |
35 if (stopped()) return; // guarenteed null or range check |
35 if (stopped()) return; // guaranteed null or range check |
36 _sp -= 2; // Pop array and index |
36 _sp -= 2; // Pop array and index |
37 const TypeAryPtr* adr_type = TypeAryPtr::get_array_body_type(elem_type); |
37 const TypeAryPtr* adr_type = TypeAryPtr::get_array_body_type(elem_type); |
38 Node* ld = make_load(control(), adr, elem, elem_type, adr_type); |
38 Node* ld = make_load(control(), adr, elem, elem_type, adr_type); |
39 push(ld); |
39 push(ld); |
40 } |
40 } |
41 |
41 |
42 |
42 |
43 //--------------------------------array_store---------------------------------- |
43 //--------------------------------array_store---------------------------------- |
44 void Parse::array_store(BasicType elem_type) { |
44 void Parse::array_store(BasicType elem_type) { |
45 Node* adr = array_addressing(elem_type, 1); |
45 Node* adr = array_addressing(elem_type, 1); |
46 if (stopped()) return; // guarenteed null or range check |
46 if (stopped()) return; // guaranteed null or range check |
47 Node* val = pop(); |
47 Node* val = pop(); |
48 _sp -= 2; // Pop array and index |
48 _sp -= 2; // Pop array and index |
49 const TypeAryPtr* adr_type = TypeAryPtr::get_array_body_type(elem_type); |
49 const TypeAryPtr* adr_type = TypeAryPtr::get_array_body_type(elem_type); |
50 store_to_memory(control(), adr, val, elem_type, adr_type); |
50 store_to_memory(control(), adr, val, elem_type, adr_type); |
51 } |
51 } |
1539 case Bytecodes::_saload: array_load(T_SHORT); break; |
1539 case Bytecodes::_saload: array_load(T_SHORT); break; |
1540 case Bytecodes::_faload: array_load(T_FLOAT); break; |
1540 case Bytecodes::_faload: array_load(T_FLOAT); break; |
1541 case Bytecodes::_aaload: array_load(T_OBJECT); break; |
1541 case Bytecodes::_aaload: array_load(T_OBJECT); break; |
1542 case Bytecodes::_laload: { |
1542 case Bytecodes::_laload: { |
1543 a = array_addressing(T_LONG, 0); |
1543 a = array_addressing(T_LONG, 0); |
1544 if (stopped()) return; // guarenteed null or range check |
1544 if (stopped()) return; // guaranteed null or range check |
1545 _sp -= 2; // Pop array and index |
1545 _sp -= 2; // Pop array and index |
1546 push_pair( make_load(control(), a, TypeLong::LONG, T_LONG, TypeAryPtr::LONGS)); |
1546 push_pair( make_load(control(), a, TypeLong::LONG, T_LONG, TypeAryPtr::LONGS)); |
1547 break; |
1547 break; |
1548 } |
1548 } |
1549 case Bytecodes::_daload: { |
1549 case Bytecodes::_daload: { |
1550 a = array_addressing(T_DOUBLE, 0); |
1550 a = array_addressing(T_DOUBLE, 0); |
1551 if (stopped()) return; // guarenteed null or range check |
1551 if (stopped()) return; // guaranteed null or range check |
1552 _sp -= 2; // Pop array and index |
1552 _sp -= 2; // Pop array and index |
1553 push_pair( make_load(control(), a, Type::DOUBLE, T_DOUBLE, TypeAryPtr::DOUBLES)); |
1553 push_pair( make_load(control(), a, Type::DOUBLE, T_DOUBLE, TypeAryPtr::DOUBLES)); |
1554 break; |
1554 break; |
1555 } |
1555 } |
1556 case Bytecodes::_bastore: array_store(T_BYTE); break; |
1556 case Bytecodes::_bastore: array_store(T_BYTE); break; |
1558 case Bytecodes::_iastore: array_store(T_INT); break; |
1558 case Bytecodes::_iastore: array_store(T_INT); break; |
1559 case Bytecodes::_sastore: array_store(T_SHORT); break; |
1559 case Bytecodes::_sastore: array_store(T_SHORT); break; |
1560 case Bytecodes::_fastore: array_store(T_FLOAT); break; |
1560 case Bytecodes::_fastore: array_store(T_FLOAT); break; |
1561 case Bytecodes::_aastore: { |
1561 case Bytecodes::_aastore: { |
1562 d = array_addressing(T_OBJECT, 1); |
1562 d = array_addressing(T_OBJECT, 1); |
1563 if (stopped()) return; // guarenteed null or range check |
1563 if (stopped()) return; // guaranteed null or range check |
1564 array_store_check(); |
1564 array_store_check(); |
1565 c = pop(); // Oop to store |
1565 c = pop(); // Oop to store |
1566 b = pop(); // index (already used) |
1566 b = pop(); // index (already used) |
1567 a = pop(); // the array itself |
1567 a = pop(); // the array itself |
1568 const Type* elemtype = _gvn.type(a)->is_aryptr()->elem(); |
1568 const Type* elemtype = _gvn.type(a)->is_aryptr()->elem(); |
1570 Node* store = store_oop_to_array(control(), a, d, adr_type, c, elemtype, T_OBJECT); |
1570 Node* store = store_oop_to_array(control(), a, d, adr_type, c, elemtype, T_OBJECT); |
1571 break; |
1571 break; |
1572 } |
1572 } |
1573 case Bytecodes::_lastore: { |
1573 case Bytecodes::_lastore: { |
1574 a = array_addressing(T_LONG, 2); |
1574 a = array_addressing(T_LONG, 2); |
1575 if (stopped()) return; // guarenteed null or range check |
1575 if (stopped()) return; // guaranteed null or range check |
1576 c = pop_pair(); |
1576 c = pop_pair(); |
1577 _sp -= 2; // Pop array and index |
1577 _sp -= 2; // Pop array and index |
1578 store_to_memory(control(), a, c, T_LONG, TypeAryPtr::LONGS); |
1578 store_to_memory(control(), a, c, T_LONG, TypeAryPtr::LONGS); |
1579 break; |
1579 break; |
1580 } |
1580 } |
1581 case Bytecodes::_dastore: { |
1581 case Bytecodes::_dastore: { |
1582 a = array_addressing(T_DOUBLE, 2); |
1582 a = array_addressing(T_DOUBLE, 2); |
1583 if (stopped()) return; // guarenteed null or range check |
1583 if (stopped()) return; // guaranteed null or range check |
1584 c = pop_pair(); |
1584 c = pop_pair(); |
1585 _sp -= 2; // Pop array and index |
1585 _sp -= 2; // Pop array and index |
1586 c = dstore_rounding(c); |
1586 c = dstore_rounding(c); |
1587 store_to_memory(control(), a, c, T_DOUBLE, TypeAryPtr::DOUBLES); |
1587 store_to_memory(control(), a, c, T_DOUBLE, TypeAryPtr::DOUBLES); |
1588 break; |
1588 break; |