annotate src/share/vm/oops/instanceRefKlass.hpp @ 9126:bc26f978b0ce

HotSpotResolvedObjectType: implement hasFinalizeSubclass() correctly don't use the (wrong) cached value, but ask the runtime on each request. Fixes regression on xml.* benchmarks @ specjvm2008. The problem was: After the constructor of Object was deoptimized due to an assumption violation, it was recompiled again after some time. However, on recompilation, the value of hasFinalizeSubclass for the class was not updated and it was compiled again with a, now wrong, assumption, which then triggers deoptimization again. This was repeated until it hit the recompilation limit (defined by PerMethodRecompilationCutoff), and therefore only executed by the interpreter from now on, causing the performance regression.
author Bernhard Urban <bernhard.urban@jku.at>
date Mon, 15 Apr 2013 19:54:58 +0200
parents db9981fd3124
children de6a9e811145
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 2021
diff changeset
2 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a61af66fc99e Initial load
duke
parents:
diff changeset
4 *
a61af66fc99e Initial load
duke
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
a61af66fc99e Initial load
duke
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
a61af66fc99e Initial load
duke
parents:
diff changeset
7 * published by the Free Software Foundation.
a61af66fc99e Initial load
duke
parents:
diff changeset
8 *
a61af66fc99e Initial load
duke
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
a61af66fc99e Initial load
duke
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a61af66fc99e Initial load
duke
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a61af66fc99e Initial load
duke
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
a61af66fc99e Initial load
duke
parents:
diff changeset
13 * accompanied this code).
a61af66fc99e Initial load
duke
parents:
diff changeset
14 *
a61af66fc99e Initial load
duke
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
a61af66fc99e Initial load
duke
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
a61af66fc99e Initial load
duke
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a61af66fc99e Initial load
duke
parents:
diff changeset
18 *
1552
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 342
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 342
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 342
diff changeset
21 * questions.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
22 *
a61af66fc99e Initial load
duke
parents:
diff changeset
23 */
a61af66fc99e Initial load
duke
parents:
diff changeset
24
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
25 #ifndef SHARE_VM_OOPS_INSTANCEREFKLASS_HPP
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
26 #define SHARE_VM_OOPS_INSTANCEREFKLASS_HPP
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
27
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
28 #include "oops/instanceKlass.hpp"
8001
db9981fd3124 8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents: 6735
diff changeset
29 #include "utilities/macros.hpp"
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
30
6735
aed758eda82a 7195833: NPG: Rename instanceClassLoaderKlass, instanceRefKlass and instanceMirrorKlass
coleenp
parents: 6725
diff changeset
31 // An InstanceRefKlass is a specialized InstanceKlass for Java
0
a61af66fc99e Initial load
duke
parents:
diff changeset
32 // classes that are subclasses of java/lang/ref/Reference.
a61af66fc99e Initial load
duke
parents:
diff changeset
33 //
a61af66fc99e Initial load
duke
parents:
diff changeset
34 // These classes are used to implement soft/weak/final/phantom
a61af66fc99e Initial load
duke
parents:
diff changeset
35 // references and finalization, and need special treatment by the
a61af66fc99e Initial load
duke
parents:
diff changeset
36 // garbage collector.
a61af66fc99e Initial load
duke
parents:
diff changeset
37 //
a61af66fc99e Initial load
duke
parents:
diff changeset
38 // During GC discovered reference objects are added (chained) to one
a61af66fc99e Initial load
duke
parents:
diff changeset
39 // of the four lists below, depending on the type of reference.
a61af66fc99e Initial load
duke
parents:
diff changeset
40 // The linked occurs through the next field in class java/lang/ref/Reference.
a61af66fc99e Initial load
duke
parents:
diff changeset
41 //
a61af66fc99e Initial load
duke
parents:
diff changeset
42 // Afterwards, the discovered references are processed in decreasing
a61af66fc99e Initial load
duke
parents:
diff changeset
43 // order of reachability. Reference objects eligible for notification
a61af66fc99e Initial load
duke
parents:
diff changeset
44 // are linked to the static pending_list in class java/lang/ref/Reference,
a61af66fc99e Initial load
duke
parents:
diff changeset
45 // and the pending list lock object in the same class is notified.
a61af66fc99e Initial load
duke
parents:
diff changeset
46
a61af66fc99e Initial load
duke
parents:
diff changeset
47
6735
aed758eda82a 7195833: NPG: Rename instanceClassLoaderKlass, instanceRefKlass and instanceMirrorKlass
coleenp
parents: 6725
diff changeset
48 class InstanceRefKlass: public InstanceKlass {
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 2021
diff changeset
49 friend class InstanceKlass;
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 2021
diff changeset
50
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 2021
diff changeset
51 // Constructor
6735
aed758eda82a 7195833: NPG: Rename instanceClassLoaderKlass, instanceRefKlass and instanceMirrorKlass
coleenp
parents: 6725
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)
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 2021
diff changeset
53 : InstanceKlass(vtable_len, itable_len, static_field_size, nonstatic_oop_map_size, rt, access_flags, is_anonymous) {}
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 2021
diff changeset
54
0
a61af66fc99e Initial load
duke
parents:
diff changeset
55 public:
6735
aed758eda82a 7195833: NPG: Rename instanceClassLoaderKlass, instanceRefKlass and instanceMirrorKlass
coleenp
parents: 6725
diff changeset
56 InstanceRefKlass() { assert(DumpSharedSpaces || UseSharedSpaces, "only for CDS"); }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
57 // Type testing
a61af66fc99e Initial load
duke
parents:
diff changeset
58 bool oop_is_instanceRef() const { return true; }
a61af66fc99e Initial load
duke
parents:
diff changeset
59
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 2021
diff changeset
60 // Casting from Klass*
6735
aed758eda82a 7195833: NPG: Rename instanceClassLoaderKlass, instanceRefKlass and instanceMirrorKlass
coleenp
parents: 6725
diff changeset
61 static InstanceRefKlass* cast(Klass* k) {
aed758eda82a 7195833: NPG: Rename instanceClassLoaderKlass, instanceRefKlass and instanceMirrorKlass
coleenp
parents: 6725
diff changeset
62 assert(k->oop_is_instanceRef(), "cast to InstanceRefKlass");
aed758eda82a 7195833: NPG: Rename instanceClassLoaderKlass, instanceRefKlass and instanceMirrorKlass
coleenp
parents: 6725
diff changeset
63 return (InstanceRefKlass*) k;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
64 }
a61af66fc99e Initial load
duke
parents:
diff changeset
65
a61af66fc99e Initial load
duke
parents:
diff changeset
66 // Garbage collection
a61af66fc99e Initial load
duke
parents:
diff changeset
67 int oop_adjust_pointers(oop obj);
a61af66fc99e Initial load
duke
parents:
diff changeset
68 void oop_follow_contents(oop obj);
a61af66fc99e Initial load
duke
parents:
diff changeset
69
a61af66fc99e Initial load
duke
parents:
diff changeset
70 // Parallel Scavenge and Parallel Old
a61af66fc99e Initial load
duke
parents:
diff changeset
71 PARALLEL_GC_DECLS
a61af66fc99e Initial load
duke
parents:
diff changeset
72
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 2021
diff changeset
73 int oop_oop_iterate(oop obj, ExtendedOopClosure* blk) {
0
a61af66fc99e Initial load
duke
parents:
diff changeset
74 return oop_oop_iterate_v(obj, blk);
a61af66fc99e Initial load
duke
parents:
diff changeset
75 }
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 2021
diff changeset
76 int oop_oop_iterate_m(oop obj, ExtendedOopClosure* blk, MemRegion mr) {
0
a61af66fc99e Initial load
duke
parents:
diff changeset
77 return oop_oop_iterate_v_m(obj, blk, mr);
a61af66fc99e Initial load
duke
parents:
diff changeset
78 }
a61af66fc99e Initial load
duke
parents:
diff changeset
79
a61af66fc99e Initial load
duke
parents:
diff changeset
80 #define InstanceRefKlass_OOP_OOP_ITERATE_DECL(OopClosureType, nv_suffix) \
a61af66fc99e Initial load
duke
parents:
diff changeset
81 int oop_oop_iterate##nv_suffix(oop obj, OopClosureType* blk); \
a61af66fc99e Initial load
duke
parents:
diff changeset
82 int oop_oop_iterate##nv_suffix##_m(oop obj, OopClosureType* blk, MemRegion mr);
a61af66fc99e Initial load
duke
parents:
diff changeset
83
a61af66fc99e Initial load
duke
parents:
diff changeset
84 ALL_OOP_OOP_ITERATE_CLOSURES_1(InstanceRefKlass_OOP_OOP_ITERATE_DECL)
342
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
85 ALL_OOP_OOP_ITERATE_CLOSURES_2(InstanceRefKlass_OOP_OOP_ITERATE_DECL)
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
86
8001
db9981fd3124 8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents: 6735
diff changeset
87 #if INCLUDE_ALL_GCS
342
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
88 #define InstanceRefKlass_OOP_OOP_ITERATE_BACKWARDS_DECL(OopClosureType, nv_suffix) \
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
89 int oop_oop_iterate_backwards##nv_suffix(oop obj, OopClosureType* blk);
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
90
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
91 ALL_OOP_OOP_ITERATE_CLOSURES_1(InstanceRefKlass_OOP_OOP_ITERATE_BACKWARDS_DECL)
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
92 ALL_OOP_OOP_ITERATE_CLOSURES_2(InstanceRefKlass_OOP_OOP_ITERATE_BACKWARDS_DECL)
8001
db9981fd3124 8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents: 6735
diff changeset
93 #endif // INCLUDE_ALL_GCS
0
a61af66fc99e Initial load
duke
parents:
diff changeset
94
a61af66fc99e Initial load
duke
parents:
diff changeset
95 static void release_and_notify_pending_list_lock(BasicLock *pending_list_basic_lock);
a61af66fc99e Initial load
duke
parents:
diff changeset
96 static void acquire_pending_list_lock(BasicLock *pending_list_basic_lock);
2021
7cf1a74771e8 6988439: Parallel Class Loading test deadlock involving MethodData_lock and Pending List Lock
coleenp
parents: 1972
diff changeset
97 static bool owns_pending_list_lock(JavaThread* thread);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
98
a61af66fc99e Initial load
duke
parents:
diff changeset
99 // Update non-static oop maps so 'referent', 'nextPending' and
a61af66fc99e Initial load
duke
parents:
diff changeset
100 // 'discovered' will look like non-oops
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 2021
diff changeset
101 static void update_nonstatic_oop_maps(Klass* k);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
102
a61af66fc99e Initial load
duke
parents:
diff changeset
103 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
104 // Verification
a61af66fc99e Initial load
duke
parents:
diff changeset
105 void oop_verify_on(oop obj, outputStream* st);
a61af66fc99e Initial load
duke
parents:
diff changeset
106 };
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
107
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
108 #endif // SHARE_VM_OOPS_INSTANCEREFKLASS_HPP