comparison src/cpu/sparc/vm/templateTable_sparc.cpp @ 11006:b88209cf98c0

Merge
author kvn
date Thu, 20 Jun 2013 16:08:11 -0700
parents 46c544b8fbfc
children 6b0fd0964b87 bd3237e0e18d
comparison
equal deleted inserted replaced
10994:9f9c0a163cc5 11006:b88209cf98c0
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);
3416 3383
3417 // RnewTopValue contains the top address after the new object 3384 // RnewTopValue contains the top address after the new object
3418 // has been allocated. 3385 // has been allocated.
3419 __ cmp_and_brx_short(RnewTopValue, RendValue, Assembler::greaterUnsigned, Assembler::pn, slow_case); 3386 __ cmp_and_brx_short(RnewTopValue, RendValue, Assembler::greaterUnsigned, Assembler::pn, slow_case);
3420 3387
3421 __ casx_under_lock(RtopAddr, RoldTopValue, RnewTopValue, 3388 __ cas_ptr(RtopAddr, RoldTopValue, RnewTopValue);
3422 VM_Version::v9_instructions_work() ? NULL :
3423 (address)StubRoutines::Sparc::atomic_memory_operation_lock_addr());
3424 3389
3425 // if someone beat us on the allocation, try again, otherwise continue 3390 // if someone beat us on the allocation, try again, otherwise continue
3426 __ cmp_and_brx_short(RoldTopValue, RnewTopValue, Assembler::notEqual, Assembler::pn, retry); 3391 __ cmp_and_brx_short(RoldTopValue, RnewTopValue, Assembler::notEqual, Assembler::pn, retry);
3427 3392
3428 // bump total bytes allocated by this thread 3393 // bump total bytes allocated by this thread
3699 3664
3700 __ bind( loop ); 3665 __ bind( loop );
3701 3666
3702 __ verify_oop(O4); // verify each monitor's oop 3667 __ verify_oop(O4); // verify each monitor's oop
3703 __ tst(O4); // is this entry unused? 3668 __ tst(O4); // is this entry unused?
3704 if (VM_Version::v9_instructions_work()) 3669 __ movcc( Assembler::zero, false, Assembler::ptr_cc, O3, O1);
3705 __ movcc( Assembler::zero, false, Assembler::ptr_cc, O3, O1);
3706 else {
3707 Label L;
3708 __ br( Assembler::zero, true, Assembler::pn, L );
3709 __ delayed()->mov(O3, O1); // rememeber this one if match
3710 __ bind(L);
3711 }
3712 3670
3713 __ cmp(O4, O0); // check if current entry is for same object 3671 __ cmp(O4, O0); // check if current entry is for same object
3714 __ brx( Assembler::equal, false, Assembler::pn, exit ); 3672 __ brx( Assembler::equal, false, Assembler::pn, exit );
3715 __ delayed()->inc( O3, frame::interpreter_frame_monitor_size() * wordSize ); // check next one 3673 __ delayed()->inc( O3, frame::interpreter_frame_monitor_size() * wordSize ); // check next one
3716 3674