int Bytecode_loadconstant::pool_index() const { int index = raw_index(); if (has_cache_index()) { return _method->constants()->object_to_cp_index(index); } return index; }
// ------------------------------------------------------------------ // ciBytecodeStream::get_constant_pool_index // Decode any CP cache index into a regular pool index. int ciBytecodeStream::get_constant_pool_index() const { // work-alike for Bytecode_loadconstant::pool_index() int index = get_constant_raw_index(); if (has_cache_index()) { return get_cpcache()->get_pool_index(index); } return index; }
oop Bytecode_loadconstant::resolve_constant(TRAPS) const { assert(_method.not_null(), "must supply method to resolve constant"); int index = raw_index(); ConstantPool* constants = _method->constants(); if (has_cache_index()) { return constants->resolve_cached_constant_at(index, THREAD); } else { return constants->resolve_constant_at(index, THREAD); } }
// ------------------------------------------------------------------ // ciBytecodeStream::get_constant // // If this bytecode is one of the ldc variants, get the referenced // constant. ciConstant ciBytecodeStream::get_constant() { int pool_index = get_constant_raw_index(); int cache_index = -1; if (has_cache_index()) { cache_index = pool_index; pool_index = -1; } VM_ENTRY_MARK; constantPoolHandle cpool(_method->get_methodOop()->constants()); return CURRENT_ENV->get_constant_by_index(cpool, pool_index, cache_index, _holder); }
// ------------------------------------------------------------------ // ciBytecodeStream::get_constant_cache_index // Return the CP cache index, or -1 if there isn't any. int ciBytecodeStream::get_constant_cache_index() const { // work-alike for Bytecode_loadconstant::cache_index() return has_cache_index() ? get_constant_raw_index() : -1; }
// Get a byte index following this bytecode. // If prefixed with a wide bytecode, get a wide index. int get_index() const { assert(!has_cache_index(), "else use cpcache variant"); return (_pc == _was_wide) // was widened? ? get_index_u2(true) // yes, return wide index : get_index_u1(); // no, return narrow index }