mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-17 09:34:38 +02:00
8252656: Replace RegisterArrayForGC mechanism with plain Handles
Reviewed-by: coleenp, tschatzl, dholmes
This commit is contained in:
parent
7282d0deb5
commit
4c73e045ce
3 changed files with 3 additions and 35 deletions
|
@ -1376,27 +1376,12 @@ JVM_ENTRY(jobject, JVM_GetInheritedAccessControlContext(JNIEnv *env, jclass cls)
|
||||||
return JNIHandles::make_local(THREAD, result);
|
return JNIHandles::make_local(THREAD, result);
|
||||||
JVM_END
|
JVM_END
|
||||||
|
|
||||||
class RegisterArrayForGC {
|
|
||||||
private:
|
|
||||||
JavaThread *_thread;
|
|
||||||
public:
|
|
||||||
RegisterArrayForGC(JavaThread *thread, GrowableArray<oop>* array) {
|
|
||||||
_thread = thread;
|
|
||||||
_thread->register_array_for_gc(array);
|
|
||||||
}
|
|
||||||
|
|
||||||
~RegisterArrayForGC() {
|
|
||||||
_thread->register_array_for_gc(NULL);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
JVM_ENTRY(jobject, JVM_GetStackAccessControlContext(JNIEnv *env, jclass cls))
|
JVM_ENTRY(jobject, JVM_GetStackAccessControlContext(JNIEnv *env, jclass cls))
|
||||||
JVMWrapper("JVM_GetStackAccessControlContext");
|
JVMWrapper("JVM_GetStackAccessControlContext");
|
||||||
if (!UsePrivilegedStack) return NULL;
|
if (!UsePrivilegedStack) return NULL;
|
||||||
|
|
||||||
ResourceMark rm(THREAD);
|
ResourceMark rm(THREAD);
|
||||||
GrowableArray<oop>* local_array = new GrowableArray<oop>(12);
|
GrowableArray<Handle>* local_array = new GrowableArray<Handle>(12);
|
||||||
JvmtiVMObjectAllocEventCollector oam;
|
JvmtiVMObjectAllocEventCollector oam;
|
||||||
|
|
||||||
// count the protection domains on the execution stack. We collapse
|
// count the protection domains on the execution stack. We collapse
|
||||||
|
@ -1438,7 +1423,7 @@ JVM_ENTRY(jobject, JVM_GetStackAccessControlContext(JNIEnv *env, jclass cls))
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((previous_protection_domain != protection_domain) && (protection_domain != NULL)) {
|
if ((previous_protection_domain != protection_domain) && (protection_domain != NULL)) {
|
||||||
local_array->push(protection_domain);
|
local_array->push(Handle(thread, protection_domain));
|
||||||
previous_protection_domain = protection_domain;
|
previous_protection_domain = protection_domain;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1455,13 +1440,11 @@ JVM_ENTRY(jobject, JVM_GetStackAccessControlContext(JNIEnv *env, jclass cls))
|
||||||
return JNIHandles::make_local(THREAD, result);
|
return JNIHandles::make_local(THREAD, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
// the resource area must be registered in case of a gc
|
|
||||||
RegisterArrayForGC ragc(thread, local_array);
|
|
||||||
objArrayOop context = oopFactory::new_objArray(SystemDictionary::ProtectionDomain_klass(),
|
objArrayOop context = oopFactory::new_objArray(SystemDictionary::ProtectionDomain_klass(),
|
||||||
local_array->length(), CHECK_NULL);
|
local_array->length(), CHECK_NULL);
|
||||||
objArrayHandle h_context(thread, context);
|
objArrayHandle h_context(thread, context);
|
||||||
for (int index = 0; index < local_array->length(); index++) {
|
for (int index = 0; index < local_array->length(); index++) {
|
||||||
h_context->obj_at_put(index, local_array->at(index));
|
h_context->obj_at_put(index, local_array->at(index)());
|
||||||
}
|
}
|
||||||
|
|
||||||
oop result = java_security_AccessControlContext::create(h_context, is_privileged, privileged_context, CHECK_NULL);
|
oop result = java_security_AccessControlContext::create(h_context, is_privileged, privileged_context, CHECK_NULL);
|
||||||
|
|
|
@ -1691,7 +1691,6 @@ void JavaThread::initialize() {
|
||||||
_on_thread_list = false;
|
_on_thread_list = false;
|
||||||
_thread_state = _thread_new;
|
_thread_state = _thread_new;
|
||||||
_terminated = _not_terminated;
|
_terminated = _not_terminated;
|
||||||
_array_for_gc = NULL;
|
|
||||||
_suspend_equivalent = false;
|
_suspend_equivalent = false;
|
||||||
_in_deopt_handler = 0;
|
_in_deopt_handler = 0;
|
||||||
_doing_unsafe_access = false;
|
_doing_unsafe_access = false;
|
||||||
|
@ -3010,13 +3009,6 @@ void JavaThread::oops_do(OopClosure* f, CodeBlobClosure* cf) {
|
||||||
// Record JavaThread to GC thread
|
// Record JavaThread to GC thread
|
||||||
RememberProcessedThread rpt(this);
|
RememberProcessedThread rpt(this);
|
||||||
|
|
||||||
// traverse the registered growable array
|
|
||||||
if (_array_for_gc != NULL) {
|
|
||||||
for (int index = 0; index < _array_for_gc->length(); index++) {
|
|
||||||
f->do_oop(_array_for_gc->adr_at(index));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Traverse the monitor chunks
|
// Traverse the monitor chunks
|
||||||
for (MonitorChunk* chunk = monitor_chunks(); chunk != NULL; chunk = chunk->next()) {
|
for (MonitorChunk* chunk = monitor_chunks(); chunk != NULL; chunk = chunk->next()) {
|
||||||
chunk->oops_do(f);
|
chunk->oops_do(f);
|
||||||
|
|
|
@ -1960,13 +1960,6 @@ class JavaThread: public Thread {
|
||||||
void thread_main_inner();
|
void thread_main_inner();
|
||||||
virtual void post_run();
|
virtual void post_run();
|
||||||
|
|
||||||
|
|
||||||
private:
|
|
||||||
GrowableArray<oop>* _array_for_gc;
|
|
||||||
public:
|
|
||||||
|
|
||||||
void register_array_for_gc(GrowableArray<oop>* array) { _array_for_gc = array; }
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Thread local information maintained by JVMTI.
|
// Thread local information maintained by JVMTI.
|
||||||
void set_jvmti_thread_state(JvmtiThreadState *value) { _jvmti_thread_state = value; }
|
void set_jvmti_thread_state(JvmtiThreadState *value) { _jvmti_thread_state = value; }
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue