315 case Bytecodes::_invokeinterface : return 1;
316 case Bytecodes::_putstatic : // fall through
317 case Bytecodes::_putfield : // fall through
318 case Bytecodes::_invokevirtual : return 2;
319 default : break;
320 }
321 return -1;
322 }
323
324 // Has this bytecode been resolved? Only valid for invokes and get/put field/static.
325 bool is_resolved(Bytecodes::Code code) const {
326 switch (bytecode_number(code)) {
327 case 1: return (bytecode_1() == code);
328 case 2: return (bytecode_2() == code);
329 }
330 return false; // default: not resolved
331 }
332
333 // Accessors
334 int indices() const { return _indices; }
335 int indices_ord() const { return (intx)OrderAccess::load_ptr_acquire(&_indices); }
336 int constant_pool_index() const { return (indices() & cp_index_mask); }
337 Bytecodes::Code bytecode_1() const { return Bytecodes::cast((indices_ord() >> bytecode_1_shift) & bytecode_1_mask); }
338 Bytecodes::Code bytecode_2() const { return Bytecodes::cast((indices_ord() >> bytecode_2_shift) & bytecode_2_mask); }
339 Metadata* f1_ord() const { return (Metadata *)OrderAccess::load_ptr_acquire(&_f1); }
340 Method* f1_as_method() const { Metadata* f1 = f1_ord(); assert(f1 == NULL || f1->is_method(), ""); return (Method*)f1; }
341 Klass* f1_as_klass() const { Metadata* f1 = f1_ord(); assert(f1 == NULL || f1->is_klass(), ""); return (Klass*)f1; }
342 // Use the accessor f1() to acquire _f1's value. This is needed for
343 // example in BytecodeInterpreter::run(), where is_f1_null() is
344 // called to check if an invokedynamic call is resolved. This load
345 // of _f1 must be ordered with the loads performed by
346 // cache->main_entry_index().
347 bool is_f1_null() const { Metadata* f1 = f1_ord(); return f1 == NULL; } // classifies a CPC entry as unbound
348 int f2_as_index() const { assert(!is_vfinal(), ""); return (int) _f2; }
349 Method* f2_as_vfinal_method() const { assert(is_vfinal(), ""); return (Method*)_f2; }
350 int field_index() const { assert(is_field_entry(), ""); return (_flags & field_index_mask); }
351 int parameter_size() const { assert(is_method_entry(), ""); return (_flags & parameter_size_mask); }
352 bool is_volatile() const { return (_flags & (1 << is_volatile_shift)) != 0; }
353 bool is_final() const { return (_flags & (1 << is_final_shift)) != 0; }
354 bool is_forced_virtual() const { return (_flags & (1 << is_forced_virtual_shift)) != 0; }
355 bool is_vfinal() const { return (_flags & (1 << is_vfinal_shift)) != 0; }
356 bool has_appendix() const { return (!is_f1_null()) && (_flags & (1 << has_appendix_shift)) != 0; }
357 bool has_method_type() const { return (!is_f1_null()) && (_flags & (1 << has_method_type_shift)) != 0; }
358 bool is_method_entry() const { return (_flags & (1 << is_field_entry_shift)) == 0; }
359 bool is_field_entry() const { return (_flags & (1 << is_field_entry_shift)) != 0; }
|
315 case Bytecodes::_invokeinterface : return 1;
316 case Bytecodes::_putstatic : // fall through
317 case Bytecodes::_putfield : // fall through
318 case Bytecodes::_invokevirtual : return 2;
319 default : break;
320 }
321 return -1;
322 }
323
324 // Has this bytecode been resolved? Only valid for invokes and get/put field/static.
325 bool is_resolved(Bytecodes::Code code) const {
326 switch (bytecode_number(code)) {
327 case 1: return (bytecode_1() == code);
328 case 2: return (bytecode_2() == code);
329 }
330 return false; // default: not resolved
331 }
332
333 // Accessors
334 int indices() const { return _indices; }
335 int indices_ord() const { return OrderAccess::load_acquire(&_indices); }
336 int constant_pool_index() const { return (indices() & cp_index_mask); }
337 Bytecodes::Code bytecode_1() const { return Bytecodes::cast((indices_ord() >> bytecode_1_shift) & bytecode_1_mask); }
338 Bytecodes::Code bytecode_2() const { return Bytecodes::cast((indices_ord() >> bytecode_2_shift) & bytecode_2_mask); }
339 Metadata* f1_ord() const { return (Metadata *)OrderAccess::load_acquire(&_f1); }
340 Method* f1_as_method() const { Metadata* f1 = f1_ord(); assert(f1 == NULL || f1->is_method(), ""); return (Method*)f1; }
341 Klass* f1_as_klass() const { Metadata* f1 = f1_ord(); assert(f1 == NULL || f1->is_klass(), ""); return (Klass*)f1; }
342 // Use the accessor f1() to acquire _f1's value. This is needed for
343 // example in BytecodeInterpreter::run(), where is_f1_null() is
344 // called to check if an invokedynamic call is resolved. This load
345 // of _f1 must be ordered with the loads performed by
346 // cache->main_entry_index().
347 bool is_f1_null() const { Metadata* f1 = f1_ord(); return f1 == NULL; } // classifies a CPC entry as unbound
348 int f2_as_index() const { assert(!is_vfinal(), ""); return (int) _f2; }
349 Method* f2_as_vfinal_method() const { assert(is_vfinal(), ""); return (Method*)_f2; }
350 int field_index() const { assert(is_field_entry(), ""); return (_flags & field_index_mask); }
351 int parameter_size() const { assert(is_method_entry(), ""); return (_flags & parameter_size_mask); }
352 bool is_volatile() const { return (_flags & (1 << is_volatile_shift)) != 0; }
353 bool is_final() const { return (_flags & (1 << is_final_shift)) != 0; }
354 bool is_forced_virtual() const { return (_flags & (1 << is_forced_virtual_shift)) != 0; }
355 bool is_vfinal() const { return (_flags & (1 << is_vfinal_shift)) != 0; }
356 bool has_appendix() const { return (!is_f1_null()) && (_flags & (1 << has_appendix_shift)) != 0; }
357 bool has_method_type() const { return (!is_f1_null()) && (_flags & (1 << has_method_type_shift)) != 0; }
358 bool is_method_entry() const { return (_flags & (1 << is_field_entry_shift)) == 0; }
359 bool is_field_entry() const { return (_flags & (1 << is_field_entry_shift)) != 0; }
|