Mercurial > hg > graal-jvmci-8
comparison src/cpu/sparc/vm/templateTable_sparc.cpp @ 11173:6b0fd0964b87
Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Wed, 31 Jul 2013 11:00:54 +0200 |
parents | 63e44cdabb91 46c544b8fbfc |
children | 096c224171c4 |
comparison
equal
deleted
inserted
replaced
10912:4ea54634f03e | 11173:6b0fd0964b87 |
---|---|
1336 } | 1336 } |
1337 | 1337 |
1338 | 1338 |
1339 void TemplateTable::fneg() { | 1339 void TemplateTable::fneg() { |
1340 transition(ftos, ftos); | 1340 transition(ftos, ftos); |
1341 __ fneg(FloatRegisterImpl::S, Ftos_f); | 1341 __ fneg(FloatRegisterImpl::S, Ftos_f, Ftos_f); |
1342 } | 1342 } |
1343 | 1343 |
1344 | 1344 |
1345 void TemplateTable::dneg() { | 1345 void TemplateTable::dneg() { |
1346 transition(dtos, dtos); | 1346 transition(dtos, dtos); |
1347 // v8 has fnegd if source and dest are the same | 1347 __ fneg(FloatRegisterImpl::D, Ftos_f, Ftos_f); |
1348 __ fneg(FloatRegisterImpl::D, Ftos_f); | |
1349 } | 1348 } |
1350 | 1349 |
1351 | 1350 |
1352 void TemplateTable::iinc() { | 1351 void TemplateTable::iinc() { |
1353 transition(vtos, vtos); | 1352 transition(vtos, vtos); |
1468 case Bytecodes::_l2f: | 1467 case Bytecodes::_l2f: |
1469 case Bytecodes::_l2d: | 1468 case Bytecodes::_l2d: |
1470 __ st_long(Otos_l, __ d_tmp); | 1469 __ st_long(Otos_l, __ d_tmp); |
1471 __ ldf(FloatRegisterImpl::D, __ d_tmp, Ftos_d); | 1470 __ ldf(FloatRegisterImpl::D, __ d_tmp, Ftos_d); |
1472 | 1471 |
1473 if (VM_Version::v9_instructions_work()) { | 1472 if (bytecode() == Bytecodes::_l2f) { |
1474 if (bytecode() == Bytecodes::_l2f) { | 1473 __ fxtof(FloatRegisterImpl::S, Ftos_d, Ftos_f); |
1475 __ fxtof(FloatRegisterImpl::S, Ftos_d, Ftos_f); | |
1476 } else { | |
1477 __ fxtof(FloatRegisterImpl::D, Ftos_d, Ftos_d); | |
1478 } | |
1479 } else { | 1474 } else { |
1480 __ call_VM_leaf( | 1475 __ fxtof(FloatRegisterImpl::D, Ftos_d, Ftos_d); |
1481 Lscratch, | |
1482 bytecode() == Bytecodes::_l2f | |
1483 ? CAST_FROM_FN_PTR(address, SharedRuntime::l2f) | |
1484 : CAST_FROM_FN_PTR(address, SharedRuntime::l2d) | |
1485 ); | |
1486 } | 1476 } |
1487 break; | 1477 break; |
1488 | 1478 |
1489 case Bytecodes::_f2i: { | 1479 case Bytecodes::_f2i: { |
1490 Label isNaN; | 1480 Label isNaN; |
1491 // result must be 0 if value is NaN; test by comparing value to itself | 1481 // result must be 0 if value is NaN; test by comparing value to itself |
1492 __ fcmp(FloatRegisterImpl::S, Assembler::fcc0, Ftos_f, Ftos_f); | 1482 __ fcmp(FloatRegisterImpl::S, Assembler::fcc0, Ftos_f, Ftos_f); |
1493 // According to the v8 manual, you have to have a non-fp instruction | |
1494 // between fcmp and fb. | |
1495 if (!VM_Version::v9_instructions_work()) { | |
1496 __ nop(); | |
1497 } | |
1498 __ fb(Assembler::f_unordered, true, Assembler::pn, isNaN); | 1483 __ fb(Assembler::f_unordered, true, Assembler::pn, isNaN); |
1499 __ delayed()->clr(Otos_i); // NaN | 1484 __ delayed()->clr(Otos_i); // NaN |
1500 __ ftoi(FloatRegisterImpl::S, Ftos_f, F30); | 1485 __ ftoi(FloatRegisterImpl::S, Ftos_f, F30); |
1501 __ stf(FloatRegisterImpl::S, F30, __ d_tmp); | 1486 __ stf(FloatRegisterImpl::S, F30, __ d_tmp); |
1502 __ ld(__ d_tmp, Otos_i); | 1487 __ ld(__ d_tmp, Otos_i); |
1535 ? CAST_FROM_FN_PTR(address, SharedRuntime::d2i) | 1520 ? CAST_FROM_FN_PTR(address, SharedRuntime::d2i) |
1536 : CAST_FROM_FN_PTR(address, SharedRuntime::d2l)); | 1521 : CAST_FROM_FN_PTR(address, SharedRuntime::d2l)); |
1537 break; | 1522 break; |
1538 | 1523 |
1539 case Bytecodes::_d2f: | 1524 case Bytecodes::_d2f: |
1540 if (VM_Version::v9_instructions_work()) { | |
1541 __ ftof( FloatRegisterImpl::D, FloatRegisterImpl::S, Ftos_d, Ftos_f); | 1525 __ ftof( FloatRegisterImpl::D, FloatRegisterImpl::S, Ftos_d, Ftos_f); |
1542 } | |
1543 else { | |
1544 // must uncache tos | |
1545 __ push_d(); | |
1546 __ pop_i(O0); | |
1547 __ pop_i(O1); | |
1548 __ call_VM_leaf(Lscratch, CAST_FROM_FN_PTR(address, SharedRuntime::d2f)); | |
1549 } | |
1550 break; | 1526 break; |
1551 | 1527 |
1552 default: ShouldNotReachHere(); | 1528 default: ShouldNotReachHere(); |
1553 } | 1529 } |
1554 __ bind(done); | 1530 __ bind(done); |
1954 // } | 1930 // } |
1955 __ sll( Rh, log_entry_size, Rscratch ); | 1931 __ sll( Rh, log_entry_size, Rscratch ); |
1956 __ ld( Rarray, Rscratch, Rscratch ); | 1932 __ ld( Rarray, Rscratch, Rscratch ); |
1957 // (Rscratch is already in the native byte-ordering.) | 1933 // (Rscratch is already in the native byte-ordering.) |
1958 __ cmp( Rkey, Rscratch ); | 1934 __ cmp( Rkey, Rscratch ); |
1959 if ( VM_Version::v9_instructions_work() ) { | 1935 __ movcc( Assembler::less, false, Assembler::icc, Rh, Rj ); // j = h if (key < array[h].fast_match()) |
1960 __ movcc( Assembler::less, false, Assembler::icc, Rh, Rj ); // j = h if (key < array[h].fast_match()) | 1936 __ movcc( Assembler::greaterEqual, false, Assembler::icc, Rh, Ri ); // i = h if (key >= array[h].fast_match()) |
1961 __ movcc( Assembler::greaterEqual, false, Assembler::icc, Rh, Ri ); // i = h if (key >= array[h].fast_match()) | |
1962 } | |
1963 else { | |
1964 Label end_of_if; | |
1965 __ br( Assembler::less, true, Assembler::pt, end_of_if ); | |
1966 __ delayed()->mov( Rh, Rj ); // if (<) Rj = Rh | |
1967 __ mov( Rh, Ri ); // else i = h | |
1968 __ bind(end_of_if); // } | |
1969 } | |
1970 | 1937 |
1971 // while (i+1 < j) | 1938 // while (i+1 < j) |
1972 __ bind( entry ); | 1939 __ bind( entry ); |
1973 __ add( Ri, 1, Rscratch ); | 1940 __ add( Ri, 1, Rscratch ); |
1974 __ cmp(Rscratch, Rj); | 1941 __ cmp(Rscratch, Rj); |
3423 | 3390 |
3424 // RnewTopValue contains the top address after the new object | 3391 // RnewTopValue contains the top address after the new object |
3425 // has been allocated. | 3392 // has been allocated. |
3426 __ cmp_and_brx_short(RnewTopValue, RendValue, Assembler::greaterUnsigned, Assembler::pn, slow_case); | 3393 __ cmp_and_brx_short(RnewTopValue, RendValue, Assembler::greaterUnsigned, Assembler::pn, slow_case); |
3427 | 3394 |
3428 __ casx_under_lock(RtopAddr, RoldTopValue, RnewTopValue, | 3395 __ cas_ptr(RtopAddr, RoldTopValue, RnewTopValue); |
3429 VM_Version::v9_instructions_work() ? NULL : | |
3430 (address)StubRoutines::Sparc::atomic_memory_operation_lock_addr()); | |
3431 | 3396 |
3432 // if someone beat us on the allocation, try again, otherwise continue | 3397 // if someone beat us on the allocation, try again, otherwise continue |
3433 __ cmp_and_brx_short(RoldTopValue, RnewTopValue, Assembler::notEqual, Assembler::pn, retry); | 3398 __ cmp_and_brx_short(RoldTopValue, RnewTopValue, Assembler::notEqual, Assembler::pn, retry); |
3434 | 3399 |
3435 // bump total bytes allocated by this thread | 3400 // bump total bytes allocated by this thread |
3708 | 3673 |
3709 __ bind( loop ); | 3674 __ bind( loop ); |
3710 | 3675 |
3711 __ verify_oop(O4); // verify each monitor's oop | 3676 __ verify_oop(O4); // verify each monitor's oop |
3712 __ tst(O4); // is this entry unused? | 3677 __ tst(O4); // is this entry unused? |
3713 if (VM_Version::v9_instructions_work()) | 3678 __ movcc( Assembler::zero, false, Assembler::ptr_cc, O3, O1); |
3714 __ movcc( Assembler::zero, false, Assembler::ptr_cc, O3, O1); | |
3715 else { | |
3716 Label L; | |
3717 __ br( Assembler::zero, true, Assembler::pn, L ); | |
3718 __ delayed()->mov(O3, O1); // rememeber this one if match | |
3719 __ bind(L); | |
3720 } | |
3721 | 3679 |
3722 __ cmp(O4, O0); // check if current entry is for same object | 3680 __ cmp(O4, O0); // check if current entry is for same object |
3723 __ brx( Assembler::equal, false, Assembler::pn, exit ); | 3681 __ brx( Assembler::equal, false, Assembler::pn, exit ); |
3724 __ delayed()->inc( O3, frame::interpreter_frame_monitor_size() * wordSize ); // check next one | 3682 __ delayed()->inc( O3, frame::interpreter_frame_monitor_size() * wordSize ); // check next one |
3725 | 3683 |