annotate src/share/vm/oops/methodKlass.cpp @ 5150:fdd9dd4508fa

some GC fixes avoid non-Java bytecodes in code() array passed to Graal
author Christian Haeubl <christian.haeubl@oracle.com>
date Thu, 22 Mar 2012 18:54:02 -0700
parents 18a5539bf19b
children af59b4dfc9e4
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
2227
e5383553fd4e 7014851: Remove unused parallel compaction code
stefank
parents: 2177
diff changeset
2 * Copyright (c) 1997, 2011, 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: 1507
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1507
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: 1507
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: 1783
diff changeset
25 #include "precompiled.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1783
diff changeset
26 #include "classfile/javaClasses.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1783
diff changeset
27 #include "gc_implementation/shared/markSweep.inline.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1783
diff changeset
28 #include "gc_interface/collectedHeap.inline.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1783
diff changeset
29 #include "interpreter/interpreter.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1783
diff changeset
30 #include "memory/gcLocker.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1783
diff changeset
31 #include "memory/resourceArea.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1783
diff changeset
32 #include "memory/universe.inline.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1783
diff changeset
33 #include "oops/constMethodKlass.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1783
diff changeset
34 #include "oops/klassOop.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1783
diff changeset
35 #include "oops/methodDataOop.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1783
diff changeset
36 #include "oops/methodKlass.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1783
diff changeset
37 #include "oops/oop.inline.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1783
diff changeset
38 #include "oops/oop.inline2.hpp"
2177
3582bf76420e 6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents: 1972
diff changeset
39 #include "oops/symbol.hpp"
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1783
diff changeset
40 #include "runtime/handles.inline.hpp"
5150
fdd9dd4508fa some GC fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4979
diff changeset
41 #ifndef SERIALGC
fdd9dd4508fa some GC fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4979
diff changeset
42 #include "gc_implementation/parallelScavenge/psScavenge.inline.hpp"
fdd9dd4508fa some GC fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4979
diff changeset
43 #include "oops/oop.pcgc.inline.hpp"
fdd9dd4508fa some GC fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4979
diff changeset
44 #endif
0
a61af66fc99e Initial load
duke
parents:
diff changeset
45
a61af66fc99e Initial load
duke
parents:
diff changeset
46 klassOop methodKlass::create_klass(TRAPS) {
a61af66fc99e Initial load
duke
parents:
diff changeset
47 methodKlass o;
a61af66fc99e Initial load
duke
parents:
diff changeset
48 KlassHandle h_this_klass(THREAD, Universe::klassKlassObj());
a61af66fc99e Initial load
duke
parents:
diff changeset
49 KlassHandle k = base_create_klass(h_this_klass, header_size(), o.vtbl_value(), CHECK_NULL);
a61af66fc99e Initial load
duke
parents:
diff changeset
50 // Make sure size calculation is right
a61af66fc99e Initial load
duke
parents:
diff changeset
51 assert(k()->size() == align_object_size(header_size()), "wrong size for object");
a61af66fc99e Initial load
duke
parents:
diff changeset
52 java_lang_Class::create_mirror(k, CHECK_NULL); // Allocate mirror
a61af66fc99e Initial load
duke
parents:
diff changeset
53 return k();
a61af66fc99e Initial load
duke
parents:
diff changeset
54 }
a61af66fc99e Initial load
duke
parents:
diff changeset
55
a61af66fc99e Initial load
duke
parents:
diff changeset
56
a61af66fc99e Initial load
duke
parents:
diff changeset
57 int methodKlass::oop_size(oop obj) const {
a61af66fc99e Initial load
duke
parents:
diff changeset
58 assert(obj->is_method(), "must be method oop");
a61af66fc99e Initial load
duke
parents:
diff changeset
59 return methodOop(obj)->object_size();
a61af66fc99e Initial load
duke
parents:
diff changeset
60 }
a61af66fc99e Initial load
duke
parents:
diff changeset
61
a61af66fc99e Initial load
duke
parents:
diff changeset
62
a61af66fc99e Initial load
duke
parents:
diff changeset
63 bool methodKlass::oop_is_parsable(oop obj) const {
a61af66fc99e Initial load
duke
parents:
diff changeset
64 assert(obj->is_method(), "must be method oop");
a61af66fc99e Initial load
duke
parents:
diff changeset
65 return methodOop(obj)->object_is_parsable();
a61af66fc99e Initial load
duke
parents:
diff changeset
66 }
a61af66fc99e Initial load
duke
parents:
diff changeset
67
a61af66fc99e Initial load
duke
parents:
diff changeset
68
a61af66fc99e Initial load
duke
parents:
diff changeset
69 methodOop methodKlass::allocate(constMethodHandle xconst,
a61af66fc99e Initial load
duke
parents:
diff changeset
70 AccessFlags access_flags, TRAPS) {
a61af66fc99e Initial load
duke
parents:
diff changeset
71 int size = methodOopDesc::object_size(access_flags.is_native());
a61af66fc99e Initial load
duke
parents:
diff changeset
72 KlassHandle h_k(THREAD, as_klassOop());
a61af66fc99e Initial load
duke
parents:
diff changeset
73 assert(xconst()->is_parsable(), "possible publication protocol violation");
a61af66fc99e Initial load
duke
parents:
diff changeset
74 methodOop m = (methodOop)CollectedHeap::permanent_obj_allocate(h_k, size, CHECK_NULL);
a61af66fc99e Initial load
duke
parents:
diff changeset
75 assert(!m->is_parsable(), "not expecting parsability yet.");
a61af66fc99e Initial load
duke
parents:
diff changeset
76
a61af66fc99e Initial load
duke
parents:
diff changeset
77 No_Safepoint_Verifier no_safepoint; // until m becomes parsable below
a61af66fc99e Initial load
duke
parents:
diff changeset
78 m->set_constMethod(xconst());
a61af66fc99e Initial load
duke
parents:
diff changeset
79 m->set_access_flags(access_flags);
a61af66fc99e Initial load
duke
parents:
diff changeset
80 m->set_method_size(size);
a61af66fc99e Initial load
duke
parents:
diff changeset
81 m->set_name_index(0);
a61af66fc99e Initial load
duke
parents:
diff changeset
82 m->set_signature_index(0);
a61af66fc99e Initial load
duke
parents:
diff changeset
83 #ifdef CC_INTERP
a61af66fc99e Initial load
duke
parents:
diff changeset
84 m->set_result_index(T_VOID);
a61af66fc99e Initial load
duke
parents:
diff changeset
85 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
86 m->set_constants(NULL);
a61af66fc99e Initial load
duke
parents:
diff changeset
87 m->set_max_stack(0);
a61af66fc99e Initial load
duke
parents:
diff changeset
88 m->set_max_locals(0);
856
75596850f863 6862576: vmIntrinsics needs cleanup in order to support JSR 292 intrinsics
jrose
parents: 710
diff changeset
89 m->set_intrinsic_id(vmIntrinsics::_none);
4800
94ec88ca68e2 7115199: Add event tracing hooks and Java Flight Recorder infrastructure
phh
parents: 2348
diff changeset
90 m->set_jfr_towrite(false);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
91 m->set_method_data(NULL);
a61af66fc99e Initial load
duke
parents:
diff changeset
92 m->set_interpreter_throwout_count(0);
a61af66fc99e Initial load
duke
parents:
diff changeset
93 m->set_vtable_index(methodOopDesc::garbage_vtable_index);
a61af66fc99e Initial load
duke
parents:
diff changeset
94
a61af66fc99e Initial load
duke
parents:
diff changeset
95 // Fix and bury in methodOop
a61af66fc99e Initial load
duke
parents:
diff changeset
96 m->set_interpreter_entry(NULL); // sets i2i entry and from_int
a61af66fc99e Initial load
duke
parents:
diff changeset
97 m->set_adapter_entry(NULL);
a61af66fc99e Initial load
duke
parents:
diff changeset
98 m->clear_code(); // from_c/from_i get set to c2i/i2i
a61af66fc99e Initial load
duke
parents:
diff changeset
99
a61af66fc99e Initial load
duke
parents:
diff changeset
100 if (access_flags.is_native()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
101 m->clear_native_function();
a61af66fc99e Initial load
duke
parents:
diff changeset
102 m->set_signature_handler(NULL);
a61af66fc99e Initial load
duke
parents:
diff changeset
103 }
a61af66fc99e Initial load
duke
parents:
diff changeset
104
a61af66fc99e Initial load
duke
parents:
diff changeset
105 NOT_PRODUCT(m->set_compiled_invocation_count(0);)
a61af66fc99e Initial load
duke
parents:
diff changeset
106 m->set_interpreter_invocation_count(0);
a61af66fc99e Initial load
duke
parents:
diff changeset
107 m->invocation_counter()->init();
a61af66fc99e Initial load
duke
parents:
diff changeset
108 m->backedge_counter()->init();
a61af66fc99e Initial load
duke
parents:
diff changeset
109 m->clear_number_of_breakpoints();
4979
18a5539bf19b More diff vs hsx24 optimizations.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4970
diff changeset
110 #ifdef GRAAL
3011
f00918f35c7f inlining and runtime interface related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2348
diff changeset
111 m->set_graal_mirror(NULL);
4979
18a5539bf19b More diff vs hsx24 optimizations.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4970
diff changeset
112 #endif
1783
d5d065957597 6953144: Tiered compilation
iveresov
parents: 1706
diff changeset
113
2348
5d8f5a6dced7 7020403: Add AdvancedCompilationPolicy for tiered
iveresov
parents: 2227
diff changeset
114 #ifdef TIERED
5d8f5a6dced7 7020403: Add AdvancedCompilationPolicy for tiered
iveresov
parents: 2227
diff changeset
115 m->set_rate(0);
5d8f5a6dced7 7020403: Add AdvancedCompilationPolicy for tiered
iveresov
parents: 2227
diff changeset
116 m->set_prev_event_count(0);
5d8f5a6dced7 7020403: Add AdvancedCompilationPolicy for tiered
iveresov
parents: 2227
diff changeset
117 m->set_prev_time(0);
5d8f5a6dced7 7020403: Add AdvancedCompilationPolicy for tiered
iveresov
parents: 2227
diff changeset
118 #endif
5d8f5a6dced7 7020403: Add AdvancedCompilationPolicy for tiered
iveresov
parents: 2227
diff changeset
119
0
a61af66fc99e Initial load
duke
parents:
diff changeset
120 assert(m->is_parsable(), "must be parsable here.");
a61af66fc99e Initial load
duke
parents:
diff changeset
121 assert(m->size() == size, "wrong size for object");
a61af66fc99e Initial load
duke
parents:
diff changeset
122 // We should not publish an uprasable object's reference
a61af66fc99e Initial load
duke
parents:
diff changeset
123 // into one that is parsable, since that presents problems
a61af66fc99e Initial load
duke
parents:
diff changeset
124 // for the concurrent parallel marking and precleaning phases
a61af66fc99e Initial load
duke
parents:
diff changeset
125 // of concurrent gc (CMS).
a61af66fc99e Initial load
duke
parents:
diff changeset
126 xconst->set_method(m);
a61af66fc99e Initial load
duke
parents:
diff changeset
127 return m;
a61af66fc99e Initial load
duke
parents:
diff changeset
128 }
a61af66fc99e Initial load
duke
parents:
diff changeset
129
a61af66fc99e Initial load
duke
parents:
diff changeset
130
a61af66fc99e Initial load
duke
parents:
diff changeset
131 void methodKlass::oop_follow_contents(oop obj) {
a61af66fc99e Initial load
duke
parents:
diff changeset
132 assert (obj->is_method(), "object must be method");
a61af66fc99e Initial load
duke
parents:
diff changeset
133 methodOop m = methodOop(obj);
a61af66fc99e Initial load
duke
parents:
diff changeset
134 // Performance tweak: We skip iterating over the klass pointer since we
a61af66fc99e Initial load
duke
parents:
diff changeset
135 // know that Universe::methodKlassObj never moves.
a61af66fc99e Initial load
duke
parents:
diff changeset
136 MarkSweep::mark_and_push(m->adr_constMethod());
a61af66fc99e Initial load
duke
parents:
diff changeset
137 MarkSweep::mark_and_push(m->adr_constants());
4979
18a5539bf19b More diff vs hsx24 optimizations.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4970
diff changeset
138 #ifdef GRAAL
3011
f00918f35c7f inlining and runtime interface related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2348
diff changeset
139 MarkSweep::mark_and_push(m->adr_graal_mirror());
4979
18a5539bf19b More diff vs hsx24 optimizations.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4970
diff changeset
140 #endif
5150
fdd9dd4508fa some GC fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4979
diff changeset
141 MarkSweep::mark_and_push(m->adr_method_data());
0
a61af66fc99e Initial load
duke
parents:
diff changeset
142 }
a61af66fc99e Initial load
duke
parents:
diff changeset
143
a61af66fc99e Initial load
duke
parents:
diff changeset
144 #ifndef SERIALGC
a61af66fc99e Initial load
duke
parents:
diff changeset
145 void methodKlass::oop_follow_contents(ParCompactionManager* cm,
a61af66fc99e Initial load
duke
parents:
diff changeset
146 oop obj) {
a61af66fc99e Initial load
duke
parents:
diff changeset
147 assert (obj->is_method(), "object must be method");
a61af66fc99e Initial load
duke
parents:
diff changeset
148 methodOop m = methodOop(obj);
a61af66fc99e Initial load
duke
parents:
diff changeset
149 // Performance tweak: We skip iterating over the klass pointer since we
a61af66fc99e Initial load
duke
parents:
diff changeset
150 // know that Universe::methodKlassObj never moves.
a61af66fc99e Initial load
duke
parents:
diff changeset
151 PSParallelCompact::mark_and_push(cm, m->adr_constMethod());
a61af66fc99e Initial load
duke
parents:
diff changeset
152 PSParallelCompact::mark_and_push(cm, m->adr_constants());
4979
18a5539bf19b More diff vs hsx24 optimizations.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4970
diff changeset
153 #ifdef GRAAL
3011
f00918f35c7f inlining and runtime interface related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2348
diff changeset
154 PSParallelCompact::mark_and_push(cm, m->adr_graal_mirror());
4979
18a5539bf19b More diff vs hsx24 optimizations.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4970
diff changeset
155 #endif
5150
fdd9dd4508fa some GC fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4979
diff changeset
156 PSParallelCompact::mark_and_push(cm, m->adr_method_data());
0
a61af66fc99e Initial load
duke
parents:
diff changeset
157 }
a61af66fc99e Initial load
duke
parents:
diff changeset
158 #endif // SERIALGC
a61af66fc99e Initial load
duke
parents:
diff changeset
159
a61af66fc99e Initial load
duke
parents:
diff changeset
160 int methodKlass::oop_oop_iterate(oop obj, OopClosure* blk) {
a61af66fc99e Initial load
duke
parents:
diff changeset
161 assert (obj->is_method(), "object must be method");
a61af66fc99e Initial load
duke
parents:
diff changeset
162 methodOop m = methodOop(obj);
a61af66fc99e Initial load
duke
parents:
diff changeset
163 // Get size before changing pointers.
a61af66fc99e Initial load
duke
parents:
diff changeset
164 // Don't call size() or oop_size() since that is a virtual call.
a61af66fc99e Initial load
duke
parents:
diff changeset
165 int size = m->object_size();
a61af66fc99e Initial load
duke
parents:
diff changeset
166 // Performance tweak: We skip iterating over the klass pointer since we
a61af66fc99e Initial load
duke
parents:
diff changeset
167 // know that Universe::methodKlassObj never moves
a61af66fc99e Initial load
duke
parents:
diff changeset
168 blk->do_oop(m->adr_constMethod());
a61af66fc99e Initial load
duke
parents:
diff changeset
169 blk->do_oop(m->adr_constants());
4979
18a5539bf19b More diff vs hsx24 optimizations.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4970
diff changeset
170 #ifdef GRAAL
3011
f00918f35c7f inlining and runtime interface related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2348
diff changeset
171 blk->do_oop(m->adr_graal_mirror());
4979
18a5539bf19b More diff vs hsx24 optimizations.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4970
diff changeset
172 #endif
5150
fdd9dd4508fa some GC fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4979
diff changeset
173 blk->do_oop(m->adr_method_data());
fdd9dd4508fa some GC fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4979
diff changeset
174
0
a61af66fc99e Initial load
duke
parents:
diff changeset
175 return size;
a61af66fc99e Initial load
duke
parents:
diff changeset
176 }
a61af66fc99e Initial load
duke
parents:
diff changeset
177
a61af66fc99e Initial load
duke
parents:
diff changeset
178
a61af66fc99e Initial load
duke
parents:
diff changeset
179 int methodKlass::oop_oop_iterate_m(oop obj, OopClosure* blk, MemRegion mr) {
a61af66fc99e Initial load
duke
parents:
diff changeset
180 assert (obj->is_method(), "object must be method");
a61af66fc99e Initial load
duke
parents:
diff changeset
181 methodOop m = methodOop(obj);
a61af66fc99e Initial load
duke
parents:
diff changeset
182 // Get size before changing pointers.
a61af66fc99e Initial load
duke
parents:
diff changeset
183 // Don't call size() or oop_size() since that is a virtual call.
a61af66fc99e Initial load
duke
parents:
diff changeset
184 int size = m->object_size();
a61af66fc99e Initial load
duke
parents:
diff changeset
185 // Performance tweak: We skip iterating over the klass pointer since we
a61af66fc99e Initial load
duke
parents:
diff changeset
186 // know that Universe::methodKlassObj never moves.
a61af66fc99e Initial load
duke
parents:
diff changeset
187 oop* adr;
a61af66fc99e Initial load
duke
parents:
diff changeset
188 adr = m->adr_constMethod();
a61af66fc99e Initial load
duke
parents:
diff changeset
189 if (mr.contains(adr)) blk->do_oop(adr);
a61af66fc99e Initial load
duke
parents:
diff changeset
190 adr = m->adr_constants();
a61af66fc99e Initial load
duke
parents:
diff changeset
191 if (mr.contains(adr)) blk->do_oop(adr);
4979
18a5539bf19b More diff vs hsx24 optimizations.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4970
diff changeset
192 #ifdef GRAAL
3011
f00918f35c7f inlining and runtime interface related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2348
diff changeset
193 adr = m->adr_graal_mirror();
f00918f35c7f inlining and runtime interface related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2348
diff changeset
194 if (mr.contains(adr)) blk->do_oop(adr);
4979
18a5539bf19b More diff vs hsx24 optimizations.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4970
diff changeset
195 #endif
5150
fdd9dd4508fa some GC fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4979
diff changeset
196 adr = m->adr_method_data();
fdd9dd4508fa some GC fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4979
diff changeset
197 if (mr.contains(adr)) blk->do_oop(adr);
fdd9dd4508fa some GC fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4979
diff changeset
198
0
a61af66fc99e Initial load
duke
parents:
diff changeset
199 return size;
a61af66fc99e Initial load
duke
parents:
diff changeset
200 }
a61af66fc99e Initial load
duke
parents:
diff changeset
201
a61af66fc99e Initial load
duke
parents:
diff changeset
202
a61af66fc99e Initial load
duke
parents:
diff changeset
203 int methodKlass::oop_adjust_pointers(oop obj) {
a61af66fc99e Initial load
duke
parents:
diff changeset
204 assert(obj->is_method(), "should be method");
a61af66fc99e Initial load
duke
parents:
diff changeset
205 methodOop m = methodOop(obj);
a61af66fc99e Initial load
duke
parents:
diff changeset
206 // Get size before changing pointers.
a61af66fc99e Initial load
duke
parents:
diff changeset
207 // Don't call size() or oop_size() since that is a virtual call.
a61af66fc99e Initial load
duke
parents:
diff changeset
208 int size = m->object_size();
a61af66fc99e Initial load
duke
parents:
diff changeset
209 // Performance tweak: We skip iterating over the klass pointer since we
a61af66fc99e Initial load
duke
parents:
diff changeset
210 // know that Universe::methodKlassObj never moves.
a61af66fc99e Initial load
duke
parents:
diff changeset
211 MarkSweep::adjust_pointer(m->adr_constMethod());
a61af66fc99e Initial load
duke
parents:
diff changeset
212 MarkSweep::adjust_pointer(m->adr_constants());
4979
18a5539bf19b More diff vs hsx24 optimizations.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4970
diff changeset
213 #ifdef GRAAL
3011
f00918f35c7f inlining and runtime interface related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2348
diff changeset
214 MarkSweep::adjust_pointer(m->adr_graal_mirror());
4979
18a5539bf19b More diff vs hsx24 optimizations.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4970
diff changeset
215 #endif
5150
fdd9dd4508fa some GC fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4979
diff changeset
216 MarkSweep::adjust_pointer(m->adr_method_data());
fdd9dd4508fa some GC fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4979
diff changeset
217
0
a61af66fc99e Initial load
duke
parents:
diff changeset
218 return size;
a61af66fc99e Initial load
duke
parents:
diff changeset
219 }
a61af66fc99e Initial load
duke
parents:
diff changeset
220
a61af66fc99e Initial load
duke
parents:
diff changeset
221 #ifndef SERIALGC
a61af66fc99e Initial load
duke
parents:
diff changeset
222 void methodKlass::oop_push_contents(PSPromotionManager* pm, oop obj) {
a61af66fc99e Initial load
duke
parents:
diff changeset
223 assert(obj->is_method(), "should be method");
5150
fdd9dd4508fa some GC fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4979
diff changeset
224 methodOop m = methodOop(obj);
fdd9dd4508fa some GC fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4979
diff changeset
225 #ifdef GRAAL
fdd9dd4508fa some GC fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4979
diff changeset
226 oop* adr = m->adr_graal_mirror();
fdd9dd4508fa some GC fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4979
diff changeset
227 if(PSScavenge::should_scavenge(adr)) {
fdd9dd4508fa some GC fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4979
diff changeset
228 pm->claim_or_forward_depth(adr);
fdd9dd4508fa some GC fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4979
diff changeset
229 }
fdd9dd4508fa some GC fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4979
diff changeset
230 #endif
0
a61af66fc99e Initial load
duke
parents:
diff changeset
231 }
a61af66fc99e Initial load
duke
parents:
diff changeset
232
a61af66fc99e Initial load
duke
parents:
diff changeset
233 int methodKlass::oop_update_pointers(ParCompactionManager* cm, oop obj) {
a61af66fc99e Initial load
duke
parents:
diff changeset
234 assert(obj->is_method(), "should be method");
a61af66fc99e Initial load
duke
parents:
diff changeset
235 methodOop m = methodOop(obj);
a61af66fc99e Initial load
duke
parents:
diff changeset
236 PSParallelCompact::adjust_pointer(m->adr_constMethod());
a61af66fc99e Initial load
duke
parents:
diff changeset
237 PSParallelCompact::adjust_pointer(m->adr_constants());
4979
18a5539bf19b More diff vs hsx24 optimizations.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4970
diff changeset
238 #ifdef GRAAL
3011
f00918f35c7f inlining and runtime interface related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2348
diff changeset
239 PSParallelCompact::adjust_pointer(m->adr_graal_mirror());
4979
18a5539bf19b More diff vs hsx24 optimizations.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4970
diff changeset
240 #endif
5150
fdd9dd4508fa some GC fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4979
diff changeset
241 PSParallelCompact::adjust_pointer(m->adr_method_data());
0
a61af66fc99e Initial load
duke
parents:
diff changeset
242 return m->object_size();
a61af66fc99e Initial load
duke
parents:
diff changeset
243 }
a61af66fc99e Initial load
duke
parents:
diff changeset
244 #endif // SERIALGC
a61af66fc99e Initial load
duke
parents:
diff changeset
245
a61af66fc99e Initial load
duke
parents:
diff changeset
246 #ifndef PRODUCT
a61af66fc99e Initial load
duke
parents:
diff changeset
247
a61af66fc99e Initial load
duke
parents:
diff changeset
248 // Printing
a61af66fc99e Initial load
duke
parents:
diff changeset
249
a61af66fc99e Initial load
duke
parents:
diff changeset
250 void methodKlass::oop_print_on(oop obj, outputStream* st) {
a61af66fc99e Initial load
duke
parents:
diff changeset
251 ResourceMark rm;
a61af66fc99e Initial load
duke
parents:
diff changeset
252 assert(obj->is_method(), "must be method");
a61af66fc99e Initial load
duke
parents:
diff changeset
253 Klass::oop_print_on(obj, st);
a61af66fc99e Initial load
duke
parents:
diff changeset
254 methodOop m = methodOop(obj);
1507
cd5dbf694d45 6939134: JSR 292 adjustments to method handle invocation
jrose
parents: 1155
diff changeset
255 // get the effect of PrintOopAddress, always, for methods:
1573
beb77f0d41b3 6957004: MethodComparator uses the wrong CP index accessor
jrose
parents: 1507
diff changeset
256 st->print_cr(" - this oop: "INTPTR_FORMAT, (intptr_t)m);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
257 st->print (" - method holder: "); m->method_holder()->print_value_on(st); st->cr();
1507
cd5dbf694d45 6939134: JSR 292 adjustments to method handle invocation
jrose
parents: 1155
diff changeset
258 st->print (" - constants: "INTPTR_FORMAT" ", (address)m->constants());
0
a61af66fc99e Initial load
duke
parents:
diff changeset
259 m->constants()->print_value_on(st); st->cr();
a61af66fc99e Initial load
duke
parents:
diff changeset
260 st->print (" - access: 0x%x ", m->access_flags().as_int()); m->access_flags().print_on(st); st->cr();
a61af66fc99e Initial load
duke
parents:
diff changeset
261 st->print (" - name: "); m->name()->print_value_on(st); st->cr();
a61af66fc99e Initial load
duke
parents:
diff changeset
262 st->print (" - signature: "); m->signature()->print_value_on(st); st->cr();
a61af66fc99e Initial load
duke
parents:
diff changeset
263 st->print_cr(" - max stack: %d", m->max_stack());
a61af66fc99e Initial load
duke
parents:
diff changeset
264 st->print_cr(" - max locals: %d", m->max_locals());
a61af66fc99e Initial load
duke
parents:
diff changeset
265 st->print_cr(" - size of params: %d", m->size_of_parameters());
a61af66fc99e Initial load
duke
parents:
diff changeset
266 st->print_cr(" - method size: %d", m->method_size());
1507
cd5dbf694d45 6939134: JSR 292 adjustments to method handle invocation
jrose
parents: 1155
diff changeset
267 if (m->intrinsic_id() != vmIntrinsics::_none)
cd5dbf694d45 6939134: JSR 292 adjustments to method handle invocation
jrose
parents: 1155
diff changeset
268 st->print_cr(" - intrinsic id: %d %s", m->intrinsic_id(), vmIntrinsics::name_at(m->intrinsic_id()));
1783
d5d065957597 6953144: Tiered compilation
iveresov
parents: 1706
diff changeset
269 if (m->highest_comp_level() != CompLevel_none)
d5d065957597 6953144: Tiered compilation
iveresov
parents: 1706
diff changeset
270 st->print_cr(" - highest level: %d", m->highest_comp_level());
0
a61af66fc99e Initial load
duke
parents:
diff changeset
271 st->print_cr(" - vtable index: %d", m->_vtable_index);
665
c89f86385056 6814659: separable cleanups and subroutines for 6655638
jrose
parents: 0
diff changeset
272 st->print_cr(" - i2i entry: " INTPTR_FORMAT, m->interpreter_entry());
c89f86385056 6814659: separable cleanups and subroutines for 6655638
jrose
parents: 0
diff changeset
273 st->print_cr(" - adapter: " INTPTR_FORMAT, m->adapter());
c89f86385056 6814659: separable cleanups and subroutines for 6655638
jrose
parents: 0
diff changeset
274 st->print_cr(" - compiled entry " INTPTR_FORMAT, m->from_compiled_entry());
0
a61af66fc99e Initial load
duke
parents:
diff changeset
275 st->print_cr(" - code size: %d", m->code_size());
665
c89f86385056 6814659: separable cleanups and subroutines for 6655638
jrose
parents: 0
diff changeset
276 if (m->code_size() != 0) {
c89f86385056 6814659: separable cleanups and subroutines for 6655638
jrose
parents: 0
diff changeset
277 st->print_cr(" - code start: " INTPTR_FORMAT, m->code_base());
c89f86385056 6814659: separable cleanups and subroutines for 6655638
jrose
parents: 0
diff changeset
278 st->print_cr(" - code end (excl): " INTPTR_FORMAT, m->code_base() + m->code_size());
c89f86385056 6814659: separable cleanups and subroutines for 6655638
jrose
parents: 0
diff changeset
279 }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
280 if (m->method_data() != NULL) {
a61af66fc99e Initial load
duke
parents:
diff changeset
281 st->print_cr(" - method data: " INTPTR_FORMAT, (address)m->method_data());
a61af66fc99e Initial load
duke
parents:
diff changeset
282 }
a61af66fc99e Initial load
duke
parents:
diff changeset
283 st->print_cr(" - checked ex length: %d", m->checked_exceptions_length());
a61af66fc99e Initial load
duke
parents:
diff changeset
284 if (m->checked_exceptions_length() > 0) {
a61af66fc99e Initial load
duke
parents:
diff changeset
285 CheckedExceptionElement* table = m->checked_exceptions_start();
a61af66fc99e Initial load
duke
parents:
diff changeset
286 st->print_cr(" - checked ex start: " INTPTR_FORMAT, table);
a61af66fc99e Initial load
duke
parents:
diff changeset
287 if (Verbose) {
a61af66fc99e Initial load
duke
parents:
diff changeset
288 for (int i = 0; i < m->checked_exceptions_length(); i++) {
a61af66fc99e Initial load
duke
parents:
diff changeset
289 st->print_cr(" - throws %s", m->constants()->printable_name_at(table[i].class_cp_index));
a61af66fc99e Initial load
duke
parents:
diff changeset
290 }
a61af66fc99e Initial load
duke
parents:
diff changeset
291 }
a61af66fc99e Initial load
duke
parents:
diff changeset
292 }
a61af66fc99e Initial load
duke
parents:
diff changeset
293 if (m->has_linenumber_table()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
294 u_char* table = m->compressed_linenumber_table();
a61af66fc99e Initial load
duke
parents:
diff changeset
295 st->print_cr(" - linenumber start: " INTPTR_FORMAT, table);
a61af66fc99e Initial load
duke
parents:
diff changeset
296 if (Verbose) {
a61af66fc99e Initial load
duke
parents:
diff changeset
297 CompressedLineNumberReadStream stream(table);
a61af66fc99e Initial load
duke
parents:
diff changeset
298 while (stream.read_pair()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
299 st->print_cr(" - line %d: %d", stream.line(), stream.bci());
a61af66fc99e Initial load
duke
parents:
diff changeset
300 }
a61af66fc99e Initial load
duke
parents:
diff changeset
301 }
a61af66fc99e Initial load
duke
parents:
diff changeset
302 }
a61af66fc99e Initial load
duke
parents:
diff changeset
303 st->print_cr(" - localvar length: %d", m->localvariable_table_length());
a61af66fc99e Initial load
duke
parents:
diff changeset
304 if (m->localvariable_table_length() > 0) {
a61af66fc99e Initial load
duke
parents:
diff changeset
305 LocalVariableTableElement* table = m->localvariable_table_start();
a61af66fc99e Initial load
duke
parents:
diff changeset
306 st->print_cr(" - localvar start: " INTPTR_FORMAT, table);
a61af66fc99e Initial load
duke
parents:
diff changeset
307 if (Verbose) {
a61af66fc99e Initial load
duke
parents:
diff changeset
308 for (int i = 0; i < m->localvariable_table_length(); i++) {
a61af66fc99e Initial load
duke
parents:
diff changeset
309 int bci = table[i].start_bci;
a61af66fc99e Initial load
duke
parents:
diff changeset
310 int len = table[i].length;
a61af66fc99e Initial load
duke
parents:
diff changeset
311 const char* name = m->constants()->printable_name_at(table[i].name_cp_index);
a61af66fc99e Initial load
duke
parents:
diff changeset
312 const char* desc = m->constants()->printable_name_at(table[i].descriptor_cp_index);
a61af66fc99e Initial load
duke
parents:
diff changeset
313 int slot = table[i].slot;
a61af66fc99e Initial load
duke
parents:
diff changeset
314 st->print_cr(" - %s %s bci=%d len=%d slot=%d", desc, name, bci, len, slot);
a61af66fc99e Initial load
duke
parents:
diff changeset
315 }
a61af66fc99e Initial load
duke
parents:
diff changeset
316 }
a61af66fc99e Initial load
duke
parents:
diff changeset
317 }
a61af66fc99e Initial load
duke
parents:
diff changeset
318 if (m->code() != NULL) {
a61af66fc99e Initial load
duke
parents:
diff changeset
319 st->print (" - compiled code: ");
a61af66fc99e Initial load
duke
parents:
diff changeset
320 m->code()->print_value_on(st);
a61af66fc99e Initial load
duke
parents:
diff changeset
321 st->cr();
a61af66fc99e Initial load
duke
parents:
diff changeset
322 }
710
e5b0439ef4ae 6655638: dynamic languages need method handles
jrose
parents: 665
diff changeset
323 if (m->is_method_handle_invoke()) {
e5b0439ef4ae 6655638: dynamic languages need method handles
jrose
parents: 665
diff changeset
324 st->print_cr(" - invoke method type: " INTPTR_FORMAT, (address) m->method_handle_type());
e5b0439ef4ae 6655638: dynamic languages need method handles
jrose
parents: 665
diff changeset
325 // m is classified as native, but it does not have an interesting
e5b0439ef4ae 6655638: dynamic languages need method handles
jrose
parents: 665
diff changeset
326 // native_function or signature handler
e5b0439ef4ae 6655638: dynamic languages need method handles
jrose
parents: 665
diff changeset
327 } else if (m->is_native()) {
665
c89f86385056 6814659: separable cleanups and subroutines for 6655638
jrose
parents: 0
diff changeset
328 st->print_cr(" - native function: " INTPTR_FORMAT, m->native_function());
c89f86385056 6814659: separable cleanups and subroutines for 6655638
jrose
parents: 0
diff changeset
329 st->print_cr(" - signature handler: " INTPTR_FORMAT, m->signature_handler());
c89f86385056 6814659: separable cleanups and subroutines for 6655638
jrose
parents: 0
diff changeset
330 }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
331 }
a61af66fc99e Initial load
duke
parents:
diff changeset
332
1155
4e6abf09f540 6912062: disassembler plugin needs to produce symbolic information in product mode
jrose
parents: 856
diff changeset
333 #endif //PRODUCT
0
a61af66fc99e Initial load
duke
parents:
diff changeset
334
a61af66fc99e Initial load
duke
parents:
diff changeset
335 void methodKlass::oop_print_value_on(oop obj, outputStream* st) {
a61af66fc99e Initial load
duke
parents:
diff changeset
336 assert(obj->is_method(), "must be method");
a61af66fc99e Initial load
duke
parents:
diff changeset
337 Klass::oop_print_value_on(obj, st);
a61af66fc99e Initial load
duke
parents:
diff changeset
338 methodOop m = methodOop(obj);
a61af66fc99e Initial load
duke
parents:
diff changeset
339 st->print(" ");
a61af66fc99e Initial load
duke
parents:
diff changeset
340 m->name()->print_value_on(st);
a61af66fc99e Initial load
duke
parents:
diff changeset
341 st->print(" ");
a61af66fc99e Initial load
duke
parents:
diff changeset
342 m->signature()->print_value_on(st);
a61af66fc99e Initial load
duke
parents:
diff changeset
343 st->print(" in ");
a61af66fc99e Initial load
duke
parents:
diff changeset
344 m->method_holder()->print_value_on(st);
a61af66fc99e Initial load
duke
parents:
diff changeset
345 if (WizardMode) st->print("[%d,%d]", m->size_of_parameters(), m->max_locals());
a61af66fc99e Initial load
duke
parents:
diff changeset
346 if (WizardMode && m->code() != NULL) st->print(" ((nmethod*)%p)", m->code());
a61af66fc99e Initial load
duke
parents:
diff changeset
347 }
a61af66fc99e Initial load
duke
parents:
diff changeset
348
a61af66fc99e Initial load
duke
parents:
diff changeset
349 const char* methodKlass::internal_name() const {
a61af66fc99e Initial load
duke
parents:
diff changeset
350 return "{method}";
a61af66fc99e Initial load
duke
parents:
diff changeset
351 }
a61af66fc99e Initial load
duke
parents:
diff changeset
352
a61af66fc99e Initial load
duke
parents:
diff changeset
353
a61af66fc99e Initial load
duke
parents:
diff changeset
354 // Verification
a61af66fc99e Initial load
duke
parents:
diff changeset
355
a61af66fc99e Initial load
duke
parents:
diff changeset
356 void methodKlass::oop_verify_on(oop obj, outputStream* st) {
a61af66fc99e Initial load
duke
parents:
diff changeset
357 Klass::oop_verify_on(obj, st);
a61af66fc99e Initial load
duke
parents:
diff changeset
358 guarantee(obj->is_method(), "object must be method");
a61af66fc99e Initial load
duke
parents:
diff changeset
359 if (!obj->partially_loaded()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
360 methodOop m = methodOop(obj);
a61af66fc99e Initial load
duke
parents:
diff changeset
361 guarantee(m->is_perm(), "should be in permspace");
a61af66fc99e Initial load
duke
parents:
diff changeset
362 guarantee(m->constants()->is_perm(), "should be in permspace");
a61af66fc99e Initial load
duke
parents:
diff changeset
363 guarantee(m->constants()->is_constantPool(), "should be constant pool");
a61af66fc99e Initial load
duke
parents:
diff changeset
364 guarantee(m->constMethod()->is_constMethod(), "should be constMethodOop");
a61af66fc99e Initial load
duke
parents:
diff changeset
365 guarantee(m->constMethod()->is_perm(), "should be in permspace");
a61af66fc99e Initial load
duke
parents:
diff changeset
366 methodDataOop method_data = m->method_data();
a61af66fc99e Initial load
duke
parents:
diff changeset
367 guarantee(method_data == NULL ||
a61af66fc99e Initial load
duke
parents:
diff changeset
368 method_data->is_perm(), "should be in permspace");
a61af66fc99e Initial load
duke
parents:
diff changeset
369 guarantee(method_data == NULL ||
a61af66fc99e Initial load
duke
parents:
diff changeset
370 method_data->is_methodData(), "should be method data");
a61af66fc99e Initial load
duke
parents:
diff changeset
371 }
a61af66fc99e Initial load
duke
parents:
diff changeset
372 }
a61af66fc99e Initial load
duke
parents:
diff changeset
373
a61af66fc99e Initial load
duke
parents:
diff changeset
374 bool methodKlass::oop_partially_loaded(oop obj) const {
a61af66fc99e Initial load
duke
parents:
diff changeset
375 assert(obj->is_method(), "object must be method");
a61af66fc99e Initial load
duke
parents:
diff changeset
376 methodOop m = methodOop(obj);
a61af66fc99e Initial load
duke
parents:
diff changeset
377 constMethodOop xconst = m->constMethod();
a61af66fc99e Initial load
duke
parents:
diff changeset
378 assert(xconst != NULL, "const method must be set");
a61af66fc99e Initial load
duke
parents:
diff changeset
379 constMethodKlass* ck = constMethodKlass::cast(xconst->klass());
a61af66fc99e Initial load
duke
parents:
diff changeset
380 return ck->oop_partially_loaded(xconst);
a61af66fc99e Initial load
duke
parents:
diff changeset
381 }
a61af66fc99e Initial load
duke
parents:
diff changeset
382
a61af66fc99e Initial load
duke
parents:
diff changeset
383
a61af66fc99e Initial load
duke
parents:
diff changeset
384 void methodKlass::oop_set_partially_loaded(oop obj) {
a61af66fc99e Initial load
duke
parents:
diff changeset
385 assert(obj->is_method(), "object must be method");
a61af66fc99e Initial load
duke
parents:
diff changeset
386 methodOop m = methodOop(obj);
a61af66fc99e Initial load
duke
parents:
diff changeset
387 constMethodOop xconst = m->constMethod();
a61af66fc99e Initial load
duke
parents:
diff changeset
388 assert(xconst != NULL, "const method must be set");
a61af66fc99e Initial load
duke
parents:
diff changeset
389 constMethodKlass* ck = constMethodKlass::cast(xconst->klass());
a61af66fc99e Initial load
duke
parents:
diff changeset
390 ck->oop_set_partially_loaded(xconst);
a61af66fc99e Initial load
duke
parents:
diff changeset
391 }