1 /*
2 * Copyright (c) 1997, 2015, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
167 ClassLoaderData* loader_data = pool_holder()->class_loader_data();
168 set_resolved_references(loader_data->add_handle(refs_handle));
169 }
170 }
171 }
172
173 void ConstantPool::remove_unshareable_info() {
174 // Resolved references are not in the shared archive.
175 // Save the length for restoration. It is not necessarily the same length
176 // as reference_map.length() if invokedynamic is saved.
177 set_resolved_reference_length(
178 resolved_references() != NULL ? resolved_references()->length() : 0);
179 set_resolved_references(NULL);
180 }
181
182 int ConstantPool::cp_to_object_index(int cp_index) {
183 // this is harder don't do this so much.
184 int i = reference_map()->find(cp_index);
185 // We might not find the index for jsr292 call.
186 return (i < 0) ? _no_index_sentinel : i;
187 }
188
189 void ConstantPool::trace_class_resolution(const constantPoolHandle& this_cp, KlassHandle k) {
190 ResourceMark rm;
191 int line_number = -1;
192 const char * source_file = NULL;
193 if (JavaThread::current()->has_last_Java_frame()) {
194 // try to identify the method which called this function.
195 vframeStream vfst(JavaThread::current());
196 if (!vfst.at_end()) {
197 line_number = vfst.method()->line_number_from_bci(vfst.bci());
198 Symbol* s = vfst.method()->method_holder()->source_file_name();
199 if (s != NULL) {
200 source_file = s->as_C_string();
201 }
202 }
203 }
204 if (k() != this_cp->pool_holder()) {
205 // only print something if the classes are different
206 if (source_file != NULL) {
|
1 /*
2 * Copyright (c) 1997, 2016, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
167 ClassLoaderData* loader_data = pool_holder()->class_loader_data();
168 set_resolved_references(loader_data->add_handle(refs_handle));
169 }
170 }
171 }
172
173 void ConstantPool::remove_unshareable_info() {
174 // Resolved references are not in the shared archive.
175 // Save the length for restoration. It is not necessarily the same length
176 // as reference_map.length() if invokedynamic is saved.
177 set_resolved_reference_length(
178 resolved_references() != NULL ? resolved_references()->length() : 0);
179 set_resolved_references(NULL);
180 }
181
182 int ConstantPool::cp_to_object_index(int cp_index) {
183 // this is harder don't do this so much.
184 int i = reference_map()->find(cp_index);
185 // We might not find the index for jsr292 call.
186 return (i < 0) ? _no_index_sentinel : i;
187 }
188
189 void ConstantPool::string_at_put(int which, int obj_index, oop str) {
190 resolved_references()->obj_at_put(obj_index, str);
191 }
192
193 void ConstantPool::trace_class_resolution(const constantPoolHandle& this_cp, KlassHandle k) {
194 ResourceMark rm;
195 int line_number = -1;
196 const char * source_file = NULL;
197 if (JavaThread::current()->has_last_Java_frame()) {
198 // try to identify the method which called this function.
199 vframeStream vfst(JavaThread::current());
200 if (!vfst.at_end()) {
201 line_number = vfst.method()->line_number_from_bci(vfst.bci());
202 Symbol* s = vfst.method()->method_holder()->source_file_name();
203 if (s != NULL) {
204 source_file = s->as_C_string();
205 }
206 }
207 }
208 if (k() != this_cp->pool_holder()) {
209 // only print something if the classes are different
210 if (source_file != NULL) {
|