hotspot/src/share/vm/oops/instanceRefKlass.hpp
author jprovino
Wed, 23 Jan 2013 13:02:39 -0500
changeset 15482 470d0b0c09f1
parent 13738 d67be49a5beb
child 22234 da823d78ad65
permissions -rw-r--r--
8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS Summary: Rename INCLUDE_ALTERNATE_GCS to INCLUDE_ALL_GCS and replace SERIALGC with INCLUDE_ALL_GCS. Reviewed-by: coleenp, stefank
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 7446
diff changeset
     2
 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     4
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
489c9b5090e2 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
489c9b5090e2 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     8
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
489c9b5090e2 Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
489c9b5090e2 Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    14
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
489c9b5090e2 Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    18
 *
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1374
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1374
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1374
diff changeset
    21
 * questions.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    22
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    23
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    24
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    25
#ifndef SHARE_VM_OOPS_INSTANCEREFKLASS_HPP
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    26
#define SHARE_VM_OOPS_INSTANCEREFKLASS_HPP
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    27
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    28
#include "oops/instanceKlass.hpp"
15482
470d0b0c09f1 8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents: 13738
diff changeset
    29
#include "utilities/macros.hpp"
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    30
13738
d67be49a5beb 7195833: NPG: Rename instanceClassLoaderKlass, instanceRefKlass and instanceMirrorKlass
coleenp
parents: 13728
diff changeset
    31
// An InstanceRefKlass is a specialized InstanceKlass for Java
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    32
// classes that are subclasses of java/lang/ref/Reference.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    33
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
// These classes are used to implement soft/weak/final/phantom
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
// references and finalization, and need special treatment by the
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
// garbage collector.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
// During GC discovered reference objects are added (chained) to one
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
// of the four lists below, depending on the type of reference.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
// The linked occurs through the next field in class java/lang/ref/Reference.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
// Afterwards, the discovered references are processed in decreasing
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
// order of reachability. Reference objects eligible for notification
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
// are linked to the static pending_list in class java/lang/ref/Reference,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
// and the pending list lock object in the same class is notified.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
13738
d67be49a5beb 7195833: NPG: Rename instanceClassLoaderKlass, instanceRefKlass and instanceMirrorKlass
coleenp
parents: 13728
diff changeset
    48
class InstanceRefKlass: public InstanceKlass {
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 7446
diff changeset
    49
  friend class InstanceKlass;
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 7446
diff changeset
    50
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 7446
diff changeset
    51
  // Constructor
13738
d67be49a5beb 7195833: NPG: Rename instanceClassLoaderKlass, instanceRefKlass and instanceMirrorKlass
coleenp
parents: 13728
diff changeset
    52
  InstanceRefKlass(int vtable_len, int itable_len, int static_field_size, int nonstatic_oop_map_size, ReferenceType rt, AccessFlags access_flags, bool is_anonymous)
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 7446
diff changeset
    53
    : InstanceKlass(vtable_len, itable_len, static_field_size, nonstatic_oop_map_size, rt, access_flags, is_anonymous) {}
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 7446
diff changeset
    54
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
 public:
13738
d67be49a5beb 7195833: NPG: Rename instanceClassLoaderKlass, instanceRefKlass and instanceMirrorKlass
coleenp
parents: 13728
diff changeset
    56
  InstanceRefKlass() { assert(DumpSharedSpaces || UseSharedSpaces, "only for CDS"); }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
  // Type testing
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
  bool oop_is_instanceRef() const             { return true; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 7446
diff changeset
    60
  // Casting from Klass*
13738
d67be49a5beb 7195833: NPG: Rename instanceClassLoaderKlass, instanceRefKlass and instanceMirrorKlass
coleenp
parents: 13728
diff changeset
    61
  static InstanceRefKlass* cast(Klass* k) {
d67be49a5beb 7195833: NPG: Rename instanceClassLoaderKlass, instanceRefKlass and instanceMirrorKlass
coleenp
parents: 13728
diff changeset
    62
    assert(k->oop_is_instanceRef(), "cast to InstanceRefKlass");
d67be49a5beb 7195833: NPG: Rename instanceClassLoaderKlass, instanceRefKlass and instanceMirrorKlass
coleenp
parents: 13728
diff changeset
    63
    return (InstanceRefKlass*) k;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
  // Garbage collection
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
  int  oop_adjust_pointers(oop obj);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
  void oop_follow_contents(oop obj);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
  // Parallel Scavenge and Parallel Old
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
  PARALLEL_GC_DECLS
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 7446
diff changeset
    73
  int oop_oop_iterate(oop obj, ExtendedOopClosure* blk) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
    return oop_oop_iterate_v(obj, blk);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
  }
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 7446
diff changeset
    76
  int oop_oop_iterate_m(oop obj, ExtendedOopClosure* blk, MemRegion mr) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
    return oop_oop_iterate_v_m(obj, blk, mr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
#define InstanceRefKlass_OOP_OOP_ITERATE_DECL(OopClosureType, nv_suffix)                \
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
  int oop_oop_iterate##nv_suffix(oop obj, OopClosureType* blk);                         \
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
  int oop_oop_iterate##nv_suffix##_m(oop obj, OopClosureType* blk, MemRegion mr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
  ALL_OOP_OOP_ITERATE_CLOSURES_1(InstanceRefKlass_OOP_OOP_ITERATE_DECL)
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
    85
  ALL_OOP_OOP_ITERATE_CLOSURES_2(InstanceRefKlass_OOP_OOP_ITERATE_DECL)
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
    86
15482
470d0b0c09f1 8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents: 13738
diff changeset
    87
#if INCLUDE_ALL_GCS
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
    88
#define InstanceRefKlass_OOP_OOP_ITERATE_BACKWARDS_DECL(OopClosureType, nv_suffix)      \
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
    89
  int oop_oop_iterate_backwards##nv_suffix(oop obj, OopClosureType* blk);
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
    90
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
    91
  ALL_OOP_OOP_ITERATE_CLOSURES_1(InstanceRefKlass_OOP_OOP_ITERATE_BACKWARDS_DECL)
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
    92
  ALL_OOP_OOP_ITERATE_CLOSURES_2(InstanceRefKlass_OOP_OOP_ITERATE_BACKWARDS_DECL)
15482
470d0b0c09f1 8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents: 13738
diff changeset
    93
#endif // INCLUDE_ALL_GCS
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
  static void release_and_notify_pending_list_lock(BasicLock *pending_list_basic_lock);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
  static void acquire_pending_list_lock(BasicLock *pending_list_basic_lock);
7446
9193aa209467 6988439: Parallel Class Loading test deadlock involving MethodData_lock and Pending List Lock
coleenp
parents: 7397
diff changeset
    97
  static bool owns_pending_list_lock(JavaThread* thread);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
  // Update non-static oop maps so 'referent', 'nextPending' and
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
  // 'discovered' will look like non-oops
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 7446
diff changeset
   101
  static void update_nonstatic_oop_maps(Klass* k);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
  // Verification
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
  void oop_verify_on(oop obj, outputStream* st);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
};
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
   107
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
   108
#endif // SHARE_VM_OOPS_INSTANCEREFKLASS_HPP