560 OptoReg::Name regnum = _regalloc->get_reg_first(local); 561 if( OptoReg::is_valid(regnum) ) {// Got a register/stack? 562 // Record the double as two float registers. 563 // The register mask for such a value always specifies two adjacent 564 // float registers, with the lower register number even. 565 // Normally, the allocation of high and low words to these registers 566 // is irrelevant, because nearly all operations on register pairs 567 // (e.g., StoreD) treat them as a single unit. 568 // Here, we assume in addition that the words in these two registers 569 // stored "naturally" (by operations like StoreD and double stores 570 // within the interpreter) such that the lower-numbered register 571 // is written to the lower memory address. This may seem like 572 // a machine dependency, but it is not--it is a requirement on 573 // the author of the <arch>.ad file to ensure that, for every 574 // even/odd double-register pair to which a double may be allocated, 575 // the word in the even single-register is stored to the first 576 // memory word. (Note that register numbers are completely 577 // arbitrary, and are not tied to any machine-level encodings.) 578 #ifdef _LP64 579 if( t->base() == Type::DoubleBot || t->base() == Type::DoubleCon ) { 580 array->append(new ConstantIntValue(0)); 581 array->append(new_loc_value( _regalloc, regnum, Location::dbl )); 582 } else if ( t->base() == Type::Long ) { 583 array->append(new ConstantIntValue(0)); 584 array->append(new_loc_value( _regalloc, regnum, Location::lng )); 585 } else if ( t->base() == Type::RawPtr ) { 586 // jsr/ret return address which must be restored into a the full 587 // width 64-bit stack slot. 588 array->append(new_loc_value( _regalloc, regnum, Location::lng )); 589 } 590 #else //_LP64 591 #ifdef SPARC 592 if (t->base() == Type::Long && OptoReg::is_reg(regnum)) { 593 // For SPARC we have to swap high and low words for 594 // long values stored in a single-register (g0-g7). 595 array->append(new_loc_value( _regalloc, regnum , Location::normal )); 596 array->append(new_loc_value( _regalloc, OptoReg::add(regnum,1), Location::normal )); 597 } else 598 #endif //SPARC 599 if( t->base() == Type::DoubleBot || t->base() == Type::DoubleCon || t->base() == Type::Long ) { 600 // Repack the double/long as two jints. 601 // The convention the interpreter uses is that the second local 602 // holds the first raw word of the native double representation. 603 // This is actually reasonable, since locals and stack arrays 646 array->append(new ConstantIntValue(t->is_int()->get_con())); 647 break; 648 case Type::RawPtr: 649 // A return address (T_ADDRESS). 650 assert((intptr_t)t->is_ptr()->get_con() < (intptr_t)0x10000, "must be a valid BCI"); 651 #ifdef _LP64 652 // Must be restored to the full-width 64-bit stack slot. 653 array->append(new ConstantLongValue(t->is_ptr()->get_con())); 654 #else 655 array->append(new ConstantIntValue(t->is_ptr()->get_con())); 656 #endif 657 break; 658 case Type::FloatCon: { 659 float f = t->is_float_constant()->getf(); 660 array->append(new ConstantIntValue(jint_cast(f))); 661 break; 662 } 663 case Type::DoubleCon: { 664 jdouble d = t->is_double_constant()->getd(); 665 #ifdef _LP64 666 array->append(new ConstantIntValue(0)); 667 array->append(new ConstantDoubleValue(d)); 668 #else 669 // Repack the double as two jints. 670 // The convention the interpreter uses is that the second local 671 // holds the first raw word of the native double representation. 672 // This is actually reasonable, since locals and stack arrays 673 // grow downwards in all implementations. 674 // (If, on some machine, the interpreter's Java locals or stack 675 // were to grow upwards, the embedded doubles would be word-swapped.) 676 jlong_accessor acc; 677 acc.long_value = jlong_cast(d); 678 array->append(new ConstantIntValue(acc.words[1])); 679 array->append(new ConstantIntValue(acc.words[0])); 680 #endif 681 break; 682 } 683 case Type::Long: { 684 jlong d = t->is_long()->get_con(); 685 #ifdef _LP64 686 array->append(new ConstantIntValue(0)); 687 array->append(new ConstantLongValue(d)); 688 #else 689 // Repack the long as two jints. 690 // The convention the interpreter uses is that the second local 691 // holds the first raw word of the native double representation. 692 // This is actually reasonable, since locals and stack arrays 693 // grow downwards in all implementations. 694 // (If, on some machine, the interpreter's Java locals or stack 695 // were to grow upwards, the embedded doubles would be word-swapped.) 696 jlong_accessor acc; 697 acc.long_value = d; 698 array->append(new ConstantIntValue(acc.words[1])); 699 array->append(new ConstantIntValue(acc.words[0])); 700 #endif 701 break; 702 } 703 case Type::Top: // Add an illegal value here 704 array->append(new LocationValue(Location())); 705 break; 706 default: | 560 OptoReg::Name regnum = _regalloc->get_reg_first(local); 561 if( OptoReg::is_valid(regnum) ) {// Got a register/stack? 562 // Record the double as two float registers. 563 // The register mask for such a value always specifies two adjacent 564 // float registers, with the lower register number even. 565 // Normally, the allocation of high and low words to these registers 566 // is irrelevant, because nearly all operations on register pairs 567 // (e.g., StoreD) treat them as a single unit. 568 // Here, we assume in addition that the words in these two registers 569 // stored "naturally" (by operations like StoreD and double stores 570 // within the interpreter) such that the lower-numbered register 571 // is written to the lower memory address. This may seem like 572 // a machine dependency, but it is not--it is a requirement on 573 // the author of the <arch>.ad file to ensure that, for every 574 // even/odd double-register pair to which a double may be allocated, 575 // the word in the even single-register is stored to the first 576 // memory word. (Note that register numbers are completely 577 // arbitrary, and are not tied to any machine-level encodings.) 578 #ifdef _LP64 579 if( t->base() == Type::DoubleBot || t->base() == Type::DoubleCon ) { 580 array->append(new ConstantIntValue((jint)0)); 581 array->append(new_loc_value( _regalloc, regnum, Location::dbl )); 582 } else if ( t->base() == Type::Long ) { 583 array->append(new ConstantIntValue((jint)0)); 584 array->append(new_loc_value( _regalloc, regnum, Location::lng )); 585 } else if ( t->base() == Type::RawPtr ) { 586 // jsr/ret return address which must be restored into a the full 587 // width 64-bit stack slot. 588 array->append(new_loc_value( _regalloc, regnum, Location::lng )); 589 } 590 #else //_LP64 591 #ifdef SPARC 592 if (t->base() == Type::Long && OptoReg::is_reg(regnum)) { 593 // For SPARC we have to swap high and low words for 594 // long values stored in a single-register (g0-g7). 595 array->append(new_loc_value( _regalloc, regnum , Location::normal )); 596 array->append(new_loc_value( _regalloc, OptoReg::add(regnum,1), Location::normal )); 597 } else 598 #endif //SPARC 599 if( t->base() == Type::DoubleBot || t->base() == Type::DoubleCon || t->base() == Type::Long ) { 600 // Repack the double/long as two jints. 601 // The convention the interpreter uses is that the second local 602 // holds the first raw word of the native double representation. 603 // This is actually reasonable, since locals and stack arrays 646 array->append(new ConstantIntValue(t->is_int()->get_con())); 647 break; 648 case Type::RawPtr: 649 // A return address (T_ADDRESS). 650 assert((intptr_t)t->is_ptr()->get_con() < (intptr_t)0x10000, "must be a valid BCI"); 651 #ifdef _LP64 652 // Must be restored to the full-width 64-bit stack slot. 653 array->append(new ConstantLongValue(t->is_ptr()->get_con())); 654 #else 655 array->append(new ConstantIntValue(t->is_ptr()->get_con())); 656 #endif 657 break; 658 case Type::FloatCon: { 659 float f = t->is_float_constant()->getf(); 660 array->append(new ConstantIntValue(jint_cast(f))); 661 break; 662 } 663 case Type::DoubleCon: { 664 jdouble d = t->is_double_constant()->getd(); 665 #ifdef _LP64 666 array->append(new ConstantIntValue((jint)0)); 667 array->append(new ConstantDoubleValue(d)); 668 #else 669 // Repack the double as two jints. 670 // The convention the interpreter uses is that the second local 671 // holds the first raw word of the native double representation. 672 // This is actually reasonable, since locals and stack arrays 673 // grow downwards in all implementations. 674 // (If, on some machine, the interpreter's Java locals or stack 675 // were to grow upwards, the embedded doubles would be word-swapped.) 676 jlong_accessor acc; 677 acc.long_value = jlong_cast(d); 678 array->append(new ConstantIntValue(acc.words[1])); 679 array->append(new ConstantIntValue(acc.words[0])); 680 #endif 681 break; 682 } 683 case Type::Long: { 684 jlong d = t->is_long()->get_con(); 685 #ifdef _LP64 686 array->append(new ConstantIntValue((jint)0)); 687 array->append(new ConstantLongValue(d)); 688 #else 689 // Repack the long as two jints. 690 // The convention the interpreter uses is that the second local 691 // holds the first raw word of the native double representation. 692 // This is actually reasonable, since locals and stack arrays 693 // grow downwards in all implementations. 694 // (If, on some machine, the interpreter's Java locals or stack 695 // were to grow upwards, the embedded doubles would be word-swapped.) 696 jlong_accessor acc; 697 acc.long_value = d; 698 array->append(new ConstantIntValue(acc.words[1])); 699 array->append(new ConstantIntValue(acc.words[0])); 700 #endif 701 break; 702 } 703 case Type::Top: // Add an illegal value here 704 array->append(new LocationValue(Location())); 705 break; 706 default: |