src/share/vm/oops/instanceRefKlass.hpp

Fri, 20 Mar 2009 23:19:36 -0700

author
jrose
date
Fri, 20 Mar 2009 23:19:36 -0700
changeset 1100
c89f86385056
parent 777
37f87013dfd8
child 1907
c18cbe5936b8
permissions
-rw-r--r--

6814659: separable cleanups and subroutines for 6655638
Summary: preparatory but separable changes for method handles
Reviewed-by: kvn, never

     1 /*
     2  * Copyright 1997-2006 Sun Microsystems, Inc.  All Rights Reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     8  *
     9  * This code is distributed in the hope that it will be useful, but WITHOUT
    10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    12  * version 2 for more details (a copy is included in the LICENSE file that
    13  * accompanied this code).
    14  *
    15  * You should have received a copy of the GNU General Public License version
    16  * 2 along with this work; if not, write to the Free Software Foundation,
    17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    18  *
    19  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
    20  * CA 95054 USA or visit www.sun.com if you need additional information or
    21  * have any questions.
    22  *
    23  */
    25 // An instanceRefKlass is a specialized instanceKlass for Java
    26 // classes that are subclasses of java/lang/ref/Reference.
    27 //
    28 // These classes are used to implement soft/weak/final/phantom
    29 // references and finalization, and need special treatment by the
    30 // garbage collector.
    31 //
    32 // During GC discovered reference objects are added (chained) to one
    33 // of the four lists below, depending on the type of reference.
    34 // The linked occurs through the next field in class java/lang/ref/Reference.
    35 //
    36 // Afterwards, the discovered references are processed in decreasing
    37 // order of reachability. Reference objects eligible for notification
    38 // are linked to the static pending_list in class java/lang/ref/Reference,
    39 // and the pending list lock object in the same class is notified.
    42 class instanceRefKlass: public instanceKlass {
    43  public:
    44   // Type testing
    45   bool oop_is_instanceRef() const             { return true; }
    47   // Casting from klassOop
    48   static instanceRefKlass* cast(klassOop k) {
    49     assert(k->klass_part()->oop_is_instanceRef(), "cast to instanceRefKlass");
    50     return (instanceRefKlass*) k->klass_part();
    51   }
    53   // allocation
    54   DEFINE_ALLOCATE_PERMANENT(instanceRefKlass);
    56   // Garbage collection
    57   int  oop_adjust_pointers(oop obj);
    58   void oop_follow_contents(oop obj);
    60   // Parallel Scavenge and Parallel Old
    61   PARALLEL_GC_DECLS
    63   int oop_oop_iterate(oop obj, OopClosure* blk) {
    64     return oop_oop_iterate_v(obj, blk);
    65   }
    66   int oop_oop_iterate_m(oop obj, OopClosure* blk, MemRegion mr) {
    67     return oop_oop_iterate_v_m(obj, blk, mr);
    68   }
    70 #define InstanceRefKlass_OOP_OOP_ITERATE_DECL(OopClosureType, nv_suffix)                \
    71   int oop_oop_iterate##nv_suffix(oop obj, OopClosureType* blk);                         \
    72   int oop_oop_iterate##nv_suffix##_m(oop obj, OopClosureType* blk, MemRegion mr);
    74   ALL_OOP_OOP_ITERATE_CLOSURES_1(InstanceRefKlass_OOP_OOP_ITERATE_DECL)
    75   ALL_OOP_OOP_ITERATE_CLOSURES_2(InstanceRefKlass_OOP_OOP_ITERATE_DECL)
    77 #ifndef SERIALGC
    78 #define InstanceRefKlass_OOP_OOP_ITERATE_BACKWARDS_DECL(OopClosureType, nv_suffix)      \
    79   int oop_oop_iterate_backwards##nv_suffix(oop obj, OopClosureType* blk);
    81   ALL_OOP_OOP_ITERATE_CLOSURES_1(InstanceRefKlass_OOP_OOP_ITERATE_BACKWARDS_DECL)
    82   ALL_OOP_OOP_ITERATE_CLOSURES_2(InstanceRefKlass_OOP_OOP_ITERATE_BACKWARDS_DECL)
    83 #endif // !SERIALGC
    85   static void release_and_notify_pending_list_lock(BasicLock *pending_list_basic_lock);
    86   static void acquire_pending_list_lock(BasicLock *pending_list_basic_lock);
    88   // Update non-static oop maps so 'referent', 'nextPending' and
    89   // 'discovered' will look like non-oops
    90   static void update_nonstatic_oop_maps(klassOop k);
    92  public:
    93   // Verification
    94   void oop_verify_on(oop obj, outputStream* st);
    95 };

mercurial