247 if (WizardMode) st->print(" cp[%d]", cp_index);
248 return true;
249 }
250
251 st->print_cr(" CP[%d] not in CP", cp_index);
252 return false;
253 }
254
255 bool BytecodePrinter::check_cp_cache_index(int i, int& cp_index, outputStream* st) {
256 ConstantPool* constants = method()->constants();
257 int ilimit = constants->length(), climit = 0;
258 Bytecodes::Code code = raw_code();
259
260 ConstantPoolCache* cache = constants->cache();
261 // If rewriter hasn't run, the index is the cp_index
262 if (cache == NULL) {
263 cp_index = i;
264 return true;
265 }
266 //climit = cache->length(); // %%% private!
267 size_t size = cache->size() * HeapWordSize;
268 size -= sizeof(ConstantPoolCache);
269 size /= sizeof(ConstantPoolCacheEntry);
270 climit = (int) size;
271
272 #ifdef ASSERT
273 {
274 const int CPCACHE_INDEX_TAG = ConstantPool::CPCACHE_INDEX_TAG;
275 if (i >= CPCACHE_INDEX_TAG && i < climit + CPCACHE_INDEX_TAG) {
276 i -= CPCACHE_INDEX_TAG;
277 } else {
278 st->print_cr(" CP[%d] missing bias?", i);
279 return false;
280 }
281 }
282 #endif //ASSERT
283 if (i >= 0 && i < climit) {
284 cp_index = cache->entry_at(i)->constant_pool_index();
285 } else {
286 st->print_cr("%d not in CP[*]?", i);
287 return false;
|
247 if (WizardMode) st->print(" cp[%d]", cp_index);
248 return true;
249 }
250
251 st->print_cr(" CP[%d] not in CP", cp_index);
252 return false;
253 }
254
255 bool BytecodePrinter::check_cp_cache_index(int i, int& cp_index, outputStream* st) {
256 ConstantPool* constants = method()->constants();
257 int ilimit = constants->length(), climit = 0;
258 Bytecodes::Code code = raw_code();
259
260 ConstantPoolCache* cache = constants->cache();
261 // If rewriter hasn't run, the index is the cp_index
262 if (cache == NULL) {
263 cp_index = i;
264 return true;
265 }
266 //climit = cache->length(); // %%% private!
267 size_t size = cache->size() * wordSize;
268 size -= sizeof(ConstantPoolCache);
269 size /= sizeof(ConstantPoolCacheEntry);
270 climit = (int) size;
271
272 #ifdef ASSERT
273 {
274 const int CPCACHE_INDEX_TAG = ConstantPool::CPCACHE_INDEX_TAG;
275 if (i >= CPCACHE_INDEX_TAG && i < climit + CPCACHE_INDEX_TAG) {
276 i -= CPCACHE_INDEX_TAG;
277 } else {
278 st->print_cr(" CP[%d] missing bias?", i);
279 return false;
280 }
281 }
282 #endif //ASSERT
283 if (i >= 0 && i < climit) {
284 cp_index = cache->entry_at(i)->constant_pool_index();
285 } else {
286 st->print_cr("%d not in CP[*]?", i);
287 return false;
|