comparison src/cpu/sparc/vm/macroAssembler_sparc.cpp @ 13000:209aa13ab8c0

8024927: Nashorn performance regression with CompressedOops Summary: Allocate compressed class space at end of Java heap. For small heap sizes, without CDS, save some space so compressed classes can have the same favorable compression as oops Reviewed-by: stefank, hseigel, goetz
author coleenp
date Fri, 25 Oct 2013 15:19:29 -0400
parents 69944b868a32
children b4aa8fc5d0d5
comparison
equal deleted inserted replaced
12999:634715d59d9e 13000:209aa13ab8c0
4094 add(dst, G6_heapbase, dst); 4094 add(dst, G6_heapbase, dst);
4095 } 4095 }
4096 4096
4097 void MacroAssembler::encode_klass_not_null(Register r) { 4097 void MacroAssembler::encode_klass_not_null(Register r) {
4098 assert (UseCompressedClassPointers, "must be compressed"); 4098 assert (UseCompressedClassPointers, "must be compressed");
4099 assert(Universe::narrow_klass_base() != NULL, "narrow_klass_base should be initialized"); 4099 if (Universe::narrow_klass_base() != NULL) {
4100 assert(r != G6_heapbase, "bad register choice"); 4100 assert(r != G6_heapbase, "bad register choice");
4101 set((intptr_t)Universe::narrow_klass_base(), G6_heapbase); 4101 set((intptr_t)Universe::narrow_klass_base(), G6_heapbase);
4102 sub(r, G6_heapbase, r); 4102 sub(r, G6_heapbase, r);
4103 if (Universe::narrow_klass_shift() != 0) { 4103 if (Universe::narrow_klass_shift() != 0) {
4104 assert (LogKlassAlignmentInBytes == Universe::narrow_klass_shift(), "decode alg wrong"); 4104 assert (LogKlassAlignmentInBytes == Universe::narrow_klass_shift(), "decode alg wrong");
4105 srlx(r, LogKlassAlignmentInBytes, r); 4105 srlx(r, LogKlassAlignmentInBytes, r);
4106 } 4106 }
4107 reinit_heapbase(); 4107 reinit_heapbase();
4108 } else {
4109 assert (LogKlassAlignmentInBytes == Universe::narrow_klass_shift() || Universe::narrow_klass_shift() == 0, "decode alg wrong");
4110 srlx(r, Universe::narrow_klass_shift(), r);
4111 }
4108 } 4112 }
4109 4113
4110 void MacroAssembler::encode_klass_not_null(Register src, Register dst) { 4114 void MacroAssembler::encode_klass_not_null(Register src, Register dst) {
4111 if (src == dst) { 4115 if (src == dst) {
4112 encode_klass_not_null(src); 4116 encode_klass_not_null(src);
4113 } else { 4117 } else {
4114 assert (UseCompressedClassPointers, "must be compressed"); 4118 assert (UseCompressedClassPointers, "must be compressed");
4115 assert(Universe::narrow_klass_base() != NULL, "narrow_klass_base should be initialized"); 4119 if (Universe::narrow_klass_base() != NULL) {
4116 set((intptr_t)Universe::narrow_klass_base(), dst); 4120 set((intptr_t)Universe::narrow_klass_base(), dst);
4117 sub(src, dst, dst); 4121 sub(src, dst, dst);
4118 if (Universe::narrow_klass_shift() != 0) { 4122 if (Universe::narrow_klass_shift() != 0) {
4119 srlx(dst, LogKlassAlignmentInBytes, dst); 4123 srlx(dst, LogKlassAlignmentInBytes, dst);
4124 }
4125 } else {
4126 // shift src into dst
4127 assert (LogKlassAlignmentInBytes == Universe::narrow_klass_shift() || Universe::narrow_klass_shift() == 0, "decode alg wrong");
4128 srlx(src, Universe::narrow_klass_shift(), dst);
4120 } 4129 }
4121 } 4130 }
4122 } 4131 }
4123 4132
4124 // Function instr_size_for_decode_klass_not_null() counts the instructions 4133 // Function instr_size_for_decode_klass_not_null() counts the instructions
4125 // generated by decode_klass_not_null() and reinit_heapbase(). Hence, if 4134 // generated by decode_klass_not_null() and reinit_heapbase(). Hence, if
4126 // the instructions they generate change, then this method needs to be updated. 4135 // the instructions they generate change, then this method needs to be updated.
4127 int MacroAssembler::instr_size_for_decode_klass_not_null() { 4136 int MacroAssembler::instr_size_for_decode_klass_not_null() {
4128 assert (UseCompressedClassPointers, "only for compressed klass ptrs"); 4137 assert (UseCompressedClassPointers, "only for compressed klass ptrs");
4129 // set + add + set 4138 int num_instrs = 1; // shift src,dst or add
4130 int num_instrs = insts_for_internal_set((intptr_t)Universe::narrow_klass_base()) + 1 + 4139 if (Universe::narrow_klass_base() != NULL) {
4131 insts_for_internal_set((intptr_t)Universe::narrow_ptrs_base()); 4140 // set + add + set
4132 if (Universe::narrow_klass_shift() == 0) { 4141 num_instrs += insts_for_internal_set((intptr_t)Universe::narrow_klass_base()) +
4133 return num_instrs * BytesPerInstWord; 4142 insts_for_internal_set((intptr_t)Universe::narrow_ptrs_base());
4134 } else { // sllx 4143 if (Universe::narrow_klass_shift() != 0) {
4135 return (num_instrs + 1) * BytesPerInstWord; 4144 num_instrs += 1; // sllx
4136 } 4145 }
4146 }
4147 return num_instrs * BytesPerInstWord;
4137 } 4148 }
4138 4149
4139 // !!! If the instructions that get generated here change then function 4150 // !!! If the instructions that get generated here change then function
4140 // instr_size_for_decode_klass_not_null() needs to get updated. 4151 // instr_size_for_decode_klass_not_null() needs to get updated.
4141 void MacroAssembler::decode_klass_not_null(Register r) { 4152 void MacroAssembler::decode_klass_not_null(Register r) {
4142 // Do not add assert code to this unless you change vtableStubs_sparc.cpp 4153 // Do not add assert code to this unless you change vtableStubs_sparc.cpp
4143 // pd_code_size_limit. 4154 // pd_code_size_limit.
4144 assert (UseCompressedClassPointers, "must be compressed"); 4155 assert (UseCompressedClassPointers, "must be compressed");
4145 assert(Universe::narrow_klass_base() != NULL, "narrow_klass_base should be initialized"); 4156 if (Universe::narrow_klass_base() != NULL) {
4146 assert(r != G6_heapbase, "bad register choice"); 4157 assert(r != G6_heapbase, "bad register choice");
4147 set((intptr_t)Universe::narrow_klass_base(), G6_heapbase); 4158 set((intptr_t)Universe::narrow_klass_base(), G6_heapbase);
4148 if (Universe::narrow_klass_shift() != 0) 4159 if (Universe::narrow_klass_shift() != 0)
4149 sllx(r, LogKlassAlignmentInBytes, r); 4160 sllx(r, LogKlassAlignmentInBytes, r);
4150 add(r, G6_heapbase, r); 4161 add(r, G6_heapbase, r);
4151 reinit_heapbase(); 4162 reinit_heapbase();
4163 } else {
4164 assert (LogKlassAlignmentInBytes == Universe::narrow_klass_shift() || Universe::narrow_klass_shift() == 0, "decode alg wrong");
4165 sllx(r, Universe::narrow_klass_shift(), r);
4166 }
4152 } 4167 }
4153 4168
4154 void MacroAssembler::decode_klass_not_null(Register src, Register dst) { 4169 void MacroAssembler::decode_klass_not_null(Register src, Register dst) {
4155 if (src == dst) { 4170 if (src == dst) {
4156 decode_klass_not_null(src); 4171 decode_klass_not_null(src);
4157 } else { 4172 } else {
4158 // Do not add assert code to this unless you change vtableStubs_sparc.cpp 4173 // Do not add assert code to this unless you change vtableStubs_sparc.cpp
4159 // pd_code_size_limit. 4174 // pd_code_size_limit.
4160 assert (UseCompressedClassPointers, "must be compressed"); 4175 assert (UseCompressedClassPointers, "must be compressed");
4161 assert(Universe::narrow_klass_base() != NULL, "narrow_klass_base should be initialized"); 4176 if (Universe::narrow_klass_base() != NULL) {
4162 if (Universe::narrow_klass_shift() != 0) { 4177 if (Universe::narrow_klass_shift() != 0) {
4163 assert((src != G6_heapbase) && (dst != G6_heapbase), "bad register choice"); 4178 assert((src != G6_heapbase) && (dst != G6_heapbase), "bad register choice");
4164 set((intptr_t)Universe::narrow_klass_base(), G6_heapbase); 4179 set((intptr_t)Universe::narrow_klass_base(), G6_heapbase);
4165 sllx(src, LogKlassAlignmentInBytes, dst); 4180 sllx(src, LogKlassAlignmentInBytes, dst);
4166 add(dst, G6_heapbase, dst); 4181 add(dst, G6_heapbase, dst);
4167 reinit_heapbase(); 4182 reinit_heapbase();
4183 } else {
4184 set((intptr_t)Universe::narrow_klass_base(), dst);
4185 add(src, dst, dst);
4186 }
4168 } else { 4187 } else {
4169 set((intptr_t)Universe::narrow_klass_base(), dst); 4188 // shift/mov src into dst.
4170 add(src, dst, dst); 4189 assert (LogKlassAlignmentInBytes == Universe::narrow_klass_shift() || Universe::narrow_klass_shift() == 0, "decode alg wrong");
4190 sllx(src, Universe::narrow_klass_shift(), dst);
4171 } 4191 }
4172 } 4192 }
4173 } 4193 }
4174 4194
4175 void MacroAssembler::reinit_heapbase() { 4195 void MacroAssembler::reinit_heapbase() {