7132690: InstanceKlass:_reference_type should be u1 type

Wed, 25 Jan 2012 17:40:51 -0500

author
jiangli
date
Wed, 25 Jan 2012 17:40:51 -0500
changeset 3526
a79cb7c55012
parent 3441
5f3fcd591768
child 3527
f3fa16bd7159

7132690: InstanceKlass:_reference_type should be u1 type
Summary: Change InstanceKlass::_reference_type to u1 type.
Reviewed-by: dholmes, coleenp, acorn
Contributed-by: Jiangli Zhou <jiangli.zhou@oracle.com>

src/cpu/sparc/vm/c1_CodeStubs_sparc.cpp file | annotate | diff | comparison | revisions
src/cpu/x86/vm/c1_CodeStubs_x86.cpp file | annotate | diff | comparison | revisions
src/share/vm/oops/instanceKlass.hpp file | annotate | diff | comparison | revisions
src/share/vm/opto/library_call.cpp file | annotate | diff | comparison | revisions
src/share/vm/runtime/vmStructs.cpp file | annotate | diff | comparison | revisions
     1.1 --- a/src/cpu/sparc/vm/c1_CodeStubs_sparc.cpp	Fri Jan 20 17:07:33 2012 -0800
     1.2 +++ b/src/cpu/sparc/vm/c1_CodeStubs_sparc.cpp	Wed Jan 25 17:40:51 2012 -0500
     1.3 @@ -472,7 +472,7 @@
     1.4    __ load_klass(src_reg, tmp_reg);
     1.5  
     1.6    Address ref_type_adr(tmp_reg, instanceKlass::reference_type_offset());
     1.7 -  __ ld(ref_type_adr, tmp_reg);
     1.8 +  __ ldub(ref_type_adr, tmp_reg);
     1.9  
    1.10    // _reference_type field is of type ReferenceType (enum)
    1.11    assert(REF_NONE == 0, "check this code");
     2.1 --- a/src/cpu/x86/vm/c1_CodeStubs_x86.cpp	Fri Jan 20 17:07:33 2012 -0800
     2.2 +++ b/src/cpu/x86/vm/c1_CodeStubs_x86.cpp	Wed Jan 25 17:40:51 2012 -0500
     2.3 @@ -520,7 +520,7 @@
     2.4    __ load_klass(tmp_reg, src_reg);
     2.5  
     2.6    Address ref_type_adr(tmp_reg, instanceKlass::reference_type_offset());
     2.7 -  __ cmpl(ref_type_adr, REF_NONE);
     2.8 +  __ cmpb(ref_type_adr, REF_NONE);
     2.9    __ jcc(Assembler::equal, _continuation);
    2.10  
    2.11    // Is marking active?
     3.1 --- a/src/share/vm/oops/instanceKlass.hpp	Fri Jan 20 17:07:33 2012 -0800
     3.2 +++ b/src/share/vm/oops/instanceKlass.hpp	Wed Jan 25 17:40:51 2012 -0500
     3.3 @@ -240,7 +240,6 @@
     3.4    Thread*         _init_thread;          // Pointer to current thread doing initialization (to handle recusive initialization)
     3.5    int             _vtable_len;           // length of Java vtable (in words)
     3.6    int             _itable_len;           // length of Java itable (in words)
     3.7 -  ReferenceType   _reference_type;       // reference type
     3.8    OopMapCache*    volatile _oop_map_cache;   // OopMapCache for all methods in the klass (allocated lazily)
     3.9    JNIid*          _jni_ids;              // First JNI identifier for static fields in this class
    3.10    jmethodID*      _methods_jmethod_ids;  // jmethodIDs corresponding to method_idnum, or NULL if none
    3.11 @@ -265,6 +264,8 @@
    3.12    // _idnum_allocated_count.
    3.13    u1              _init_state;                    // state of class
    3.14  
    3.15 +  u1              _reference_type;                // reference type
    3.16 +
    3.17    // embedded Java vtable follows here
    3.18    // embedded Java itables follows here
    3.19    // embedded static fields follows here
    3.20 @@ -407,8 +408,11 @@
    3.21    void eager_initialize(Thread *thread);
    3.22  
    3.23    // reference type
    3.24 -  ReferenceType reference_type() const     { return _reference_type; }
    3.25 -  void set_reference_type(ReferenceType t) { _reference_type = t; }
    3.26 +  ReferenceType reference_type() const     { return (ReferenceType)_reference_type; }
    3.27 +  void set_reference_type(ReferenceType t) {
    3.28 +    assert(t == (u1)t, "overflow");
    3.29 +    _reference_type = (u1)t;
    3.30 +  }
    3.31  
    3.32    static ByteSize reference_type_offset() { return in_ByteSize(sizeof(klassOopDesc) + offset_of(instanceKlass, _reference_type)); }
    3.33  
     4.1 --- a/src/share/vm/opto/library_call.cpp	Fri Jan 20 17:07:33 2012 -0800
     4.2 +++ b/src/share/vm/opto/library_call.cpp	Wed Jan 25 17:40:51 2012 -0500
     4.3 @@ -2153,7 +2153,7 @@
     4.4    //
     4.5    // if (offset == java_lang_ref_Reference::_reference_offset) {
     4.6    //   if (base != null) {
     4.7 -  //     if (klass(base)->reference_type() != REF_NONE)) {
     4.8 +  //     if (instance_of(base, java.lang.ref.Reference)) {
     4.9    //       pre_barrier(_, pre_val, ...);
    4.10    //     }
    4.11    //   }
    4.12 @@ -2165,8 +2165,6 @@
    4.13    IdealKit ideal(this);
    4.14  #define __ ideal.
    4.15  
    4.16 -  const int reference_type_offset = in_bytes(instanceKlass::reference_type_offset());
    4.17 -
    4.18    Node* referent_off = __ ConX(java_lang_ref_Reference::referent_offset);
    4.19  
    4.20    __ if_then(offset, BoolTest::eq, referent_off, unlikely); {
     5.1 --- a/src/share/vm/runtime/vmStructs.cpp	Fri Jan 20 17:07:33 2012 -0800
     5.2 +++ b/src/share/vm/runtime/vmStructs.cpp	Wed Jan 25 17:40:51 2012 -0500
     5.3 @@ -314,7 +314,7 @@
     5.4    nonstatic_field(instanceKlass,               _init_thread,                                  Thread*)                               \
     5.5    nonstatic_field(instanceKlass,               _vtable_len,                                   int)                                   \
     5.6    nonstatic_field(instanceKlass,               _itable_len,                                   int)                                   \
     5.7 -  nonstatic_field(instanceKlass,               _reference_type,                               ReferenceType)                         \
     5.8 +  nonstatic_field(instanceKlass,               _reference_type,                               u1)                                    \
     5.9    volatile_nonstatic_field(instanceKlass,      _oop_map_cache,                                OopMapCache*)                          \
    5.10    nonstatic_field(instanceKlass,               _jni_ids,                                      JNIid*)                                \
    5.11    nonstatic_field(instanceKlass,               _osr_nmethods_head,                            nmethod*)                              \

mercurial