Mercurial > hg > graal-jvmci-8
comparison src/share/vm/oops/constMethodKlass.cpp @ 6123:2fe087c3e814
7172967: Eliminate constMethod's _method backpointer to methodOop.
Summary: Eliminate constMethod's _method backpointer to methodOop, and move the _constant field from methodOop to constMethod.
Reviewed-by: roland, bdelsart, kamg
author | jiangli |
---|---|
date | Wed, 06 Jun 2012 14:33:43 -0400 |
parents | c124e2e7463e |
children | 8150fa46d2ed |
comparison
equal
deleted
inserted
replaced
6115:6e2633440960 | 6123:2fe087c3e814 |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. | 2 * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | 4 * |
5 * This code is free software; you can redistribute it and/or modify it | 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 | 6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
78 CollectedHeap::permanent_obj_allocate(h_k, size, CHECK_NULL); | 78 CollectedHeap::permanent_obj_allocate(h_k, size, CHECK_NULL); |
79 assert(!cm->is_parsable(), "Not yet safely parsable"); | 79 assert(!cm->is_parsable(), "Not yet safely parsable"); |
80 No_Safepoint_Verifier no_safepoint; | 80 No_Safepoint_Verifier no_safepoint; |
81 cm->set_interpreter_kind(Interpreter::invalid); | 81 cm->set_interpreter_kind(Interpreter::invalid); |
82 cm->init_fingerprint(); | 82 cm->init_fingerprint(); |
83 cm->set_method(NULL); | 83 cm->set_constants(NULL); |
84 cm->set_stackmap_data(NULL); | 84 cm->set_stackmap_data(NULL); |
85 cm->set_exception_table(NULL); | 85 cm->set_exception_table(NULL); |
86 cm->set_code_size(byte_code_size); | 86 cm->set_code_size(byte_code_size); |
87 cm->set_constMethod_size(size); | 87 cm->set_constMethod_size(size); |
88 cm->set_inlined_tables_length(checked_exceptions_length, | 88 cm->set_inlined_tables_length(checked_exceptions_length, |
96 } | 96 } |
97 | 97 |
98 void constMethodKlass::oop_follow_contents(oop obj) { | 98 void constMethodKlass::oop_follow_contents(oop obj) { |
99 assert (obj->is_constMethod(), "object must be constMethod"); | 99 assert (obj->is_constMethod(), "object must be constMethod"); |
100 constMethodOop cm = constMethodOop(obj); | 100 constMethodOop cm = constMethodOop(obj); |
101 MarkSweep::mark_and_push(cm->adr_method()); | 101 MarkSweep::mark_and_push(cm->adr_constants()); |
102 MarkSweep::mark_and_push(cm->adr_stackmap_data()); | 102 MarkSweep::mark_and_push(cm->adr_stackmap_data()); |
103 MarkSweep::mark_and_push(cm->adr_exception_table()); | 103 MarkSweep::mark_and_push(cm->adr_exception_table()); |
104 // Performance tweak: We skip iterating over the klass pointer since we | 104 // Performance tweak: We skip iterating over the klass pointer since we |
105 // know that Universe::constMethodKlassObj never moves. | 105 // know that Universe::constMethodKlassObj never moves. |
106 } | 106 } |
108 #ifndef SERIALGC | 108 #ifndef SERIALGC |
109 void constMethodKlass::oop_follow_contents(ParCompactionManager* cm, | 109 void constMethodKlass::oop_follow_contents(ParCompactionManager* cm, |
110 oop obj) { | 110 oop obj) { |
111 assert (obj->is_constMethod(), "object must be constMethod"); | 111 assert (obj->is_constMethod(), "object must be constMethod"); |
112 constMethodOop cm_oop = constMethodOop(obj); | 112 constMethodOop cm_oop = constMethodOop(obj); |
113 PSParallelCompact::mark_and_push(cm, cm_oop->adr_method()); | 113 PSParallelCompact::mark_and_push(cm, cm_oop->adr_constants()); |
114 PSParallelCompact::mark_and_push(cm, cm_oop->adr_stackmap_data()); | 114 PSParallelCompact::mark_and_push(cm, cm_oop->adr_stackmap_data()); |
115 PSParallelCompact::mark_and_push(cm, cm_oop->adr_exception_table()); | 115 PSParallelCompact::mark_and_push(cm, cm_oop->adr_exception_table()); |
116 // Performance tweak: We skip iterating over the klass pointer since we | 116 // Performance tweak: We skip iterating over the klass pointer since we |
117 // know that Universe::constMethodKlassObj never moves. | 117 // know that Universe::constMethodKlassObj never moves. |
118 } | 118 } |
119 #endif // SERIALGC | 119 #endif // SERIALGC |
120 | 120 |
121 int constMethodKlass::oop_oop_iterate(oop obj, OopClosure* blk) { | 121 int constMethodKlass::oop_oop_iterate(oop obj, OopClosure* blk) { |
122 assert (obj->is_constMethod(), "object must be constMethod"); | 122 assert (obj->is_constMethod(), "object must be constMethod"); |
123 constMethodOop cm = constMethodOop(obj); | 123 constMethodOop cm = constMethodOop(obj); |
124 blk->do_oop(cm->adr_method()); | 124 blk->do_oop(cm->adr_constants()); |
125 blk->do_oop(cm->adr_stackmap_data()); | 125 blk->do_oop(cm->adr_stackmap_data()); |
126 blk->do_oop(cm->adr_exception_table()); | 126 blk->do_oop(cm->adr_exception_table()); |
127 // Get size before changing pointers. | 127 // Get size before changing pointers. |
128 // Don't call size() or oop_size() since that is a virtual call. | 128 // Don't call size() or oop_size() since that is a virtual call. |
129 int size = cm->object_size(); | 129 int size = cm->object_size(); |
133 | 133 |
134 int constMethodKlass::oop_oop_iterate_m(oop obj, OopClosure* blk, MemRegion mr) { | 134 int constMethodKlass::oop_oop_iterate_m(oop obj, OopClosure* blk, MemRegion mr) { |
135 assert (obj->is_constMethod(), "object must be constMethod"); | 135 assert (obj->is_constMethod(), "object must be constMethod"); |
136 constMethodOop cm = constMethodOop(obj); | 136 constMethodOop cm = constMethodOop(obj); |
137 oop* adr; | 137 oop* adr; |
138 adr = cm->adr_method(); | 138 adr = cm->adr_constants(); |
139 if (mr.contains(adr)) blk->do_oop(adr); | 139 if (mr.contains(adr)) blk->do_oop(adr); |
140 adr = cm->adr_stackmap_data(); | 140 adr = cm->adr_stackmap_data(); |
141 if (mr.contains(adr)) blk->do_oop(adr); | 141 if (mr.contains(adr)) blk->do_oop(adr); |
142 adr = cm->adr_exception_table(); | 142 adr = cm->adr_exception_table(); |
143 if (mr.contains(adr)) blk->do_oop(adr); | 143 if (mr.contains(adr)) blk->do_oop(adr); |
151 | 151 |
152 | 152 |
153 int constMethodKlass::oop_adjust_pointers(oop obj) { | 153 int constMethodKlass::oop_adjust_pointers(oop obj) { |
154 assert(obj->is_constMethod(), "should be constMethod"); | 154 assert(obj->is_constMethod(), "should be constMethod"); |
155 constMethodOop cm = constMethodOop(obj); | 155 constMethodOop cm = constMethodOop(obj); |
156 MarkSweep::adjust_pointer(cm->adr_method()); | 156 MarkSweep::adjust_pointer(cm->adr_constants()); |
157 MarkSweep::adjust_pointer(cm->adr_stackmap_data()); | 157 MarkSweep::adjust_pointer(cm->adr_stackmap_data()); |
158 MarkSweep::adjust_pointer(cm->adr_exception_table()); | 158 MarkSweep::adjust_pointer(cm->adr_exception_table()); |
159 // Get size before changing pointers. | 159 // Get size before changing pointers. |
160 // Don't call size() or oop_size() since that is a virtual call. | 160 // Don't call size() or oop_size() since that is a virtual call. |
161 int size = cm->object_size(); | 161 int size = cm->object_size(); |
186 void constMethodKlass::oop_print_on(oop obj, outputStream* st) { | 186 void constMethodKlass::oop_print_on(oop obj, outputStream* st) { |
187 ResourceMark rm; | 187 ResourceMark rm; |
188 assert(obj->is_constMethod(), "must be constMethod"); | 188 assert(obj->is_constMethod(), "must be constMethod"); |
189 Klass::oop_print_on(obj, st); | 189 Klass::oop_print_on(obj, st); |
190 constMethodOop m = constMethodOop(obj); | 190 constMethodOop m = constMethodOop(obj); |
191 st->print(" - method: " INTPTR_FORMAT " ", (address)m->method()); | 191 st->print(" - constants: " INTPTR_FORMAT " ", (address)m->constants()); |
192 m->method()->print_value_on(st); st->cr(); | 192 m->constants()->print_value_on(st); st->cr(); |
193 st->print(" - exceptions: " INTPTR_FORMAT "\n", (address)m->exception_table()); | 193 st->print(" - exceptions: " INTPTR_FORMAT "\n", (address)m->exception_table()); |
194 if (m->has_stackmap_table()) { | 194 if (m->has_stackmap_table()) { |
195 st->print(" - stackmap data: "); | 195 st->print(" - stackmap data: "); |
196 m->stackmap_data()->print_value_on(st); | 196 m->stackmap_data()->print_value_on(st); |
197 st->cr(); | 197 st->cr(); |
221 guarantee(m->is_perm(), "should be in permspace"); | 221 guarantee(m->is_perm(), "should be in permspace"); |
222 | 222 |
223 // Verification can occur during oop construction before the method or | 223 // Verification can occur during oop construction before the method or |
224 // other fields have been initialized. | 224 // other fields have been initialized. |
225 if (!obj->partially_loaded()) { | 225 if (!obj->partially_loaded()) { |
226 guarantee(m->method()->is_perm(), "should be in permspace"); | 226 guarantee(m->constants()->is_perm(), "should be in permspace"); |
227 guarantee(m->method()->is_method(), "should be method"); | 227 guarantee(m->constants()->is_constantPool(), "should be constant pool"); |
228 typeArrayOop stackmap_data = m->stackmap_data(); | 228 typeArrayOop stackmap_data = m->stackmap_data(); |
229 guarantee(stackmap_data == NULL || | 229 guarantee(stackmap_data == NULL || |
230 stackmap_data->is_perm(), "should be in permspace"); | 230 stackmap_data->is_perm(), "should be in permspace"); |
231 guarantee(m->exception_table()->is_perm(), "should be in permspace"); | 231 guarantee(m->exception_table()->is_perm(), "should be in permspace"); |
232 guarantee(m->exception_table()->is_typeArray(), "should be type array"); | 232 guarantee(m->exception_table()->is_typeArray(), "should be type array"); |