< prev index next >

src/share/vm/prims/jniCheck.cpp

Print this page
rev 13107 : imported patch jvm_h
   1 /*
   2  * Copyright (c) 2001, 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  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "classfile/javaClasses.inline.hpp"
  27 #include "classfile/systemDictionary.hpp"
  28 #include "classfile/vmSymbols.hpp"
  29 #include "memory/guardedMemory.hpp"
  30 #include "oops/instanceKlass.hpp"
  31 #include "oops/oop.inline.hpp"
  32 #include "oops/symbol.hpp"
  33 #include "prims/jni.h"
  34 #include "prims/jniCheck.hpp"

  35 #include "prims/jvm_misc.hpp"
  36 #include "runtime/fieldDescriptor.hpp"
  37 #include "runtime/handles.hpp"
  38 #include "runtime/interfaceSupport.hpp"
  39 #include "runtime/jfieldIDWorkaround.hpp"
  40 #include "runtime/thread.inline.hpp"
  41 
  42 // Complain every extra number of unplanned local refs
  43 #define CHECK_JNI_LOCAL_REF_CAP_WARN_THRESHOLD 32
  44 
  45 // Heap objects are allowed to be directly referenced only in VM code,
  46 // not in native code.
  47 
  48 #define ASSERT_OOPS_ALLOWED                                          \
  49     assert(JavaThread::current()->thread_state() == _thread_in_vm,   \
  50            "jniCheck examining oops in bad state.")
  51 
  52 
  53 // Execute the given block of source code with the thread in VM state.
  54 // To do this, transition from the NATIVE state to the VM state, execute


   1 /*
   2  * Copyright (c) 2001, 2017, 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.inline.hpp"
  27 #include "classfile/systemDictionary.hpp"
  28 #include "classfile/vmSymbols.hpp"
  29 #include "memory/guardedMemory.hpp"
  30 #include "oops/instanceKlass.hpp"
  31 #include "oops/oop.inline.hpp"
  32 #include "oops/symbol.hpp"
  33 #include "prims/jni.h"
  34 #include "prims/jniCheck.hpp"
  35 #include "prims/jvm.h"
  36 #include "prims/jvm_misc.hpp"
  37 #include "runtime/fieldDescriptor.hpp"
  38 #include "runtime/handles.hpp"
  39 #include "runtime/interfaceSupport.hpp"
  40 #include "runtime/jfieldIDWorkaround.hpp"
  41 #include "runtime/thread.inline.hpp"
  42 
  43 // Complain every extra number of unplanned local refs
  44 #define CHECK_JNI_LOCAL_REF_CAP_WARN_THRESHOLD 32
  45 
  46 // Heap objects are allowed to be directly referenced only in VM code,
  47 // not in native code.
  48 
  49 #define ASSERT_OOPS_ALLOWED                                          \
  50     assert(JavaThread::current()->thread_state() == _thread_in_vm,   \
  51            "jniCheck examining oops in bad state.")
  52 
  53 
  54 // Execute the given block of source code with the thread in VM state.
  55 // To do this, transition from the NATIVE state to the VM state, execute


< prev index next >