本文整理汇总了C++中ConstantPool::length方法的典型用法代码示例。如果您正苦于以下问题:C++ ConstantPool::length方法的具体用法?C++ ConstantPool::length怎么用?C++ ConstantPool::length使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConstantPool
的用法示例。
在下文中一共展示了ConstantPool::length方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: check_index
bool BytecodePrinter::check_index(int i, int& cp_index, outputStream* st) {
ConstantPool* constants = method()->constants();
int ilimit = constants->length();
Bytecodes::Code code = raw_code();
ConstantPoolCache* cache = NULL;
if (Bytecodes::uses_cp_cache(code)) {
bool okay = true;
switch (code) {
case Bytecodes::_fast_aldc:
case Bytecodes::_fast_aldc_w:
okay = check_obj_index(i, cp_index, st);
break;
case Bytecodes::_invokedynamic:
okay = check_invokedynamic_index(i, cp_index, st);
break;
default:
okay = check_cp_cache_index(i, cp_index, st);
break;
}
if (!okay) return false;
}
// check cp index
if (cp_index >= 0 && cp_index < ilimit) {
if (WizardMode) st->print(" cp[%d]", cp_index);
return true;
}
st->print_cr(" CP[%d] not in CP", cp_index);
return false;
}
示例2: check_cp_cache_index
bool BytecodePrinter::check_cp_cache_index(int i, int& cp_index, outputStream* st) {
ConstantPool* constants = method()->constants();
int ilimit = constants->length(), climit = 0;
Bytecodes::Code code = raw_code();
ConstantPoolCache* cache = constants->cache();
// If rewriter hasn't run, the index is the cp_index
if (cache == NULL) {
cp_index = i;
return true;
}
//climit = cache->length(); // %%% private!
size_t size = cache->size() * HeapWordSize;
size -= sizeof(ConstantPoolCache);
size /= sizeof(ConstantPoolCacheEntry);
climit = (int) size;
#ifdef ASSERT
{
const int CPCACHE_INDEX_TAG = ConstantPool::CPCACHE_INDEX_TAG;
if (i >= CPCACHE_INDEX_TAG && i < climit + CPCACHE_INDEX_TAG) {
i -= CPCACHE_INDEX_TAG;
} else {
st->print_cr(" CP[%d] missing bias?", i);
return false;
}
}
#endif //ASSERT
if (i >= 0 && i < climit) {
cp_index = cache->entry_at(i)->constant_pool_index();
} else {
st->print_cr(" not in CP[*]?", i);
return false;
}
return true;
}