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 * 23 */ 24 25 #include "incls/_precompiled.incl" 26 #include "incls/_reflection.cpp.incl" 27 28 #define JAVA_1_5_VERSION 49 29 30 static void trace_class_resolution(klassOop to_class) { 31 ResourceMark rm; 32 int line_number = -1; 33 const char * source_file = NULL; 34 klassOop caller = NULL; 35 JavaThread* jthread = JavaThread::current(); 36 if (jthread->has_last_Java_frame()) { 37 vframeStream vfst(jthread); 38 // skip over any frames belonging to java.lang.Class 39 while (!vfst.at_end() && 40 instanceKlass::cast(vfst.method()->method_holder())->name() == vmSymbols::java_lang_Class()) { 41 vfst.next(); 42 } 43 if (!vfst.at_end()) { 44 // this frame is a likely suspect 45 caller = vfst.method()->method_holder(); 46 line_number = vfst.method()->line_number_from_bci(vfst.bci()); | 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 * 23 */ 24 25 #include "precompiled.hpp" 26 #include "classfile/javaClasses.hpp" 27 #include "classfile/symbolTable.hpp" 28 #include "classfile/systemDictionary.hpp" 29 #include "classfile/verifier.hpp" 30 #include "classfile/vmSymbols.hpp" 31 #include "interpreter/linkResolver.hpp" 32 #include "memory/oopFactory.hpp" 33 #include "memory/resourceArea.hpp" 34 #include "memory/universe.inline.hpp" 35 #include "oops/instanceKlass.hpp" 36 #include "oops/objArrayKlass.hpp" 37 #include "oops/objArrayOop.hpp" 38 #include "prims/jvm.h" 39 #include "prims/methodHandleWalk.hpp" 40 #include "runtime/arguments.hpp" 41 #include "runtime/handles.inline.hpp" 42 #include "runtime/javaCalls.hpp" 43 #include "runtime/reflection.hpp" 44 #include "runtime/reflectionUtils.hpp" 45 #include "runtime/signature.hpp" 46 #include "runtime/vframe.hpp" 47 48 #define JAVA_1_5_VERSION 49 49 50 static void trace_class_resolution(klassOop to_class) { 51 ResourceMark rm; 52 int line_number = -1; 53 const char * source_file = NULL; 54 klassOop caller = NULL; 55 JavaThread* jthread = JavaThread::current(); 56 if (jthread->has_last_Java_frame()) { 57 vframeStream vfst(jthread); 58 // skip over any frames belonging to java.lang.Class 59 while (!vfst.at_end() && 60 instanceKlass::cast(vfst.method()->method_holder())->name() == vmSymbols::java_lang_Class()) { 61 vfst.next(); 62 } 63 if (!vfst.at_end()) { 64 // this frame is a likely suspect 65 caller = vfst.method()->method_holder(); 66 line_number = vfst.method()->line_number_from_bci(vfst.bci()); |