int add_cp_cache_entry(int cp_index) { assert((cp_index & _secondary_entry_tag) == 0, "bad tag"); assert(_cp_map[cp_index] == -1, "not twice on same cp_index"); int cache_index = _cp_cache_map.append(cp_index); _cp_map.at_put(cp_index, cache_index); assert(cp_entry_to_cp_cache(cp_index) == cache_index, ""); return cache_index; }
int add_invokedynamic_cp_cache_entry(int cp_index) { assert(_pool->tag_at(cp_index).value() == JVM_CONSTANT_InvokeDynamic, "use non-indy version"); assert(_first_iteration_cp_cache_limit >= 0, "add indy cache entries after first iteration"); // add to the invokedynamic index map. int cache_index = _invokedynamic_cp_cache_map.append(cp_index); // do not update _cp_map, since the mapping is one-to-many assert(invokedynamic_cp_cache_entry_pool_index(cache_index) == cp_index, ""); // this index starts at one but in the bytecode it's appended to the end. return cache_index + _first_iteration_cp_cache_limit; }
// add a new entries to the resolved_references map (for invokedynamic and invokehandle only) int add_invokedynamic_resolved_references_entries(int cp_index, int cache_index) { assert(_resolved_reference_limit >= 0, "must add indy refs after first iteration"); int ref_index = -1; for (int entry = 0; entry < ConstantPoolCacheEntry::_indy_resolved_references_entries; entry++) { const int index = _resolved_references_map.append(cp_index); // many-to-one assert(index >= _resolved_reference_limit, ""); if (entry == 0) { ref_index = index; } assert((index - entry) == ref_index, "entries must be consecutive"); _invokedynamic_references_map.at_put_grow(index, cache_index, -1); } return ref_index; }
// add a new CP cache entry beyond the normal cache for the special case of // invokespecial with InterfaceMethodref as cpool operand. int add_invokespecial_cp_cache_entry(int cp_index) { assert(_first_iteration_cp_cache_limit >= 0, "add these special cache entries after first iteration"); // Don't add InterfaceMethodref if it already exists at the end. for (int i = _first_iteration_cp_cache_limit; i < _cp_cache_map.length(); i++) { if (cp_cache_entry_pool_index(i) == cp_index) { return i; } } int cache_index = _cp_cache_map.append(cp_index); assert(cache_index >= _first_iteration_cp_cache_limit, ""); // do not update _cp_map, since the mapping is one-to-many assert(cp_cache_entry_pool_index(cache_index) == cp_index, ""); return cache_index; }
int add_secondary_cp_cache_entry(int main_cpc_entry) { assert(main_cpc_entry < _cp_cache_map.length(), "must be earlier CP cache entry"); int cache_index = _cp_cache_map.append(main_cpc_entry | _secondary_entry_tag); return cache_index; }