// 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 cp_cache_delta() { // How many cp cache entries were added since recording map limits after // cp cache initialization? assert(_first_iteration_cp_cache_limit != -1, "only valid after first iteration"); return _cp_cache_map.length() - _first_iteration_cp_cache_limit; }
void record_map_limits() { // Record initial size of the two arrays generated for the CP cache // relative to walking the constant pool. _first_iteration_cp_cache_limit = _cp_cache_map.length(); _resolved_reference_limit = _resolved_references_map.length(); }
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; }