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/systemDictionary.hpp"
27 #include "oops/oop.inline.hpp"
28 #include "prims/jvmtiExport.hpp"
29 #include "runtime/jniHandles.hpp"
30 #include "runtime/mutexLocker.hpp"
31 #ifdef TARGET_OS_FAMILY_linux
32 # include "thread_linux.inline.hpp"
33 #endif
34 #ifdef TARGET_OS_FAMILY_solaris
35 # include "thread_solaris.inline.hpp"
36 #endif
37 #ifdef TARGET_OS_FAMILY_windows
38 # include "thread_windows.inline.hpp"
39 #endif
40 #ifdef TARGET_OS_FAMILY_bsd
41 # include "thread_bsd.inline.hpp"
42 #endif
43
44
45 JNIHandleBlock* JNIHandles::_global_handles = NULL;
46 JNIHandleBlock* JNIHandles::_weak_global_handles = NULL;
47 oop JNIHandles::_deleted_handle = NULL;
48
49
50 jobject JNIHandles::make_local(oop obj) {
51 if (obj == NULL) {
52 return NULL; // ignore null handles
53 } else {
54 Thread* thread = Thread::current();
55 assert(Universe::heap()->is_in_reserved(obj), "sanity check");
56 return thread->active_handles()->allocate_handle(obj);
57 }
58 }
59
60
61 // optimized versions
62
|
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/systemDictionary.hpp"
27 #include "oops/oop.inline.hpp"
28 #include "prims/jvmtiExport.hpp"
29 #include "runtime/jniHandles.hpp"
30 #include "runtime/mutexLocker.hpp"
31 #include "runtime/thread.inline.hpp"
32
33
34 JNIHandleBlock* JNIHandles::_global_handles = NULL;
35 JNIHandleBlock* JNIHandles::_weak_global_handles = NULL;
36 oop JNIHandles::_deleted_handle = NULL;
37
38
39 jobject JNIHandles::make_local(oop obj) {
40 if (obj == NULL) {
41 return NULL; // ignore null handles
42 } else {
43 Thread* thread = Thread::current();
44 assert(Universe::heap()->is_in_reserved(obj), "sanity check");
45 return thread->active_handles()->allocate_handle(obj);
46 }
47 }
48
49
50 // optimized versions
51
|