src/share/vm/oops/arrayKlass.hpp

changeset 4037
da91efe96a93
parent 3391
069ab3f976d3
child 4142
d8ce2825b193
     1.1 --- a/src/share/vm/oops/arrayKlass.hpp	Fri Aug 31 16:39:35 2012 -0700
     1.2 +++ b/src/share/vm/oops/arrayKlass.hpp	Sat Sep 01 13:25:18 2012 -0400
     1.3 @@ -1,5 +1,5 @@
     1.4  /*
     1.5 - * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
     1.6 + * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
     1.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.8   *
     1.9   * This code is free software; you can redistribute it and/or modify it
    1.10 @@ -27,8 +27,8 @@
    1.11  
    1.12  #include "memory/universe.hpp"
    1.13  #include "oops/klass.hpp"
    1.14 -#include "oops/klassOop.hpp"
    1.15 -#include "oops/klassVtable.hpp"
    1.16 +
    1.17 +class klassVtable;
    1.18  
    1.19  // arrayKlass is the abstract baseclass for all array classes
    1.20  
    1.21 @@ -36,27 +36,34 @@
    1.22    friend class VMStructs;
    1.23   private:
    1.24    int      _dimension;         // This is n'th-dimensional array.
    1.25 -  volatile klassOop _higher_dimension;  // Refers the (n+1)'th-dimensional array (if present).
    1.26 -  volatile klassOop _lower_dimension;   // Refers the (n-1)'th-dimensional array (if present).
    1.27 +  Klass* volatile _higher_dimension;  // Refers the (n+1)'th-dimensional array (if present).
    1.28 +  Klass* volatile _lower_dimension;   // Refers the (n-1)'th-dimensional array (if present).
    1.29    int      _vtable_len;        // size of vtable for this klass
    1.30    juint    _alloc_size;        // allocation profiling support
    1.31    oop      _component_mirror;  // component type, as a java/lang/Class
    1.32  
    1.33 + protected:
    1.34 +  // Constructors
    1.35 +  // The constructor with the Symbol argument does the real array
    1.36 +  // initialization, the other is a dummy
    1.37 +  arrayKlass(Symbol* name);
    1.38 +  arrayKlass() { assert(DumpSharedSpaces || UseSharedSpaces, "only for cds"); }
    1.39 +
    1.40   public:
    1.41    // Testing operation
    1.42 -  bool oop_is_array() const { return true; }
    1.43 +  bool oop_is_array_slow() const { return true; }
    1.44  
    1.45    // Instance variables
    1.46    int dimension() const                 { return _dimension;      }
    1.47    void set_dimension(int dimension)     { _dimension = dimension; }
    1.48  
    1.49 -  klassOop higher_dimension() const     { return _higher_dimension; }
    1.50 -  void set_higher_dimension(klassOop k) { oop_store_without_check((oop*) &_higher_dimension, (oop) k); }
    1.51 -  oop* adr_higher_dimension()           { return (oop*)&this->_higher_dimension;}
    1.52 +  Klass* higher_dimension() const     { return _higher_dimension; }
    1.53 +  void set_higher_dimension(Klass* k) { _higher_dimension = k; }
    1.54 +  Klass** adr_higher_dimension()      { return (Klass**)&this->_higher_dimension;}
    1.55  
    1.56 -  klassOop lower_dimension() const      { return _lower_dimension; }
    1.57 -  void set_lower_dimension(klassOop k)  { oop_store_without_check((oop*) &_lower_dimension, (oop) k); }
    1.58 -  oop* adr_lower_dimension()            { return (oop*)&this->_lower_dimension;}
    1.59 +  Klass* lower_dimension() const      { return _lower_dimension; }
    1.60 +  void set_lower_dimension(Klass* k)  { _lower_dimension = k; }
    1.61 +  Klass** adr_lower_dimension()       { return (Klass**)&this->_lower_dimension;}
    1.62  
    1.63    // Allocation profiling support
    1.64    juint alloc_size() const              { return _alloc_size; }
    1.65 @@ -69,13 +76,13 @@
    1.66    BasicType element_type() const        { return layout_helper_element_type(layout_helper()); }
    1.67  
    1.68    oop  component_mirror() const         { return _component_mirror; }
    1.69 -  void set_component_mirror(oop m)      { oop_store((oop*) &_component_mirror, m); }
    1.70 +  void set_component_mirror(oop m)      { klass_oop_store(&_component_mirror, m); }
    1.71    oop* adr_component_mirror()           { return (oop*)&this->_component_mirror;}
    1.72  
    1.73    // Compiler/Interpreter offset
    1.74 -  static ByteSize component_mirror_offset() { return in_ByteSize(sizeof(klassOopDesc) + offset_of(arrayKlass, _component_mirror)); }
    1.75 +  static ByteSize component_mirror_offset() { return in_ByteSize(offset_of(arrayKlass, _component_mirror)); }
    1.76  
    1.77 -  virtual klassOop java_super() const;//{ return SystemDictionary::Object_klass(); }
    1.78 +  virtual Klass* java_super() const;//{ return SystemDictionary::Object_klass(); }
    1.79  
    1.80    // Allocation
    1.81    // Sizes points to the first dimension of the array, subsequent dimensions
    1.82 @@ -84,23 +91,20 @@
    1.83    objArrayOop allocate_arrayArray(int n, int length, TRAPS);
    1.84  
    1.85    // Lookup operations
    1.86 -  methodOop uncached_lookup_method(Symbol* name, Symbol* signature) const;
    1.87 +  Method* uncached_lookup_method(Symbol* name, Symbol* signature) const;
    1.88  
    1.89 -  // Casting from klassOop
    1.90 -  static arrayKlass* cast(klassOop k) {
    1.91 -    Klass* kp = k->klass_part();
    1.92 -    assert(kp->null_vtbl() || kp->oop_is_array(), "cast to arrayKlass");
    1.93 -    return (arrayKlass*) kp;
    1.94 +  // Casting from Klass*
    1.95 +  static arrayKlass* cast(Klass* k) {
    1.96 +    assert(k->oop_is_array(), "cast to arrayKlass");
    1.97 +    return (arrayKlass*) k;
    1.98    }
    1.99  
   1.100 -  objArrayOop compute_secondary_supers(int num_extra_slots, TRAPS);
   1.101 -  bool compute_is_subtype_of(klassOop k);
   1.102 +  GrowableArray<Klass*>* compute_secondary_supers(int num_extra_slots);
   1.103 +  bool compute_is_subtype_of(Klass* k);
   1.104  
   1.105    // Sizing
   1.106 -  static int header_size()                 { return oopDesc::header_size() + sizeof(arrayKlass)/HeapWordSize; }
   1.107 -  int object_size(int header_size) const;
   1.108 -
   1.109 -  bool object_is_parsable() const          { return _vtable_len > 0; }
   1.110 +  static int header_size()                 { return sizeof(arrayKlass)/HeapWordSize; }
   1.111 +  static int static_size(int header_size);
   1.112  
   1.113    // Java vtable
   1.114    klassVtable* vtable() const;             // return new klassVtable
   1.115 @@ -112,16 +116,16 @@
   1.116  
   1.117   public:
   1.118    // Iterators
   1.119 -  void array_klasses_do(void f(klassOop k));
   1.120 -  void with_array_klasses_do(void f(klassOop k));
   1.121 +  void array_klasses_do(void f(Klass* k));
   1.122 +  void array_klasses_do(void f(Klass* k, TRAPS), TRAPS);
   1.123 +  void with_array_klasses_do(void f(Klass* k));
   1.124  
   1.125 -  // Shared creation method
   1.126 -  static arrayKlassHandle base_create_array_klass(
   1.127 -                                          const Klass_vtbl& vtbl,
   1.128 -                                          int header_size, KlassHandle klass,
   1.129 -                                          TRAPS);
   1.130 +  // GC support
   1.131 +  virtual void oops_do(OopClosure* cl);
   1.132 +
   1.133    // Return a handle.
   1.134 -  static void     complete_create_array_klass(arrayKlassHandle k, KlassHandle super_klass, TRAPS);
   1.135 +  static void     complete_create_array_klass(arrayKlass* k, KlassHandle super_klass, TRAPS);
   1.136 +
   1.137  
   1.138    // jvm support
   1.139    jint compute_modifier_flags(TRAPS) const;
   1.140 @@ -129,10 +133,19 @@
   1.141    // JVMTI support
   1.142    jint jvmti_class_status() const;
   1.143  
   1.144 +  // CDS support - remove and restore oops from metadata. Oops are not shared.
   1.145 +  virtual void remove_unshareable_info();
   1.146 +  virtual void restore_unshareable_info(TRAPS);
   1.147 +
   1.148    // Printing
   1.149 +  void print_on(outputStream* st) const;
   1.150 +  void print_value_on(outputStream* st) const;
   1.151 +
   1.152    void oop_print_on(oop obj, outputStream* st);
   1.153  
   1.154    // Verification
   1.155 +  void verify_on(outputStream* st);
   1.156 +
   1.157    void oop_verify_on(oop obj, outputStream* st);
   1.158  };
   1.159  

mercurial