mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-26 22:34:27 +02:00
8198474: Move JNIHandles::resolve into jniHandles.inline.hpp
Moved resolve and friends to new jniHandles.inline.hpp. Reviewed-by: tschatzl, pliden, coleenp
This commit is contained in:
parent
d0ec59a9fb
commit
d7765d9002
43 changed files with 232 additions and 122 deletions
|
@ -43,6 +43,7 @@
|
||||||
#include "runtime/biasedLocking.hpp"
|
#include "runtime/biasedLocking.hpp"
|
||||||
#include "runtime/icache.hpp"
|
#include "runtime/icache.hpp"
|
||||||
#include "runtime/interfaceSupport.hpp"
|
#include "runtime/interfaceSupport.hpp"
|
||||||
|
#include "runtime/jniHandles.inline.hpp"
|
||||||
#include "runtime/sharedRuntime.hpp"
|
#include "runtime/sharedRuntime.hpp"
|
||||||
#include "runtime/thread.hpp"
|
#include "runtime/thread.hpp"
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||||
* Copyright (c) 2012, 2017 SAP SE. All rights reserved.
|
* Copyright (c) 2012, 2017 SAP SE. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
|
@ -32,6 +32,7 @@
|
||||||
#include "runtime/frame.inline.hpp"
|
#include "runtime/frame.inline.hpp"
|
||||||
#include "runtime/handles.inline.hpp"
|
#include "runtime/handles.inline.hpp"
|
||||||
#include "runtime/javaCalls.hpp"
|
#include "runtime/javaCalls.hpp"
|
||||||
|
#include "runtime/jniHandles.inline.hpp"
|
||||||
#include "runtime/monitorChunk.hpp"
|
#include "runtime/monitorChunk.hpp"
|
||||||
#include "runtime/signature.hpp"
|
#include "runtime/signature.hpp"
|
||||||
#include "runtime/stubCodeGenerator.hpp"
|
#include "runtime/stubCodeGenerator.hpp"
|
||||||
|
|
|
@ -35,6 +35,7 @@
|
||||||
#include "gc/shared/collectedHeap.hpp"
|
#include "gc/shared/collectedHeap.hpp"
|
||||||
#include "nativeInst_sparc.hpp"
|
#include "nativeInst_sparc.hpp"
|
||||||
#include "oops/objArrayKlass.hpp"
|
#include "oops/objArrayKlass.hpp"
|
||||||
|
#include "runtime/jniHandles.inline.hpp"
|
||||||
#include "runtime/safepointMechanism.inline.hpp"
|
#include "runtime/safepointMechanism.inline.hpp"
|
||||||
#include "runtime/sharedRuntime.hpp"
|
#include "runtime/sharedRuntime.hpp"
|
||||||
|
|
||||||
|
|
|
@ -36,6 +36,7 @@
|
||||||
#include "prims/methodHandles.hpp"
|
#include "prims/methodHandles.hpp"
|
||||||
#include "runtime/biasedLocking.hpp"
|
#include "runtime/biasedLocking.hpp"
|
||||||
#include "runtime/interfaceSupport.hpp"
|
#include "runtime/interfaceSupport.hpp"
|
||||||
|
#include "runtime/jniHandles.inline.hpp"
|
||||||
#include "runtime/objectMonitor.hpp"
|
#include "runtime/objectMonitor.hpp"
|
||||||
#include "runtime/os.inline.hpp"
|
#include "runtime/os.inline.hpp"
|
||||||
#include "runtime/safepoint.hpp"
|
#include "runtime/safepoint.hpp"
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||||
* Copyright 2007, 2008, 2009, 2010, 2011 Red Hat, Inc.
|
* Copyright 2007, 2008, 2009, 2010, 2011 Red Hat, Inc.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
|
@ -41,6 +41,7 @@
|
||||||
#include "runtime/deoptimization.hpp"
|
#include "runtime/deoptimization.hpp"
|
||||||
#include "runtime/frame.inline.hpp"
|
#include "runtime/frame.inline.hpp"
|
||||||
#include "runtime/interfaceSupport.hpp"
|
#include "runtime/interfaceSupport.hpp"
|
||||||
|
#include "runtime/jniHandles.inline.hpp"
|
||||||
#include "runtime/orderAccess.inline.hpp"
|
#include "runtime/orderAccess.inline.hpp"
|
||||||
#include "runtime/sharedRuntime.hpp"
|
#include "runtime/sharedRuntime.hpp"
|
||||||
#include "runtime/stubRoutines.hpp"
|
#include "runtime/stubRoutines.hpp"
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -53,6 +53,7 @@
|
||||||
#include "prims/jvmtiExport.hpp"
|
#include "prims/jvmtiExport.hpp"
|
||||||
#include "runtime/init.hpp"
|
#include "runtime/init.hpp"
|
||||||
#include "runtime/reflection.hpp"
|
#include "runtime/reflection.hpp"
|
||||||
|
#include "runtime/jniHandles.inline.hpp"
|
||||||
#include "runtime/sharedRuntime.hpp"
|
#include "runtime/sharedRuntime.hpp"
|
||||||
#include "runtime/thread.inline.hpp"
|
#include "runtime/thread.inline.hpp"
|
||||||
#include "trace/tracing.hpp"
|
#include "trace/tracing.hpp"
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -34,6 +34,7 @@
|
||||||
#include "oops/oop.inline.hpp"
|
#include "oops/oop.inline.hpp"
|
||||||
#include "oops/fieldStreams.hpp"
|
#include "oops/fieldStreams.hpp"
|
||||||
#include "runtime/fieldDescriptor.hpp"
|
#include "runtime/fieldDescriptor.hpp"
|
||||||
|
#include "runtime/jniHandles.inline.hpp"
|
||||||
|
|
||||||
// ciInstanceKlass
|
// ciInstanceKlass
|
||||||
//
|
//
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -27,6 +27,7 @@
|
||||||
#include "ci/ciUtilities.hpp"
|
#include "ci/ciUtilities.hpp"
|
||||||
#include "gc/shared/collectedHeap.inline.hpp"
|
#include "gc/shared/collectedHeap.inline.hpp"
|
||||||
#include "oops/oop.inline.hpp"
|
#include "oops/oop.inline.hpp"
|
||||||
|
#include "runtime/jniHandles.inline.hpp"
|
||||||
|
|
||||||
// ciObject
|
// ciObject
|
||||||
//
|
//
|
||||||
|
@ -97,6 +98,14 @@ ciObject::ciObject() {
|
||||||
_klass = NULL;
|
_klass = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------
|
||||||
|
// ciObject::get_oop
|
||||||
|
//
|
||||||
|
// Get the oop of this ciObject.
|
||||||
|
oop ciObject::get_oop() const {
|
||||||
|
return JNIHandles::resolve_non_null(_handle);
|
||||||
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------
|
// ------------------------------------------------------------------
|
||||||
// ciObject::klass
|
// ciObject::klass
|
||||||
//
|
//
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -67,10 +67,7 @@ protected:
|
||||||
|
|
||||||
jobject handle() const { return _handle; }
|
jobject handle() const { return _handle; }
|
||||||
// Get the VM oop that this object holds.
|
// Get the VM oop that this object holds.
|
||||||
oop get_oop() const {
|
oop get_oop() const;
|
||||||
assert(_handle != NULL, "null oop");
|
|
||||||
return JNIHandles::resolve_non_null(_handle);
|
|
||||||
}
|
|
||||||
|
|
||||||
void init_flags_from(oop x);
|
void init_flags_from(oop x);
|
||||||
|
|
||||||
|
|
|
@ -53,6 +53,7 @@
|
||||||
#include "runtime/interfaceSupport.hpp"
|
#include "runtime/interfaceSupport.hpp"
|
||||||
#include "runtime/java.hpp"
|
#include "runtime/java.hpp"
|
||||||
#include "runtime/javaCalls.hpp"
|
#include "runtime/javaCalls.hpp"
|
||||||
|
#include "runtime/jniHandles.inline.hpp"
|
||||||
#include "runtime/safepoint.hpp"
|
#include "runtime/safepoint.hpp"
|
||||||
#include "runtime/thread.inline.hpp"
|
#include "runtime/thread.inline.hpp"
|
||||||
#include "runtime/vframe.hpp"
|
#include "runtime/vframe.hpp"
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -44,6 +44,7 @@
|
||||||
#include "runtime/arguments.hpp"
|
#include "runtime/arguments.hpp"
|
||||||
#include "runtime/handles.inline.hpp"
|
#include "runtime/handles.inline.hpp"
|
||||||
#include "runtime/javaCalls.hpp"
|
#include "runtime/javaCalls.hpp"
|
||||||
|
#include "runtime/jniHandles.inline.hpp"
|
||||||
#include "runtime/reflection.hpp"
|
#include "runtime/reflection.hpp"
|
||||||
#include "utilities/stringUtils.hpp"
|
#include "utilities/stringUtils.hpp"
|
||||||
#include "utilities/utf8.hpp"
|
#include "utilities/utf8.hpp"
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -45,6 +45,7 @@
|
||||||
#include "runtime/handles.inline.hpp"
|
#include "runtime/handles.inline.hpp"
|
||||||
#include "runtime/interfaceSupport.hpp"
|
#include "runtime/interfaceSupport.hpp"
|
||||||
#include "runtime/javaCalls.hpp"
|
#include "runtime/javaCalls.hpp"
|
||||||
|
#include "runtime/jniHandles.inline.hpp"
|
||||||
#include "runtime/orderAccess.inline.hpp"
|
#include "runtime/orderAccess.inline.hpp"
|
||||||
#include "runtime/os.hpp"
|
#include "runtime/os.hpp"
|
||||||
#include "runtime/thread.hpp"
|
#include "runtime/thread.hpp"
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -29,6 +29,7 @@
|
||||||
#include "oops/oop.inline.hpp"
|
#include "oops/oop.inline.hpp"
|
||||||
#include "runtime/handles.inline.hpp"
|
#include "runtime/handles.inline.hpp"
|
||||||
#include "runtime/interfaceSupport.hpp"
|
#include "runtime/interfaceSupport.hpp"
|
||||||
|
#include "runtime/jniHandles.inline.hpp"
|
||||||
#include "runtime/thread.hpp"
|
#include "runtime/thread.hpp"
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -37,6 +37,7 @@
|
||||||
#include "oops/objArrayKlass.hpp"
|
#include "oops/objArrayKlass.hpp"
|
||||||
#include "runtime/handles.hpp"
|
#include "runtime/handles.hpp"
|
||||||
#include "runtime/handles.inline.hpp"
|
#include "runtime/handles.inline.hpp"
|
||||||
|
#include "runtime/jniHandles.inline.hpp"
|
||||||
#include "runtime/thread.inline.hpp"
|
#include "runtime/thread.inline.hpp"
|
||||||
#include "utilities/copy.hpp"
|
#include "utilities/copy.hpp"
|
||||||
|
|
||||||
|
|
|
@ -44,6 +44,7 @@
|
||||||
#include "oops/oop.inline.hpp"
|
#include "oops/oop.inline.hpp"
|
||||||
#include "prims/jvmtiImpl.hpp"
|
#include "prims/jvmtiImpl.hpp"
|
||||||
#include "runtime/atomic.hpp"
|
#include "runtime/atomic.hpp"
|
||||||
|
#include "runtime/jniHandles.inline.hpp"
|
||||||
#include "runtime/orderAccess.inline.hpp"
|
#include "runtime/orderAccess.inline.hpp"
|
||||||
#include "runtime/os.hpp"
|
#include "runtime/os.hpp"
|
||||||
#include "runtime/sharedRuntime.hpp"
|
#include "runtime/sharedRuntime.hpp"
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
#include "code/oopRecorder.hpp"
|
#include "code/oopRecorder.hpp"
|
||||||
#include "memory/allocation.inline.hpp"
|
#include "memory/allocation.inline.hpp"
|
||||||
#include "oops/oop.inline.hpp"
|
#include "oops/oop.inline.hpp"
|
||||||
|
#include "runtime/jniHandles.inline.hpp"
|
||||||
|
|
||||||
#ifdef ASSERT
|
#ifdef ASSERT
|
||||||
template <class T> int ValueRecorder<T>::_find_index_calls = 0;
|
template <class T> int ValueRecorder<T>::_find_index_calls = 0;
|
||||||
|
|
|
@ -39,6 +39,7 @@
|
||||||
#include "oops/objArrayOop.inline.hpp"
|
#include "oops/objArrayOop.inline.hpp"
|
||||||
#include "oops/typeArrayOop.inline.hpp"
|
#include "oops/typeArrayOop.inline.hpp"
|
||||||
#include "runtime/javaCalls.hpp"
|
#include "runtime/javaCalls.hpp"
|
||||||
|
#include "runtime/jniHandles.inline.hpp"
|
||||||
#include "runtime/safepointMechanism.inline.hpp"
|
#include "runtime/safepointMechanism.inline.hpp"
|
||||||
#include "utilities/align.hpp"
|
#include "utilities/align.hpp"
|
||||||
|
|
||||||
|
@ -97,6 +98,32 @@ VMReg getVMRegFromLocation(Handle location, int total_frame_size, TRAPS) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
objArrayOop CodeInstaller::sites() {
|
||||||
|
return (objArrayOop) JNIHandles::resolve(_sites_handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
arrayOop CodeInstaller::code() {
|
||||||
|
return (arrayOop) JNIHandles::resolve(_code_handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
arrayOop CodeInstaller::data_section() {
|
||||||
|
return (arrayOop) JNIHandles::resolve(_data_section_handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
objArrayOop CodeInstaller::data_section_patches() {
|
||||||
|
return (objArrayOop) JNIHandles::resolve(_data_section_patches_handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifndef PRODUCT
|
||||||
|
objArrayOop CodeInstaller::comments() {
|
||||||
|
return (objArrayOop) JNIHandles::resolve(_comments_handle);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
oop CodeInstaller::word_kind() {
|
||||||
|
return JNIHandles::resolve(_word_kind_handle);
|
||||||
|
}
|
||||||
|
|
||||||
// creates a HotSpot oop map out of the byte arrays provided by DebugInfo
|
// creates a HotSpot oop map out of the byte arrays provided by DebugInfo
|
||||||
OopMap* CodeInstaller::create_oop_map(Handle debug_info, TRAPS) {
|
OopMap* CodeInstaller::create_oop_map(Handle debug_info, TRAPS) {
|
||||||
Handle reference_map(THREAD, DebugInfo::referenceMap(debug_info));
|
Handle reference_map(THREAD, DebugInfo::referenceMap(debug_info));
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -188,15 +188,15 @@ private:
|
||||||
void pd_relocate_JavaMethod(CodeBuffer &cbuf, Handle method, jint pc_offset, TRAPS);
|
void pd_relocate_JavaMethod(CodeBuffer &cbuf, Handle method, jint pc_offset, TRAPS);
|
||||||
void pd_relocate_poll(address pc, jint mark, TRAPS);
|
void pd_relocate_poll(address pc, jint mark, TRAPS);
|
||||||
|
|
||||||
objArrayOop sites() { return (objArrayOop) JNIHandles::resolve(_sites_handle); }
|
objArrayOop sites();
|
||||||
arrayOop code() { return (arrayOop) JNIHandles::resolve(_code_handle); }
|
arrayOop code();
|
||||||
arrayOop data_section() { return (arrayOop) JNIHandles::resolve(_data_section_handle); }
|
arrayOop data_section();
|
||||||
objArrayOop data_section_patches() { return (objArrayOop) JNIHandles::resolve(_data_section_patches_handle); }
|
objArrayOop data_section_patches();
|
||||||
#ifndef PRODUCT
|
#ifndef PRODUCT
|
||||||
objArrayOop comments() { return (objArrayOop) JNIHandles::resolve(_comments_handle); }
|
objArrayOop comments();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
oop word_kind() { return (oop) JNIHandles::resolve(_word_kind_handle); }
|
oop word_kind();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
|
@ -36,6 +36,7 @@
|
||||||
#include "oops/typeArrayOop.inline.hpp"
|
#include "oops/typeArrayOop.inline.hpp"
|
||||||
#include "runtime/fieldDescriptor.hpp"
|
#include "runtime/fieldDescriptor.hpp"
|
||||||
#include "runtime/javaCalls.hpp"
|
#include "runtime/javaCalls.hpp"
|
||||||
|
#include "runtime/jniHandles.inline.hpp"
|
||||||
#include "jvmci/jvmciRuntime.hpp"
|
#include "jvmci/jvmciRuntime.hpp"
|
||||||
#include "compiler/abstractCompiler.hpp"
|
#include "compiler/abstractCompiler.hpp"
|
||||||
#include "compiler/compileBroker.hpp"
|
#include "compiler/compileBroker.hpp"
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
#include "oops/access.inline.hpp"
|
#include "oops/access.inline.hpp"
|
||||||
#include "oops/instanceMirrorKlass.hpp"
|
#include "oops/instanceMirrorKlass.hpp"
|
||||||
#include "oops/oop.inline.hpp"
|
#include "oops/oop.inline.hpp"
|
||||||
|
#include "runtime/jniHandles.inline.hpp"
|
||||||
|
|
||||||
class JVMCIJavaClasses : AllStatic {
|
class JVMCIJavaClasses : AllStatic {
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -40,6 +40,7 @@
|
||||||
#include "oops/objArrayOop.inline.hpp"
|
#include "oops/objArrayOop.inline.hpp"
|
||||||
#include "runtime/biasedLocking.hpp"
|
#include "runtime/biasedLocking.hpp"
|
||||||
#include "runtime/interfaceSupport.hpp"
|
#include "runtime/interfaceSupport.hpp"
|
||||||
|
#include "runtime/jniHandles.inline.hpp"
|
||||||
#include "runtime/reflection.hpp"
|
#include "runtime/reflection.hpp"
|
||||||
#include "runtime/sharedRuntime.hpp"
|
#include "runtime/sharedRuntime.hpp"
|
||||||
#include "runtime/threadSMR.hpp"
|
#include "runtime/threadSMR.hpp"
|
||||||
|
@ -630,6 +631,11 @@ Handle JVMCIRuntime::callStatic(const char* className, const char* methodName, c
|
||||||
return Handle(THREAD, (oop)result.get_jobject());
|
return Handle(THREAD, (oop)result.get_jobject());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Handle JVMCIRuntime::get_HotSpotJVMCIRuntime(TRAPS) {
|
||||||
|
initialize_JVMCI(CHECK_(Handle()));
|
||||||
|
return Handle(THREAD, JNIHandles::resolve_non_null(_HotSpotJVMCIRuntime_instance));
|
||||||
|
}
|
||||||
|
|
||||||
void JVMCIRuntime::initialize_HotSpotJVMCIRuntime(TRAPS) {
|
void JVMCIRuntime::initialize_HotSpotJVMCIRuntime(TRAPS) {
|
||||||
guarantee(!_HotSpotJVMCIRuntime_initialized, "cannot reinitialize HotSpotJVMCIRuntime");
|
guarantee(!_HotSpotJVMCIRuntime_initialized, "cannot reinitialize HotSpotJVMCIRuntime");
|
||||||
JVMCIRuntime::initialize_well_known_classes(CHECK);
|
JVMCIRuntime::initialize_well_known_classes(CHECK);
|
||||||
|
|
|
@ -73,10 +73,7 @@ class JVMCIRuntime: public AllStatic {
|
||||||
/**
|
/**
|
||||||
* Gets the singleton HotSpotJVMCIRuntime instance, initializing it if necessary
|
* Gets the singleton HotSpotJVMCIRuntime instance, initializing it if necessary
|
||||||
*/
|
*/
|
||||||
static Handle get_HotSpotJVMCIRuntime(TRAPS) {
|
static Handle get_HotSpotJVMCIRuntime(TRAPS);
|
||||||
initialize_JVMCI(CHECK_(Handle()));
|
|
||||||
return Handle(THREAD, JNIHandles::resolve_non_null(_HotSpotJVMCIRuntime_instance));
|
|
||||||
}
|
|
||||||
|
|
||||||
static jobject get_HotSpotJVMCIRuntime_jobject(TRAPS) {
|
static jobject get_HotSpotJVMCIRuntime_jobject(TRAPS) {
|
||||||
initialize_JVMCI(CHECK_NULL);
|
initialize_JVMCI(CHECK_NULL);
|
||||||
|
|
|
@ -69,6 +69,7 @@
|
||||||
#include "runtime/java.hpp"
|
#include "runtime/java.hpp"
|
||||||
#include "runtime/javaCalls.hpp"
|
#include "runtime/javaCalls.hpp"
|
||||||
#include "runtime/jfieldIDWorkaround.hpp"
|
#include "runtime/jfieldIDWorkaround.hpp"
|
||||||
|
#include "runtime/jniHandles.inline.hpp"
|
||||||
#include "runtime/orderAccess.inline.hpp"
|
#include "runtime/orderAccess.inline.hpp"
|
||||||
#include "runtime/reflection.hpp"
|
#include "runtime/reflection.hpp"
|
||||||
#include "runtime/sharedRuntime.hpp"
|
#include "runtime/sharedRuntime.hpp"
|
||||||
|
|
|
@ -38,6 +38,7 @@
|
||||||
#include "runtime/handles.hpp"
|
#include "runtime/handles.hpp"
|
||||||
#include "runtime/interfaceSupport.hpp"
|
#include "runtime/interfaceSupport.hpp"
|
||||||
#include "runtime/jfieldIDWorkaround.hpp"
|
#include "runtime/jfieldIDWorkaround.hpp"
|
||||||
|
#include "runtime/jniHandles.inline.hpp"
|
||||||
#include "runtime/thread.inline.hpp"
|
#include "runtime/thread.inline.hpp"
|
||||||
|
|
||||||
// Complain every extra number of unplanned local refs
|
// Complain every extra number of unplanned local refs
|
||||||
|
|
|
@ -61,6 +61,7 @@
|
||||||
#include "runtime/java.hpp"
|
#include "runtime/java.hpp"
|
||||||
#include "runtime/javaCalls.hpp"
|
#include "runtime/javaCalls.hpp"
|
||||||
#include "runtime/jfieldIDWorkaround.hpp"
|
#include "runtime/jfieldIDWorkaround.hpp"
|
||||||
|
#include "runtime/jniHandles.inline.hpp"
|
||||||
#include "runtime/orderAccess.inline.hpp"
|
#include "runtime/orderAccess.inline.hpp"
|
||||||
#include "runtime/os.inline.hpp"
|
#include "runtime/os.inline.hpp"
|
||||||
#include "runtime/perfData.hpp"
|
#include "runtime/perfData.hpp"
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -58,6 +58,7 @@
|
||||||
#include "runtime/interfaceSupport.hpp"
|
#include "runtime/interfaceSupport.hpp"
|
||||||
#include "runtime/javaCalls.hpp"
|
#include "runtime/javaCalls.hpp"
|
||||||
#include "runtime/jfieldIDWorkaround.hpp"
|
#include "runtime/jfieldIDWorkaround.hpp"
|
||||||
|
#include "runtime/jniHandles.inline.hpp"
|
||||||
#include "runtime/osThread.hpp"
|
#include "runtime/osThread.hpp"
|
||||||
#include "runtime/reflectionUtils.hpp"
|
#include "runtime/reflectionUtils.hpp"
|
||||||
#include "runtime/signature.hpp"
|
#include "runtime/signature.hpp"
|
||||||
|
|
|
@ -40,6 +40,7 @@
|
||||||
#include "runtime/deoptimization.hpp"
|
#include "runtime/deoptimization.hpp"
|
||||||
#include "runtime/interfaceSupport.hpp"
|
#include "runtime/interfaceSupport.hpp"
|
||||||
#include "runtime/jfieldIDWorkaround.hpp"
|
#include "runtime/jfieldIDWorkaround.hpp"
|
||||||
|
#include "runtime/jniHandles.inline.hpp"
|
||||||
#include "runtime/objectMonitor.hpp"
|
#include "runtime/objectMonitor.hpp"
|
||||||
#include "runtime/objectMonitor.inline.hpp"
|
#include "runtime/objectMonitor.inline.hpp"
|
||||||
#include "runtime/signature.hpp"
|
#include "runtime/signature.hpp"
|
||||||
|
@ -501,6 +502,24 @@ JvmtiEnvBase::jvmtiMalloc(jlong size) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Handle management
|
||||||
|
|
||||||
|
jobject JvmtiEnvBase::jni_reference(Handle hndl) {
|
||||||
|
return JNIHandles::make_local(hndl());
|
||||||
|
}
|
||||||
|
|
||||||
|
jobject JvmtiEnvBase::jni_reference(JavaThread *thread, Handle hndl) {
|
||||||
|
return JNIHandles::make_local(thread, hndl());
|
||||||
|
}
|
||||||
|
|
||||||
|
void JvmtiEnvBase::destroy_jni_reference(jobject jobj) {
|
||||||
|
JNIHandles::destroy_local(jobj);
|
||||||
|
}
|
||||||
|
|
||||||
|
void JvmtiEnvBase::destroy_jni_reference(JavaThread *thread, jobject jobj) {
|
||||||
|
JNIHandles::destroy_local(jobj); // thread is unused.
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Threads
|
// Threads
|
||||||
//
|
//
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -214,29 +214,20 @@ class JvmtiEnvBase : public CHeapObj<mtInternal> {
|
||||||
unsigned char* jvmtiMalloc(jlong size); // don't use this - call allocate
|
unsigned char* jvmtiMalloc(jlong size); // don't use this - call allocate
|
||||||
|
|
||||||
// method to create a local handle
|
// method to create a local handle
|
||||||
jobject jni_reference(Handle hndl) {
|
jobject jni_reference(Handle hndl);
|
||||||
return JNIHandles::make_local(hndl());
|
|
||||||
}
|
|
||||||
|
|
||||||
// method to create a local handle.
|
// method to create a local handle.
|
||||||
// This function allows caller to specify which
|
// This function allows caller to specify which
|
||||||
// threads local handle table to use.
|
// threads local handle table to use.
|
||||||
jobject jni_reference(JavaThread *thread, Handle hndl) {
|
jobject jni_reference(JavaThread *thread, Handle hndl);
|
||||||
return JNIHandles::make_local(thread, hndl());
|
|
||||||
}
|
|
||||||
|
|
||||||
// method to destroy a local handle
|
// method to destroy a local handle
|
||||||
void destroy_jni_reference(jobject jobj) {
|
void destroy_jni_reference(jobject jobj);
|
||||||
JNIHandles::destroy_local(jobj);
|
|
||||||
}
|
|
||||||
|
|
||||||
// method to destroy a local handle.
|
// method to destroy a local handle.
|
||||||
// This function allows caller to specify which
|
// This function allows caller to specify which
|
||||||
// threads local handle table to use although currently it is
|
// threads local handle table to use.
|
||||||
// not used.
|
void destroy_jni_reference(JavaThread *thread, jobject jobj);
|
||||||
void destroy_jni_reference(JavaThread *thread, jobject jobj) {
|
|
||||||
destroy_jni_reference(jobj);
|
|
||||||
}
|
|
||||||
|
|
||||||
jvmtiEnv* jvmti_external() { return &_jvmti_external; };
|
jvmtiEnv* jvmti_external() { return &_jvmti_external; };
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -49,6 +49,7 @@
|
||||||
#include "runtime/handles.hpp"
|
#include "runtime/handles.hpp"
|
||||||
#include "runtime/interfaceSupport.hpp"
|
#include "runtime/interfaceSupport.hpp"
|
||||||
#include "runtime/javaCalls.hpp"
|
#include "runtime/javaCalls.hpp"
|
||||||
|
#include "runtime/jniHandles.inline.hpp"
|
||||||
#include "runtime/objectMonitor.hpp"
|
#include "runtime/objectMonitor.hpp"
|
||||||
#include "runtime/objectMonitor.inline.hpp"
|
#include "runtime/objectMonitor.inline.hpp"
|
||||||
#include "runtime/os.inline.hpp"
|
#include "runtime/os.inline.hpp"
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
#include "gc/shared/collectedHeap.hpp"
|
#include "gc/shared/collectedHeap.hpp"
|
||||||
#include "memory/universe.inline.hpp"
|
#include "memory/universe.inline.hpp"
|
||||||
#include "prims/jvmtiGetLoadedClasses.hpp"
|
#include "prims/jvmtiGetLoadedClasses.hpp"
|
||||||
|
#include "runtime/jniHandles.inline.hpp"
|
||||||
#include "runtime/thread.hpp"
|
#include "runtime/thread.hpp"
|
||||||
#include "utilities/stack.inline.hpp"
|
#include "utilities/stack.inline.hpp"
|
||||||
#if INCLUDE_ALL_GCS
|
#if INCLUDE_ALL_GCS
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -47,6 +47,7 @@
|
||||||
#include "prims/resolvedMethodTable.hpp"
|
#include "prims/resolvedMethodTable.hpp"
|
||||||
#include "prims/methodComparator.hpp"
|
#include "prims/methodComparator.hpp"
|
||||||
#include "runtime/deoptimization.hpp"
|
#include "runtime/deoptimization.hpp"
|
||||||
|
#include "runtime/jniHandles.inline.hpp"
|
||||||
#include "runtime/relocator.hpp"
|
#include "runtime/relocator.hpp"
|
||||||
#include "utilities/bitMap.inline.hpp"
|
#include "utilities/bitMap.inline.hpp"
|
||||||
#include "utilities/events.hpp"
|
#include "utilities/events.hpp"
|
||||||
|
|
|
@ -44,7 +44,7 @@
|
||||||
#include "prims/jvmtiTagMap.hpp"
|
#include "prims/jvmtiTagMap.hpp"
|
||||||
#include "runtime/biasedLocking.hpp"
|
#include "runtime/biasedLocking.hpp"
|
||||||
#include "runtime/javaCalls.hpp"
|
#include "runtime/javaCalls.hpp"
|
||||||
#include "runtime/jniHandles.hpp"
|
#include "runtime/jniHandles.inline.hpp"
|
||||||
#include "runtime/mutex.hpp"
|
#include "runtime/mutex.hpp"
|
||||||
#include "runtime/mutexLocker.hpp"
|
#include "runtime/mutexLocker.hpp"
|
||||||
#include "runtime/reflectionUtils.hpp"
|
#include "runtime/reflectionUtils.hpp"
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2008, 2017, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -40,6 +40,7 @@
|
||||||
#include "prims/methodHandles.hpp"
|
#include "prims/methodHandles.hpp"
|
||||||
#include "runtime/compilationPolicy.hpp"
|
#include "runtime/compilationPolicy.hpp"
|
||||||
#include "runtime/javaCalls.hpp"
|
#include "runtime/javaCalls.hpp"
|
||||||
|
#include "runtime/jniHandles.inline.hpp"
|
||||||
#include "runtime/timerTrace.hpp"
|
#include "runtime/timerTrace.hpp"
|
||||||
#include "runtime/reflection.hpp"
|
#include "runtime/reflection.hpp"
|
||||||
#include "runtime/signature.hpp"
|
#include "runtime/signature.hpp"
|
||||||
|
|
|
@ -38,6 +38,7 @@
|
||||||
#include "runtime/atomic.hpp"
|
#include "runtime/atomic.hpp"
|
||||||
#include "runtime/globals.hpp"
|
#include "runtime/globals.hpp"
|
||||||
#include "runtime/interfaceSupport.hpp"
|
#include "runtime/interfaceSupport.hpp"
|
||||||
|
#include "runtime/jniHandles.inline.hpp"
|
||||||
#include "runtime/orderAccess.inline.hpp"
|
#include "runtime/orderAccess.inline.hpp"
|
||||||
#include "runtime/reflection.hpp"
|
#include "runtime/reflection.hpp"
|
||||||
#include "runtime/thread.hpp"
|
#include "runtime/thread.hpp"
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -32,6 +32,7 @@
|
||||||
#include "prims/whitebox.hpp"
|
#include "prims/whitebox.hpp"
|
||||||
#include "prims/wbtestmethods/parserTests.hpp"
|
#include "prims/wbtestmethods/parserTests.hpp"
|
||||||
#include "runtime/interfaceSupport.hpp"
|
#include "runtime/interfaceSupport.hpp"
|
||||||
|
#include "runtime/jniHandles.inline.hpp"
|
||||||
#include "services/diagnosticArgument.hpp"
|
#include "services/diagnosticArgument.hpp"
|
||||||
#include "services/diagnosticFramework.hpp"
|
#include "services/diagnosticFramework.hpp"
|
||||||
|
|
||||||
|
|
|
@ -53,6 +53,7 @@
|
||||||
#include "runtime/handshake.hpp"
|
#include "runtime/handshake.hpp"
|
||||||
#include "runtime/interfaceSupport.hpp"
|
#include "runtime/interfaceSupport.hpp"
|
||||||
#include "runtime/javaCalls.hpp"
|
#include "runtime/javaCalls.hpp"
|
||||||
|
#include "runtime/jniHandles.inline.hpp"
|
||||||
#include "runtime/os.hpp"
|
#include "runtime/os.hpp"
|
||||||
#include "runtime/sweeper.hpp"
|
#include "runtime/sweeper.hpp"
|
||||||
#include "runtime/thread.hpp"
|
#include "runtime/thread.hpp"
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -36,6 +36,7 @@
|
||||||
#include "runtime/handles.inline.hpp"
|
#include "runtime/handles.inline.hpp"
|
||||||
#include "runtime/interfaceSupport.hpp"
|
#include "runtime/interfaceSupport.hpp"
|
||||||
#include "runtime/javaCalls.hpp"
|
#include "runtime/javaCalls.hpp"
|
||||||
|
#include "runtime/jniHandles.inline.hpp"
|
||||||
#include "runtime/mutexLocker.hpp"
|
#include "runtime/mutexLocker.hpp"
|
||||||
#include "runtime/os.inline.hpp"
|
#include "runtime/os.inline.hpp"
|
||||||
#include "runtime/signature.hpp"
|
#include "runtime/signature.hpp"
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
#include "logging/log.hpp"
|
#include "logging/log.hpp"
|
||||||
#include "memory/iterator.hpp"
|
#include "memory/iterator.hpp"
|
||||||
#include "oops/oop.inline.hpp"
|
#include "oops/oop.inline.hpp"
|
||||||
#include "runtime/jniHandles.hpp"
|
#include "runtime/jniHandles.inline.hpp"
|
||||||
#include "runtime/mutexLocker.hpp"
|
#include "runtime/mutexLocker.hpp"
|
||||||
#include "runtime/thread.inline.hpp"
|
#include "runtime/thread.inline.hpp"
|
||||||
#include "trace/traceMacros.hpp"
|
#include "trace/traceMacros.hpp"
|
||||||
|
@ -135,6 +135,18 @@ jobject JNIHandles::make_weak_global(Handle obj, AllocFailType alloc_failmode) {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Resolve some erroneous cases to NULL, rather than treating them as
|
||||||
|
// possibly unchecked errors. In particular, deleted handles are
|
||||||
|
// treated as NULL (though a deleted and later reallocated handle
|
||||||
|
// isn't detected).
|
||||||
|
oop JNIHandles::resolve_external_guard(jobject handle) {
|
||||||
|
oop result = NULL;
|
||||||
|
if (handle != NULL) {
|
||||||
|
result = resolve_impl<true /* external_guard */ >(handle);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
oop JNIHandles::resolve_jweak(jweak handle) {
|
oop JNIHandles::resolve_jweak(jweak handle) {
|
||||||
assert(handle != NULL, "precondition");
|
assert(handle != NULL, "precondition");
|
||||||
assert(is_jweak(handle), "precondition");
|
assert(is_jweak(handle), "precondition");
|
||||||
|
|
|
@ -67,10 +67,10 @@ class JNIHandles : AllStatic {
|
||||||
|
|
||||||
// Resolve handle into oop
|
// Resolve handle into oop
|
||||||
inline static oop resolve(jobject handle);
|
inline static oop resolve(jobject handle);
|
||||||
// Resolve externally provided handle into oop with some guards
|
|
||||||
inline static oop resolve_external_guard(jobject handle);
|
|
||||||
// Resolve handle into oop, result guaranteed not to be null
|
// Resolve handle into oop, result guaranteed not to be null
|
||||||
inline static oop resolve_non_null(jobject handle);
|
inline static oop resolve_non_null(jobject handle);
|
||||||
|
// Resolve externally provided handle into oop with some guards
|
||||||
|
static oop resolve_external_guard(jobject handle);
|
||||||
|
|
||||||
// Local handles
|
// Local handles
|
||||||
static jobject make_local(oop obj);
|
static jobject make_local(oop obj);
|
||||||
|
@ -198,72 +198,4 @@ class JNIHandleBlock : public CHeapObj<mtInternal> {
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
inline bool JNIHandles::is_jweak(jobject handle) {
|
|
||||||
STATIC_ASSERT(weak_tag_size == 1);
|
|
||||||
STATIC_ASSERT(weak_tag_value == 1);
|
|
||||||
return (reinterpret_cast<uintptr_t>(handle) & weak_tag_mask) != 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline oop& JNIHandles::jobject_ref(jobject handle) {
|
|
||||||
assert(!is_jweak(handle), "precondition");
|
|
||||||
return *reinterpret_cast<oop*>(handle);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline oop& JNIHandles::jweak_ref(jobject handle) {
|
|
||||||
assert(is_jweak(handle), "precondition");
|
|
||||||
char* ptr = reinterpret_cast<char*>(handle) - weak_tag_value;
|
|
||||||
return *reinterpret_cast<oop*>(ptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
// external_guard is true if called from resolve_external_guard.
|
|
||||||
template<bool external_guard>
|
|
||||||
inline oop JNIHandles::resolve_impl(jobject handle) {
|
|
||||||
assert(handle != NULL, "precondition");
|
|
||||||
assert(!current_thread_in_native(), "must not be in native");
|
|
||||||
oop result;
|
|
||||||
if (is_jweak(handle)) { // Unlikely
|
|
||||||
result = resolve_jweak(handle);
|
|
||||||
} else {
|
|
||||||
result = jobject_ref(handle);
|
|
||||||
// Construction of jobjects canonicalize a null value into a null
|
|
||||||
// jobject, so for non-jweak the pointee should never be null.
|
|
||||||
assert(external_guard || result != NULL, "Invalid JNI handle");
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline oop JNIHandles::resolve(jobject handle) {
|
|
||||||
oop result = NULL;
|
|
||||||
if (handle != NULL) {
|
|
||||||
result = resolve_impl<false /* external_guard */ >(handle);
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Resolve some erroneous cases to NULL, rather than treating them as
|
|
||||||
// possibly unchecked errors. In particular, deleted handles are
|
|
||||||
// treated as NULL (though a deleted and later reallocated handle
|
|
||||||
// isn't detected).
|
|
||||||
inline oop JNIHandles::resolve_external_guard(jobject handle) {
|
|
||||||
oop result = NULL;
|
|
||||||
if (handle != NULL) {
|
|
||||||
result = resolve_impl<true /* external_guard */ >(handle);
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline oop JNIHandles::resolve_non_null(jobject handle) {
|
|
||||||
assert(handle != NULL, "JNI handle should not be null");
|
|
||||||
oop result = resolve_impl<false /* external_guard */ >(handle);
|
|
||||||
assert(result != NULL, "NULL read from jni handle");
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void JNIHandles::destroy_local(jobject handle) {
|
|
||||||
if (handle != NULL) {
|
|
||||||
assert(!is_jweak(handle), "Invalid JNI local handle");
|
|
||||||
jobject_ref(handle) = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // SHARE_VM_RUNTIME_JNIHANDLES_HPP
|
#endif // SHARE_VM_RUNTIME_JNIHANDLES_HPP
|
||||||
|
|
90
src/hotspot/share/runtime/jniHandles.inline.hpp
Normal file
90
src/hotspot/share/runtime/jniHandles.inline.hpp
Normal file
|
@ -0,0 +1,90 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
|
||||||
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
|
*
|
||||||
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU General Public License version 2 only, as
|
||||||
|
* published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
* version 2 for more details (a copy is included in the LICENSE file that
|
||||||
|
* accompanied this code).
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License version
|
||||||
|
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
|
* or visit www.oracle.com if you need additional information or have any
|
||||||
|
* questions.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef SHARE_RUNTIME_JNIHANDLES_INLINE_HPP
|
||||||
|
#define SHARE_RUNTIME_JNIHANDLES_INLINE_HPP
|
||||||
|
|
||||||
|
#include "oops/oop.hpp"
|
||||||
|
#include "runtime/jniHandles.hpp"
|
||||||
|
#include "utilities/debug.hpp"
|
||||||
|
#include "utilities/globalDefinitions.hpp"
|
||||||
|
|
||||||
|
inline bool JNIHandles::is_jweak(jobject handle) {
|
||||||
|
STATIC_ASSERT(weak_tag_size == 1);
|
||||||
|
STATIC_ASSERT(weak_tag_value == 1);
|
||||||
|
return (reinterpret_cast<uintptr_t>(handle) & weak_tag_mask) != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline oop& JNIHandles::jobject_ref(jobject handle) {
|
||||||
|
assert(!is_jweak(handle), "precondition");
|
||||||
|
return *reinterpret_cast<oop*>(handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline oop& JNIHandles::jweak_ref(jobject handle) {
|
||||||
|
assert(is_jweak(handle), "precondition");
|
||||||
|
char* ptr = reinterpret_cast<char*>(handle) - weak_tag_value;
|
||||||
|
return *reinterpret_cast<oop*>(ptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
// external_guard is true if called from resolve_external_guard.
|
||||||
|
template<bool external_guard>
|
||||||
|
inline oop JNIHandles::resolve_impl(jobject handle) {
|
||||||
|
assert(handle != NULL, "precondition");
|
||||||
|
assert(!current_thread_in_native(), "must not be in native");
|
||||||
|
oop result;
|
||||||
|
if (is_jweak(handle)) { // Unlikely
|
||||||
|
result = resolve_jweak(handle);
|
||||||
|
} else {
|
||||||
|
result = jobject_ref(handle);
|
||||||
|
// Construction of jobjects canonicalize a null value into a null
|
||||||
|
// jobject, so for non-jweak the pointee should never be null.
|
||||||
|
assert(external_guard || result != NULL, "Invalid JNI handle");
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline oop JNIHandles::resolve(jobject handle) {
|
||||||
|
oop result = NULL;
|
||||||
|
if (handle != NULL) {
|
||||||
|
result = resolve_impl<false /* external_guard */ >(handle);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline oop JNIHandles::resolve_non_null(jobject handle) {
|
||||||
|
assert(handle != NULL, "JNI handle should not be null");
|
||||||
|
oop result = resolve_impl<false /* external_guard */ >(handle);
|
||||||
|
assert(result != NULL, "NULL read from jni handle");
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void JNIHandles::destroy_local(jobject handle) {
|
||||||
|
if (handle != NULL) {
|
||||||
|
assert(!is_jweak(handle), "Invalid JNI local handle");
|
||||||
|
jobject_ref(handle) = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // SHARE_RUNTIME_JNIHANDLES_INLINE_HPP
|
||||||
|
|
|
@ -71,6 +71,7 @@
|
||||||
#include "runtime/interfaceSupport.hpp"
|
#include "runtime/interfaceSupport.hpp"
|
||||||
#include "runtime/java.hpp"
|
#include "runtime/java.hpp"
|
||||||
#include "runtime/javaCalls.hpp"
|
#include "runtime/javaCalls.hpp"
|
||||||
|
#include "runtime/jniHandles.inline.hpp"
|
||||||
#include "runtime/jniPeriodicChecker.hpp"
|
#include "runtime/jniPeriodicChecker.hpp"
|
||||||
#include "runtime/memprofiler.hpp"
|
#include "runtime/memprofiler.hpp"
|
||||||
#include "runtime/mutexLocker.hpp"
|
#include "runtime/mutexLocker.hpp"
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -25,6 +25,7 @@
|
||||||
#include "precompiled.hpp"
|
#include "precompiled.hpp"
|
||||||
#include "logging/logStream.hpp"
|
#include "logging/logStream.hpp"
|
||||||
#include "memory/allocation.inline.hpp"
|
#include "memory/allocation.inline.hpp"
|
||||||
|
#include "runtime/jniHandles.inline.hpp"
|
||||||
#include "runtime/thread.inline.hpp"
|
#include "runtime/thread.inline.hpp"
|
||||||
#include "runtime/threadSMR.inline.hpp"
|
#include "runtime/threadSMR.inline.hpp"
|
||||||
#include "services/threadService.hpp"
|
#include "services/threadService.hpp"
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -39,7 +39,7 @@
|
||||||
#include "runtime/handles.inline.hpp"
|
#include "runtime/handles.inline.hpp"
|
||||||
#include "runtime/interfaceSupport.hpp"
|
#include "runtime/interfaceSupport.hpp"
|
||||||
#include "runtime/javaCalls.hpp"
|
#include "runtime/javaCalls.hpp"
|
||||||
#include "runtime/jniHandles.hpp"
|
#include "runtime/jniHandles.inline.hpp"
|
||||||
#include "runtime/os.hpp"
|
#include "runtime/os.hpp"
|
||||||
#include "runtime/serviceThread.hpp"
|
#include "runtime/serviceThread.hpp"
|
||||||
#include "runtime/thread.inline.hpp"
|
#include "runtime/thread.inline.hpp"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue