Top


定義場所(file name)

hotspot/src/share/vm/oops/cpCacheOop.cpp

説明(description)

なお, 各引数の意味は以下の通り.

    Bytecodes::Code get_code,                    // the bytecode used for reading the field
    Bytecodes::Code put_code,                    // the bytecode used for writing the field
    KlassHandle     field_holder,                // the object/klass holding the field
    int             orig_field_index,            // the original field index in the field holder
    int             field_offset,                // the field offset in words in the field holder
    TosState        field_type,                  // the (machine) field type
    bool            is_final,                     // the field is final
    bool            is_volatile                  // the field is volatile
// Note that concurrent update of both bytecodes can leave one of them
// reset to zero.  This is harmless; the interpreter will simply re-resolve
// the damaged entry.  More seriously, the memory synchronization is needed
// to flush other fields (f1, f2) completely to memory before the bytecodes
// are updated, lest other processors see a non-zero bytecode but zero f1/f2.

名前(function name)

void ConstantPoolCacheEntry::set_field(Bytecodes::Code get_code,
                                       Bytecodes::Code put_code,
                                       KlassHandle field_holder,
                                       int orig_field_index,
                                       int field_offset,
                                       TosState field_type,
                                       bool is_final,
                                       bool is_volatile) {

本体部(body)

  {- -------------------------------------------
  (1) (参考: 以下のような値が入るべき
      // _indices = get (b1 section) and put (b2 section) bytecodes, original constant pool index
      // _f1      = field holder
      // _f2      = field offset in words
      // _flags   = field type information, original field index in field holder
      //            (field_index section))
      ---------------------------------------- -}

  {- -------------------------------------------
  (1) _f1 を設定 (holder の java_mirror)
      ---------------------------------------- -}

      set_f1(field_holder()->java_mirror());

  {- -------------------------------------------
  (1) _f2 を設定 (field offset)
      ---------------------------------------- -}

      set_f2(field_offset);

  {- -------------------------------------------
  (1) _flags を設定 (型情報)
      ---------------------------------------- -}

      // The field index is used by jvm/ti and is the index into fields() array
      // in holder instanceKlass.  This is scaled by instanceKlass::next_offset.
      assert((orig_field_index % instanceKlass::next_offset) == 0, "wierd index");
      const int field_index = orig_field_index / instanceKlass::next_offset;
      assert(field_index <= field_index_mask,
             "field index does not fit in low flag bits");
      set_flags(as_flags(field_type, is_final, false, is_volatile, false, false) |
                (field_index & field_index_mask));

  {- -------------------------------------------
  (1) _indices を設定
      (_indices は set_bytecode_1(), set_bytecode_2() で設定)
      ---------------------------------------- -}

      set_bytecode_1(get_code);
      set_bytecode_2(put_code);
      NOT_PRODUCT(verify(tty));
    }

This document is available under the GNU GENERAL PUBLIC LICENSE Version 2.