3797 _phase_name, C->unique(), C->live_nodes(), C->count_live_nodes_by_graph_walk());
3798 }
3799
3800 if (VerifyIdealNodeCount) {
3801 Compile::current()->print_missing_nodes();
3802 }
3803 #endif
3804
3805 if (_log != NULL) {
3806 _log->done("phase name='%s' nodes='%d' live='%d'", _phase_name, C->unique(), C->live_nodes());
3807 }
3808 }
3809
3810 //=============================================================================
3811 // Two Constant's are equal when the type and the value are equal.
3812 bool Compile::Constant::operator==(const Constant& other) {
3813 if (type() != other.type() ) return false;
3814 if (can_be_reused() != other.can_be_reused()) return false;
3815 // For floating point values we compare the bit pattern.
3816 switch (type()) {
3817 case T_FLOAT: return (_v._value.i == other._v._value.i);
3818 case T_LONG:
3819 case T_DOUBLE: return (_v._value.j == other._v._value.j);
3820 case T_OBJECT:
3821 case T_ADDRESS: return (_v._value.l == other._v._value.l);
3822 case T_VOID: return (_v._value.l == other._v._value.l); // jump-table entries
3823 case T_METADATA: return (_v._metadata == other._v._metadata);
3824 default: ShouldNotReachHere();
3825 }
3826 return false;
3827 }
3828
3829 static int type_to_size_in_bytes(BasicType t) {
3830 switch (t) {
3831 case T_LONG: return sizeof(jlong );
3832 case T_FLOAT: return sizeof(jfloat );
3833 case T_DOUBLE: return sizeof(jdouble);
3834 case T_METADATA: return sizeof(Metadata*);
3835 // We use T_VOID as marker for jump-table entries (labels) which
3836 // need an internal word relocation.
3837 case T_VOID:
3838 case T_ADDRESS:
3839 case T_OBJECT: return sizeof(jobject);
3840 }
3841
3842 ShouldNotReachHere();
3843 return -1;
3844 }
3845
3846 int Compile::ConstantTable::qsort_comparator(Constant* a, Constant* b) {
3847 // sort descending
3848 if (a->freq() > b->freq()) return -1;
3849 if (a->freq() < b->freq()) return 1;
3850 return 0;
3879 if (con->type() == T_VOID) {
3880 MachConstantNode* n = (MachConstantNode*) con->get_jobject();
3881 offset = offset + typesize * n->outcnt(); // expand jump-table
3882 } else {
3883 offset = offset + typesize;
3884 }
3885 }
3886
3887 // Align size up to the next section start (which is insts; see
3888 // CodeBuffer::align_at_start).
3889 assert(_size == -1, "already set?");
3890 _size = align_size_up(offset, CodeEntryAlignment);
3891 }
3892
3893 void Compile::ConstantTable::emit(CodeBuffer& cb) {
3894 MacroAssembler _masm(&cb);
3895 for (int i = 0; i < _constants.length(); i++) {
3896 Constant con = _constants.at(i);
3897 address constant_addr = NULL;
3898 switch (con.type()) {
3899 case T_LONG: constant_addr = _masm.long_constant( con.get_jlong() ); break;
3900 case T_FLOAT: constant_addr = _masm.float_constant( con.get_jfloat() ); break;
3901 case T_DOUBLE: constant_addr = _masm.double_constant(con.get_jdouble()); break;
3902 case T_OBJECT: {
3903 jobject obj = con.get_jobject();
3904 int oop_index = _masm.oop_recorder()->find_index(obj);
3905 constant_addr = _masm.address_constant((address) obj, oop_Relocation::spec(oop_index));
3906 break;
3907 }
3908 case T_ADDRESS: {
3909 address addr = (address) con.get_jobject();
3910 constant_addr = _masm.address_constant(addr);
3911 break;
3912 }
3913 // We use T_VOID as marker for jump-table entries (labels) which
3914 // need an internal word relocation.
3915 case T_VOID: {
3916 MachConstantNode* n = (MachConstantNode*) con.get_jobject();
3917 // Fill the jump-table with a dummy word. The real value is
3918 // filled in later in fill_jump_table.
|
3797 _phase_name, C->unique(), C->live_nodes(), C->count_live_nodes_by_graph_walk());
3798 }
3799
3800 if (VerifyIdealNodeCount) {
3801 Compile::current()->print_missing_nodes();
3802 }
3803 #endif
3804
3805 if (_log != NULL) {
3806 _log->done("phase name='%s' nodes='%d' live='%d'", _phase_name, C->unique(), C->live_nodes());
3807 }
3808 }
3809
3810 //=============================================================================
3811 // Two Constant's are equal when the type and the value are equal.
3812 bool Compile::Constant::operator==(const Constant& other) {
3813 if (type() != other.type() ) return false;
3814 if (can_be_reused() != other.can_be_reused()) return false;
3815 // For floating point values we compare the bit pattern.
3816 switch (type()) {
3817 case T_INT:
3818 case T_FLOAT: return (_v._value.i == other._v._value.i);
3819 case T_LONG:
3820 case T_DOUBLE: return (_v._value.j == other._v._value.j);
3821 case T_OBJECT:
3822 case T_ADDRESS: return (_v._value.l == other._v._value.l);
3823 case T_VOID: return (_v._value.l == other._v._value.l); // jump-table entries
3824 case T_METADATA: return (_v._metadata == other._v._metadata);
3825 default: ShouldNotReachHere();
3826 }
3827 return false;
3828 }
3829
3830 static int type_to_size_in_bytes(BasicType t) {
3831 switch (t) {
3832 case T_INT: return sizeof(jint );
3833 case T_LONG: return sizeof(jlong );
3834 case T_FLOAT: return sizeof(jfloat );
3835 case T_DOUBLE: return sizeof(jdouble);
3836 case T_METADATA: return sizeof(Metadata*);
3837 // We use T_VOID as marker for jump-table entries (labels) which
3838 // need an internal word relocation.
3839 case T_VOID:
3840 case T_ADDRESS:
3841 case T_OBJECT: return sizeof(jobject);
3842 }
3843
3844 ShouldNotReachHere();
3845 return -1;
3846 }
3847
3848 int Compile::ConstantTable::qsort_comparator(Constant* a, Constant* b) {
3849 // sort descending
3850 if (a->freq() > b->freq()) return -1;
3851 if (a->freq() < b->freq()) return 1;
3852 return 0;
3881 if (con->type() == T_VOID) {
3882 MachConstantNode* n = (MachConstantNode*) con->get_jobject();
3883 offset = offset + typesize * n->outcnt(); // expand jump-table
3884 } else {
3885 offset = offset + typesize;
3886 }
3887 }
3888
3889 // Align size up to the next section start (which is insts; see
3890 // CodeBuffer::align_at_start).
3891 assert(_size == -1, "already set?");
3892 _size = align_size_up(offset, CodeEntryAlignment);
3893 }
3894
3895 void Compile::ConstantTable::emit(CodeBuffer& cb) {
3896 MacroAssembler _masm(&cb);
3897 for (int i = 0; i < _constants.length(); i++) {
3898 Constant con = _constants.at(i);
3899 address constant_addr = NULL;
3900 switch (con.type()) {
3901 case T_INT: constant_addr = _masm.int_constant( con.get_jint() ); break;
3902 case T_LONG: constant_addr = _masm.long_constant( con.get_jlong() ); break;
3903 case T_FLOAT: constant_addr = _masm.float_constant( con.get_jfloat() ); break;
3904 case T_DOUBLE: constant_addr = _masm.double_constant(con.get_jdouble()); break;
3905 case T_OBJECT: {
3906 jobject obj = con.get_jobject();
3907 int oop_index = _masm.oop_recorder()->find_index(obj);
3908 constant_addr = _masm.address_constant((address) obj, oop_Relocation::spec(oop_index));
3909 break;
3910 }
3911 case T_ADDRESS: {
3912 address addr = (address) con.get_jobject();
3913 constant_addr = _masm.address_constant(addr);
3914 break;
3915 }
3916 // We use T_VOID as marker for jump-table entries (labels) which
3917 // need an internal word relocation.
3918 case T_VOID: {
3919 MachConstantNode* n = (MachConstantNode*) con.get_jobject();
3920 // Fill the jump-table with a dummy word. The real value is
3921 // filled in later in fill_jump_table.
|