comparison src/cpu/x86/vm/interp_masm_x86_64.cpp @ 1565:ab102d5d923e

6939207: refactor constant pool index processing Summary: Factored cleanup of instruction decode which prepares for enhanced ldc semantics. Reviewed-by: twisti
author jrose
date Sun, 23 May 2010 01:38:26 -0700
parents 2338d41fbd81
children e9ff18c4ace7
comparison
equal deleted inserted replaced
1564:61b2245abf36 1565:ab102d5d923e
185 } 185 }
186 186
187 187
188 void InterpreterMacroAssembler::get_cache_index_at_bcp(Register index, 188 void InterpreterMacroAssembler::get_cache_index_at_bcp(Register index,
189 int bcp_offset, 189 int bcp_offset,
190 bool giant_index) { 190 size_t index_size) {
191 assert(bcp_offset > 0, "bcp is still pointing to start of bytecode"); 191 assert(bcp_offset > 0, "bcp is still pointing to start of bytecode");
192 if (!giant_index) { 192 if (index_size == sizeof(u2)) {
193 load_unsigned_short(index, Address(r13, bcp_offset)); 193 load_unsigned_short(index, Address(r13, bcp_offset));
194 } else { 194 } else if (index_size == sizeof(u4)) {
195 assert(EnableInvokeDynamic, "giant index used only for EnableInvokeDynamic"); 195 assert(EnableInvokeDynamic, "giant index used only for EnableInvokeDynamic");
196 movl(index, Address(r13, bcp_offset)); 196 movl(index, Address(r13, bcp_offset));
197 // Check if the secondary index definition is still ~x, otherwise 197 // Check if the secondary index definition is still ~x, otherwise
198 // we have to change the following assembler code to calculate the 198 // we have to change the following assembler code to calculate the
199 // plain index. 199 // plain index.
200 assert(constantPoolCacheOopDesc::decode_secondary_index(~123) == 123, "else change next line"); 200 assert(constantPoolCacheOopDesc::decode_secondary_index(~123) == 123, "else change next line");
201 notl(index); // convert to plain index 201 notl(index); // convert to plain index
202 } else if (index_size == sizeof(u1)) {
203 assert(EnableMethodHandles, "tiny index used only for EnableMethodHandles");
204 load_unsigned_byte(index, Address(r13, bcp_offset));
205 } else {
206 ShouldNotReachHere();
202 } 207 }
203 } 208 }
204 209
205 210
206 void InterpreterMacroAssembler::get_cache_and_index_at_bcp(Register cache, 211 void InterpreterMacroAssembler::get_cache_and_index_at_bcp(Register cache,
207 Register index, 212 Register index,
208 int bcp_offset, 213 int bcp_offset,
209 bool giant_index) { 214 size_t index_size) {
210 assert(cache != index, "must use different registers"); 215 assert(cache != index, "must use different registers");
211 get_cache_index_at_bcp(index, bcp_offset, giant_index); 216 get_cache_index_at_bcp(index, bcp_offset, index_size);
212 movptr(cache, Address(rbp, frame::interpreter_frame_cache_offset * wordSize)); 217 movptr(cache, Address(rbp, frame::interpreter_frame_cache_offset * wordSize));
213 assert(sizeof(ConstantPoolCacheEntry) == 4 * wordSize, "adjust code below"); 218 assert(sizeof(ConstantPoolCacheEntry) == 4 * wordSize, "adjust code below");
214 // convert from field index to ConstantPoolCacheEntry index 219 // convert from field index to ConstantPoolCacheEntry index
215 shll(index, 2); 220 shll(index, 2);
216 } 221 }
217 222
218 223
219 void InterpreterMacroAssembler::get_cache_entry_pointer_at_bcp(Register cache, 224 void InterpreterMacroAssembler::get_cache_entry_pointer_at_bcp(Register cache,
220 Register tmp, 225 Register tmp,
221 int bcp_offset, 226 int bcp_offset,
222 bool giant_index) { 227 size_t index_size) {
223 assert(cache != tmp, "must use different register"); 228 assert(cache != tmp, "must use different register");
224 get_cache_index_at_bcp(tmp, bcp_offset, giant_index); 229 get_cache_index_at_bcp(tmp, bcp_offset, index_size);
225 assert(sizeof(ConstantPoolCacheEntry) == 4 * wordSize, "adjust code below"); 230 assert(sizeof(ConstantPoolCacheEntry) == 4 * wordSize, "adjust code below");
226 // convert from field index to ConstantPoolCacheEntry index 231 // convert from field index to ConstantPoolCacheEntry index
227 // and from word offset to byte offset 232 // and from word offset to byte offset
228 shll(tmp, 2 + LogBytesPerWord); 233 shll(tmp, 2 + LogBytesPerWord);
229 movptr(cache, Address(rbp, frame::interpreter_frame_cache_offset * wordSize)); 234 movptr(cache, Address(rbp, frame::interpreter_frame_cache_offset * wordSize));