8203381: Replace InstanceKlass::allocate_instance_handle with JavaCalls::construct_new_instance
Reviewed-by: lfoltan, dholmes, coleenp, minqi
This commit is contained in:
parent
f0e6200376
commit
1ae12b4328
@ -3249,17 +3249,9 @@ int java_lang_Module::_module_entry_offset = -1;
|
|||||||
|
|
||||||
Handle java_lang_Module::create(Handle loader, Handle module_name, TRAPS) {
|
Handle java_lang_Module::create(Handle loader, Handle module_name, TRAPS) {
|
||||||
assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem");
|
assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem");
|
||||||
|
return JavaCalls::construct_new_instance(SystemDictionary::Module_klass(),
|
||||||
Symbol* name = vmSymbols::java_lang_Module();
|
|
||||||
Klass* k = SystemDictionary::resolve_or_fail(name, true, CHECK_NH);
|
|
||||||
InstanceKlass* ik = InstanceKlass::cast(k);
|
|
||||||
Handle jlmh = ik->allocate_instance_handle(CHECK_NH);
|
|
||||||
JavaValue result(T_VOID);
|
|
||||||
JavaCalls::call_special(&result, jlmh, ik,
|
|
||||||
vmSymbols::object_initializer_name(),
|
|
||||||
vmSymbols::java_lang_module_init_signature(),
|
vmSymbols::java_lang_module_init_signature(),
|
||||||
loader, module_name, CHECK_NH);
|
loader, module_name, CHECK_NH);
|
||||||
return jlmh;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#define MODULE_FIELDS_DO(macro) \
|
#define MODULE_FIELDS_DO(macro) \
|
||||||
|
@ -728,24 +728,14 @@ void CompileBroker::compilation_init_phase2() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Handle CompileBroker::create_thread_oop(const char* name, TRAPS) {
|
Handle CompileBroker::create_thread_oop(const char* name, TRAPS) {
|
||||||
Klass* k = SystemDictionary::find(vmSymbols::java_lang_Thread(), Handle(), Handle(), CHECK_NH);
|
|
||||||
assert(k != NULL, "must be initialized");
|
|
||||||
InstanceKlass* klass = InstanceKlass::cast(k);
|
|
||||||
instanceHandle thread_handle = klass->allocate_instance_handle(CHECK_NH);
|
|
||||||
Handle string = java_lang_String::create_from_str(name, CHECK_NH);
|
Handle string = java_lang_String::create_from_str(name, CHECK_NH);
|
||||||
|
|
||||||
// Initialize thread_oop to put it into the system threadGroup
|
|
||||||
Handle thread_group(THREAD, Universe::system_thread_group());
|
Handle thread_group(THREAD, Universe::system_thread_group());
|
||||||
JavaValue result(T_VOID);
|
return JavaCalls::construct_new_instance(
|
||||||
JavaCalls::call_special(&result, thread_handle,
|
SystemDictionary::Thread_klass(),
|
||||||
klass,
|
|
||||||
vmSymbols::object_initializer_name(),
|
|
||||||
vmSymbols::threadgroup_string_void_signature(),
|
vmSymbols::threadgroup_string_void_signature(),
|
||||||
thread_group,
|
thread_group,
|
||||||
string,
|
string,
|
||||||
CHECK_NH);
|
CHECK_NH);
|
||||||
|
|
||||||
return thread_handle;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1200,11 +1200,8 @@ static bool is_authorized(Handle context, InstanceKlass* klass, TRAPS) {
|
|||||||
// and null permissions - which gives no permissions.
|
// and null permissions - which gives no permissions.
|
||||||
oop create_dummy_access_control_context(TRAPS) {
|
oop create_dummy_access_control_context(TRAPS) {
|
||||||
InstanceKlass* pd_klass = SystemDictionary::ProtectionDomain_klass();
|
InstanceKlass* pd_klass = SystemDictionary::ProtectionDomain_klass();
|
||||||
Handle obj = pd_klass->allocate_instance_handle(CHECK_NULL);
|
|
||||||
// Call constructor ProtectionDomain(null, null);
|
// Call constructor ProtectionDomain(null, null);
|
||||||
JavaValue result(T_VOID);
|
Handle obj = JavaCalls::construct_new_instance(pd_klass,
|
||||||
JavaCalls::call_special(&result, obj, pd_klass,
|
|
||||||
vmSymbols::object_initializer_name(),
|
|
||||||
vmSymbols::codesource_permissioncollection_signature(),
|
vmSymbols::codesource_permissioncollection_signature(),
|
||||||
Handle(), Handle(), CHECK_NULL);
|
Handle(), Handle(), CHECK_NULL);
|
||||||
|
|
||||||
|
@ -446,31 +446,25 @@ void os::init_before_ergo() {
|
|||||||
void os::initialize_jdk_signal_support(TRAPS) {
|
void os::initialize_jdk_signal_support(TRAPS) {
|
||||||
if (!ReduceSignalUsage) {
|
if (!ReduceSignalUsage) {
|
||||||
// Setup JavaThread for processing signals
|
// Setup JavaThread for processing signals
|
||||||
Klass* k = SystemDictionary::resolve_or_fail(vmSymbols::java_lang_Thread(), true, CHECK);
|
|
||||||
InstanceKlass* ik = InstanceKlass::cast(k);
|
|
||||||
instanceHandle thread_oop = ik->allocate_instance_handle(CHECK);
|
|
||||||
|
|
||||||
const char thread_name[] = "Signal Dispatcher";
|
const char thread_name[] = "Signal Dispatcher";
|
||||||
Handle string = java_lang_String::create_from_str(thread_name, CHECK);
|
Handle string = java_lang_String::create_from_str(thread_name, CHECK);
|
||||||
|
|
||||||
// Initialize thread_oop to put it into the system threadGroup
|
// Initialize thread_oop to put it into the system threadGroup
|
||||||
Handle thread_group (THREAD, Universe::system_thread_group());
|
Handle thread_group (THREAD, Universe::system_thread_group());
|
||||||
JavaValue result(T_VOID);
|
Handle thread_oop = JavaCalls::construct_new_instance(SystemDictionary::Thread_klass(),
|
||||||
JavaCalls::call_special(&result, thread_oop,
|
|
||||||
ik,
|
|
||||||
vmSymbols::object_initializer_name(),
|
|
||||||
vmSymbols::threadgroup_string_void_signature(),
|
vmSymbols::threadgroup_string_void_signature(),
|
||||||
thread_group,
|
thread_group,
|
||||||
string,
|
string,
|
||||||
CHECK);
|
CHECK);
|
||||||
|
|
||||||
Klass* group = SystemDictionary::ThreadGroup_klass();
|
Klass* group = SystemDictionary::ThreadGroup_klass();
|
||||||
|
JavaValue result(T_VOID);
|
||||||
JavaCalls::call_special(&result,
|
JavaCalls::call_special(&result,
|
||||||
thread_group,
|
thread_group,
|
||||||
group,
|
group,
|
||||||
vmSymbols::add_method_name(),
|
vmSymbols::add_method_name(),
|
||||||
vmSymbols::thread_void_signature(),
|
vmSymbols::thread_void_signature(),
|
||||||
thread_oop, // ARG 1
|
thread_oop,
|
||||||
CHECK);
|
CHECK);
|
||||||
|
|
||||||
{ MutexLocker mu(Threads_lock);
|
{ MutexLocker mu(Threads_lock);
|
||||||
|
@ -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
|
||||||
@ -39,19 +39,13 @@ ServiceThread* ServiceThread::_instance = NULL;
|
|||||||
void ServiceThread::initialize() {
|
void ServiceThread::initialize() {
|
||||||
EXCEPTION_MARK;
|
EXCEPTION_MARK;
|
||||||
|
|
||||||
InstanceKlass* klass = SystemDictionary::Thread_klass();
|
|
||||||
instanceHandle thread_oop = klass->allocate_instance_handle(CHECK);
|
|
||||||
|
|
||||||
const char* name = "Service Thread";
|
const char* name = "Service Thread";
|
||||||
|
|
||||||
Handle string = java_lang_String::create_from_str(name, CHECK);
|
Handle string = java_lang_String::create_from_str(name, CHECK);
|
||||||
|
|
||||||
// Initialize thread_oop to put it into the system threadGroup
|
// Initialize thread_oop to put it into the system threadGroup
|
||||||
Handle thread_group (THREAD, Universe::system_thread_group());
|
Handle thread_group (THREAD, Universe::system_thread_group());
|
||||||
JavaValue result(T_VOID);
|
Handle thread_oop = JavaCalls::construct_new_instance(
|
||||||
JavaCalls::call_special(&result, thread_oop,
|
SystemDictionary::Thread_klass(),
|
||||||
klass,
|
|
||||||
vmSymbols::object_initializer_name(),
|
|
||||||
vmSymbols::threadgroup_string_void_signature(),
|
vmSymbols::threadgroup_string_void_signature(),
|
||||||
thread_group,
|
thread_group,
|
||||||
string,
|
string,
|
||||||
|
@ -1025,44 +1025,32 @@ static void initialize_class(Symbol* class_name, TRAPS) {
|
|||||||
|
|
||||||
// Creates the initial ThreadGroup
|
// Creates the initial ThreadGroup
|
||||||
static Handle create_initial_thread_group(TRAPS) {
|
static Handle create_initial_thread_group(TRAPS) {
|
||||||
Klass* k = SystemDictionary::resolve_or_fail(vmSymbols::java_lang_ThreadGroup(), true, CHECK_NH);
|
Handle system_instance = JavaCalls::construct_new_instance(
|
||||||
InstanceKlass* ik = InstanceKlass::cast(k);
|
SystemDictionary::ThreadGroup_klass(),
|
||||||
|
|
||||||
Handle system_instance = ik->allocate_instance_handle(CHECK_NH);
|
|
||||||
{
|
|
||||||
JavaValue result(T_VOID);
|
|
||||||
JavaCalls::call_special(&result,
|
|
||||||
system_instance,
|
|
||||||
ik,
|
|
||||||
vmSymbols::object_initializer_name(),
|
|
||||||
vmSymbols::void_method_signature(),
|
vmSymbols::void_method_signature(),
|
||||||
CHECK_NH);
|
CHECK_NH);
|
||||||
}
|
|
||||||
Universe::set_system_thread_group(system_instance());
|
Universe::set_system_thread_group(system_instance());
|
||||||
|
|
||||||
Handle main_instance = ik->allocate_instance_handle(CHECK_NH);
|
Handle string = java_lang_String::create_from_str("main", CHECK_NH);
|
||||||
{
|
Handle main_instance = JavaCalls::construct_new_instance(
|
||||||
JavaValue result(T_VOID);
|
SystemDictionary::ThreadGroup_klass(),
|
||||||
Handle string = java_lang_String::create_from_str("main", CHECK_NH);
|
|
||||||
JavaCalls::call_special(&result,
|
|
||||||
main_instance,
|
|
||||||
ik,
|
|
||||||
vmSymbols::object_initializer_name(),
|
|
||||||
vmSymbols::threadgroup_string_void_signature(),
|
vmSymbols::threadgroup_string_void_signature(),
|
||||||
system_instance,
|
system_instance,
|
||||||
string,
|
string,
|
||||||
CHECK_NH);
|
CHECK_NH);
|
||||||
}
|
|
||||||
return main_instance;
|
return main_instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Creates the initial Thread
|
// Creates the initial Thread
|
||||||
static oop create_initial_thread(Handle thread_group, JavaThread* thread,
|
static oop create_initial_thread(Handle thread_group, JavaThread* thread,
|
||||||
TRAPS) {
|
TRAPS) {
|
||||||
Klass* k = SystemDictionary::resolve_or_fail(vmSymbols::java_lang_Thread(), true, CHECK_NULL);
|
InstanceKlass* ik = SystemDictionary::Thread_klass();
|
||||||
InstanceKlass* ik = InstanceKlass::cast(k);
|
assert(ik->is_initialized(), "must be");
|
||||||
instanceHandle thread_oop = ik->allocate_instance_handle(CHECK_NULL);
|
instanceHandle thread_oop = ik->allocate_instance_handle(CHECK_NULL);
|
||||||
|
|
||||||
|
// Cannot use JavaCalls::construct_new_instance because the java.lang.Thread
|
||||||
|
// constructor calls Thread.current(), which must be set here for the
|
||||||
|
// initial thread.
|
||||||
java_lang_Thread::set_thread(thread_oop(), thread);
|
java_lang_Thread::set_thread(thread_oop(), thread);
|
||||||
java_lang_Thread::set_priority(thread_oop(), NormPriority);
|
java_lang_Thread::set_priority(thread_oop(), NormPriority);
|
||||||
thread->set_threadObj(thread_oop());
|
thread->set_threadObj(thread_oop());
|
||||||
@ -1170,10 +1158,13 @@ void JavaThread::allocate_threadObj(Handle thread_group, const char* thread_name
|
|||||||
assert(thread_group.not_null(), "thread group should be specified");
|
assert(thread_group.not_null(), "thread group should be specified");
|
||||||
assert(threadObj() == NULL, "should only create Java thread object once");
|
assert(threadObj() == NULL, "should only create Java thread object once");
|
||||||
|
|
||||||
Klass* k = SystemDictionary::resolve_or_fail(vmSymbols::java_lang_Thread(), true, CHECK);
|
InstanceKlass* ik = SystemDictionary::Thread_klass();
|
||||||
InstanceKlass* ik = InstanceKlass::cast(k);
|
assert(ik->is_initialized(), "must be");
|
||||||
instanceHandle thread_oop = ik->allocate_instance_handle(CHECK);
|
instanceHandle thread_oop = ik->allocate_instance_handle(CHECK);
|
||||||
|
|
||||||
|
// We are called from jni_AttachCurrentThread/jni_AttachCurrentThreadAsDaemon.
|
||||||
|
// We cannot use JavaCalls::construct_new_instance because the java.lang.Thread
|
||||||
|
// constructor calls Thread.current(), which must be set here.
|
||||||
java_lang_Thread::set_thread(thread_oop(), this);
|
java_lang_Thread::set_thread(thread_oop(), this);
|
||||||
java_lang_Thread::set_priority(thread_oop(), NormPriority);
|
java_lang_Thread::set_priority(thread_oop(), NormPriority);
|
||||||
set_threadObj(thread_oop());
|
set_threadObj(thread_oop());
|
||||||
@ -1187,8 +1178,8 @@ void JavaThread::allocate_threadObj(Handle thread_group, const char* thread_name
|
|||||||
ik,
|
ik,
|
||||||
vmSymbols::object_initializer_name(),
|
vmSymbols::object_initializer_name(),
|
||||||
vmSymbols::threadgroup_string_void_signature(),
|
vmSymbols::threadgroup_string_void_signature(),
|
||||||
thread_group, // Argument 1
|
thread_group,
|
||||||
name, // Argument 2
|
name,
|
||||||
THREAD);
|
THREAD);
|
||||||
} else {
|
} else {
|
||||||
// Thread gets assigned name "Thread-nnn" and null target
|
// Thread gets assigned name "Thread-nnn" and null target
|
||||||
@ -1198,8 +1189,8 @@ void JavaThread::allocate_threadObj(Handle thread_group, const char* thread_name
|
|||||||
ik,
|
ik,
|
||||||
vmSymbols::object_initializer_name(),
|
vmSymbols::object_initializer_name(),
|
||||||
vmSymbols::threadgroup_runnable_void_signature(),
|
vmSymbols::threadgroup_runnable_void_signature(),
|
||||||
thread_group, // Argument 1
|
thread_group,
|
||||||
Handle(), // Argument 2
|
Handle(),
|
||||||
THREAD);
|
THREAD);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -409,16 +409,6 @@ bool AttachListener::has_init_error(TRAPS) {
|
|||||||
// Starts the Attach Listener thread
|
// Starts the Attach Listener thread
|
||||||
void AttachListener::init() {
|
void AttachListener::init() {
|
||||||
EXCEPTION_MARK;
|
EXCEPTION_MARK;
|
||||||
Klass* k = SystemDictionary::resolve_or_fail(vmSymbols::java_lang_Thread(), true, THREAD);
|
|
||||||
if (has_init_error(THREAD)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
InstanceKlass* klass = InstanceKlass::cast(k);
|
|
||||||
instanceHandle thread_oop = klass->allocate_instance_handle(THREAD);
|
|
||||||
if (has_init_error(THREAD)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const char thread_name[] = "Attach Listener";
|
const char thread_name[] = "Attach Listener";
|
||||||
Handle string = java_lang_String::create_from_str(thread_name, THREAD);
|
Handle string = java_lang_String::create_from_str(thread_name, THREAD);
|
||||||
@ -428,26 +418,23 @@ void AttachListener::init() {
|
|||||||
|
|
||||||
// Initialize thread_oop to put it into the system threadGroup
|
// Initialize thread_oop to put it into the system threadGroup
|
||||||
Handle thread_group (THREAD, Universe::system_thread_group());
|
Handle thread_group (THREAD, Universe::system_thread_group());
|
||||||
JavaValue result(T_VOID);
|
Handle thread_oop = JavaCalls::construct_new_instance(SystemDictionary::Thread_klass(),
|
||||||
JavaCalls::call_special(&result, thread_oop,
|
|
||||||
klass,
|
|
||||||
vmSymbols::object_initializer_name(),
|
|
||||||
vmSymbols::threadgroup_string_void_signature(),
|
vmSymbols::threadgroup_string_void_signature(),
|
||||||
thread_group,
|
thread_group,
|
||||||
string,
|
string,
|
||||||
THREAD);
|
THREAD);
|
||||||
|
|
||||||
if (has_init_error(THREAD)) {
|
if (has_init_error(THREAD)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Klass* group = SystemDictionary::ThreadGroup_klass();
|
Klass* group = SystemDictionary::ThreadGroup_klass();
|
||||||
|
JavaValue result(T_VOID);
|
||||||
JavaCalls::call_special(&result,
|
JavaCalls::call_special(&result,
|
||||||
thread_group,
|
thread_group,
|
||||||
group,
|
group,
|
||||||
vmSymbols::add_method_name(),
|
vmSymbols::add_method_name(),
|
||||||
vmSymbols::thread_void_signature(),
|
vmSymbols::thread_void_signature(),
|
||||||
thread_oop, // ARG 1
|
thread_oop,
|
||||||
THREAD);
|
THREAD);
|
||||||
if (has_init_error(THREAD)) {
|
if (has_init_error(THREAD)) {
|
||||||
return;
|
return;
|
||||||
|
@ -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
|
||||||
@ -133,32 +133,20 @@ static Handle createGcInfo(GCMemoryManager *gcManager, GCStatInfo *gcStatInfo,TR
|
|||||||
// The type is 'I'
|
// The type is 'I'
|
||||||
objArrayOop extra_args_array = oopFactory::new_objArray(SystemDictionary::Integer_klass(), 1, CHECK_NH);
|
objArrayOop extra_args_array = oopFactory::new_objArray(SystemDictionary::Integer_klass(), 1, CHECK_NH);
|
||||||
objArrayHandle extra_array (THREAD, extra_args_array);
|
objArrayHandle extra_array (THREAD, extra_args_array);
|
||||||
InstanceKlass* intK = SystemDictionary::Integer_klass();
|
|
||||||
|
|
||||||
instanceHandle extra_arg_val = intK->allocate_instance_handle(CHECK_NH);
|
JavaCallArguments argsInt;
|
||||||
|
argsInt.push_int(gcManager->num_gc_threads());
|
||||||
{
|
Handle extra_arg_val = JavaCalls::construct_new_instance(
|
||||||
JavaValue res(T_VOID);
|
SystemDictionary::Integer_klass(),
|
||||||
JavaCallArguments argsInt;
|
|
||||||
argsInt.push_oop(extra_arg_val);
|
|
||||||
argsInt.push_int(gcManager->num_gc_threads());
|
|
||||||
|
|
||||||
JavaCalls::call_special(&res,
|
|
||||||
intK,
|
|
||||||
vmSymbols::object_initializer_name(),
|
|
||||||
vmSymbols::int_void_signature(),
|
vmSymbols::int_void_signature(),
|
||||||
&argsInt,
|
&argsInt,
|
||||||
CHECK_NH);
|
CHECK_NH);
|
||||||
}
|
|
||||||
extra_array->obj_at_put(0,extra_arg_val());
|
extra_array->obj_at_put(0,extra_arg_val());
|
||||||
|
|
||||||
InstanceKlass* gcInfoklass = Management::com_sun_management_GcInfo_klass(CHECK_NH);
|
InstanceKlass* gcInfoklass = Management::com_sun_management_GcInfo_klass(CHECK_NH);
|
||||||
|
|
||||||
Handle gcInfo_instance = gcInfoklass->allocate_instance_handle(CHECK_NH);
|
|
||||||
|
|
||||||
JavaValue constructor_result(T_VOID);
|
|
||||||
JavaCallArguments constructor_args(16);
|
JavaCallArguments constructor_args(16);
|
||||||
constructor_args.push_oop(gcInfo_instance);
|
|
||||||
constructor_args.push_oop(getGcInfoBuilder(gcManager,THREAD));
|
constructor_args.push_oop(getGcInfoBuilder(gcManager,THREAD));
|
||||||
constructor_args.push_long(gcStatInfo->gc_index());
|
constructor_args.push_long(gcStatInfo->gc_index());
|
||||||
constructor_args.push_long(Management::ticks_to_ms(gcStatInfo->start_time()));
|
constructor_args.push_long(Management::ticks_to_ms(gcStatInfo->start_time()));
|
||||||
@ -167,14 +155,11 @@ static Handle createGcInfo(GCMemoryManager *gcManager, GCStatInfo *gcStatInfo,TR
|
|||||||
constructor_args.push_oop(usage_after_gc_ah);
|
constructor_args.push_oop(usage_after_gc_ah);
|
||||||
constructor_args.push_oop(extra_array);
|
constructor_args.push_oop(extra_array);
|
||||||
|
|
||||||
JavaCalls::call_special(&constructor_result,
|
return JavaCalls::construct_new_instance(
|
||||||
gcInfoklass,
|
gcInfoklass,
|
||||||
vmSymbols::object_initializer_name(),
|
|
||||||
vmSymbols::com_sun_management_GcInfo_constructor_signature(),
|
vmSymbols::com_sun_management_GcInfo_constructor_signature(),
|
||||||
&constructor_args,
|
&constructor_args,
|
||||||
CHECK_NH);
|
CHECK_NH);
|
||||||
|
|
||||||
return Handle(THREAD, gcInfo_instance());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GCNotifier::sendNotification(TRAPS) {
|
void GCNotifier::sendNotification(TRAPS) {
|
||||||
|
@ -337,26 +337,17 @@ static void initialize_ThreadInfo_constructor_arguments(JavaCallArguments* args,
|
|||||||
// Helper function to construct a ThreadInfo object
|
// Helper function to construct a ThreadInfo object
|
||||||
instanceOop Management::create_thread_info_instance(ThreadSnapshot* snapshot, TRAPS) {
|
instanceOop Management::create_thread_info_instance(ThreadSnapshot* snapshot, TRAPS) {
|
||||||
InstanceKlass* ik = Management::java_lang_management_ThreadInfo_klass(CHECK_NULL);
|
InstanceKlass* ik = Management::java_lang_management_ThreadInfo_klass(CHECK_NULL);
|
||||||
|
|
||||||
JavaValue result(T_VOID);
|
|
||||||
JavaCallArguments args(14);
|
JavaCallArguments args(14);
|
||||||
|
|
||||||
// First allocate a ThreadObj object and
|
|
||||||
// push the receiver as the first argument
|
|
||||||
Handle element = ik->allocate_instance_handle(CHECK_NULL);
|
|
||||||
args.push_oop(element);
|
|
||||||
|
|
||||||
// initialize the arguments for the ThreadInfo constructor
|
// initialize the arguments for the ThreadInfo constructor
|
||||||
initialize_ThreadInfo_constructor_arguments(&args, snapshot, CHECK_NULL);
|
initialize_ThreadInfo_constructor_arguments(&args, snapshot, CHECK_NULL);
|
||||||
|
|
||||||
// Call ThreadInfo constructor with no locked monitors and synchronizers
|
// Call ThreadInfo constructor with no locked monitors and synchronizers
|
||||||
JavaCalls::call_special(&result,
|
Handle element = JavaCalls::construct_new_instance(
|
||||||
ik,
|
ik,
|
||||||
vmSymbols::object_initializer_name(),
|
|
||||||
vmSymbols::java_lang_management_ThreadInfo_constructor_signature(),
|
vmSymbols::java_lang_management_ThreadInfo_constructor_signature(),
|
||||||
&args,
|
&args,
|
||||||
CHECK_NULL);
|
CHECK_NULL);
|
||||||
|
|
||||||
return (instanceOop) element();
|
return (instanceOop) element();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -366,15 +357,8 @@ instanceOop Management::create_thread_info_instance(ThreadSnapshot* snapshot,
|
|||||||
objArrayHandle synchronizers_array,
|
objArrayHandle synchronizers_array,
|
||||||
TRAPS) {
|
TRAPS) {
|
||||||
InstanceKlass* ik = Management::java_lang_management_ThreadInfo_klass(CHECK_NULL);
|
InstanceKlass* ik = Management::java_lang_management_ThreadInfo_klass(CHECK_NULL);
|
||||||
|
|
||||||
JavaValue result(T_VOID);
|
|
||||||
JavaCallArguments args(17);
|
JavaCallArguments args(17);
|
||||||
|
|
||||||
// First allocate a ThreadObj object and
|
|
||||||
// push the receiver as the first argument
|
|
||||||
Handle element = ik->allocate_instance_handle(CHECK_NULL);
|
|
||||||
args.push_oop(element);
|
|
||||||
|
|
||||||
// initialize the arguments for the ThreadInfo constructor
|
// initialize the arguments for the ThreadInfo constructor
|
||||||
initialize_ThreadInfo_constructor_arguments(&args, snapshot, CHECK_NULL);
|
initialize_ThreadInfo_constructor_arguments(&args, snapshot, CHECK_NULL);
|
||||||
|
|
||||||
@ -384,13 +368,11 @@ instanceOop Management::create_thread_info_instance(ThreadSnapshot* snapshot,
|
|||||||
args.push_oop(synchronizers_array);
|
args.push_oop(synchronizers_array);
|
||||||
|
|
||||||
// Call ThreadInfo constructor with locked monitors and synchronizers
|
// Call ThreadInfo constructor with locked monitors and synchronizers
|
||||||
JavaCalls::call_special(&result,
|
Handle element = JavaCalls::construct_new_instance(
|
||||||
ik,
|
ik,
|
||||||
vmSymbols::object_initializer_name(),
|
|
||||||
vmSymbols::java_lang_management_ThreadInfo_with_locks_constructor_signature(),
|
vmSymbols::java_lang_management_ThreadInfo_with_locks_constructor_signature(),
|
||||||
&args,
|
&args,
|
||||||
CHECK_NULL);
|
CHECK_NULL);
|
||||||
|
|
||||||
return (instanceOop) element();
|
return (instanceOop) element();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -217,23 +217,17 @@ bool MemoryService::set_verbose(bool verbose) {
|
|||||||
Handle MemoryService::create_MemoryUsage_obj(MemoryUsage usage, TRAPS) {
|
Handle MemoryService::create_MemoryUsage_obj(MemoryUsage usage, TRAPS) {
|
||||||
InstanceKlass* ik = Management::java_lang_management_MemoryUsage_klass(CHECK_NH);
|
InstanceKlass* ik = Management::java_lang_management_MemoryUsage_klass(CHECK_NH);
|
||||||
|
|
||||||
instanceHandle obj = ik->allocate_instance_handle(CHECK_NH);
|
|
||||||
|
|
||||||
JavaValue result(T_VOID);
|
|
||||||
JavaCallArguments args(10);
|
JavaCallArguments args(10);
|
||||||
args.push_oop(obj); // receiver
|
args.push_long(usage.init_size_as_jlong());
|
||||||
args.push_long(usage.init_size_as_jlong()); // Argument 1
|
args.push_long(usage.used_as_jlong());
|
||||||
args.push_long(usage.used_as_jlong()); // Argument 2
|
args.push_long(usage.committed_as_jlong());
|
||||||
args.push_long(usage.committed_as_jlong()); // Argument 3
|
args.push_long(usage.max_size_as_jlong());
|
||||||
args.push_long(usage.max_size_as_jlong()); // Argument 4
|
|
||||||
|
|
||||||
JavaCalls::call_special(&result,
|
return JavaCalls::construct_new_instance(
|
||||||
ik,
|
ik,
|
||||||
vmSymbols::object_initializer_name(),
|
|
||||||
vmSymbols::long_long_long_long_void_signature(),
|
vmSymbols::long_long_long_long_void_signature(),
|
||||||
&args,
|
&args,
|
||||||
CHECK_NH);
|
CHECK_NH);
|
||||||
return obj;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TraceMemoryManagerStats::TraceMemoryManagerStats(GCMemoryManager* gc_memory_manager,
|
TraceMemoryManagerStats::TraceMemoryManagerStats(GCMemoryManager* gc_memory_manager,
|
||||||
|
@ -264,23 +264,10 @@ Handle Exceptions::new_exception(Thread *thread, Symbol* name,
|
|||||||
|
|
||||||
if (!thread->has_pending_exception()) {
|
if (!thread->has_pending_exception()) {
|
||||||
assert(klass != NULL, "klass must exist");
|
assert(klass != NULL, "klass must exist");
|
||||||
// We are about to create an instance - so make sure that klass is initialized
|
h_exception = JavaCalls::construct_new_instance(InstanceKlass::cast(klass),
|
||||||
InstanceKlass* ik = InstanceKlass::cast(klass);
|
|
||||||
ik->initialize(thread);
|
|
||||||
if (!thread->has_pending_exception()) {
|
|
||||||
// Allocate new exception
|
|
||||||
h_exception = ik->allocate_instance_handle(thread);
|
|
||||||
if (!thread->has_pending_exception()) {
|
|
||||||
JavaValue result(T_VOID);
|
|
||||||
args->set_receiver(h_exception);
|
|
||||||
// Call constructor
|
|
||||||
JavaCalls::call_special(&result, ik,
|
|
||||||
vmSymbols::object_initializer_name(),
|
|
||||||
signature,
|
signature,
|
||||||
args,
|
args,
|
||||||
thread);
|
thread);
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if another exception was thrown in the process, if so rethrow that one
|
// Check if another exception was thrown in the process, if so rethrow that one
|
||||||
|
Loading…
Reference in New Issue
Block a user