331 int constant_pool_index() const { return (indices() & cp_index_mask); } 332 Bytecodes::Code bytecode_1() const { return Bytecodes::cast((indices_ord() >> bytecode_1_shift) & bytecode_1_mask); } 333 Bytecodes::Code bytecode_2() const { return Bytecodes::cast((indices_ord() >> bytecode_2_shift) & bytecode_2_mask); } 334 Metadata* f1_ord() const { return (Metadata *)OrderAccess::load_ptr_acquire(&_f1); } 335 Method* f1_as_method() const { Metadata* f1 = f1_ord(); assert(f1 == NULL || f1->is_method(), ""); return (Method*)f1; } 336 Klass* f1_as_klass() const { Metadata* f1 = f1_ord(); assert(f1 == NULL || f1->is_klass(), ""); return (Klass*)f1; } 337 // Use the accessor f1() to acquire _f1's value. This is needed for 338 // example in BytecodeInterpreter::run(), where is_f1_null() is 339 // called to check if an invokedynamic call is resolved. This load 340 // of _f1 must be ordered with the loads performed by 341 // cache->main_entry_index(). 342 bool is_f1_null() const { Metadata* f1 = f1_ord(); return f1 == NULL; } // classifies a CPC entry as unbound 343 int f2_as_index() const { assert(!is_vfinal(), ""); return (int) _f2; } 344 Method* f2_as_vfinal_method() const { assert(is_vfinal(), ""); return (Method*)_f2; } 345 int field_index() const { assert(is_field_entry(), ""); return (_flags & field_index_mask); } 346 int parameter_size() const { assert(is_method_entry(), ""); return (_flags & parameter_size_mask); } 347 bool is_volatile() const { return (_flags & (1 << is_volatile_shift)) != 0; } 348 bool is_final() const { return (_flags & (1 << is_final_shift)) != 0; } 349 bool is_forced_virtual() const { return (_flags & (1 << is_forced_virtual_shift)) != 0; } 350 bool is_vfinal() const { return (_flags & (1 << is_vfinal_shift)) != 0; } 351 bool has_appendix() const { return (_flags & (1 << has_appendix_shift)) != 0; } 352 bool has_method_type() const { return (_flags & (1 << has_method_type_shift)) != 0; } 353 bool is_method_entry() const { return (_flags & (1 << is_field_entry_shift)) == 0; } 354 bool is_field_entry() const { return (_flags & (1 << is_field_entry_shift)) != 0; } 355 bool is_byte() const { return flag_state() == btos; } 356 bool is_char() const { return flag_state() == ctos; } 357 bool is_short() const { return flag_state() == stos; } 358 bool is_int() const { return flag_state() == itos; } 359 bool is_long() const { return flag_state() == ltos; } 360 bool is_float() const { return flag_state() == ftos; } 361 bool is_double() const { return flag_state() == dtos; } 362 bool is_object() const { return flag_state() == atos; } 363 TosState flag_state() const { assert((uint)number_of_states <= (uint)tos_state_mask+1, ""); 364 return (TosState)((_flags >> tos_state_shift) & tos_state_mask); } 365 366 // Code generation support 367 static WordSize size() { return in_WordSize(sizeof(ConstantPoolCacheEntry) / HeapWordSize); } 368 static ByteSize size_in_bytes() { return in_ByteSize(sizeof(ConstantPoolCacheEntry)); } 369 static ByteSize indices_offset() { return byte_offset_of(ConstantPoolCacheEntry, _indices); } 370 static ByteSize f1_offset() { return byte_offset_of(ConstantPoolCacheEntry, _f1); } 371 static ByteSize f2_offset() { return byte_offset_of(ConstantPoolCacheEntry, _f2); } 372 static ByteSize flags_offset() { return byte_offset_of(ConstantPoolCacheEntry, _flags); } | 331 int constant_pool_index() const { return (indices() & cp_index_mask); } 332 Bytecodes::Code bytecode_1() const { return Bytecodes::cast((indices_ord() >> bytecode_1_shift) & bytecode_1_mask); } 333 Bytecodes::Code bytecode_2() const { return Bytecodes::cast((indices_ord() >> bytecode_2_shift) & bytecode_2_mask); } 334 Metadata* f1_ord() const { return (Metadata *)OrderAccess::load_ptr_acquire(&_f1); } 335 Method* f1_as_method() const { Metadata* f1 = f1_ord(); assert(f1 == NULL || f1->is_method(), ""); return (Method*)f1; } 336 Klass* f1_as_klass() const { Metadata* f1 = f1_ord(); assert(f1 == NULL || f1->is_klass(), ""); return (Klass*)f1; } 337 // Use the accessor f1() to acquire _f1's value. This is needed for 338 // example in BytecodeInterpreter::run(), where is_f1_null() is 339 // called to check if an invokedynamic call is resolved. This load 340 // of _f1 must be ordered with the loads performed by 341 // cache->main_entry_index(). 342 bool is_f1_null() const { Metadata* f1 = f1_ord(); return f1 == NULL; } // classifies a CPC entry as unbound 343 int f2_as_index() const { assert(!is_vfinal(), ""); return (int) _f2; } 344 Method* f2_as_vfinal_method() const { assert(is_vfinal(), ""); return (Method*)_f2; } 345 int field_index() const { assert(is_field_entry(), ""); return (_flags & field_index_mask); } 346 int parameter_size() const { assert(is_method_entry(), ""); return (_flags & parameter_size_mask); } 347 bool is_volatile() const { return (_flags & (1 << is_volatile_shift)) != 0; } 348 bool is_final() const { return (_flags & (1 << is_final_shift)) != 0; } 349 bool is_forced_virtual() const { return (_flags & (1 << is_forced_virtual_shift)) != 0; } 350 bool is_vfinal() const { return (_flags & (1 << is_vfinal_shift)) != 0; } 351 bool has_appendix() const { return (!is_f1_null()) && (_flags & (1 << has_appendix_shift)) != 0; } 352 bool has_method_type() const { return (!is_f1_null()) && (_flags & (1 << has_method_type_shift)) != 0; } 353 bool is_method_entry() const { return (_flags & (1 << is_field_entry_shift)) == 0; } 354 bool is_field_entry() const { return (_flags & (1 << is_field_entry_shift)) != 0; } 355 bool is_byte() const { return flag_state() == btos; } 356 bool is_char() const { return flag_state() == ctos; } 357 bool is_short() const { return flag_state() == stos; } 358 bool is_int() const { return flag_state() == itos; } 359 bool is_long() const { return flag_state() == ltos; } 360 bool is_float() const { return flag_state() == ftos; } 361 bool is_double() const { return flag_state() == dtos; } 362 bool is_object() const { return flag_state() == atos; } 363 TosState flag_state() const { assert((uint)number_of_states <= (uint)tos_state_mask+1, ""); 364 return (TosState)((_flags >> tos_state_shift) & tos_state_mask); } 365 366 // Code generation support 367 static WordSize size() { return in_WordSize(sizeof(ConstantPoolCacheEntry) / HeapWordSize); } 368 static ByteSize size_in_bytes() { return in_ByteSize(sizeof(ConstantPoolCacheEntry)); } 369 static ByteSize indices_offset() { return byte_offset_of(ConstantPoolCacheEntry, _indices); } 370 static ByteSize f1_offset() { return byte_offset_of(ConstantPoolCacheEntry, _f1); } 371 static ByteSize f2_offset() { return byte_offset_of(ConstantPoolCacheEntry, _f2); } 372 static ByteSize flags_offset() { return byte_offset_of(ConstantPoolCacheEntry, _flags); } |