1 /* 2 * Copyright (c) 1997, 2009, 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 * 23 */ 24 25 # include "incls/_precompiled.incl" 26 # include "incls/_javaClasses.cpp.incl" 27 28 static bool find_field(instanceKlass* ik, 29 symbolOop name_symbol, symbolOop signature_symbol, 30 fieldDescriptor* fd, 31 bool allow_super = false) { 32 if (allow_super) 33 return ik->find_field(name_symbol, signature_symbol, fd) != NULL; 34 else 35 return ik->find_local_field(name_symbol, signature_symbol, fd); 36 } 37 38 // Helpful routine for computing field offsets at run time rather than hardcoding them 39 static void 40 compute_offset(int &dest_offset, 41 klassOop klass_oop, symbolOop name_symbol, symbolOop signature_symbol, 42 bool allow_super = false) { 43 fieldDescriptor fd; 44 instanceKlass* ik = instanceKlass::cast(klass_oop); 45 if (!find_field(ik, name_symbol, signature_symbol, &fd, allow_super)) { 46 ResourceMark rm; | 1 /* 2 * Copyright (c) 1997, 2010, 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 * 23 */ 24 25 #include "precompiled.hpp" 26 #include "classfile/javaClasses.hpp" 27 #include "classfile/symbolTable.hpp" 28 #include "classfile/vmSymbols.hpp" 29 #include "code/debugInfo.hpp" 30 #include "code/pcDesc.hpp" 31 #include "interpreter/interpreter.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/klass.hpp" 37 #include "oops/klassOop.hpp" 38 #include "oops/methodOop.hpp" 39 #include "oops/symbolOop.hpp" 40 #include "oops/typeArrayOop.hpp" 41 #include "runtime/fieldDescriptor.hpp" 42 #include "runtime/handles.inline.hpp" 43 #include "runtime/interfaceSupport.hpp" 44 #include "runtime/java.hpp" 45 #include "runtime/javaCalls.hpp" 46 #include "runtime/safepoint.hpp" 47 #include "runtime/vframe.hpp" 48 #include "utilities/preserveException.hpp" 49 #ifdef TARGET_OS_FAMILY_linux 50 # include "thread_linux.inline.hpp" 51 #endif 52 #ifdef TARGET_OS_FAMILY_solaris 53 # include "thread_solaris.inline.hpp" 54 #endif 55 #ifdef TARGET_OS_FAMILY_windows 56 # include "thread_windows.inline.hpp" 57 #endif 58 59 static bool find_field(instanceKlass* ik, 60 symbolOop name_symbol, symbolOop signature_symbol, 61 fieldDescriptor* fd, 62 bool allow_super = false) { 63 if (allow_super) 64 return ik->find_field(name_symbol, signature_symbol, fd) != NULL; 65 else 66 return ik->find_local_field(name_symbol, signature_symbol, fd); 67 } 68 69 // Helpful routine for computing field offsets at run time rather than hardcoding them 70 static void 71 compute_offset(int &dest_offset, 72 klassOop klass_oop, symbolOop name_symbol, symbolOop signature_symbol, 73 bool allow_super = false) { 74 fieldDescriptor fd; 75 instanceKlass* ik = instanceKlass::cast(klass_oop); 76 if (!find_field(ik, name_symbol, signature_symbol, &fd, allow_super)) { 77 ResourceMark rm; |