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/_jvm.cpp.incl" 27 #include <errno.h> 28 29 HS_DTRACE_PROBE_DECL1(hotspot, thread__sleep__begin, long long); 30 HS_DTRACE_PROBE_DECL1(hotspot, thread__sleep__end, int); 31 HS_DTRACE_PROBE_DECL0(hotspot, thread__yield); 32 33 /* 34 NOTE about use of any ctor or function call that can trigger a safepoint/GC: 35 such ctors and calls MUST NOT come between an oop declaration/init and its 36 usage because if objects are move this may cause various memory stomps, bus 37 errors and segfaults. Here is a cookbook for causing so called "naked oop 38 failures": 39 40 JVM_ENTRY(jobjectArray, JVM_GetClassDeclaredFields<etc> { 41 JVMWrapper("JVM_GetClassDeclaredFields"); 42 43 // Object address to be held directly in mirror & not visible to GC 44 oop mirror = JNIHandles::resolve_non_null(ofClass); 45 46 // If this ctor can hit a safepoint, moving objects around, then | 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/classLoader.hpp" 27 #include "classfile/javaAssertions.hpp" 28 #include "classfile/javaClasses.hpp" 29 #include "classfile/symbolTable.hpp" 30 #include "classfile/systemDictionary.hpp" 31 #include "classfile/vmSymbols.hpp" 32 #include "gc_interface/collectedHeap.inline.hpp" 33 #include "memory/oopFactory.hpp" 34 #include "memory/universe.inline.hpp" 35 #include "oops/instanceKlass.hpp" 36 #include "oops/objArrayKlass.hpp" 37 #include "prims/jvm.h" 38 #include "prims/jvm_misc.hpp" 39 #include "prims/jvmtiExport.hpp" 40 #include "prims/jvmtiThreadState.hpp" 41 #include "prims/nativeLookup.hpp" 42 #include "prims/privilegedStack.hpp" 43 #include "runtime/arguments.hpp" 44 #include "runtime/dtraceJSDT.hpp" 45 #include "runtime/handles.inline.hpp" 46 #include "runtime/hpi.hpp" 47 #include "runtime/init.hpp" 48 #include "runtime/interfaceSupport.hpp" 49 #include "runtime/java.hpp" 50 #include "runtime/javaCalls.hpp" 51 #include "runtime/jfieldIDWorkaround.hpp" 52 #include "runtime/os.hpp" 53 #include "runtime/perfData.hpp" 54 #include "runtime/reflection.hpp" 55 #include "runtime/vframe.hpp" 56 #include "runtime/vm_operations.hpp" 57 #include "services/attachListener.hpp" 58 #include "services/management.hpp" 59 #include "services/threadService.hpp" 60 #include "utilities/copy.hpp" 61 #include "utilities/defaultStream.hpp" 62 #include "utilities/dtrace.hpp" 63 #include "utilities/events.hpp" 64 #include "utilities/histogram.hpp" 65 #include "utilities/top.hpp" 66 #include "utilities/utf8.hpp" 67 #ifdef TARGET_OS_FAMILY_linux 68 # include "hpi_linux.hpp" 69 # include "jvm_linux.h" 70 #endif 71 #ifdef TARGET_OS_FAMILY_solaris 72 # include "hpi_solaris.hpp" 73 # include "jvm_solaris.h" 74 #endif 75 #ifdef TARGET_OS_FAMILY_windows 76 # include "hpi_windows.hpp" 77 # include "jvm_windows.h" 78 #endif 79 80 #include <errno.h> 81 82 HS_DTRACE_PROBE_DECL1(hotspot, thread__sleep__begin, long long); 83 HS_DTRACE_PROBE_DECL1(hotspot, thread__sleep__end, int); 84 HS_DTRACE_PROBE_DECL0(hotspot, thread__yield); 85 86 /* 87 NOTE about use of any ctor or function call that can trigger a safepoint/GC: 88 such ctors and calls MUST NOT come between an oop declaration/init and its 89 usage because if objects are move this may cause various memory stomps, bus 90 errors and segfaults. Here is a cookbook for causing so called "naked oop 91 failures": 92 93 JVM_ENTRY(jobjectArray, JVM_GetClassDeclaredFields<etc> { 94 JVMWrapper("JVM_GetClassDeclaredFields"); 95 96 // Object address to be held directly in mirror & not visible to GC 97 oop mirror = JNIHandles::resolve_non_null(ofClass); 98 99 // If this ctor can hit a safepoint, moving objects around, then |