8252685: APIs that require JavaThread should take JavaThread arguments

Reviewed-by: coleenp, sspitsyn, kvn, iklam
This commit is contained in:
David Holmes 2021-05-17 04:05:44 +00:00
parent 2066f497b9
commit 02f895c5f6
120 changed files with 507 additions and 521 deletions

View File

@ -69,7 +69,6 @@ jint CodeInstaller::pd_next_offset(NativeInstruction* inst, jint pc_offset, JVMC
void CodeInstaller::pd_patch_OopConstant(int pc_offset, JVMCIObject constant, JVMCI_TRAPS) {
address pc = _instructions->start() + pc_offset;
Handle obj = jvmci_env()->asConstant(constant, JVMCI_CHECK);
Thread* THREAD = Thread::current();
jobject value = JNIHandles::make_local(obj());
if (jvmci_env()->get_HotSpotObjectConstantImpl_compressed(constant)) {
#ifdef _LP64

View File

@ -40,7 +40,7 @@
void MethodHandles::invoke_target(Method* method, TRAPS) {
JavaThread *thread = THREAD->as_Java_thread();
JavaThread *thread = THREAD;
ZeroStack *stack = thread->zero_stack();
InterpreterFrame *frame = thread->top_zero_frame()->as_interpreter_frame();
interpreterState istate = frame->interpreter_state();
@ -57,7 +57,7 @@ void MethodHandles::invoke_target(Method* method, TRAPS) {
oop MethodHandles::popFromStack(TRAPS) {
JavaThread *thread = THREAD->as_Java_thread();
JavaThread *thread = THREAD;
InterpreterFrame *frame = thread->top_zero_frame()->as_interpreter_frame();
interpreterState istate = frame->interpreter_state();
intptr_t* topOfStack = istate->stack();
@ -93,7 +93,7 @@ void MethodHandles::teardown_frame_anchor(JavaThread* thread) {
}
void MethodHandles::throw_AME(Klass* rcvr, Method* interface_method, TRAPS) {
JavaThread* thread = THREAD->as_Java_thread();
JavaThread* thread = THREAD;
bool has_last_Java_frame = thread->has_last_Java_frame();
if (!has_last_Java_frame) {
setup_frame_anchor(thread);
@ -105,7 +105,7 @@ void MethodHandles::throw_AME(Klass* rcvr, Method* interface_method, TRAPS) {
}
void MethodHandles::throw_NPE(TRAPS) {
JavaThread* thread = THREAD->as_Java_thread();
JavaThread* thread = THREAD;
bool has_last_Java_frame = thread->has_last_Java_frame();
if (!has_last_Java_frame) {
setup_frame_anchor(thread);
@ -118,7 +118,7 @@ void MethodHandles::throw_NPE(TRAPS) {
int MethodHandles::method_handle_entry_invokeBasic(Method* method, intptr_t UNUSED, TRAPS) {
JavaThread *thread = THREAD->as_Java_thread();
JavaThread *thread = THREAD;
InterpreterFrame *frame = thread->top_zero_frame()->as_interpreter_frame();
interpreterState istate = frame->interpreter_state();
intptr_t* topOfStack = istate->stack();
@ -156,7 +156,7 @@ int MethodHandles::method_handle_entry_linkToStaticOrSpecial(Method* method, int
}
int MethodHandles::method_handle_entry_linkToInterface(Method* method, intptr_t UNUSED, TRAPS) {
JavaThread *thread = THREAD->as_Java_thread();
JavaThread *thread = THREAD;
InterpreterFrame *frame = thread->top_zero_frame()->as_interpreter_frame();
interpreterState istate = frame->interpreter_state();
@ -200,7 +200,7 @@ int MethodHandles::method_handle_entry_linkToInterface(Method* method, intptr_t
}
int MethodHandles::method_handle_entry_linkToVirtual(Method* method, intptr_t UNUSED, TRAPS) {
JavaThread *thread = THREAD->as_Java_thread();
JavaThread *thread = THREAD;
InterpreterFrame *frame = thread->top_zero_frame()->as_interpreter_frame();
interpreterState istate = frame->interpreter_state();

View File

@ -46,7 +46,7 @@ int ZeroStack::suggest_size(Thread *thread) const {
}
void ZeroStack::handle_overflow(TRAPS) {
JavaThread *thread = THREAD->as_Java_thread();
JavaThread *thread = THREAD;
// Set up the frame anchor if it isn't already
bool has_last_Java_frame = thread->has_last_Java_frame();

View File

@ -72,7 +72,7 @@ class StubGenerator: public StubCodeGenerator {
intptr_t* parameters,
int parameter_words,
TRAPS) {
JavaThread *thread = THREAD->as_Java_thread();
JavaThread *thread = THREAD;
ZeroStack *stack = thread->zero_stack();
// Make sure we have no pending exceptions
@ -316,7 +316,7 @@ EntryFrame *EntryFrame::build(const intptr_t* parameters,
JavaCallWrapper* call_wrapper,
TRAPS) {
ZeroStack *stack = THREAD->as_Java_thread()->zero_stack();
ZeroStack *stack = THREAD->zero_stack();
stack->overflow_check(header_words + parameter_words, CHECK_NULL);
stack->push(0); // next_frame, filled in later

View File

@ -108,7 +108,7 @@ InterpreterCodelet* ZeroInterpreter::codelet_containing(address pc) {
fixup_after_potential_safepoint()
int ZeroInterpreter::normal_entry(Method* method, intptr_t UNUSED, TRAPS) {
JavaThread *thread = THREAD->as_Java_thread();
JavaThread *thread = THREAD;
// Allocate and initialize our frame.
InterpreterFrame *frame = InterpreterFrame::build(method, CHECK_0);
@ -122,7 +122,7 @@ int ZeroInterpreter::normal_entry(Method* method, intptr_t UNUSED, TRAPS) {
}
int ZeroInterpreter::Reference_get_entry(Method* method, intptr_t UNUSED, TRAPS) {
JavaThread* thread = THREAD->as_Java_thread();
JavaThread* thread = THREAD;
ZeroStack* stack = thread->zero_stack();
intptr_t* topOfStack = stack->sp();
@ -170,7 +170,7 @@ intptr_t narrow(BasicType type, intptr_t result) {
void ZeroInterpreter::main_loop(int recurse, TRAPS) {
JavaThread *thread = THREAD->as_Java_thread();
JavaThread *thread = THREAD;
ZeroStack *stack = thread->zero_stack();
// If we are entering from a deopt we may need to call
@ -304,7 +304,7 @@ int ZeroInterpreter::native_entry(Method* method, intptr_t UNUSED, TRAPS) {
// Make sure method is native and not abstract
assert(method->is_native() && !method->is_abstract(), "should be");
JavaThread *thread = THREAD->as_Java_thread();
JavaThread *thread = THREAD;
ZeroStack *stack = thread->zero_stack();
// Allocate and initialize our frame
@ -551,7 +551,7 @@ int ZeroInterpreter::native_entry(Method* method, intptr_t UNUSED, TRAPS) {
}
int ZeroInterpreter::getter_entry(Method* method, intptr_t UNUSED, TRAPS) {
JavaThread* thread = THREAD->as_Java_thread();
JavaThread* thread = THREAD;
// Drop into the slow path if we need a safepoint check
if (SafepointMechanism::should_process(thread)) {
return normal_entry(method, 0, THREAD);
@ -639,7 +639,7 @@ int ZeroInterpreter::getter_entry(Method* method, intptr_t UNUSED, TRAPS) {
}
int ZeroInterpreter::setter_entry(Method* method, intptr_t UNUSED, TRAPS) {
JavaThread* thread = THREAD->as_Java_thread();
JavaThread* thread = THREAD;
// Drop into the slow path if we need a safepoint check
if (SafepointMechanism::should_process(thread)) {
return normal_entry(method, 0, THREAD);
@ -730,7 +730,7 @@ int ZeroInterpreter::setter_entry(Method* method, intptr_t UNUSED, TRAPS) {
}
int ZeroInterpreter::empty_entry(Method* method, intptr_t UNUSED, TRAPS) {
JavaThread *thread = THREAD->as_Java_thread();
JavaThread *thread = THREAD;
ZeroStack *stack = thread->zero_stack();
// Drop into the slow path if we need a safepoint check
@ -746,7 +746,7 @@ int ZeroInterpreter::empty_entry(Method* method, intptr_t UNUSED, TRAPS) {
}
InterpreterFrame *InterpreterFrame::build(Method* const method, TRAPS) {
JavaThread *thread = THREAD->as_Java_thread();
JavaThread *thread = THREAD;
ZeroStack *stack = thread->zero_stack();
// Calculate the size of the frame we'll build, including
@ -821,7 +821,7 @@ InterpreterFrame *InterpreterFrame::build(Method* const method, TRAPS) {
}
InterpreterFrame *InterpreterFrame::build(int size, TRAPS) {
ZeroStack *stack = THREAD->as_Java_thread()->zero_stack();
ZeroStack *stack = THREAD->zero_stack();
int size_in_words = size >> LogBytesPerWord;
assert(size_in_words * wordSize == size, "unaligned");

View File

@ -2542,7 +2542,7 @@ bool os::find(address addr, outputStream* st) {
// on, e.g., Win32.
void
os::os_exception_wrapper(java_call_t f, JavaValue* value, const methodHandle& method,
JavaCallArguments* args, Thread* thread) {
JavaCallArguments* args, JavaThread* thread) {
f(value, method, args, thread);
}

View File

@ -2221,7 +2221,7 @@ bool os::find(address addr, outputStream* st) {
// on, e.g., Win32.
void os::os_exception_wrapper(java_call_t f, JavaValue* value,
const methodHandle& method, JavaCallArguments* args,
Thread* thread) {
JavaThread* thread) {
f(value, method, args, thread);
}

View File

@ -4764,7 +4764,7 @@ bool os::find(address addr, outputStream* st) {
// on, e.g., Win32.
void
os::os_exception_wrapper(java_call_t f, JavaValue* value, const methodHandle& method,
JavaCallArguments* args, Thread* thread) {
JavaCallArguments* args, JavaThread* thread) {
f(value, method, args, thread);
}

View File

@ -59,7 +59,7 @@
# include <stdio.h>
# include <intrin.h>
void os::os_exception_wrapper(java_call_t f, JavaValue* value, const methodHandle& method, JavaCallArguments* args, Thread* thread) {
void os::os_exception_wrapper(java_call_t f, JavaValue* value, const methodHandle& method, JavaCallArguments* args, JavaThread* thread) {
f(value, method, args, thread);
}

View File

@ -70,7 +70,7 @@ JNIEXPORT
extern LONG WINAPI topLevelExceptionFilter(_EXCEPTION_POINTERS* );
// Install a win32 structured exception handler around thread.
void os::os_exception_wrapper(java_call_t f, JavaValue* value, const methodHandle& method, JavaCallArguments* args, Thread* thread) {
void os::os_exception_wrapper(java_call_t f, JavaValue* value, const methodHandle& method, JavaCallArguments* args, JavaThread* thread) {
__try {
#ifndef AMD64

View File

@ -900,13 +900,13 @@ class ArchiveBuilder::CDSMapLogger : AllStatic {
#define _LOG_PREFIX PTR_FORMAT ": @@ %-17s %d"
static void write_klass(Klass* k, address runtime_dest, const char* type_name, int bytes, Thread* THREAD) {
ResourceMark rm(THREAD);
static void write_klass(Klass* k, address runtime_dest, const char* type_name, int bytes, Thread* current) {
ResourceMark rm(current);
log_debug(cds, map)(_LOG_PREFIX " %s",
p2i(runtime_dest), type_name, bytes, k->external_name());
}
static void write_method(Method* m, address runtime_dest, const char* type_name, int bytes, Thread* THREAD) {
ResourceMark rm(THREAD);
static void write_method(Method* m, address runtime_dest, const char* type_name, int bytes, Thread* current) {
ResourceMark rm(current);
log_debug(cds, map)(_LOG_PREFIX " %s",
p2i(runtime_dest), type_name, bytes, m->external_name());
}
@ -916,7 +916,7 @@ class ArchiveBuilder::CDSMapLogger : AllStatic {
address last_obj_base = address(region->base());
address last_obj_end = address(region->base());
address region_end = address(region->end());
Thread* THREAD = Thread::current();
Thread* current = Thread::current();
for (int i = 0; i < src_objs->objs()->length(); i++) {
SourceObjInfo* src_info = src_objs->at(i);
address src = src_info->orig_obj();
@ -930,25 +930,25 @@ class ArchiveBuilder::CDSMapLogger : AllStatic {
switch (type) {
case MetaspaceObj::ClassType:
write_klass((Klass*)src, runtime_dest, type_name, bytes, THREAD);
write_klass((Klass*)src, runtime_dest, type_name, bytes, current);
break;
case MetaspaceObj::ConstantPoolType:
write_klass(((ConstantPool*)src)->pool_holder(),
runtime_dest, type_name, bytes, THREAD);
runtime_dest, type_name, bytes, current);
break;
case MetaspaceObj::ConstantPoolCacheType:
write_klass(((ConstantPoolCache*)src)->constant_pool()->pool_holder(),
runtime_dest, type_name, bytes, THREAD);
runtime_dest, type_name, bytes, current);
break;
case MetaspaceObj::MethodType:
write_method((Method*)src, runtime_dest, type_name, bytes, THREAD);
write_method((Method*)src, runtime_dest, type_name, bytes, current);
break;
case MetaspaceObj::ConstMethodType:
write_method(((ConstMethod*)src)->method(), runtime_dest, type_name, bytes, THREAD);
write_method(((ConstMethod*)src)->method(), runtime_dest, type_name, bytes, current);
break;
case MetaspaceObj::SymbolType:
{
ResourceMark rm(THREAD);
ResourceMark rm(current);
Symbol* s = (Symbol*)src;
log_debug(cds, map)(_LOG_PREFIX " %s", p2i(runtime_dest), type_name, bytes,
s->as_quoted_ascii());

View File

@ -522,9 +522,9 @@ bool ClassListParser::is_matching_cp_entry(constantPoolHandle &pool, int cp_inde
return true;
}
void ClassListParser::resolve_indy(Thread* current, Symbol* class_name_symbol) {
void ClassListParser::resolve_indy(JavaThread* current, Symbol* class_name_symbol) {
ExceptionMark em(current);
Thread* THREAD = current; // For exception macros.
JavaThread* THREAD = current; // For exception macros.
ClassListParser::resolve_indy_impl(class_name_symbol, THREAD);
if (HAS_PENDING_EXCEPTION) {
ResourceMark rm(current);

View File

@ -116,7 +116,7 @@ class ClassListParser : public StackObj {
void print_actual_interfaces(InstanceKlass *ik);
bool is_matching_cp_entry(constantPoolHandle &pool, int cp_index, TRAPS);
void resolve_indy(Thread* current, Symbol* class_name_symbol);
void resolve_indy(JavaThread* current, Symbol* class_name_symbol);
void resolve_indy_impl(Symbol* class_name_symbol, TRAPS);
bool parse_one_line();
Klass* load_current_class(Symbol* class_name_symbol, TRAPS);

View File

@ -685,7 +685,7 @@ static void verify_the_heap(Klass* k, const char* which) {
// Note: if a ArchivedKlassSubGraphInfoRecord contains non-early classes, and JVMTI
// ClassFileLoadHook is enabled, it's possible for this class to be dynamically replaced. In
// this case, we will not load the ArchivedKlassSubGraphInfoRecord and will clear its roots.
void HeapShared::resolve_classes(Thread* THREAD) {
void HeapShared::resolve_classes(JavaThread* THREAD) {
if (!is_mapped()) {
return; // nothing to do
}
@ -701,7 +701,7 @@ void HeapShared::resolve_classes(Thread* THREAD) {
}
void HeapShared::resolve_classes_for_subgraphs(ArchivableStaticFieldInfo fields[],
int num, Thread* THREAD) {
int num, JavaThread* THREAD) {
for (int i = 0; i < num; i++) {
ArchivableStaticFieldInfo* info = &fields[i];
TempNewSymbol klass_name = SymbolTable::new_symbol(info->klass_name);
@ -711,7 +711,7 @@ void HeapShared::resolve_classes_for_subgraphs(ArchivableStaticFieldInfo fields[
}
}
void HeapShared::resolve_classes_for_subgraph_of(Klass* k, Thread* THREAD) {
void HeapShared::resolve_classes_for_subgraph_of(Klass* k, JavaThread* THREAD) {
ExceptionMark em(THREAD);
const ArchivedKlassSubGraphInfoRecord* record =
resolve_or_init_classes_for_subgraph_of(k, /*do_init=*/false, THREAD);
@ -723,7 +723,7 @@ void HeapShared::resolve_classes_for_subgraph_of(Klass* k, Thread* THREAD) {
}
}
void HeapShared::initialize_from_archived_subgraph(Klass* k, Thread* THREAD) {
void HeapShared::initialize_from_archived_subgraph(Klass* k, JavaThread* THREAD) {
if (!is_mapped()) {
return; // nothing to do
}

View File

@ -275,8 +275,8 @@ private:
static void copy_roots();
static void resolve_classes_for_subgraphs(ArchivableStaticFieldInfo fields[],
int num, Thread* THREAD);
static void resolve_classes_for_subgraph_of(Klass* k, Thread* THREAD);
int num, JavaThread* THREAD);
static void resolve_classes_for_subgraph_of(Klass* k, JavaThread* THREAD);
static void clear_archived_roots_of(Klass* k);
static const ArchivedKlassSubGraphInfoRecord*
resolve_or_init_classes_for_subgraph_of(Klass* k, bool do_init, TRAPS);
@ -386,8 +386,8 @@ private:
inline static bool is_archived_object(oop p) NOT_CDS_JAVA_HEAP_RETURN_(false);
static void resolve_classes(Thread* THREAD) NOT_CDS_JAVA_HEAP_RETURN;
static void initialize_from_archived_subgraph(Klass* k, Thread* THREAD) NOT_CDS_JAVA_HEAP_RETURN;
static void resolve_classes(JavaThread* THREAD) NOT_CDS_JAVA_HEAP_RETURN;
static void initialize_from_archived_subgraph(Klass* k, JavaThread* THREAD) NOT_CDS_JAVA_HEAP_RETURN;
// NarrowOops stored in the CDS archive may use a different encoding scheme
// than CompressedOops::{base,shift} -- see FileMapInfo::map_heap_regions_impl.

View File

@ -264,7 +264,7 @@ void MetaspaceShared::post_initialize(TRAPS) {
static GrowableArrayCHeap<OopHandle, mtClassShared>* _extra_interned_strings = NULL;
static GrowableArrayCHeap<Symbol*, mtClassShared>* _extra_symbols = NULL;
void MetaspaceShared::read_extra_data(Thread* current, const char* filename) {
void MetaspaceShared::read_extra_data(JavaThread* current, const char* filename) {
_extra_interned_strings = new GrowableArrayCHeap<OopHandle, mtClassShared>(10000);
_extra_symbols = new GrowableArrayCHeap<Symbol*, mtClassShared>(1000);
@ -289,7 +289,7 @@ void MetaspaceShared::read_extra_data(Thread* current, const char* filename) {
} else{
assert(prefix_type == HashtableTextDump::StringPrefix, "Sanity");
ExceptionMark em(current);
Thread* THREAD = current; // For exception macros.
JavaThread* THREAD = current; // For exception macros.
oop str = StringTable::intern(utf8_buffer, THREAD);
if (HAS_PENDING_EXCEPTION) {
@ -639,7 +639,7 @@ void MetaspaceShared::prepare_for_dumping() {
Arguments::assert_is_dumping_archive();
Arguments::check_unsupported_dumping_properties();
ClassLoader::initialize_shared_path(Thread::current());
ClassLoader::initialize_shared_path(JavaThread::current());
}
// Preload classes from a list, populate the shared spaces and dump to a
@ -752,9 +752,9 @@ int MetaspaceShared::parse_classlist(const char* classlist_path, TRAPS) {
}
// Returns true if the class's status has changed.
bool MetaspaceShared::try_link_class(Thread* current, InstanceKlass* ik) {
bool MetaspaceShared::try_link_class(JavaThread* current, InstanceKlass* ik) {
ExceptionMark em(current);
Thread* THREAD = current; // For exception macros.
JavaThread* THREAD = current; // For exception macros.
Arguments::assert_is_dumping_archive();
if (ik->is_loaded() && !ik->is_linked() && !ik->has_old_class_version() &&
!SystemDictionaryShared::has_class_failed_verification(ik)) {

View File

@ -133,7 +133,7 @@ public:
NOT_CDS(return false);
}
static bool try_link_class(Thread* current, InstanceKlass* ik);
static bool try_link_class(JavaThread* current, InstanceKlass* ik);
static void link_and_cleanup_shared_classes(TRAPS) NOT_CDS_RETURN;
static bool link_class_for_cds(InstanceKlass* ik, TRAPS) NOT_CDS_RETURN_(false);
static bool linking_required(InstanceKlass* ik) NOT_CDS_RETURN_(false);
@ -184,7 +184,7 @@ public:
static void disable_full_module_graph() { _use_full_module_graph = false; }
private:
static void read_extra_data(Thread* current, const char* filename) NOT_CDS_RETURN;
static void read_extra_data(JavaThread* current, const char* filename) NOT_CDS_RETURN;
static FileMapInfo* open_static_archive();
static FileMapInfo* open_dynamic_archive();
// use_requested_addr: If true (default), attempt to map at the address the

View File

@ -35,7 +35,7 @@
CompilerThread* thread=CompilerThread::current(); \
ThreadInVMfromNative __tiv(thread); \
HandleMarkCleaner __hm(thread); \
Thread* THREAD = thread; \
JavaThread* THREAD = thread; /* For exception macros. */ \
debug_only(VMNativeEntryWrapper __vew;)
@ -50,13 +50,13 @@
* removed, causes the NoHandleMark assert to trigger. \
* debug_only(NoHandleMark __hm();) \
*/ \
Thread* THREAD = thread; \
JavaThread* THREAD = thread; /* For exception macros. */ \
debug_only(VMNativeEntryWrapper __vew;)
#define EXCEPTION_CONTEXT \
CompilerThread* thread=CompilerThread::current(); \
Thread* THREAD = thread;
CompilerThread* thread = CompilerThread::current(); \
JavaThread* THREAD = thread; // For exception macros.
#define GUARDED_VM_ENTRY(action) \

View File

@ -5565,7 +5565,6 @@ ClassFileParser::ClassFileParser(ClassFileStream* stream,
_class_name = name != NULL ? name : vmSymbols::unknown_class_name();
_class_name->increment_refcount();
assert(THREAD->is_Java_thread(), "invariant");
assert(_loader_data != NULL, "invariant");
assert(stream != NULL, "invariant");
assert(_stream != NULL, "invariant");

View File

@ -238,7 +238,7 @@ const char* ClassPathEntry::copy_path(const char* path) {
return copy;
}
ClassFileStream* ClassPathDirEntry::open_stream(Thread* current, const char* name) {
ClassFileStream* ClassPathDirEntry::open_stream(JavaThread* current, const char* name) {
// construct full path name
assert((_dir != NULL) && (name != NULL), "sanity");
size_t path_len = strlen(_dir) + strlen(name) + strlen(os::file_separator()) + 1;
@ -286,9 +286,9 @@ ClassPathZipEntry::~ClassPathZipEntry() {
FREE_C_HEAP_ARRAY(char, _zip_name);
}
u1* ClassPathZipEntry::open_entry(Thread* current, const char* name, jint* filesize, bool nul_terminate) {
u1* ClassPathZipEntry::open_entry(JavaThread* current, const char* name, jint* filesize, bool nul_terminate) {
// enable call to C land
ThreadToNativeFromVM ttn(current->as_Java_thread());
ThreadToNativeFromVM ttn(current);
// check whether zip archive contains name
jint name_len;
jzentry* entry = (*FindEntry)(_zip, name, filesize, &name_len);
@ -314,7 +314,7 @@ u1* ClassPathZipEntry::open_entry(Thread* current, const char* name, jint* files
return buffer;
}
ClassFileStream* ClassPathZipEntry::open_stream(Thread* current, const char* name) {
ClassFileStream* ClassPathZipEntry::open_stream(JavaThread* current, const char* name) {
jint filesize;
u1* buffer = open_entry(current, name, &filesize, false);
if (buffer == NULL) {
@ -372,7 +372,7 @@ ClassPathImageEntry::ClassPathImageEntry(JImageFile* jimage, const char* name) :
_name = copy_path(name);
}
ClassFileStream* ClassPathImageEntry::open_stream(Thread* current, const char* name) {
ClassFileStream* ClassPathImageEntry::open_stream(JavaThread* current, const char* name) {
return open_stream_for_loader(current, name, ClassLoaderData::the_null_class_loader_data());
}
@ -383,7 +383,7 @@ ClassFileStream* ClassPathImageEntry::open_stream(Thread* current, const char* n
// 1. There are no unnamed modules in the jimage file.
// 2. A package is in at most one module in the jimage file.
//
ClassFileStream* ClassPathImageEntry::open_stream_for_loader(Thread* current, const char* name, ClassLoaderData* loader_data) {
ClassFileStream* ClassPathImageEntry::open_stream_for_loader(JavaThread* current, const char* name, ClassLoaderData* loader_data) {
jlong size;
JImageLocationRef location = (*JImageFindResource)(jimage_non_null(), "", get_jimage_version_string(), name, &size);
@ -499,7 +499,7 @@ void ClassLoader::trace_class_path(const char* msg, const char* name) {
}
}
void ClassLoader::setup_bootstrap_search_path(Thread* current) {
void ClassLoader::setup_bootstrap_search_path(JavaThread* current) {
const char* sys_class_path = Arguments::get_sysclasspath();
assert(sys_class_path != NULL, "System boot class path must not be NULL");
if (PrintSharedArchiveAndExit) {
@ -512,7 +512,7 @@ void ClassLoader::setup_bootstrap_search_path(Thread* current) {
}
#if INCLUDE_CDS
void ClassLoader::setup_app_search_path(Thread* current, const char *class_path) {
void ClassLoader::setup_app_search_path(JavaThread* current, const char *class_path) {
Arguments::assert_is_dumping_archive();
ResourceMark rm(current);
@ -540,7 +540,7 @@ void ClassLoader::add_to_module_path_entries(const char* path,
}
// Add a module path to the _module_path_entries list.
void ClassLoader::setup_module_search_path(Thread* current, const char* path) {
void ClassLoader::setup_module_search_path(JavaThread* current, const char* path) {
Arguments::assert_is_dumping_archive();
struct stat st;
if (os::stat(path, &st) != 0) {
@ -569,7 +569,7 @@ void ClassLoader::close_jrt_image() {
// for the boot loader to search ahead of the jimage, if the class being
// loaded is defined to a module that has been specified to --patch-module.
void ClassLoader::setup_patch_mod_entries() {
Thread* THREAD = Thread::current();
JavaThread* current = JavaThread::current();
GrowableArray<ModulePatchPath*>* patch_mod_args = Arguments::get_patch_mod_prefix();
int num_of_entries = patch_mod_args->length();
@ -583,7 +583,7 @@ void ClassLoader::setup_patch_mod_entries() {
ModuleClassPathList* module_cpl = new ModuleClassPathList(module_sym);
char* class_path = (patch_mod_args->at(i))->path_string();
ResourceMark rm(THREAD);
ResourceMark rm(current);
ClasspathStream cp_stream(class_path);
while (cp_stream.has_next()) {
@ -591,7 +591,7 @@ void ClassLoader::setup_patch_mod_entries() {
struct stat st;
if (os::stat(path, &st) == 0) {
// File or directory found
ClassPathEntry* new_entry = create_class_path_entry(THREAD, path, &st, false, false);
ClassPathEntry* new_entry = create_class_path_entry(current, path, &st, false, false);
// If the path specification is valid, enter it into this module's list
if (new_entry != NULL) {
module_cpl->add_to_list(new_entry);
@ -623,7 +623,7 @@ bool ClassLoader::is_in_patch_mod_entries(Symbol* module_name) {
}
// Set up the _jrt_entry if present and boot append path
void ClassLoader::setup_bootstrap_search_path_impl(Thread* current, const char *class_path) {
void ClassLoader::setup_bootstrap_search_path_impl(JavaThread* current, const char *class_path) {
ResourceMark rm(current);
ClasspathStream cp_stream(class_path);
bool set_base_piece = true;
@ -675,7 +675,7 @@ void ClassLoader::setup_bootstrap_search_path_impl(Thread* current, const char *
// During an exploded modules build, each module defined to the boot loader
// will be added to the ClassLoader::_exploded_entries array.
void ClassLoader::add_to_exploded_build_list(Thread* current, Symbol* module_sym) {
void ClassLoader::add_to_exploded_build_list(JavaThread* current, Symbol* module_sym) {
assert(!ClassLoader::has_jrt_entry(), "Exploded build not applicable");
assert(_exploded_entries != NULL, "_exploded_entries was not initialized");
@ -718,7 +718,7 @@ jzfile* ClassLoader::open_zip_file(const char* canonical_path, char** error_msg,
return (*ZipOpen)(canonical_path, error_msg);
}
ClassPathEntry* ClassLoader::create_class_path_entry(Thread* current,
ClassPathEntry* ClassLoader::create_class_path_entry(JavaThread* current,
const char *path, const struct stat* st,
bool is_boot_append,
bool from_class_path_attr) {
@ -794,7 +794,7 @@ void ClassLoader::add_to_boot_append_entries(ClassPathEntry *new_entry) {
// Note that at dump time, ClassLoader::_app_classpath_entries are NOT used for
// loading app classes. Instead, the app class are loaded by the
// jdk/internal/loader/ClassLoaders$AppClassLoader instance.
void ClassLoader::add_to_app_classpath_entries(Thread* current,
void ClassLoader::add_to_app_classpath_entries(JavaThread* current,
const char* path,
ClassPathEntry* entry,
bool check_for_duplicates) {
@ -827,7 +827,7 @@ void ClassLoader::add_to_app_classpath_entries(Thread* current,
}
// Returns true IFF the file/dir exists and the entry was successfully created.
bool ClassLoader::update_class_path_entry_list(Thread* current,
bool ClassLoader::update_class_path_entry_list(JavaThread* current,
const char *path,
bool check_for_duplicates,
bool is_boot_append,
@ -1074,7 +1074,7 @@ ClassPathEntry* find_first_module_cpe(ModuleEntry* mod_entry,
// Search either the patch-module or exploded build entries for class.
ClassFileStream* ClassLoader::search_module_entries(Thread* current,
ClassFileStream* ClassLoader::search_module_entries(JavaThread* current,
const GrowableArray<ModuleClassPathList*>* const module_list,
const char* const class_name,
const char* const file_name) {
@ -1130,7 +1130,6 @@ ClassFileStream* ClassLoader::search_module_entries(Thread* current,
// Called by the boot classloader to load classes
InstanceKlass* ClassLoader::load_class(Symbol* name, bool search_append_only, TRAPS) {
assert(name != NULL, "invariant");
assert(THREAD->is_Java_thread(), "must be a JavaThread");
ResourceMark rm(THREAD);
HandleMark hm(THREAD);
@ -1252,7 +1251,7 @@ char* ClassLoader::skip_uri_protocol(char* source) {
// Record the shared classpath index and loader type for classes loaded
// by the builtin loaders at dump time.
void ClassLoader::record_result(Thread* current, InstanceKlass* ik, const ClassFileStream* stream) {
void ClassLoader::record_result(JavaThread* current, InstanceKlass* ik, const ClassFileStream* stream) {
Arguments::assert_is_dumping_archive();
assert(stream != NULL, "sanity");
@ -1434,7 +1433,7 @@ char* ClassLoader::lookup_vm_options() {
}
#if INCLUDE_CDS
void ClassLoader::initialize_shared_path(Thread* current) {
void ClassLoader::initialize_shared_path(JavaThread* current) {
if (Arguments::is_dumping_archive()) {
ClassLoaderExt::setup_search_paths(current);
}
@ -1507,7 +1506,7 @@ void classLoader_init1() {
}
// Complete the ClassPathEntry setup for the boot loader
void ClassLoader::classLoader_init2(Thread* current) {
void ClassLoader::classLoader_init2(JavaThread* current) {
// Setup the list of module/path pairs for --patch-module processing
// This must be done after the SymbolTable is created in order
// to use fast_compare on module names instead of a string compare.
@ -1551,7 +1550,7 @@ char* ClassLoader::get_canonical_path(const char* orig, Thread* thread) {
}
void ClassLoader::create_javabase() {
Thread* THREAD = Thread::current();
JavaThread* current = JavaThread::current();
// Create java.base's module entry for the boot
// class loader prior to loading j.l.Ojbect.
@ -1564,7 +1563,7 @@ void ClassLoader::create_javabase() {
}
{
MutexLocker ml(THREAD, Module_lock);
MutexLocker ml(current, Module_lock);
if (ModuleEntryTable::javabase_moduleEntry() == NULL) { // may have been inited by CDS.
ModuleEntry* jb_module = null_cld_modules->locked_create_entry(Handle(),
false, vmSymbols::java_base(), NULL, NULL, null_cld);

View File

@ -65,9 +65,9 @@ public:
ClassPathEntry() : _next(NULL) {}
// Attempt to locate file_name through this class path entry.
// Returns a class file parsing stream if successfull.
virtual ClassFileStream* open_stream(Thread* current, const char* name) = 0;
virtual ClassFileStream* open_stream(JavaThread* current, const char* name) = 0;
// Open the stream for a specific class loader
virtual ClassFileStream* open_stream_for_loader(Thread* current, const char* name, ClassLoaderData* loader_data) {
virtual ClassFileStream* open_stream_for_loader(JavaThread* current, const char* name, ClassLoaderData* loader_data) {
return open_stream(current, name);
}
};
@ -81,7 +81,7 @@ class ClassPathDirEntry: public ClassPathEntry {
_dir = copy_path(dir);
}
virtual ~ClassPathDirEntry() {}
ClassFileStream* open_stream(Thread* current, const char* name);
ClassFileStream* open_stream(JavaThread* current, const char* name);
};
// Type definitions for zip file and zip file entry
@ -108,8 +108,8 @@ class ClassPathZipEntry: public ClassPathEntry {
const char* name() const { return _zip_name; }
ClassPathZipEntry(jzfile* zip, const char* zip_name, bool is_boot_append, bool from_class_path_attr);
virtual ~ClassPathZipEntry();
u1* open_entry(Thread* current, const char* name, jint* filesize, bool nul_terminate);
ClassFileStream* open_stream(Thread* current, const char* name);
u1* open_entry(JavaThread* current, const char* name, jint* filesize, bool nul_terminate);
ClassFileStream* open_stream(JavaThread* current, const char* name);
void contents_do(void f(const char* name, void* context), void* context);
};
@ -127,8 +127,8 @@ public:
void close_jimage();
ClassPathImageEntry(JImageFile* jimage, const char* name);
virtual ~ClassPathImageEntry() { ShouldNotReachHere(); }
ClassFileStream* open_stream(Thread* current, const char* name);
ClassFileStream* open_stream_for_loader(Thread* current, const char* name, ClassLoaderData* loader_data);
ClassFileStream* open_stream(JavaThread* current, const char* name);
ClassFileStream* open_stream_for_loader(JavaThread* current, const char* name, ClassLoaderData* loader_data);
};
// ModuleClassPathList contains a linked list of ClassPathEntry's
@ -221,9 +221,9 @@ class ClassLoader: AllStatic {
CDS_ONLY(static ClassPathEntry* _last_app_classpath_entry;)
CDS_ONLY(static ClassPathEntry* _module_path_entries;)
CDS_ONLY(static ClassPathEntry* _last_module_path_entry;)
CDS_ONLY(static void setup_app_search_path(Thread* current, const char* class_path);)
CDS_ONLY(static void setup_module_search_path(Thread* current, const char* path);)
static void add_to_app_classpath_entries(Thread* current,
CDS_ONLY(static void setup_app_search_path(JavaThread* current, const char* class_path);)
CDS_ONLY(static void setup_module_search_path(JavaThread* current, const char* path);)
static void add_to_app_classpath_entries(JavaThread* current,
const char* path,
ClassPathEntry* entry,
bool check_for_duplicates);
@ -240,8 +240,8 @@ class ClassLoader: AllStatic {
// - setup the boot loader's system class path
// - setup the boot loader's patch mod entries, if present
// - create the ModuleEntry for java.base
static void setup_bootstrap_search_path(Thread* current);
static void setup_bootstrap_search_path_impl(Thread* current, const char *class_path);
static void setup_bootstrap_search_path(JavaThread* current);
static void setup_bootstrap_search_path_impl(JavaThread* current, const char *class_path);
static void setup_patch_mod_entries();
static void create_javabase();
@ -257,7 +257,7 @@ class ClassLoader: AllStatic {
static jzfile* open_zip_file(const char* canonical_path, char** error_msg, JavaThread* thread);
public:
static ClassPathEntry* create_class_path_entry(Thread* current,
static ClassPathEntry* create_class_path_entry(JavaThread* current,
const char *path, const struct stat* st,
bool is_boot_append,
bool from_class_path_attr);
@ -269,7 +269,7 @@ class ClassLoader: AllStatic {
int class_name_len);
static PackageEntry* get_package_entry(Symbol* pkg_name, ClassLoaderData* loader_data);
static int crc32(int crc, const char* buf, int len);
static bool update_class_path_entry_list(Thread* current,
static bool update_class_path_entry_list(JavaThread* current,
const char *path,
bool check_for_duplicates,
bool is_boot_append,
@ -310,10 +310,10 @@ class ClassLoader: AllStatic {
static void close_jrt_image();
// Add a module's exploded directory to the boot loader's exploded module build list
static void add_to_exploded_build_list(Thread* current, Symbol* module_name);
static void add_to_exploded_build_list(JavaThread* current, Symbol* module_name);
// Attempt load of individual class from either the patched or exploded modules build lists
static ClassFileStream* search_module_entries(Thread* current,
static ClassFileStream* search_module_entries(JavaThread* current,
const GrowableArray<ModuleClassPathList*>* const module_list,
const char* const class_name,
const char* const file_name);
@ -337,8 +337,8 @@ class ClassLoader: AllStatic {
// Initialization
static void initialize(TRAPS);
static void classLoader_init2(Thread* current);
CDS_ONLY(static void initialize_shared_path(Thread* current);)
static void classLoader_init2(JavaThread* current);
CDS_ONLY(static void initialize_shared_path(JavaThread* current);)
CDS_ONLY(static void initialize_module_path(TRAPS);)
static int compute_Object_vtable();
@ -365,7 +365,7 @@ class ClassLoader: AllStatic {
static int num_module_path_entries();
static void exit_with_path_failure(const char* error, const char* message);
static char* skip_uri_protocol(char* source);
static void record_result(Thread* current, InstanceKlass* ik, const ClassFileStream* stream);
static void record_result(JavaThread* current, InstanceKlass* ik, const ClassFileStream* stream);
#endif
static char* lookup_vm_options();

View File

@ -103,8 +103,7 @@ void ClassLoaderData::init_null_class_loader_data() {
// and klass are available after the class_loader oop is no longer alive,
// during unloading.
void ClassLoaderData::initialize_name(Handle class_loader) {
Thread* THREAD = Thread::current();
ResourceMark rm(THREAD);
ResourceMark rm;
// Obtain the class loader's name. If the class loader's name was not
// explicitly set during construction, the CLD's _name field will be null.

View File

@ -65,7 +65,7 @@ void ClassLoaderExt::append_boot_classpath(ClassPathEntry* new_entry) {
ClassLoader::add_to_boot_append_entries(new_entry);
}
void ClassLoaderExt::setup_app_search_path(Thread* current) {
void ClassLoaderExt::setup_app_search_path(JavaThread* current) {
Arguments::assert_is_dumping_archive();
_app_class_paths_start_index = ClassLoader::num_boot_classpath_entries();
char* app_class_path = os::strdup(Arguments::get_appclasspath());
@ -81,7 +81,7 @@ void ClassLoaderExt::setup_app_search_path(Thread* current) {
}
}
void ClassLoaderExt::process_module_table(Thread* current, ModuleEntryTable* met) {
void ClassLoaderExt::process_module_table(JavaThread* current, ModuleEntryTable* met) {
ResourceMark rm(current);
for (int i = 0; i < met->table_size(); i++) {
for (ModuleEntry* m = met->bucket(i); m != NULL;) {
@ -94,7 +94,7 @@ void ClassLoaderExt::process_module_table(Thread* current, ModuleEntryTable* met
}
}
}
void ClassLoaderExt::setup_module_paths(Thread* current) {
void ClassLoaderExt::setup_module_paths(JavaThread* current) {
Arguments::assert_is_dumping_archive();
_app_module_paths_start_index = ClassLoader::num_boot_classpath_entries() +
ClassLoader::num_app_classpath_entries();
@ -103,7 +103,8 @@ void ClassLoaderExt::setup_module_paths(Thread* current) {
process_module_table(current, met);
}
char* ClassLoaderExt::read_manifest(Thread* current, ClassPathEntry* entry, jint *manifest_size, bool clean_text) {
char* ClassLoaderExt::read_manifest(JavaThread* current, ClassPathEntry* entry,
jint *manifest_size, bool clean_text) {
const char* name = "META-INF/MANIFEST.MF";
char* manifest;
jint size;
@ -163,7 +164,7 @@ char* ClassLoaderExt::get_class_path_attr(const char* jar_path, char* manifest,
return found;
}
void ClassLoaderExt::process_jar_manifest(Thread* current, ClassPathEntry* entry,
void ClassLoaderExt::process_jar_manifest(JavaThread* current, ClassPathEntry* entry,
bool check_for_duplicates) {
ResourceMark rm(current);
jint manifest_size;
@ -225,7 +226,7 @@ void ClassLoaderExt::process_jar_manifest(Thread* current, ClassPathEntry* entry
}
}
void ClassLoaderExt::setup_search_paths(Thread* current) {
void ClassLoaderExt::setup_search_paths(JavaThread* current) {
ClassLoaderExt::setup_app_search_path(current);
}
@ -270,7 +271,7 @@ InstanceKlass* ClassLoaderExt::load_class(Symbol* name, const char* path, TRAPS)
{
PerfClassTraceTime vmtimer(perf_sys_class_lookup_time(),
THREAD->as_Java_thread()->get_thread_stat()->perf_timers_addr(),
THREAD->get_thread_stat()->perf_timers_addr(),
PerfClassTraceTime::CLASS_LOAD);
stream = e->open_stream(THREAD, file_name);
}
@ -300,7 +301,7 @@ struct CachedClassPathEntry {
static GrowableArray<CachedClassPathEntry>* cached_path_entries = NULL;
ClassPathEntry* ClassLoaderExt::find_classpath_entry_from_cache(Thread* current, const char* path) {
ClassPathEntry* ClassLoaderExt::find_classpath_entry_from_cache(JavaThread* current, const char* path) {
// This is called from dump time so it's single threaded and there's no need for a lock.
assert(DumpSharedSpaces, "this function is only used with -Xshare:dump");
if (cached_path_entries == NULL) {

View File

@ -45,8 +45,8 @@ private:
};
static char* get_class_path_attr(const char* jar_path, char* manifest, jint manifest_size);
static void setup_app_search_path(Thread* current); // Only when -Xshare:dump
static void process_module_table(Thread* current, ModuleEntryTable* met);
static void setup_app_search_path(JavaThread* current); // Only when -Xshare:dump
static void process_module_table(JavaThread* current, ModuleEntryTable* met);
// index of first app JAR in shared classpath entry table
static jshort _app_class_paths_start_index;
// index of first modular JAR in shared modulepath entry table
@ -57,25 +57,25 @@ private:
static bool _has_app_classes;
static bool _has_platform_classes;
static char* read_manifest(Thread* current, ClassPathEntry* entry, jint *manifest_size, bool clean_text);
static ClassPathEntry* find_classpath_entry_from_cache(Thread* current, const char* path);
static char* read_manifest(JavaThread* current, ClassPathEntry* entry, jint *manifest_size, bool clean_text);
static ClassPathEntry* find_classpath_entry_from_cache(JavaThread* current, const char* path);
public:
static void process_jar_manifest(Thread* current, ClassPathEntry* entry, bool check_for_duplicates);
static void process_jar_manifest(JavaThread* current, ClassPathEntry* entry, bool check_for_duplicates);
// Called by JVMTI code to add boot classpath
static void append_boot_classpath(ClassPathEntry* new_entry);
static void setup_search_paths(Thread* current);
static void setup_module_paths(Thread* current);
static void setup_search_paths(JavaThread* current);
static void setup_module_paths(JavaThread* current);
static char* read_manifest(Thread* current, ClassPathEntry* entry, jint *manifest_size) {
static char* read_manifest(JavaThread* current, ClassPathEntry* entry, jint *manifest_size) {
// Remove all the new-line continuations (which wrap long lines at 72 characters, see
// http://docs.oracle.com/javase/6/docs/technotes/guides/jar/jar.html#JAR%20Manifest), so
// that the manifest is easier to parse.
return read_manifest(current, entry, manifest_size, true);
}
static char* read_raw_manifest(Thread* current, ClassPathEntry* entry, jint *manifest_size) {
static char* read_raw_manifest(JavaThread* current, ClassPathEntry* entry, jint *manifest_size) {
// Do not remove new-line continuations, so we can easily pass it as an argument to
// java.util.jar.Manifest.getManifest() at run-time.
return read_manifest(current, entry, manifest_size, false);

View File

@ -430,7 +430,7 @@ Handle java_lang_String::create_from_platform_dependent_str(const char* str, TRA
jstring js = NULL;
{
JavaThread* thread = THREAD->as_Java_thread();
JavaThread* thread = THREAD;
HandleMark hm(thread);
ThreadToNativeFromVM ttn(thread);
js = (_to_java_string_fn)(thread->jni_environment(), str);
@ -456,7 +456,7 @@ char* java_lang_String::as_platform_dependent_str(Handle java_string, TRAPS) {
}
char *native_platform_string;
{ JavaThread* thread = THREAD->as_Java_thread();
{ JavaThread* thread = THREAD;
jstring js = (jstring) JNIHandles::make_local(thread, java_string());
bool is_copy;
HandleMark hm(thread);
@ -536,6 +536,14 @@ Handle java_lang_String::char_converter(Handle java_string, jchar from_char, jch
}
jchar* java_lang_String::as_unicode_string(oop java_string, int& length, TRAPS) {
jchar* result = as_unicode_string_or_null(java_string, length);
if (result == NULL) {
THROW_MSG_0(vmSymbols::java_lang_OutOfMemoryError(), "could not allocate Unicode string");
}
return result;
}
jchar* java_lang_String::as_unicode_string_or_null(oop java_string, int& length) {
typeArrayOop value = java_lang_String::value(java_string);
length = java_lang_String::length(java_string, value);
bool is_latin1 = java_lang_String::is_latin1(java_string);
@ -551,8 +559,6 @@ jchar* java_lang_String::as_unicode_string(oop java_string, int& length, TRAPS)
result[index] = ((jchar) value->byte_at(index)) & 0xff;
}
}
} else {
THROW_MSG_0(vmSymbols::java_lang_OutOfMemoryError(), "could not allocate Unicode string");
}
return result;
}
@ -1102,7 +1108,7 @@ void java_lang_Class::create_mirror(Klass* k, Handle class_loader,
// Set the module field in the java_lang_Class instance. This must be done
// after the mirror is set.
set_mirror_module_field(THREAD->as_Java_thread(), k, mirror, module);
set_mirror_module_field(THREAD, k, mirror, module);
if (comp_mirror() != NULL) {
// Set after k->java_mirror() is published, because compiled code running
@ -1409,7 +1415,7 @@ bool java_lang_Class::restore_archived_mirror(Klass *k,
k->set_java_mirror(mirror);
set_mirror_module_field(THREAD->as_Java_thread(), k, mirror, module);
set_mirror_module_field(THREAD, k, mirror, module);
if (log_is_enabled(Trace, cds, heap, mirror)) {
ResourceMark rm(THREAD);
@ -2418,7 +2424,7 @@ void java_lang_Throwable::print_stack_trace(Handle throwable, outputStream* st)
st->cr();
// Now print the stack trace.
Thread* THREAD = Thread::current();
JavaThread* THREAD = JavaThread::current(); // For exception macros.
while (throwable.not_null()) {
objArrayHandle result (THREAD, objArrayOop(backtrace(throwable())));
if (result.is_null()) {
@ -2483,7 +2489,7 @@ void java_lang_Throwable::fill_in_stack_trace(Handle throwable, const methodHand
clear_stacktrace(throwable());
int max_depth = MaxJavaStackTraceDepth;
JavaThread* thread = THREAD->as_Java_thread();
JavaThread* thread = THREAD;
BacktraceBuilder bt(CHECK);
@ -2619,7 +2625,7 @@ void java_lang_Throwable::fill_in_stack_trace(Handle throwable, const methodHand
return;
}
JavaThread* THREAD = JavaThread::current();
JavaThread* THREAD = JavaThread::current(); // For exception macros.
PreserveExceptionMark pm(THREAD);
fill_in_stack_trace(throwable, method, THREAD);
@ -2646,7 +2652,7 @@ void java_lang_Throwable::fill_in_stack_trace_of_preallocated_backtrace(Handle t
assert(throwable->is_a(vmClasses::Throwable_klass()), "sanity check");
JavaThread* THREAD = JavaThread::current();
JavaThread* THREAD = JavaThread::current(); // For exception macros.
objArrayHandle backtrace (THREAD, (objArrayOop)java_lang_Throwable::backtrace(throwable()));
assert(backtrace.not_null(), "backtrace should have been preallocated");
@ -2714,9 +2720,9 @@ void java_lang_Throwable::get_stack_trace_elements(Handle throwable,
}
bool java_lang_Throwable::get_top_method_and_bci(oop throwable, Method** method, int* bci) {
Thread* THREAD = Thread::current();
objArrayHandle result(THREAD, objArrayOop(backtrace(throwable)));
BacktraceIterator iter(result, THREAD);
JavaThread* current = JavaThread::current();
objArrayHandle result(current, objArrayOop(backtrace(throwable)));
BacktraceIterator iter(result, current);
// No backtrace available.
if (!iter.repeat()) return false;
@ -2728,7 +2734,7 @@ bool java_lang_Throwable::get_top_method_and_bci(oop throwable, Method** method,
}
// Get first backtrace element.
BacktraceElement bte = iter.next(THREAD);
BacktraceElement bte = iter.next(current);
InstanceKlass* holder = InstanceKlass::cast(java_lang_Class::as_Klass(bte._mirror()));
assert(holder != NULL, "first element should be non-null");

View File

@ -191,6 +191,7 @@ class java_lang_String : AllStatic {
static char* as_utf8_string(oop java_string, typeArrayOop value, int start, int len, char* buf, int buflen);
static char* as_platform_dependent_str(Handle java_string, TRAPS);
static jchar* as_unicode_string(oop java_string, int& length, TRAPS);
static jchar* as_unicode_string_or_null(oop java_string, int& length);
// produce an ascii string with all other values quoted using \u####
static char* as_quoted_ascii(oop java_string);

View File

@ -54,7 +54,6 @@ InstanceKlass* KlassFactory::check_shared_class_file_load_hook(
assert(ik != NULL, "sanity");
assert(ik->is_shared(), "expecting a shared class");
if (JvmtiExport::should_post_class_file_load_hook()) {
assert(THREAD->is_Java_thread(), "must be JavaThread");
// Post the CFLH
JvmtiCachedClassFileData* cached_class_file = NULL;
@ -119,7 +118,7 @@ static ClassFileStream* check_class_file_load_hook(ClassFileStream* stream,
assert(stream != NULL, "invariant");
if (JvmtiExport::should_post_class_file_load_hook()) {
const JavaThread* jt = THREAD->as_Java_thread();
const JavaThread* jt = THREAD;
Handle class_loader(THREAD, loader_data->class_loader());
@ -171,7 +170,6 @@ InstanceKlass* KlassFactory::create_from_stream(ClassFileStream* stream,
TRAPS) {
assert(stream != NULL, "invariant");
assert(loader_data != NULL, "invariant");
assert(THREAD->is_Java_thread(), "must be a JavaThread");
ResourceMark rm(THREAD);
HandleMark hm(THREAD);

View File

@ -105,17 +105,16 @@ class StringTableConfig : public StackObj {
typedef WeakHandle Value;
static uintx get_hash(Value const& value, bool* is_dead) {
EXCEPTION_MARK;
oop val_oop = value.peek();
if (val_oop == NULL) {
*is_dead = true;
return 0;
}
*is_dead = false;
ResourceMark rm(THREAD);
ResourceMark rm;
// All String oops are hashed as unicode
int length;
jchar* chars = java_lang_String::as_unicode_string(val_oop, length, THREAD);
jchar* chars = java_lang_String::as_unicode_string_or_null(val_oop, length);
if (chars != NULL) {
return hash_string(chars, length, _alt_hash);
}

View File

@ -472,17 +472,17 @@ Symbol* SymbolTable::do_add_if_needed(const char* name, int len, uintx hash, boo
bool clean_hint = false;
bool rehash_warning = false;
Symbol* sym = NULL;
Thread* THREAD = Thread::current();
Thread* current = Thread::current();
do {
// Callers have looked up the symbol once, insert the symbol.
sym = allocate_symbol(name, len, heap);
if (_local_table->insert(THREAD, lookup, sym, &rehash_warning, &clean_hint)) {
if (_local_table->insert(current, lookup, sym, &rehash_warning, &clean_hint)) {
break;
}
// In case another thread did a concurrent add, return value already in the table.
// This could fail if the symbol got deleted concurrently, so loop back until success.
if (_local_table->get(THREAD, lookup, stg, &rehash_warning)) {
if (_local_table->get(current, lookup, stg, &rehash_warning)) {
sym = stg.get_res_sym();
break;
}

View File

@ -619,7 +619,7 @@ InstanceKlass* SystemDictionary::resolve_instance_class_or_null(Symbol* name,
// ParallelCapable class loaders and the bootstrap classloader
// do not acquire lock here.
Handle lockObject = get_loader_lock_or_null(class_loader);
ObjectLocker ol(lockObject, THREAD->as_Java_thread());
ObjectLocker ol(lockObject, THREAD);
bool super_load_in_progress = false;
InstanceKlass* loaded_class = NULL;
@ -682,7 +682,7 @@ InstanceKlass* SystemDictionary::resolve_instance_class_or_null(Symbol* name,
{
MutexLocker mu(THREAD, SystemDictionary_lock);
if (should_wait_for_loading(class_loader)) {
loaded_class = handle_parallel_loading(THREAD->as_Java_thread(),
loaded_class = handle_parallel_loading(THREAD,
name_hash,
name,
loader_data,
@ -864,7 +864,7 @@ InstanceKlass* SystemDictionary::resolve_hidden_class_from_stream(
// notify jvmti
if (JvmtiExport::should_post_class_load()) {
JvmtiExport::post_class_load(THREAD->as_Java_thread(), k);
JvmtiExport::post_class_load(THREAD, k);
}
if (class_load_start_event.should_commit()) {
post_class_load_event(&class_load_start_event, k, loader_data);
@ -893,7 +893,7 @@ InstanceKlass* SystemDictionary::resolve_class_from_stream(
// Classloaders that support parallelism, e.g. bootstrap classloader,
// do not acquire lock here
Handle lockObject = get_loader_lock_or_null(class_loader);
ObjectLocker ol(lockObject, THREAD->as_Java_thread());
ObjectLocker ol(lockObject, THREAD);
// Parse the stream and create a klass.
// Note that we do this even though this klass might
@ -1191,7 +1191,7 @@ InstanceKlass* SystemDictionary::load_shared_class(InstanceKlass* ik,
{
HandleMark hm(THREAD);
Handle lockObject = get_loader_lock_or_null(class_loader);
ObjectLocker ol(lockObject, THREAD->as_Java_thread());
ObjectLocker ol(lockObject, THREAD);
// prohibited package check assumes all classes loaded from archive call
// restore_unshareable_info which calls ik->set_package()
ik->restore_unshareable_info(loader_data, protection_domain, pkg_entry, CHECK_NULL);
@ -1308,7 +1308,7 @@ InstanceKlass* SystemDictionary::load_instance_class_impl(Symbol* class_name, Ha
// Use user specified class loader to load class. Call loadClass operation on class_loader.
ResourceMark rm(THREAD);
JavaThread* jt = THREAD->as_Java_thread();
JavaThread* jt = THREAD;
PerfClassTraceTime vmtimer(ClassLoader::perf_app_classload_time(),
ClassLoader::perf_app_classload_selftime(),
@ -1385,7 +1385,7 @@ InstanceKlass* SystemDictionary::load_instance_class(unsigned int name_hash,
}
if (JvmtiExport::should_post_class_load()) {
JvmtiExport::post_class_load(THREAD->as_Java_thread(), loaded_class);
JvmtiExport::post_class_load(THREAD, loaded_class);
}
}
return loaded_class;
@ -1411,7 +1411,7 @@ void SystemDictionary::define_instance_class(InstanceKlass* k, Handle class_load
// find_or_define_instance_class to get here, we have a timing
// hole with systemDictionary updates and check_constraints
if (!is_parallelCapable(class_loader)) {
assert(ObjectSynchronizer::current_thread_holds_lock(THREAD->as_Java_thread(),
assert(ObjectSynchronizer::current_thread_holds_lock(THREAD,
get_loader_lock_or_null(class_loader)),
"define called without lock");
}
@ -1458,7 +1458,7 @@ void SystemDictionary::define_instance_class(InstanceKlass* k, Handle class_load
// notify jvmti
if (JvmtiExport::should_post_class_load()) {
JvmtiExport::post_class_load(THREAD->as_Java_thread(), k);
JvmtiExport::post_class_load(THREAD, k);
}
post_class_define_event(k, loader_data);
}

View File

@ -1715,7 +1715,7 @@ InstanceKlass* SystemDictionaryShared::prepare_shared_lambda_proxy_class(Instanc
loaded_lambda->link_class(CHECK_NULL);
// notify jvmti
if (JvmtiExport::should_post_class_load()) {
JvmtiExport::post_class_load(THREAD->as_Java_thread(), loaded_lambda);
JvmtiExport::post_class_load(THREAD, loaded_lambda);
}
if (class_load_start_event.should_commit()) {
SystemDictionary::post_class_load_event(&class_load_start_event, loaded_lambda, ClassLoaderData::class_loader_data(class_loader()));

View File

@ -175,7 +175,7 @@ bool Verifier::verify(InstanceKlass* klass, bool should_verify_class, TRAPS) {
// Timer includes any side effects of class verification (resolution,
// etc), but not recursive calls to Verifier::verify().
JavaThread* jt = THREAD->as_Java_thread();
JavaThread* jt = THREAD;
PerfClassTraceTime timer(ClassLoader::perf_class_verify_time(),
ClassLoader::perf_class_verify_selftime(),
ClassLoader::perf_classes_verified(),
@ -301,7 +301,7 @@ bool Verifier::is_eligible_for_verification(InstanceKlass* klass, bool should_ve
Symbol* Verifier::inference_verify(
InstanceKlass* klass, char* message, size_t message_len, TRAPS) {
JavaThread* thread = THREAD->as_Java_thread();
JavaThread* thread = THREAD;
verify_byte_codes_fn_t verify_func = verify_byte_codes_fn();

View File

@ -703,7 +703,7 @@ nmethod* CompilationPolicy::event(const methodHandle& method, const methodHandle
if (comp_level == CompLevel_none &&
JvmtiExport::can_post_interpreter_events() &&
THREAD->as_Java_thread()->is_interp_only_mode()) {
THREAD->is_interp_only_mode()) {
return NULL;
}
if (ReplayCompiles) {
@ -753,7 +753,7 @@ void CompilationPolicy::compile(const methodHandle& mh, int bci, CompLevel level
mh->code()->make_not_used();
}
// Deoptimize immediately (we don't have to wait for a compile).
JavaThread* jt = THREAD->as_Java_thread();
JavaThread* jt = THREAD;
RegisterMap map(jt, false);
frame fr = jt->last_frame().sender(&map);
Deoptimization::deoptimize_frame(jt, fr.id());
@ -928,7 +928,7 @@ bool CompilationPolicy::should_not_inline(ciEnv* env, ciMethod* callee) {
}
// Create MDO if necessary.
void CompilationPolicy::create_mdo(const methodHandle& mh, Thread* THREAD) {
void CompilationPolicy::create_mdo(const methodHandle& mh, JavaThread* THREAD) {
if (mh->is_native() ||
mh->is_abstract() ||
mh->is_accessor() ||
@ -941,8 +941,7 @@ void CompilationPolicy::create_mdo(const methodHandle& mh, Thread* THREAD) {
if (ProfileInterpreter) {
MethodData* mdo = mh->method_data();
if (mdo != NULL) {
JavaThread* jt = THREAD->as_Java_thread();
frame last_frame = jt->last_frame();
frame last_frame = THREAD->last_frame();
if (last_frame.is_interpreted_frame() && mh == last_frame.interpreter_frame_method()) {
int bci = last_frame.interpreter_frame_bci();
address dp = mdo->bci_to_dp(bci);

View File

@ -206,7 +206,7 @@ class CompilationPolicy : AllStatic {
// determines whether we should do that.
inline static bool should_create_mdo(const methodHandle& method, CompLevel cur_level);
// Create MDO if necessary.
static void create_mdo(const methodHandle& mh, Thread* thread);
static void create_mdo(const methodHandle& mh, JavaThread* THREAD);
// Is method profiled enough?
static bool is_method_profiled(const methodHandle& method);

View File

@ -627,7 +627,7 @@ void register_jfr_phasetype_serializer(CompilerType compiler_type) {
// CompileBroker::compilation_init
//
// Initialize the Compilation object
void CompileBroker::compilation_init_phase1(Thread* THREAD) {
void CompileBroker::compilation_init_phase1(JavaThread* THREAD) {
// No need to initialize compilation system if we do not use it.
if (!UseCompiler) {
return;
@ -873,7 +873,7 @@ void DeoptimizeObjectsALotThread::deoptimize_objects_alot_loop_all() {
#endif // defined(ASSERT) && COMPILER2_OR_JVMCI
JavaThread* CompileBroker::make_thread(ThreadType type, jobject thread_handle, CompileQueue* queue, AbstractCompiler* comp, Thread* THREAD) {
JavaThread* CompileBroker::make_thread(ThreadType type, jobject thread_handle, CompileQueue* queue, AbstractCompiler* comp, JavaThread* THREAD) {
JavaThread* new_thread = NULL;
{
MutexLocker mu(THREAD, Threads_lock);
@ -1060,7 +1060,7 @@ void CompileBroker::init_compiler_sweeper_threads() {
#endif // defined(ASSERT) && COMPILER2_OR_JVMCI
}
void CompileBroker::possibly_add_compiler_threads(Thread* THREAD) {
void CompileBroker::possibly_add_compiler_threads(JavaThread* THREAD) {
julong available_memory = os::available_memory();
// If SegmentedCodeCache is off, both values refer to the single heap (with type CodeBlobType::All).

View File

@ -235,9 +235,9 @@ class CompileBroker: AllStatic {
};
static Handle create_thread_oop(const char* name, TRAPS);
static JavaThread* make_thread(ThreadType type, jobject thread_oop, CompileQueue* queue, AbstractCompiler* comp, Thread* THREAD);
static JavaThread* make_thread(ThreadType type, jobject thread_oop, CompileQueue* queue, AbstractCompiler* comp, JavaThread* THREAD);
static void init_compiler_sweeper_threads();
static void possibly_add_compiler_threads(Thread* THREAD);
static void possibly_add_compiler_threads(JavaThread* THREAD);
static bool compilation_is_prohibited(const methodHandle& method, int osr_bci, int comp_level, bool excluded);
static CompileTask* create_compile_task(CompileQueue* queue,
@ -295,7 +295,7 @@ public:
CompileQueue *q = compile_queue(comp_level);
return q != NULL ? q->size() : 0;
}
static void compilation_init_phase1(Thread* THREAD);
static void compilation_init_phase1(JavaThread* THREAD);
static void compilation_init_phase2();
static void init_compiler_thread_log();
static nmethod* compile_method(const methodHandle& method,

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2021, 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
@ -31,7 +31,7 @@
#include "jfr/support/jfrAllocationTracer.hpp"
#endif
void AllocTracer::send_allocation_outside_tlab(Klass* klass, HeapWord* obj, size_t alloc_size, Thread* thread) {
void AllocTracer::send_allocation_outside_tlab(Klass* klass, HeapWord* obj, size_t alloc_size, JavaThread* thread) {
JFR_ONLY(JfrAllocationTracer tracer(klass, obj, alloc_size, true, thread);)
EventObjectAllocationOutsideTLAB event;
if (event.should_commit()) {
@ -41,7 +41,7 @@ void AllocTracer::send_allocation_outside_tlab(Klass* klass, HeapWord* obj, size
}
}
void AllocTracer::send_allocation_in_new_tlab(Klass* klass, HeapWord* obj, size_t tlab_size, size_t alloc_size, Thread* thread) {
void AllocTracer::send_allocation_in_new_tlab(Klass* klass, HeapWord* obj, size_t tlab_size, size_t alloc_size, JavaThread* thread) {
JFR_ONLY(JfrAllocationTracer tracer(klass, obj, alloc_size, false, thread);)
EventObjectAllocationInNewTLAB event;
if (event.should_commit()) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2021, 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
@ -30,8 +30,8 @@
class AllocTracer : AllStatic {
public:
static void send_allocation_outside_tlab(Klass* klass, HeapWord* obj, size_t alloc_size, Thread* thread);
static void send_allocation_in_new_tlab(Klass* klass, HeapWord* obj, size_t tlab_size, size_t alloc_size, Thread* thread);
static void send_allocation_outside_tlab(Klass* klass, HeapWord* obj, size_t alloc_size, JavaThread* thread);
static void send_allocation_in_new_tlab(Klass* klass, HeapWord* obj, size_t tlab_size, size_t alloc_size, JavaThread* thread);
static void send_allocation_requiring_gc_event(size_t size, uint gcId);
};

View File

@ -44,7 +44,7 @@ class MemAllocator::Allocation: StackObj {
friend class MemAllocator;
const MemAllocator& _allocator;
Thread* _thread;
JavaThread* _thread;
oop* _obj_ptr;
bool _overhead_limit_exceeded;
bool _allocated_outside_tlab;
@ -69,7 +69,7 @@ class MemAllocator::Allocation: StackObj {
public:
Allocation(const MemAllocator& allocator, oop* obj_ptr)
: _allocator(allocator),
_thread(Thread::current()),
_thread(JavaThread::current()),
_obj_ptr(obj_ptr),
_overhead_limit_exceeded(false),
_allocated_outside_tlab(false),
@ -95,7 +95,7 @@ class MemAllocator::Allocation::PreserveObj: StackObj {
oop* const _obj_ptr;
public:
PreserveObj(Thread* thread, oop* obj_ptr)
PreserveObj(JavaThread* thread, oop* obj_ptr)
: _handle_mark(thread),
_handle(thread, *obj_ptr),
_obj_ptr(obj_ptr)
@ -113,7 +113,7 @@ public:
};
bool MemAllocator::Allocation::check_out_of_memory() {
Thread* THREAD = _thread;
JavaThread* THREAD = _thread; // For exception macros.
assert(!HAS_PENDING_EXCEPTION, "Unexpected exception, will result in uninitialized storage");
if (obj() != NULL) {
@ -121,7 +121,7 @@ bool MemAllocator::Allocation::check_out_of_memory() {
}
const char* message = _overhead_limit_exceeded ? "GC overhead limit exceeded" : "Java heap space";
if (!THREAD->in_retryable_allocation()) {
if (!_thread->in_retryable_allocation()) {
// -XX:+HeapDumpOnOutOfMemoryError and -XX:OnOutOfMemoryError support
report_java_out_of_memory(message);
@ -142,7 +142,7 @@ bool MemAllocator::Allocation::check_out_of_memory() {
void MemAllocator::Allocation::verify_before() {
// Clear unhandled oops for memory allocation. Memory allocation might
// not take out a lock if from tlab, so clear here.
Thread* THREAD = _thread;
JavaThread* THREAD = _thread; // For exception macros.
assert(!HAS_PENDING_EXCEPTION, "Should not allocate with exception pending");
debug_only(check_for_valid_allocation_state());
assert(!Universe::heap()->is_gc_active(), "Allocation during gc not allowed");
@ -172,7 +172,6 @@ void MemAllocator::Allocation::check_for_valid_allocation_state() const {
assert(!_thread->has_pending_exception(),
"shouldn't be allocating with pending exception");
// Allocation of an oop can always invoke a safepoint.
assert(_thread->is_Java_thread(), "non Java threads shouldn't allocate on the Heap");
_thread->as_Java_thread()->check_for_valid_safepoint_state();
}
#endif

View File

@ -316,7 +316,7 @@ void InterpreterRuntime::note_trap_inner(JavaThread* current, int reason,
MethodData* trap_mdo = trap_method->method_data();
if (trap_mdo == NULL) {
ExceptionMark em(current);
JavaThread* THREAD = current; // for exception macros
JavaThread* THREAD = current; // For exception macros.
Method::build_interpreter_method_data(trap_method, THREAD);
if (HAS_PENDING_EXCEPTION) {
// Only metaspace OOM is expected. No Java code executed.
@ -655,7 +655,7 @@ void InterpreterRuntime::resolve_get_put(JavaThread* current, Bytecodes::Code by
{
JvmtiHideSingleStepping jhss(current);
Thread* THREAD = current; // for exception macros
JavaThread* THREAD = current; // For exception macros.
LinkResolver::resolve_field_access(info, pool, last_frame.get_index_u2_cpcache(bytecode),
m, bytecode, CHECK);
} // end JvmtiHideSingleStepping
@ -826,7 +826,7 @@ void InterpreterRuntime::resolve_invoke(JavaThread* current, Bytecodes::Code byt
{
JvmtiHideSingleStepping jhss(current);
Thread* THREAD = current; // for exception macros
JavaThread* THREAD = current; // For exception macros.
LinkResolver::resolve_invoke(info, receiver, pool,
last_frame.get_index_u2_cpcache(bytecode), bytecode,
CHECK);
@ -906,7 +906,7 @@ void InterpreterRuntime::resolve_invokehandle(JavaThread* current) {
constantPoolHandle pool(current, last_frame.method()->constants());
{
JvmtiHideSingleStepping jhss(current);
Thread* THREAD = current; // for exception macros
JavaThread* THREAD = current; // For exception macros.
LinkResolver::resolve_invoke(info, Handle(), pool,
last_frame.get_index_u2_cpcache(bytecode), bytecode,
CHECK);
@ -927,7 +927,7 @@ void InterpreterRuntime::resolve_invokedynamic(JavaThread* current) {
int index = last_frame.get_index_u4(bytecode);
{
JvmtiHideSingleStepping jhss(current);
Thread* THREAD = current; // for exception macros
JavaThread* THREAD = current; // For exception macros.
LinkResolver::resolve_invoke(info, Handle(), pool,
index, bytecode, CHECK);
} // end JvmtiHideSingleStepping

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2021, 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
@ -61,7 +61,7 @@
// push_jni_handle_block
//
// Push on a new block of JNI handles.
static void push_jni_handle_block(Thread* const thread) {
static void push_jni_handle_block(JavaThread* const thread) {
DEBUG_ONLY(JfrJavaSupport::check_java_thread_in_vm(thread));
// Allocate a new block for JNI handles.
@ -77,7 +77,7 @@ static void push_jni_handle_block(Thread* const thread) {
// pop_jni_handle_block
//
// Pop off the current block of JNI handles.
static void pop_jni_handle_block(Thread* const thread) {
static void pop_jni_handle_block(JavaThread* const thread) {
DEBUG_ONLY(JfrJavaSupport::check_java_thread_in_vm(thread));
// Release our JNI handle block
@ -91,9 +91,9 @@ static void pop_jni_handle_block(Thread* const thread) {
class JNIHandleBlockManager : public StackObj {
private:
Thread* const _thread;
JavaThread* const _thread;
public:
JNIHandleBlockManager(Thread* thread) : _thread(thread) {
JNIHandleBlockManager(JavaThread* thread) : _thread(thread) {
push_jni_handle_block(_thread);
}
@ -731,4 +731,3 @@ bool register_jfr_dcmds() {
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<JfrConfigureFlightRecorderDCmd>(full_export, true, false));
return true;
}

View File

@ -1397,7 +1397,7 @@ static bool should_force_instrumentation() {
return !JfrOptionSet::allow_event_retransforms() || JfrEventClassTransformer::is_force_instrumentation();
}
static ClassFileStream* create_new_bytes_for_subklass(const InstanceKlass* ik, const ClassFileParser& parser, Thread* t) {
static ClassFileStream* create_new_bytes_for_subklass(const InstanceKlass* ik, const ClassFileParser& parser, JavaThread* t) {
assert(JdkJfrEvent::is_a(ik), "invariant");
DEBUG_ONLY(JfrJavaSupport::check_java_thread_in_vm(t));
jint size_of_new_bytes = 0;

View File

@ -98,7 +98,7 @@ extern "C" void JNICALL jfr_on_class_file_load_hook(jvmtiEnv *jvmti_env,
static jclass* create_classes_array(jint classes_count, TRAPS) {
assert(classes_count > 0, "invariant");
DEBUG_ONLY(JfrJavaSupport::check_java_thread_in_native(THREAD));
ThreadInVMfromNative tvmfn(THREAD->as_Java_thread());
ThreadInVMfromNative tvmfn(THREAD);
jclass* const classes = NEW_RESOURCE_ARRAY_IN_THREAD_RETURN_NULL(THREAD, jclass, classes_count);
if (NULL == classes) {
char error_buffer[ERROR_MSG_BUFFER_SIZE];
@ -115,7 +115,7 @@ static jclass* create_classes_array(jint classes_count, TRAPS) {
static void log_and_throw(jvmtiError error, TRAPS) {
if (!HAS_PENDING_EXCEPTION) {
DEBUG_ONLY(JfrJavaSupport::check_java_thread_in_native(THREAD));
ThreadInVMfromNative tvmfn(THREAD->as_Java_thread());
ThreadInVMfromNative tvmfn(THREAD);
const char base_error_msg[] = "JfrJvmtiAgent::retransformClasses failed: ";
size_t length = sizeof base_error_msg; // includes terminating null
const char* const jvmti_error_name = JvmtiUtil::error_name(error);
@ -136,7 +136,7 @@ static void check_exception_and_log(JNIEnv* env, TRAPS) {
if (env->ExceptionOccurred()) {
// array index out of bound
DEBUG_ONLY(JfrJavaSupport::check_java_thread_in_native(THREAD));
ThreadInVMfromNative tvmfn(THREAD->as_Java_thread());
ThreadInVMfromNative tvmfn(THREAD);
log_error(jfr, system)("GetObjectArrayElement threw an exception");
return;
}
@ -165,7 +165,7 @@ void JfrJvmtiAgent::retransform_classes(JNIEnv* env, jobjectArray classes_array,
}
{
// inspecting the oop/klass requires a thread transition
ThreadInVMfromNative transition(THREAD->as_Java_thread());
ThreadInVMfromNative transition(THREAD);
for (jint i = 0; i < classes_count; ++i) {
jclass clz = classes[i];
if (!JdkJfrEvent::is_a(clz)) {

View File

@ -50,31 +50,31 @@
#include "classfile/vmSymbols.hpp"
#ifdef ASSERT
void JfrJavaSupport::check_java_thread_in_vm(Thread* t) {
void JfrJavaSupport::check_java_thread_in_vm(JavaThread* t) {
assert(t != NULL, "invariant");
assert(t->as_Java_thread()->thread_state() == _thread_in_vm, "invariant");
assert(t->thread_state() == _thread_in_vm, "invariant");
}
void JfrJavaSupport::check_java_thread_in_native(Thread* t) {
void JfrJavaSupport::check_java_thread_in_native(JavaThread* t) {
assert(t != NULL, "invariant");
assert(t->as_Java_thread()->thread_state() == _thread_in_native, "invariant");
assert(t->thread_state() == _thread_in_native, "invariant");
}
static void check_new_unstarted_java_thread(Thread* t) {
static void check_new_unstarted_java_thread(JavaThread* t) {
assert(t != NULL, "invariant");
assert(t->as_Java_thread()->thread_state() == _thread_new, "invariant");
assert(t->thread_state() == _thread_new, "invariant");
}
#endif
/*
* Handles and references
*/
jobject JfrJavaSupport::local_jni_handle(const oop obj, Thread* t) {
jobject JfrJavaSupport::local_jni_handle(const oop obj, JavaThread* t) {
DEBUG_ONLY(check_java_thread_in_vm(t));
return t->active_handles()->allocate_handle(obj);
}
jobject JfrJavaSupport::local_jni_handle(const jobject handle, Thread* t) {
jobject JfrJavaSupport::local_jni_handle(const jobject handle, JavaThread* t) {
DEBUG_ONLY(check_java_thread_in_vm(t));
const oop obj = JNIHandles::resolve(handle);
return obj == NULL ? NULL : local_jni_handle(obj, t);
@ -84,13 +84,13 @@ void JfrJavaSupport::destroy_local_jni_handle(jobject handle) {
JNIHandles::destroy_local(handle);
}
jobject JfrJavaSupport::global_jni_handle(const oop obj, Thread* t) {
jobject JfrJavaSupport::global_jni_handle(const oop obj, JavaThread* t) {
DEBUG_ONLY(check_java_thread_in_vm(t));
HandleMark hm(t);
return JNIHandles::make_global(Handle(t, obj));
}
jobject JfrJavaSupport::global_jni_handle(const jobject handle, Thread* t) {
jobject JfrJavaSupport::global_jni_handle(const jobject handle, JavaThread* t) {
const oop obj = JNIHandles::resolve(handle);
return obj == NULL ? NULL : global_jni_handle(obj, t);
}
@ -99,13 +99,13 @@ void JfrJavaSupport::destroy_global_jni_handle(jobject handle) {
JNIHandles::destroy_global(handle);
}
jweak JfrJavaSupport::global_weak_jni_handle(const oop obj, Thread* t) {
jweak JfrJavaSupport::global_weak_jni_handle(const oop obj, JavaThread* t) {
DEBUG_ONLY(check_java_thread_in_vm(t));
HandleMark hm(t);
return JNIHandles::make_weak_global(Handle(t, obj));
}
jweak JfrJavaSupport::global_weak_jni_handle(const jobject handle, Thread* t) {
jweak JfrJavaSupport::global_weak_jni_handle(const jobject handle, JavaThread* t) {
const oop obj = JNIHandles::resolve(handle);
return obj == NULL ? NULL : global_weak_jni_handle(obj, t);
}
@ -139,7 +139,7 @@ void JfrJavaSupport::notify_all(jobject object, TRAPS) {
HandleMark hm(THREAD);
Handle h_obj(THREAD, resolve_non_null(object));
assert(h_obj.not_null(), "invariant");
ObjectSynchronizer::jni_enter(h_obj, THREAD->as_Java_thread());
ObjectSynchronizer::jni_enter(h_obj, THREAD);
ObjectSynchronizer::notifyall(h_obj, THREAD);
ObjectSynchronizer::jni_exit(h_obj(), THREAD);
DEBUG_ONLY(check_java_thread_in_vm(THREAD));
@ -196,7 +196,7 @@ static void create_object(JfrJavaArguments* args, JavaValue* result, TRAPS) {
}
}
static void handle_result(JavaValue* result, bool global_ref, Thread* t) {
static void handle_result(JavaValue* result, bool global_ref, JavaThread* t) {
assert(result != NULL, "invariant");
DEBUG_ONLY(JfrJavaSupport::check_java_thread_in_vm(t));
const oop result_oop = result->get_oop();
@ -275,7 +275,7 @@ jobject JfrJavaSupport::new_java_lang_Long(jlong value, TRAPS) {
return args.result()->get_jobject();
}
void JfrJavaSupport::set_array_element(jobjectArray arr, jobject element, int index, Thread* t) {
void JfrJavaSupport::set_array_element(jobjectArray arr, jobject element, int index, JavaThread* t) {
assert(arr != NULL, "invariant");
DEBUG_ONLY(check_java_thread_in_vm(t));
HandleMark hm(t);
@ -488,7 +488,7 @@ Klass* JfrJavaSupport::klass(const jobject handle) {
}
// caller needs ResourceMark
const char* JfrJavaSupport::c_str(oop string, Thread* t) {
const char* JfrJavaSupport::c_str(oop string, JavaThread* t) {
DEBUG_ONLY(check_java_thread_in_vm(t));
char* resource_copy = NULL;
const typeArrayOop value = java_lang_String::value(string);
@ -506,7 +506,7 @@ const char* JfrJavaSupport::c_str(oop string, Thread* t) {
}
// caller needs ResourceMark
const char* JfrJavaSupport::c_str(jstring string, Thread* t) {
const char* JfrJavaSupport::c_str(jstring string, JavaThread* t) {
DEBUG_ONLY(check_java_thread_in_vm(t));
return string != NULL ? c_str(resolve_non_null(string), t) : NULL;
}
@ -545,7 +545,7 @@ void JfrJavaSupport::throw_runtime_exception(const char* message, TRAPS) {
create_and_throw(vmSymbols::java_lang_RuntimeException(), message, THREAD);
}
void JfrJavaSupport::abort(jstring errorMsg, Thread* t) {
void JfrJavaSupport::abort(jstring errorMsg, JavaThread* t) {
DEBUG_ONLY(check_java_thread_in_vm(t));
ResourceMark rm(t);
@ -558,7 +558,7 @@ void JfrJavaSupport::abort(jstring errorMsg, Thread* t) {
}
JfrJavaSupport::CAUSE JfrJavaSupport::_cause = JfrJavaSupport::VM_ERROR;
void JfrJavaSupport::set_cause(jthrowable throwable, Thread* t) {
void JfrJavaSupport::set_cause(jthrowable throwable, JavaThread* t) {
DEBUG_ONLY(check_java_thread_in_vm(t));
HandleMark hm(t);
@ -590,7 +590,7 @@ void JfrJavaSupport::set_cause(jthrowable throwable, Thread* t) {
}
}
void JfrJavaSupport::uncaught_exception(jthrowable throwable, Thread* t) {
void JfrJavaSupport::uncaught_exception(jthrowable throwable, JavaThread* t) {
DEBUG_ONLY(check_java_thread_in_vm(t));
assert(throwable != NULL, "invariant");
set_cause(throwable, t);
@ -684,7 +684,7 @@ static int add_thread_to_exclusion_list(jobject thread) {
}
assert(exclusion_list != NULL, "invariant");
assert(thread_is_not_excluded(thread), "invariant");
jweak ref = JfrJavaSupport::global_weak_jni_handle(thread, Thread::current());
jweak ref = JfrJavaSupport::global_weak_jni_handle(thread, JavaThread::current());
const int idx = exclusion_list->append(ref);
assert(is_thread_excluded(thread), "invariant");
return idx;
@ -833,7 +833,7 @@ void JfrJavaSupport::on_thread_start(Thread* t) {
if (!t->is_Java_thread()) {
return;
}
DEBUG_ONLY(check_new_unstarted_java_thread(t);)
DEBUG_ONLY(check_new_unstarted_java_thread(t->as_Java_thread());)
HandleMark hm(t);
if (check_exclusion_state_on_thread_start(t->as_Java_thread())) {
JfrThreadLocal::exclude(t);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2021, 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
@ -33,21 +33,21 @@ class outputStream;
class JfrJavaSupport : public AllStatic {
public:
static jobject local_jni_handle(const oop obj, Thread* t);
static jobject local_jni_handle(const jobject handle, Thread* t);
static jobject local_jni_handle(const oop obj, JavaThread* t);
static jobject local_jni_handle(const jobject handle, JavaThread* t);
static void destroy_local_jni_handle(jobject handle);
static jobject global_jni_handle(const oop obj, Thread* t);
static jobject global_jni_handle(const jobject handle, Thread* t);
static jobject global_jni_handle(const oop obj, JavaThread* t);
static jobject global_jni_handle(const jobject handle, JavaThread* t);
static void destroy_global_jni_handle(jobject handle);
static jweak global_weak_jni_handle(const oop obj, Thread* t);
static jweak global_weak_jni_handle(const jobject handle, Thread* t);
static jweak global_weak_jni_handle(const oop obj, JavaThread* t);
static jweak global_weak_jni_handle(const jobject handle, JavaThread* t);
static void destroy_global_weak_jni_handle(jweak handle);
static oop resolve_non_null(jobject obj);
static void notify_all(jobject obj, TRAPS);
static void set_array_element(jobjectArray arr, jobject element, int index, Thread* t);
static void set_array_element(jobjectArray arr, jobject element, int index, JavaThread* t);
// naked oop result
static void call_static(JfrJavaArguments* args, TRAPS);
@ -76,8 +76,8 @@ class JfrJavaSupport : public AllStatic {
// misc
static Klass* klass(const jobject handle);
// caller needs ResourceMark
static const char* c_str(jstring string, Thread* jt);
static const char* c_str(oop string, Thread* t);
static const char* c_str(jstring string, JavaThread* jt);
static const char* c_str(oop string, JavaThread* t);
// exceptions
static void throw_illegal_state_exception(const char* message, TRAPS);
@ -101,11 +101,11 @@ class JfrJavaSupport : public AllStatic {
// critical
static void abort(jstring errorMsg, TRAPS);
static void uncaught_exception(jthrowable throwable, Thread* t);
static void uncaught_exception(jthrowable throwable, JavaThread* t);
// asserts
DEBUG_ONLY(static void check_java_thread_in_vm(Thread* t);)
DEBUG_ONLY(static void check_java_thread_in_native(Thread* t);)
DEBUG_ONLY(static void check_java_thread_in_vm(JavaThread* t);)
DEBUG_ONLY(static void check_java_thread_in_native(JavaThread* t);)
enum CAUSE {
VM_ERROR,
@ -120,7 +120,7 @@ class JfrJavaSupport : public AllStatic {
private:
static CAUSE _cause;
static void set_cause(jthrowable throwable, Thread* t);
static void set_cause(jthrowable throwable, JavaThread* t);
};
#endif // SHARE_JFR_JNI_JFRJAVASUPPORT_HPP

View File

@ -420,7 +420,7 @@ static void save_type_set_blob(JfrCheckpointWriter& writer, bool copy = false) {
void ObjectSampleCheckpoint::on_type_set(JfrCheckpointWriter& writer) {
assert(LeakProfiler::is_running(), "invariant");
DEBUG_ONLY(JfrJavaSupport::check_java_thread_in_vm(Thread::current());)
DEBUG_ONLY(JfrJavaSupport::check_java_thread_in_vm(JavaThread::current());)
const ObjectSample* last = ObjectSampler::sampler()->last();
if (writer.has_data() && last != NULL) {
save_type_set_blob(writer);

View File

@ -38,7 +38,7 @@
* param: cmd = the DCMD to execute (including options)
*/
static bool execute_dcmd(bufferedStream& st, const char* const cmd) {
Thread* THREAD = Thread::current();
JavaThread* THREAD = JavaThread::current(); // For exception macros.
assert(!HAS_PENDING_EXCEPTION, "dcmd does not expect pending exceptions on entry!");
// delegate to DCmd execution
DCmd::parse_and_execute(DCmd_Source_Internal, &st, cmd, ' ', THREAD);

View File

@ -336,7 +336,7 @@ void JfrCheckpointManager::end_epoch_shift() {
}
size_t JfrCheckpointManager::write() {
DEBUG_ONLY(JfrJavaSupport::check_java_thread_in_native(Thread::current()));
DEBUG_ONLY(JfrJavaSupport::check_java_thread_in_native(JavaThread::current()));
WriteOperation wo(_chunkwriter);
MutexedWriteOperation mwo(wo);
_thread_local_mspace->iterate(mwo, true); // previous epoch list
@ -369,10 +369,10 @@ size_t JfrCheckpointManager::write_static_type_set(Thread* thread) {
return writer.used_size();
}
size_t JfrCheckpointManager::write_threads(Thread* thread) {
size_t JfrCheckpointManager::write_threads(JavaThread* thread) {
assert(thread != NULL, "invariant");
// can safepoint here
ThreadInVMfromNative transition(thread->as_Java_thread());
ThreadInVMfromNative transition(thread);
ResourceMark rm(thread);
HandleMark hm(thread);
JfrCheckpointWriter writer(true, thread, THREADS);
@ -381,7 +381,7 @@ size_t JfrCheckpointManager::write_threads(Thread* thread) {
}
size_t JfrCheckpointManager::write_static_type_set_and_threads() {
Thread* const thread = Thread::current();
JavaThread* const thread = JavaThread::current();
DEBUG_ONLY(JfrJavaSupport::check_java_thread_in_native(thread));
write_static_type_set(thread);
write_threads(thread);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2021, 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
@ -80,7 +80,7 @@ class JfrCheckpointManager : public JfrCHeapObj {
void notify_threads();
size_t write_static_type_set(Thread* thread);
size_t write_threads(Thread* thread);
size_t write_threads(JavaThread* thread);
size_t write_static_type_set_and_threads();
void clear_type_set();
void write_type_set();

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2021, 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
@ -36,7 +36,7 @@ static jbyteArray metadata_blob = NULL;
static u8 metadata_id = 0;
static u8 last_metadata_id = 0;
static void write_metadata_blob(JfrChunkWriter& chunkwriter, Thread* thread) {
static void write_metadata_blob(JfrChunkWriter& chunkwriter, JavaThread* thread) {
assert(chunkwriter.is_valid(), "invariant");
assert(thread != NULL, "invariant");
assert(metadata_blob != NULL, "invariant");

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2021, 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
@ -105,9 +105,8 @@ traceid JfrThreadId::jfr_id(const Thread* t) {
}
// caller needs ResourceMark
const char* get_java_thread_name(const Thread* t) {
assert(t != NULL, "invariant");
const JavaThread* const jt = t->as_Java_thread();
const char* get_java_thread_name(const JavaThread* jt) {
assert(jt != NULL, "invariant");
const char* name_str = "<no-name - thread name unresolved>";
const oop thread_obj = jt->threadObj();
if (thread_obj != NULL) {
@ -124,5 +123,5 @@ const char* get_java_thread_name(const Thread* t) {
const char* JfrThreadName::name(const Thread* t) {
assert(t != NULL, "invariant");
return t->is_Java_thread() ? get_java_thread_name(t) : t->name();
return t->is_Java_thread() ? get_java_thread_name(t->as_Java_thread()) : t->name();
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2021, 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
@ -196,7 +196,7 @@ bool JfrRecorder::on_create_vm_2() {
if (is_cds_dump_requested()) {
return true;
}
Thread* const thread = Thread::current();
JavaThread* const thread = JavaThread::current();
if (!JfrOptionSet::initialize(thread)) {
return false;
}
@ -224,7 +224,7 @@ bool JfrRecorder::on_create_vm_2() {
bool JfrRecorder::on_create_vm_3() {
assert(JvmtiEnvBase::get_phase() == JVMTI_PHASE_LIVE, "invalid init sequence");
return Arguments::is_dumping_archive() || launch_command_line_recordings(Thread::current());
return Arguments::is_dumping_archive() || launch_command_line_recordings(JavaThread::current());
}
static bool _created = false;
@ -408,7 +408,7 @@ void JfrRecorder::destroy_components() {
}
bool JfrRecorder::create_recorder_thread() {
return JfrRecorderThread::start(_checkpoint_manager, _post_box, Thread::current());
return JfrRecorderThread::start(_checkpoint_manager, _post_box, JavaThread::current());
}
void JfrRecorder::destroy() {

View File

@ -36,7 +36,7 @@ class Thread;
//
class JfrRecorder : public JfrCHeapObj {
friend class Jfr;
friend void recorderthread_entry(JavaThread*, Thread*);
friend void recorderthread_entry(JavaThread*, JavaThread*);
private:
static bool on_create_vm_1();
static bool on_create_vm_2();

View File

@ -33,7 +33,7 @@ static jobject chunk_monitor = NULL;
static int64_t threshold = 0;
static bool rotate = false;
static jobject install_chunk_monitor(Thread* thread) {
static jobject install_chunk_monitor(JavaThread* thread) {
assert(chunk_monitor == NULL, "invariant");
// read static field
HandleMark hm(thread);
@ -48,7 +48,7 @@ static jobject install_chunk_monitor(Thread* thread) {
}
// lazy install
static jobject get_chunk_monitor(Thread* thread) {
static jobject get_chunk_monitor(JavaThread* thread) {
return chunk_monitor != NULL ? chunk_monitor : install_chunk_monitor(thread);
}

View File

@ -314,7 +314,7 @@ jboolean JfrOptionSet::_sample_protection = JNI_FALSE;
jboolean JfrOptionSet::_sample_protection = JNI_TRUE;
#endif
bool JfrOptionSet::initialize(Thread* thread) {
bool JfrOptionSet::initialize(JavaThread* thread) {
register_parser_options();
if (!parse_flight_recorder_options_internal(thread)) {
return false;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2021, 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
@ -49,7 +49,7 @@ class JfrOptionSet : public AllStatic {
static jboolean _retransform;
static jboolean _sample_protection;
static bool initialize(Thread* thread);
static bool initialize(JavaThread* thread);
static bool configure(TRAPS);
static bool adjust_memory_options();

View File

@ -87,7 +87,7 @@ class JfrPostBox : public JfrCHeapObj {
void deposit(int new_messages);
bool is_message_processed(uintptr_t serial_id) const;
friend void recorderthread_entry(JavaThread*, Thread*);
friend void recorderthread_entry(JavaThread*, JavaThread*);
// for the friend declaration above
bool is_empty() const;
int collect();

View File

@ -645,7 +645,7 @@ void JfrRecorderService::invoke_flush() {
}
void JfrRecorderService::flushpoint() {
DEBUG_ONLY(JfrJavaSupport::check_java_thread_in_native(Thread::current()));
DEBUG_ONLY(JfrJavaSupport::check_java_thread_in_native(JavaThread::current()));
JfrRotationLock lock;
if (_chunkwriter.is_valid()) {
invoke_flush();
@ -653,7 +653,7 @@ void JfrRecorderService::flushpoint() {
}
void JfrRecorderService::process_full_buffers() {
DEBUG_ONLY(JfrJavaSupport::check_java_thread_in_native(Thread::current()));
DEBUG_ONLY(JfrJavaSupport::check_java_thread_in_native(JavaThread::current()));
JfrRotationLock lock;
if (_chunkwriter.is_valid()) {
_storage.write_full();
@ -661,6 +661,6 @@ void JfrRecorderService::process_full_buffers() {
}
void JfrRecorderService::evaluate_chunk_size_for_rotation() {
DEBUG_ONLY(JfrJavaSupport::check_java_thread_in_native(Thread::current()));
DEBUG_ONLY(JfrJavaSupport::check_java_thread_in_native(JavaThread::current()));
JfrChunkRotation::evaluate(_chunkwriter);
}

View File

@ -78,7 +78,7 @@ JfrPostBox& JfrRecorderThread::post_box() {
}
// defined in JfrRecorderThreadLoop.cpp
void recorderthread_entry(JavaThread*, Thread*);
void recorderthread_entry(JavaThread*, JavaThread*);
bool JfrRecorderThread::start(JfrCheckpointManager* cp_manager, JfrPostBox* post_box, TRAPS) {
assert(cp_manager != NULL, "invariant");

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2021, 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
@ -39,7 +39,7 @@
// Entry point for "JFR Recorder Thread" message loop.
// The recorder thread executes service requests collected from the message system.
//
void recorderthread_entry(JavaThread* thread, Thread* unused) {
void recorderthread_entry(JavaThread* thread, JavaThread* unused) {
assert(thread != NULL, "invariant");
#define START (msgs & (MSGBIT(MSG_START)))
#define SHUTDOWN (msgs & MSGBIT(MSG_SHUTDOWN))

View File

@ -28,9 +28,9 @@
#include "jfr/support/jfrObjectAllocationSample.hpp"
#include "runtime/thread.hpp"
JfrAllocationTracer::JfrAllocationTracer(const Klass* klass, HeapWord* obj, size_t alloc_size, bool outside_tlab, Thread* thread) {
JfrAllocationTracer::JfrAllocationTracer(const Klass* klass, HeapWord* obj, size_t alloc_size, bool outside_tlab, JavaThread* thread) {
if (LeakProfiler::is_running()) {
LeakProfiler::sample(obj, alloc_size, thread->as_Java_thread());
LeakProfiler::sample(obj, alloc_size, thread);
}
JfrObjectAllocationSample::send_event(klass, alloc_size, outside_tlab, thread);
}

View File

@ -32,7 +32,7 @@ class Thread;
class JfrAllocationTracer : public StackObj {
public:
JfrAllocationTracer(const Klass* klass, HeapWord* obj, size_t alloc_size, bool outside_tlab, Thread* thread);
JfrAllocationTracer(const Klass* klass, HeapWord* obj, size_t alloc_size, bool outside_tlab, JavaThread* thread);
};
#endif // SHARE_JFR_SUPPORT_JFRALLOCATIONTRACER_HPP

View File

@ -76,7 +76,7 @@ static bool is_allowed(const Klass* k) {
return !(k->is_abstract() || k->should_be_initialized());
}
static void fill_klasses(GrowableArray<const void*>& event_subklasses, const Klass* event_klass, Thread* thread) {
static void fill_klasses(GrowableArray<const void*>& event_subklasses, const Klass* event_klass, JavaThread* thread) {
assert(event_subklasses.length() == 0, "invariant");
assert(event_klass != NULL, "invariant");
DEBUG_ONLY(JfrJavaSupport::check_java_thread_in_vm(thread));
@ -107,7 +107,7 @@ static void fill_klasses(GrowableArray<const void*>& event_subklasses, const Kla
assert(mark_stack.is_empty(), "invariant");
}
static void transform_klasses_to_local_jni_handles(GrowableArray<const void*>& event_subklasses, Thread* thread) {
static void transform_klasses_to_local_jni_handles(GrowableArray<const void*>& event_subklasses, JavaThread* thread) {
assert(event_subklasses.is_nonempty(), "invariant");
DEBUG_ONLY(JfrJavaSupport::check_java_thread_in_vm(thread));

View File

@ -100,7 +100,7 @@ static void log_config_change_internal(bool init, TRAPS) {
}
static void log_config_change() {
Thread* t = Thread::current();
JavaThread* t = JavaThread::current();
DEBUG_ONLY(JfrJavaSupport::check_java_thread_in_vm(t));
log_config_change_internal(false, t);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2021, 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
@ -128,7 +128,7 @@ static bool setup_event_writer_offsets(TRAPS) {
bool JfrJavaEventWriter::initialize() {
static bool initialized = false;
if (!initialized) {
initialized = setup_event_writer_offsets(Thread::current());
initialized = setup_event_writer_offsets(JavaThread::current());
}
return initialized;
}
@ -211,7 +211,7 @@ static jobject create_new_event_writer(JfrBuffer* buffer, TRAPS) {
return result.get_jobject();
}
jobject JfrJavaEventWriter::event_writer(Thread* t) {
jobject JfrJavaEventWriter::event_writer(JavaThread* t) {
DEBUG_ONLY(JfrJavaSupport::check_java_thread_in_vm(t));
JfrThreadLocal* const tl = t->jfr_thread_local();
assert(tl->shelved_buffer() == NULL, "invariant");

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2021, 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
@ -42,7 +42,7 @@ class JfrJavaEventWriter : AllStatic {
public:
static void notify();
static jobject event_writer(Thread* t);
static jobject event_writer(JavaThread* t);
static jobject new_event_writer(TRAPS);
static jboolean flush(jobject writer, jint used, jint requested, JavaThread* jt);
};

View File

@ -804,7 +804,7 @@ JVMCI::CodeInstallResult CodeInstaller::initialize_buffer(CodeBuffer& buffer, bo
}
#endif
if (_has_auto_box) {
JavaThread* THREAD = JavaThread::current();
JavaThread* THREAD = JavaThread::current(); // For exception macros.
JVMCI::ensure_box_caches_initialized(CHECK_(JVMCI::ok));
}
return JVMCI::ok;

View File

@ -66,7 +66,6 @@ void JVMCICompiler::initialize() {
}
void JVMCICompiler::bootstrap(TRAPS) {
assert(THREAD->is_Java_thread(), "must be");
if (Arguments::mode() == Arguments::_int) {
// Nothing to do in -Xint mode
return;
@ -97,7 +96,7 @@ void JVMCICompiler::bootstrap(TRAPS) {
do {
// Loop until there is something in the queue.
do {
THREAD->as_Java_thread()->sleep(100);
THREAD->sleep(100);
qsize = CompileBroker::queue_size(CompLevel_full_optimization);
} while (!_bootstrap_compilation_request_handled && first_round && qsize == 0);
first_round = false;

View File

@ -133,7 +133,7 @@ Handle JavaArgumentUnboxer::next_arg(BasicType expectedType) {
MACOS_AARCH64_ONLY(ThreadWXEnable __wx(WXWrite, thread)); \
ThreadInVMfromNative __tiv(thread); \
HandleMarkCleaner __hm(thread); \
Thread* THREAD = thread; \
JavaThread* THREAD = thread; \
debug_only(VMNativeEntryWrapper __vew;)
// Native method block that transitions current thread to '_thread_in_vm'.

View File

@ -284,7 +284,7 @@ JVMCIObjectArray CompilerToVM::initialize_intrinsics(JVMCI_TRAPS) {
} while (0)
jobjectArray readConfiguration0(JNIEnv *env, JVMCI_TRAPS) {
Thread* THREAD = Thread::current();
JavaThread* THREAD = JavaThread::current(); // For exception macros.
ResourceHashtable<jlong, JVMCIObject> longs;
ResourceHashtable<const char*, JVMCIObject, &CompilerToVM::cstring_hash, &CompilerToVM::cstring_equals> strings;

View File

@ -100,7 +100,7 @@ bool JVMCICompileState::jvmti_state_changed() const {
void JVMCIEnv::copy_saved_properties() {
assert(!is_hotspot(), "can only copy saved properties from HotSpot to native image");
JavaThread* THREAD = JavaThread::current();
JavaThread* THREAD = JavaThread::current(); // For exception macros.
Klass* k = SystemDictionary::resolve_or_fail(vmSymbols::jdk_vm_ci_services_Services(), Handle(), Handle(), true, THREAD);
if (HAS_PENDING_EXCEPTION) {
@ -261,7 +261,7 @@ void JVMCIEnv::init(JavaThread* thread, bool is_hotspot, const char* file, int l
// Prints a pending exception (if any) and its stack trace.
void JVMCIEnv::describe_pending_exception(bool clear) {
JavaThread* THREAD = JavaThread::current();
JavaThread* THREAD = JavaThread::current(); // For exception macros.
if (!is_hotspot()) {
JNIAccessMark jni(this, THREAD);
if (jni()->ExceptionCheck()) {
@ -314,7 +314,7 @@ JVMCIEnv::~JVMCIEnv() {
} else {
Thread* thread = Thread::current();
if (thread->is_Java_thread()) {
JavaThread* THREAD = thread->as_Java_thread();
JavaThread* THREAD = thread->as_Java_thread(); // For exception macros.
if (HAS_PENDING_EXCEPTION) {
Handle throwable = Handle(THREAD, PENDING_EXCEPTION);
CLEAR_PENDING_EXCEPTION;
@ -343,7 +343,7 @@ JVMCIEnv::~JVMCIEnv() {
jboolean JVMCIEnv::has_pending_exception() {
if (is_hotspot()) {
Thread* THREAD = Thread::current();
JavaThread* THREAD = JavaThread::current(); // For exception macros.
return HAS_PENDING_EXCEPTION;
} else {
JNIAccessMark jni(this);
@ -353,7 +353,7 @@ jboolean JVMCIEnv::has_pending_exception() {
void JVMCIEnv::clear_pending_exception() {
if (is_hotspot()) {
Thread* THREAD = Thread::current();
JavaThread* THREAD = JavaThread::current(); // For exception macros.
CLEAR_PENDING_EXCEPTION;
} else {
JNIAccessMark jni(this);
@ -571,7 +571,7 @@ JVMCIObject JVMCIEnv::create_box(BasicType type, jvalue* value, JVMCI_TRAPS) {
default:
JVMCI_THROW_MSG_(IllegalArgumentException, "Only boxes for primitive values can be created", JVMCIObject());
}
JavaThread* THREAD = JavaThread::current();
JavaThread* THREAD = JavaThread::current(); // For exception macros.
if (is_hotspot()) {
oop box = java_lang_boxing_object::create(type, value, CHECK_(JVMCIObject()));
return HotSpotJVMCI::wrap(box);
@ -639,7 +639,7 @@ void JVMCIEnv::fthrow_error(const char* file, int line, const char* format, ...)
}
jboolean JVMCIEnv::call_HotSpotJVMCIRuntime_isGCSupported (JVMCIObject runtime, jint gcIdentifier) {
JavaThread* THREAD = JavaThread::current();
JavaThread* THREAD = JavaThread::current(); // For exception macros.
if (is_hotspot()) {
JavaCallArguments jargs;
jargs.push_oop(Handle(THREAD, HotSpotJVMCI::resolve(runtime)));
@ -665,7 +665,7 @@ jboolean JVMCIEnv::call_HotSpotJVMCIRuntime_isGCSupported (JVMCIObject runtime,
JVMCIObject JVMCIEnv::call_HotSpotJVMCIRuntime_compileMethod (JVMCIObject runtime, JVMCIObject method, int entry_bci,
jlong compile_state, int id) {
JavaThread* THREAD = JVMCI::compilation_tick(JavaThread::current());
JavaThread* THREAD = JVMCI::compilation_tick(JavaThread::current()); // For exception macros.
if (is_hotspot()) {
JavaCallArguments jargs;
jargs.push_oop(Handle(THREAD, HotSpotJVMCI::resolve(runtime)));
@ -693,7 +693,7 @@ JVMCIObject JVMCIEnv::call_HotSpotJVMCIRuntime_compileMethod (JVMCIObject runtim
}
void JVMCIEnv::call_HotSpotJVMCIRuntime_bootstrapFinished (JVMCIObject runtime, JVMCIEnv* JVMCIENV) {
JavaThread* THREAD = JVMCI::compilation_tick(JavaThread::current());
JavaThread* THREAD = JVMCI::compilation_tick(JavaThread::current()); // For exception macros.
if (is_hotspot()) {
JavaCallArguments jargs;
jargs.push_oop(Handle(THREAD, HotSpotJVMCI::resolve(runtime)));
@ -707,7 +707,7 @@ void JVMCIEnv::call_HotSpotJVMCIRuntime_bootstrapFinished (JVMCIObject runtime,
}
void JVMCIEnv::call_HotSpotJVMCIRuntime_shutdown (JVMCIObject runtime) {
JavaThread* THREAD = JavaThread::current();
JavaThread* THREAD = JavaThread::current(); // For exception macros.
HandleMark hm(THREAD);
if (is_hotspot()) {
JavaCallArguments jargs;
@ -726,7 +726,7 @@ void JVMCIEnv::call_HotSpotJVMCIRuntime_shutdown (JVMCIObject runtime) {
}
JVMCIObject JVMCIEnv::call_HotSpotJVMCIRuntime_runtime (JVMCIEnv* JVMCIENV) {
JavaThread* THREAD = JVMCI::compilation_tick(JavaThread::current());
JavaThread* THREAD = JVMCI::compilation_tick(JavaThread::current()); // For exception macros.
if (is_hotspot()) {
JavaCallArguments jargs;
JavaValue result(T_OBJECT);
@ -743,7 +743,7 @@ JVMCIObject JVMCIEnv::call_HotSpotJVMCIRuntime_runtime (JVMCIEnv* JVMCIENV) {
}
JVMCIObject JVMCIEnv::call_JVMCI_getRuntime (JVMCIEnv* JVMCIENV) {
JavaThread* THREAD = JVMCI::compilation_tick(JavaThread::current());
JavaThread* THREAD = JVMCI::compilation_tick(JavaThread::current()); // For exception macros.
if (is_hotspot()) {
JavaCallArguments jargs;
JavaValue result(T_OBJECT);
@ -760,7 +760,7 @@ JVMCIObject JVMCIEnv::call_JVMCI_getRuntime (JVMCIEnv* JVMCIENV) {
}
JVMCIObject JVMCIEnv::call_HotSpotJVMCIRuntime_getCompiler (JVMCIObject runtime, JVMCIEnv* JVMCIENV) {
JavaThread* THREAD = JVMCI::compilation_tick(JavaThread::current());
JavaThread* THREAD = JVMCI::compilation_tick(JavaThread::current()); // For exception macros.
if (is_hotspot()) {
JavaCallArguments jargs;
jargs.push_oop(Handle(THREAD, HotSpotJVMCI::resolve(runtime)));
@ -779,7 +779,7 @@ JVMCIObject JVMCIEnv::call_HotSpotJVMCIRuntime_getCompiler (JVMCIObject runtime,
JVMCIObject JVMCIEnv::call_HotSpotJVMCIRuntime_callToString(JVMCIObject object, JVMCIEnv* JVMCIENV) {
JavaThread* THREAD = JVMCI::compilation_tick(JavaThread::current());
JavaThread* THREAD = JVMCI::compilation_tick(JavaThread::current()); // For exception macros.
if (is_hotspot()) {
JavaCallArguments jargs;
jargs.push_oop(Handle(THREAD, HotSpotJVMCI::resolve(object)));
@ -803,7 +803,7 @@ JVMCIObject JVMCIEnv::call_HotSpotJVMCIRuntime_callToString(JVMCIObject object,
JVMCIObject JVMCIEnv::call_JavaConstant_forPrimitive(JVMCIObject kind, jlong value, JVMCI_TRAPS) {
JavaThread* THREAD = JVMCI::compilation_tick(JavaThread::current());
JavaThread* THREAD = JVMCI::compilation_tick(JavaThread::current()); // For exception macros.
if (is_hotspot()) {
JavaCallArguments jargs;
jargs.push_oop(Handle(THREAD, HotSpotJVMCI::resolve(kind)));
@ -833,7 +833,7 @@ JVMCIObject JVMCIEnv::get_jvmci_primitive_type(BasicType type) {
}
JVMCIObject JVMCIEnv::new_StackTraceElement(const methodHandle& method, int bci, JVMCI_TRAPS) {
JavaThread* THREAD = JavaThread::current();
JavaThread* THREAD = JavaThread::current(); // For exception macros.
Symbol* file_name_sym;
int line_number;
java_lang_StackTraceElement::decode(method, bci, file_name_sym, line_number, CHECK_(JVMCIObject()));
@ -885,7 +885,7 @@ JVMCIObject JVMCIEnv::new_StackTraceElement(const methodHandle& method, int bci,
}
JVMCIObject JVMCIEnv::new_HotSpotNmethod(const methodHandle& method, const char* name, jboolean isDefault, jlong compileId, JVMCI_TRAPS) {
JavaThread* THREAD = JVMCI::compilation_tick(JavaThread::current());
JavaThread* THREAD = JVMCI::compilation_tick(JavaThread::current()); // For exception macros.
JVMCIObject methodObject = get_jvmci_method(method, JVMCI_CHECK_(JVMCIObject()));
@ -990,7 +990,7 @@ JVMCIObject JVMCIEnv::get_jvmci_method(const methodHandle& method, JVMCI_TRAPS)
CompilerOracle::tag_blackhole_if_possible(method);
JavaThread* THREAD = JVMCI::compilation_tick(JavaThread::current());
JavaThread* THREAD = JVMCI::compilation_tick(JavaThread::current()); // For exception macros.
jmetadata handle = _runtime->allocate_handle(method);
jboolean exception = false;
if (is_hotspot()) {
@ -1033,7 +1033,7 @@ JVMCIObject JVMCIEnv::get_jvmci_type(const JVMCIKlassHandle& klass, JVMCI_TRAPS)
}
jlong pointer = (jlong) klass();
JavaThread* THREAD = JVMCI::compilation_tick(JavaThread::current());
JavaThread* THREAD = JVMCI::compilation_tick(JavaThread::current()); // For exception macros.
JVMCIObject signature = create_string(klass->signature_name(), JVMCI_CHECK_(JVMCIObject()));
jboolean exception = false;
if (is_hotspot()) {
@ -1072,7 +1072,7 @@ JVMCIObject JVMCIEnv::get_jvmci_constant_pool(const constantPoolHandle& cp, JVMC
JVMCIObject cp_object;
jmetadata handle = _runtime->allocate_handle(cp);
jboolean exception = false;
JavaThread* THREAD = JVMCI::compilation_tick(JavaThread::current());
JavaThread* THREAD = JVMCI::compilation_tick(JavaThread::current()); // For exception macros.
if (is_hotspot()) {
JavaValue result(T_OBJECT);
JavaCallArguments args;
@ -1106,7 +1106,7 @@ JVMCIObject JVMCIEnv::get_jvmci_constant_pool(const constantPoolHandle& cp, JVMC
}
JVMCIPrimitiveArray JVMCIEnv::new_booleanArray(int length, JVMCI_TRAPS) {
JavaThread* THREAD = JavaThread::current();
JavaThread* THREAD = JavaThread::current(); // For exception macros.
if (is_hotspot()) {
typeArrayOop result = oopFactory::new_boolArray(length, CHECK_(JVMCIObject()));
return wrap(result);
@ -1118,7 +1118,7 @@ JVMCIPrimitiveArray JVMCIEnv::new_booleanArray(int length, JVMCI_TRAPS) {
}
JVMCIPrimitiveArray JVMCIEnv::new_byteArray(int length, JVMCI_TRAPS) {
JavaThread* THREAD = JavaThread::current();
JavaThread* THREAD = JavaThread::current(); // For exception macros.
if (is_hotspot()) {
typeArrayOop result = oopFactory::new_byteArray(length, CHECK_(JVMCIObject()));
return wrap(result);
@ -1130,7 +1130,7 @@ JVMCIPrimitiveArray JVMCIEnv::new_byteArray(int length, JVMCI_TRAPS) {
}
JVMCIObjectArray JVMCIEnv::new_byte_array_array(int length, JVMCI_TRAPS) {
JavaThread* THREAD = JavaThread::current();
JavaThread* THREAD = JavaThread::current(); // For exception macros.
if (is_hotspot()) {
Klass* byteArrayArrayKlass = TypeArrayKlass::cast(Universe::byteArrayKlassObj ())->array_klass(CHECK_(JVMCIObject()));
objArrayOop result = ObjArrayKlass::cast(byteArrayArrayKlass) ->allocate(length, CHECK_(JVMCIObject()));
@ -1143,7 +1143,7 @@ JVMCIObjectArray JVMCIEnv::new_byte_array_array(int length, JVMCI_TRAPS) {
}
JVMCIPrimitiveArray JVMCIEnv::new_intArray(int length, JVMCI_TRAPS) {
JavaThread* THREAD = JavaThread::current();
JavaThread* THREAD = JavaThread::current(); // For exception macros.
if (is_hotspot()) {
typeArrayOop result = oopFactory::new_intArray(length, CHECK_(JVMCIObject()));
return wrap(result);
@ -1155,7 +1155,7 @@ JVMCIPrimitiveArray JVMCIEnv::new_intArray(int length, JVMCI_TRAPS) {
}
JVMCIPrimitiveArray JVMCIEnv::new_longArray(int length, JVMCI_TRAPS) {
JavaThread* THREAD = JavaThread::current();
JavaThread* THREAD = JavaThread::current(); // For exception macros.
if (is_hotspot()) {
typeArrayOop result = oopFactory::new_longArray(length, CHECK_(JVMCIObject()));
return wrap(result);
@ -1167,7 +1167,7 @@ JVMCIPrimitiveArray JVMCIEnv::new_longArray(int length, JVMCI_TRAPS) {
}
JVMCIObject JVMCIEnv::new_VMField(JVMCIObject name, JVMCIObject type, jlong offset, jlong address, JVMCIObject value, JVMCI_TRAPS) {
JavaThread* THREAD = JavaThread::current();
JavaThread* THREAD = JavaThread::current(); // For exception macros.
if (is_hotspot()) {
HotSpotJVMCI::VMField::klass()->initialize(CHECK_(JVMCIObject()));
oop obj = HotSpotJVMCI::VMField::klass()->allocate_instance(CHECK_(JVMCIObject()));
@ -1187,7 +1187,7 @@ JVMCIObject JVMCIEnv::new_VMField(JVMCIObject name, JVMCIObject type, jlong offs
}
JVMCIObject JVMCIEnv::new_VMFlag(JVMCIObject name, JVMCIObject type, JVMCIObject value, JVMCI_TRAPS) {
JavaThread* THREAD = JavaThread::current();
JavaThread* THREAD = JavaThread::current(); // For exception macros.
if (is_hotspot()) {
HotSpotJVMCI::VMFlag::klass()->initialize(CHECK_(JVMCIObject()));
oop obj = HotSpotJVMCI::VMFlag::klass()->allocate_instance(CHECK_(JVMCIObject()));
@ -1205,7 +1205,7 @@ JVMCIObject JVMCIEnv::new_VMFlag(JVMCIObject name, JVMCIObject type, JVMCIObject
}
JVMCIObject JVMCIEnv::new_VMIntrinsicMethod(JVMCIObject declaringClass, JVMCIObject name, JVMCIObject descriptor, int id, JVMCI_TRAPS) {
JavaThread* THREAD = JavaThread::current();
JavaThread* THREAD = JavaThread::current(); // For exception macros.
if (is_hotspot()) {
HotSpotJVMCI::VMIntrinsicMethod::klass()->initialize(CHECK_(JVMCIObject()));
oop obj = HotSpotJVMCI::VMIntrinsicMethod::klass()->allocate_instance(CHECK_(JVMCIObject()));
@ -1225,7 +1225,7 @@ JVMCIObject JVMCIEnv::new_VMIntrinsicMethod(JVMCIObject declaringClass, JVMCIObj
JVMCIObject JVMCIEnv::new_HotSpotStackFrameReference(JVMCI_TRAPS) {
if (is_hotspot()) {
JavaThread* THREAD = JavaThread::current();
JavaThread* THREAD = JavaThread::current(); // For exception macros.
HotSpotJVMCI::HotSpotStackFrameReference::klass()->initialize(CHECK_(JVMCIObject()));
oop obj = HotSpotJVMCI::HotSpotStackFrameReference::klass()->allocate_instance(CHECK_(JVMCIObject()));
return wrap(obj);
@ -1236,7 +1236,7 @@ JVMCIObject JVMCIEnv::new_HotSpotStackFrameReference(JVMCI_TRAPS) {
}
JVMCIObject JVMCIEnv::new_JVMCIError(JVMCI_TRAPS) {
if (is_hotspot()) {
JavaThread* THREAD = JavaThread::current();
JavaThread* THREAD = JavaThread::current(); // For exception macros.
HotSpotJVMCI::JVMCIError::klass()->initialize(CHECK_(JVMCIObject()));
oop obj = HotSpotJVMCI::JVMCIError::klass()->allocate_instance(CHECK_(JVMCIObject()));
return wrap(obj);
@ -1248,7 +1248,7 @@ JVMCIObject JVMCIEnv::new_JVMCIError(JVMCI_TRAPS) {
JVMCIObject JVMCIEnv::get_object_constant(oop objOop, bool compressed, bool dont_register) {
JavaThread* THREAD = JavaThread::current();
JavaThread* THREAD = JavaThread::current(); // For exception macros.
Handle obj = Handle(THREAD, objOop);
if (obj.is_null()) {
return JVMCIObject();
@ -1274,7 +1274,7 @@ Handle JVMCIEnv::asConstant(JVMCIObject constant, JVMCI_TRAPS) {
if (constant.is_null()) {
return Handle();
}
JavaThread* THREAD = JavaThread::current();
JavaThread* THREAD = JavaThread::current(); // For exception macros.
if (is_hotspot()) {
assert(HotSpotJVMCI::DirectHotSpotObjectConstantImpl::is_instance(this, constant), "wrong type");
oop obj = HotSpotJVMCI::DirectHotSpotObjectConstantImpl::object(this, HotSpotJVMCI::resolve(constant));
@ -1314,7 +1314,7 @@ oop JVMCIEnv::resolve_handle(jlong objectHandle) {
}
JVMCIObject JVMCIEnv::create_string(const char* str, JVMCI_TRAPS) {
JavaThread* THREAD = JavaThread::current();
JavaThread* THREAD = JavaThread::current(); // For exception macros.
if (is_hotspot()) {
Handle result = java_lang_String::create_from_str(str, CHECK_(JVMCIObject()));
return HotSpotJVMCI::wrap(result());
@ -1400,8 +1400,8 @@ void JVMCIEnv::invalidate_nmethod_mirror(JVMCIObject mirror, JVMCI_TRAPS) {
return;
}
Thread* THREAD = Thread::current();
if (!mirror.is_hotspot() && !THREAD->is_Java_thread()) {
Thread* current = Thread::current();
if (!mirror.is_hotspot() && !current->is_Java_thread()) {
// Calling back into native might cause the execution to block, so only allow this when calling
// from a JavaThread, which is the normal case anyway.
JVMCI_THROW_MSG(IllegalArgumentException,
@ -1522,7 +1522,7 @@ nmethod* JVMCIEnv::get_nmethod(JVMCIObject obj, nmethodLocker& locker) {
} \
JVMCIObjectArray JVMCIEnv::new_##className##_array(int length, JVMCI_TRAPS) { \
if (is_hotspot()) { \
Thread* THREAD = Thread::current(); \
JavaThread* THREAD = JavaThread::current(); /* For exception macros. */ \
objArrayOop array = oopFactory::new_objArray(HotSpotJVMCI::className::klass(), length, CHECK_(JVMCIObject())); \
return (JVMCIObjectArray) wrap(array); \
} else { \

View File

@ -39,8 +39,8 @@ class JVMCIRuntime;
class nmethodLocker;
#define JVMCI_EXCEPTION_CONTEXT \
JavaThread* thread=JavaThread::current(); \
Thread* THREAD = thread;
JavaThread* thread = JavaThread::current(); \
JavaThread* THREAD = thread; // For exception macros.
// Helper to log more context on a JNI exception
#define JVMCI_EXCEPTION_CHECK(env, ...) \

View File

@ -180,7 +180,7 @@ void HotSpotJVMCI::compute_offsets(TRAPS) {
#define START_CLASS(className, fullClassName) \
void HotSpotJVMCI::className::initialize(JVMCI_TRAPS) { \
Thread* THREAD = Thread::current(); \
JavaThread* THREAD = JavaThread::current(); /* For exception macros. */ \
className::klass()->initialize(CHECK); \
} \
bool HotSpotJVMCI::className::is_instance(JVMCIEnv* env, JVMCIObject object) { \
@ -306,7 +306,6 @@ void JNIJVMCI::initialize_field_id(JNIEnv* env, jfieldID &fieldid, jclass clazz,
env->ExceptionDescribe();
env->ExceptionClear();
ResourceMark rm;
Thread* THREAD = Thread::current();
fatal("Could not find field %s.%s with signature %s", class_name, name, signature);
}
}
@ -379,7 +378,7 @@ class ThrowableInitDumper : public SymbolClosure {
public:
ThrowableInitDumper(fileStream* st) { _st = st; }
void do_symbol(Symbol** p) {
Thread* THREAD = Thread::current();
JavaThread* THREAD = JavaThread::current(); // For exception macros.
Symbol* name = *p;
if (name == NULL) {
return;
@ -488,7 +487,7 @@ void JNIJVMCI::initialize_ids(JNIEnv* env) {
} while(0)
if (JVMCILibDumpJNIConfig != NULL) {
Thread* THREAD = Thread::current();
JavaThread* THREAD = JavaThread::current(); // For exception macros.
fileStream* st = JVMCIGlobals::get_jni_config_file();
DUMP_ALL_NATIVE_METHODS(vmSymbols::jdk_vm_ci_hotspot_CompilerToVM());

View File

@ -104,7 +104,7 @@ class RetryableAllocationMark: public StackObj {
~RetryableAllocationMark() {
if (_thread != NULL) {
_thread->set_in_retryable_allocation(false);
JavaThread* THREAD = _thread;
JavaThread* THREAD = _thread; // For exception macros.
if (HAS_PENDING_EXCEPTION) {
oop ex = PENDING_EXCEPTION;
// Do not clear probable async exceptions.
@ -1046,7 +1046,7 @@ void JVMCIRuntime::initialize(JVMCIEnv* JVMCIENV) {
{
MutexUnlocker unlock(JVMCI_lock);
JavaThread* THREAD = JavaThread::current();
JavaThread* THREAD = JavaThread::current(); // For exception macros.
HandleMark hm(THREAD);
ResourceMark rm(THREAD);
if (JVMCIENV->is_hotspot()) {
@ -1086,7 +1086,7 @@ void JVMCIRuntime::initialize(JVMCIEnv* JVMCIENV) {
}
JVMCIObject JVMCIRuntime::create_jvmci_primitive_type(BasicType type, JVMCI_TRAPS) {
Thread* THREAD = Thread::current();
JavaThread* THREAD = JavaThread::current(); // For exception macros.
// These primitive types are long lived and are created before the runtime is fully set up
// so skip registering them for scanning.
JVMCIObject mirror = JVMCIENV->get_object_constant(java_lang_Class::primitive_mirror(type), false, true);
@ -1197,7 +1197,7 @@ void JVMCIRuntime::describe_pending_hotspot_exception(JavaThread* THREAD, bool c
void JVMCIRuntime::fatal_exception(JVMCIEnv* JVMCIENV, const char* message) {
JavaThread* THREAD = JavaThread::current();
JavaThread* THREAD = JavaThread::current(); // For exception macros.
static volatile int report_error = 0;
if (!report_error && Atomic::cmpxchg(&report_error, 0, 1) == 0) {

View File

@ -33,6 +33,7 @@
class outputStream;
class Thread;
class JavaThread;
class AllocFailStrategy {
public:
@ -344,7 +345,7 @@ class MetaspaceObj {
void* operator new(size_t size, ClassLoaderData* loader_data,
size_t word_size,
Type type, Thread* thread) throw();
Type type, JavaThread* thread) throw();
// can't use TRAPS from this header file.
void* operator new(size_t size, ClassLoaderData* loader_data,
size_t word_size,

View File

@ -816,8 +816,6 @@ MetaWord* Metaspace::allocate(ClassLoaderData* loader_data, size_t word_size,
MetaWord* Metaspace::allocate(ClassLoaderData* loader_data, size_t word_size,
MetaspaceObj::Type type, TRAPS) {
assert(THREAD->is_Java_thread(), "can't allocate in non-Java thread because we cannot throw exception");
if (HAS_PENDING_EXCEPTION) {
assert(false, "Should not allocate with exception pending");
return NULL; // caller does a CHECK_NULL too

View File

@ -626,11 +626,11 @@ oop Universe::gen_out_of_memory_error(oop default_err) {
// return default
return default_err;
} else {
Thread* THREAD = Thread::current();
Handle default_err_h(THREAD, default_err);
JavaThread* current = JavaThread::current();
Handle default_err_h(current, default_err);
// get the error object at the slot and set set it to NULL so that the
// array isn't keeping it alive anymore.
Handle exc(THREAD, preallocated_out_of_memory_errors()->obj_at(next));
Handle exc(current, preallocated_out_of_memory_errors()->obj_at(next));
assert(exc() != NULL, "slot has been used already");
preallocated_out_of_memory_errors()->obj_at_put(next, NULL);

View File

@ -468,7 +468,7 @@ void ConstantPool::trace_class_resolution(const constantPoolHandle& this_cp, Kla
Klass* ConstantPool::klass_at_impl(const constantPoolHandle& this_cp, int which,
TRAPS) {
JavaThread* javaThread = THREAD->as_Java_thread();
JavaThread* javaThread = THREAD;
// A resolved constantPool entry will contain a Klass*, otherwise a Symbol*.
// It is not safe to rely on the tag bit's here, since we don't have a lock, and
@ -576,19 +576,19 @@ Klass* ConstantPool::klass_at_if_loaded(const constantPoolHandle& this_cp, int w
} else if (this_cp->tag_at(which).is_unresolved_klass_in_error()) {
return NULL;
} else {
Thread *thread = Thread::current();
Thread* current = Thread::current();
Symbol* name = this_cp->symbol_at(name_index);
oop loader = this_cp->pool_holder()->class_loader();
oop protection_domain = this_cp->pool_holder()->protection_domain();
Handle h_prot (thread, protection_domain);
Handle h_loader (thread, loader);
Handle h_prot (current, protection_domain);
Handle h_loader (current, loader);
Klass* k = SystemDictionary::find_instance_klass(name, h_loader, h_prot);
// Avoid constant pool verification at a safepoint, which takes the Module_lock.
if (k != NULL && !SafepointSynchronize::is_at_safepoint()) {
// Avoid constant pool verification at a safepoint, as it takes the Module_lock.
if (k != NULL && current->is_Java_thread()) {
// Make sure that resolving is legal
ExceptionMark em(thread);
Thread* THREAD = thread; // For exception macros.
JavaThread* THREAD = current->as_Java_thread(); // For exception macros.
ExceptionMark em(THREAD);
// return NULL if verification fails
verify_constant_pool_resolve(this_cp, k, THREAD);
if (HAS_PENDING_EXCEPTION) {

View File

@ -33,6 +33,7 @@
#include "oops/symbol.hpp"
#include "oops/typeArrayOop.hpp"
#include "runtime/handles.hpp"
#include "runtime/thread.hpp"
#include "utilities/align.hpp"
#include "utilities/bytes.hpp"
#include "utilities/constantTag.hpp"

View File

@ -399,7 +399,7 @@ void ConstantPoolCacheEntry::set_method_handle_common(const constantPoolHandle&
guarantee(index >= 0, "Didn't find cpCache entry!");
int encoded_index = ResolutionErrorTable::encode_cpcache_index(
ConstantPool::encode_invokedynamic_index(index));
Thread* THREAD = Thread::current();
JavaThread* THREAD = JavaThread::current(); // For exception macros.
ConstantPool::throw_resolution_error(cpool, encoded_index, THREAD);
return;
}
@ -482,7 +482,7 @@ bool ConstantPoolCacheEntry::save_and_throw_indy_exc(
// Use the resolved_references() lock for this cpCache entry.
// resolved_references are created for all classes with Invokedynamic, MethodHandle
// or MethodType constant pool cache entries.
JavaThread* current = THREAD->as_Java_thread();
JavaThread* current = THREAD;
objArrayHandle resolved_references(current, cpool->resolved_references());
assert(resolved_references() != NULL,
"a resolved_references array should have been created for this class");
@ -729,12 +729,12 @@ void ConstantPoolCache::walk_entries_for_initialization(bool check_only) {
bool* f2_used = NEW_RESOURCE_ARRAY(bool, length());
memset(f2_used, 0, sizeof(bool) * length());
Thread* THREAD = Thread::current();
Thread* current = Thread::current();
// Find all the slots that we need to preserve f2
for (int i = 0; i < ik->methods()->length(); i++) {
Method* m = ik->methods()->at(i);
RawBytecodeStream bcs(methodHandle(THREAD, m));
RawBytecodeStream bcs(methodHandle(current, m));
while (!bcs.is_last_bytecode()) {
Bytecodes::Code opcode = bcs.raw_next();
switch (opcode) {

View File

@ -2159,7 +2159,9 @@ void GenerateOopMap::error_work(const char *format, va_list ap) {
os::snprintf(msg_buffer2, sizeof(msg_buffer2), "%s in method %s", msg_buffer, method()->name()->as_C_string());
Thread* current = Thread::current();
if (current->can_call_java()) {
_exception = Exceptions::new_exception(current, vmSymbols::java_lang_LinkageError(), msg_buffer2);
_exception = Exceptions::new_exception(current->as_Java_thread(),
vmSymbols::java_lang_LinkageError(),
msg_buffer2);
} else {
fatal("%s", msg_buffer2);
}
@ -2437,7 +2439,7 @@ class RelocCallback : public RelocatorListener {
// Returns true if expanding was succesful. Otherwise, reports an error and
// returns false.
void GenerateOopMap::expand_current_instr(int bci, int ilen, int newIlen, u_char inst_buffer[]) {
Thread *THREAD = Thread::current(); // Could really have TRAPS argument.
JavaThread* THREAD = JavaThread::current(); // For exception macros.
RelocCallback rcb(this);
Relocator rc(_method, &rcb);
methodHandle m= rc.insert_space_at(bci, newIlen, inst_buffer, THREAD);

View File

@ -197,27 +197,27 @@ bool InstanceKlass::has_nest_member(JavaThread* current, InstanceKlass* k) const
// Called to verify that k is a permitted subclass of this class
bool InstanceKlass::has_as_permitted_subclass(const InstanceKlass* k) const {
Thread* THREAD = Thread::current();
Thread* current = Thread::current();
assert(k != NULL, "sanity check");
assert(_permitted_subclasses != NULL && _permitted_subclasses != Universe::the_empty_short_array(),
"unexpected empty _permitted_subclasses array");
if (log_is_enabled(Trace, class, sealed)) {
ResourceMark rm(THREAD);
ResourceMark rm(current);
log_trace(class, sealed)("Checking for permitted subclass of %s in %s",
k->external_name(), this->external_name());
}
// Check that the class and its super are in the same module.
if (k->module() != this->module()) {
ResourceMark rm(THREAD);
ResourceMark rm(current);
log_trace(class, sealed)("Check failed for same module of permitted subclass %s and sealed class %s",
k->external_name(), this->external_name());
return false;
}
if (!k->is_public() && !is_same_class_package(k)) {
ResourceMark rm(THREAD);
ResourceMark rm(current);
log_trace(class, sealed)("Check failed, subclass %s not public and not in the same package as sealed class %s",
k->external_name(), this->external_name());
return false;
@ -298,7 +298,7 @@ InstanceKlass* InstanceKlass::nest_host(TRAPS) {
// not an instance class.
if (k->is_instance_klass()) {
nest_host_k = InstanceKlass::cast(k);
bool is_member = nest_host_k->has_nest_member(THREAD->as_Java_thread(), this);
bool is_member = nest_host_k->has_nest_member(THREAD, this);
if (is_member) {
_nest_host = nest_host_k; // save resolved nest-host value
@ -764,7 +764,7 @@ void InstanceKlass::eager_initialize_impl() {
EXCEPTION_MARK;
HandleMark hm(THREAD);
Handle h_init_lock(THREAD, init_lock());
ObjectLocker ol(h_init_lock, THREAD->as_Java_thread());
ObjectLocker ol(h_init_lock, THREAD);
// abort if someone beat us to the initialization
if (!is_not_initialized()) return; // note: not equivalent to is_initialized()
@ -853,7 +853,7 @@ bool InstanceKlass::link_class_impl(TRAPS) {
// Timing
// timer handles recursion
JavaThread* jt = THREAD->as_Java_thread();
JavaThread* jt = THREAD;
// link super class before linking this class
Klass* super_klass = super();
@ -965,7 +965,7 @@ bool InstanceKlass::link_class_impl(TRAPS) {
set_init_state(linked);
}
if (JvmtiExport::should_post_class_prepare()) {
JvmtiExport::post_class_prepare(THREAD->as_Java_thread(), this);
JvmtiExport::post_class_prepare(THREAD, this);
}
}
}
@ -1029,7 +1029,7 @@ void InstanceKlass::initialize_impl(TRAPS) {
bool wait = false;
JavaThread* jt = THREAD->as_Java_thread();
JavaThread* jt = THREAD;
// refer to the JVM book page 47 for description of steps
// Step 1
@ -1175,7 +1175,7 @@ void InstanceKlass::initialize_impl(TRAPS) {
void InstanceKlass::set_initialization_state_and_notify(ClassState state, TRAPS) {
Handle h_init_lock(THREAD, init_lock());
if (h_init_lock() != NULL) {
ObjectLocker ol(h_init_lock, THREAD->as_Java_thread());
ObjectLocker ol(h_init_lock, THREAD);
set_init_thread(NULL); // reset _init_thread before changing _init_state
set_init_state(state);
fence_and_clear_init_lock();
@ -1400,7 +1400,7 @@ Klass* InstanceKlass::array_klass(int n, TRAPS) {
// Need load-acquire for lock-free read
if (array_klasses_acquire() == NULL) {
ResourceMark rm(THREAD);
JavaThread *jt = THREAD->as_Java_thread();
JavaThread *jt = THREAD;
{
// Atomic creation of array_klasses
MutexLocker ma(THREAD, MultiArray_lock);
@ -3621,11 +3621,10 @@ void InstanceKlass::print_class_load_logging(ClassLoaderData* loader_data,
info_stream.print(" source: %s", cfs->source());
}
} else if (loader_data == ClassLoaderData::the_null_class_loader_data()) {
Thread* THREAD = Thread::current();
Klass* caller =
THREAD->is_Java_thread()
? THREAD->as_Java_thread()->security_get_caller_class(1)
: NULL;
Thread* current = Thread::current();
Klass* caller = current->is_Java_thread() ?
current->as_Java_thread()->security_get_caller_class(1):
NULL;
// caller can be NULL, for example, during a JVMTI VM_Init hook
if (caller != NULL) {
info_stream.print(" source: instance of %s", caller->external_name());

View File

@ -568,7 +568,7 @@ MethodCounters* Method::build_method_counters(Thread* current, Method* m) {
methodHandle mh(current, m);
MethodCounters* counters;
if (current->is_Java_thread()) {
Thread* THREAD = current;
JavaThread* THREAD = current->as_Java_thread(); // For exception macros.
// Use the TRAPS version for a JavaThread so it will adjust the GC threshold
// if needed.
counters = MethodCounters::allocate_with_exception(mh, THREAD);

View File

@ -665,7 +665,7 @@ public:
}
static int size(bool is_native);
int size() const { return method_size(); }
void log_touched(TRAPS);
void log_touched(Thread* current);
static void print_touched_methods(outputStream* out);
// interpreter support

View File

@ -340,7 +340,7 @@ Klass* ObjArrayKlass::array_klass(int n, TRAPS) {
}
ObjArrayKlass *ak = ObjArrayKlass::cast(higher_dimension());
THREAD->as_Java_thread()->check_possible_safepoint();
THREAD->check_possible_safepoint();
return ak->array_klass(n, THREAD);
}

View File

@ -91,10 +91,10 @@ void oopDesc::verify(oopDesc* oop_desc) {
intptr_t oopDesc::slow_identity_hash() {
// slow case; we have to acquire the micro lock in order to locate the header
Thread* THREAD = Thread::current();
Thread* current = Thread::current();
ResetNoHandleMark rnm; // Might be called from LEAF/QUICK ENTRY
HandleMark hm(THREAD);
Handle object(THREAD, this);
HandleMark hm(current);
Handle object(current, this);
return ObjectSynchronizer::identity_hash_value_for(object);
}

View File

@ -181,7 +181,7 @@ Klass* TypeArrayKlass::array_klass(int n, TRAPS) {
if (higher_dimension_acquire() == NULL) {
ResourceMark rm;
JavaThread *jt = THREAD->as_Java_thread();
JavaThread *jt = THREAD;
{
// Atomic create higher dimension and link into list
MutexLocker mu(THREAD, MultiArray_lock);
@ -199,7 +199,7 @@ Klass* TypeArrayKlass::array_klass(int n, TRAPS) {
}
ObjArrayKlass* h_ak = ObjArrayKlass::cast(higher_dimension());
THREAD->as_Java_thread()->check_possible_safepoint();
THREAD->check_possible_safepoint();
return h_ak->array_klass(n, THREAD);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, 2021, 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
@ -60,7 +60,7 @@ const BufferLayout ForeignGlobals::parse_buffer_layout(jobject jlayout) {
}
ForeignGlobals::ForeignGlobals() {
Thread* current_thread = Thread::current();
JavaThread* current_thread = JavaThread::current();
ResourceMark rm(current_thread);
// ABIDescriptor

View File

@ -3602,7 +3602,7 @@ static jint JNI_CreateJavaVM_inner(JavaVM **vm, void **penv, void *args) {
if (UseJVMCICompiler) {
// JVMCI is initialized on a CompilerThread
if (BootstrapJVMCI) {
JavaThread* THREAD = thread;
JavaThread* THREAD = thread; // For exception macros.
JVMCICompiler* compiler = JVMCICompiler::instance(true, CATCH);
compiler->bootstrap(THREAD);
if (HAS_PENDING_EXCEPTION) {
@ -3643,7 +3643,7 @@ static jint JNI_CreateJavaVM_inner(JavaVM **vm, void **penv, void *args) {
// to continue.
if (Universe::is_fully_initialized()) {
// otherwise no pending exception possible - VM will already have aborted
JavaThread* THREAD = JavaThread::current();
JavaThread* THREAD = JavaThread::current(); // For exception macros.
if (HAS_PENDING_EXCEPTION) {
HandleMark hm(THREAD);
vm_exit_during_initialization(Handle(THREAD, PENDING_EXCEPTION));

View File

@ -145,7 +145,7 @@ static void trace_class_resolution_impl(Klass* to_class, TRAPS) {
const char * source_file = NULL;
const char * trace = "explicit";
InstanceKlass* caller = NULL;
JavaThread* jthread = THREAD->as_Java_thread();
JavaThread* jthread = THREAD;
if (jthread->has_last_Java_frame()) {
vframeStream vfst(jthread);
@ -841,7 +841,7 @@ static jclass jvm_define_class_common(const char *name,
TRAPS) {
if (source == NULL) source = "__JVM_DefineClass__";
JavaThread* jt = THREAD->as_Java_thread();
JavaThread* jt = THREAD;
PerfClassTraceTime vmtimer(ClassLoader::perf_define_appclass_time(),
ClassLoader::perf_define_appclass_selftime(),

View File

@ -216,7 +216,7 @@ JvmtiEnv::GetAllModules(jint* module_count_ptr, jobject** modules_ptr) {
// module_ptr - pre-checked for NULL
jvmtiError
JvmtiEnv::GetNamedModule(jobject class_loader, const char* package_name, jobject* module_ptr) {
JavaThread* THREAD = JavaThread::current(); // pass to macros
JavaThread* THREAD = JavaThread::current(); // For exception macros.
ResourceMark rm(THREAD);
Handle h_loader (THREAD, JNIHandles::resolve(class_loader));
// Check that loader is a subclass of java.lang.ClassLoader.
@ -233,7 +233,7 @@ JvmtiEnv::GetNamedModule(jobject class_loader, const char* package_name, jobject
// to_module - pre-checked for NULL
jvmtiError
JvmtiEnv::AddModuleReads(jobject module, jobject to_module) {
JavaThread* THREAD = JavaThread::current();
JavaThread* THREAD = JavaThread::current(); // For exception macros.
// check module
Handle h_module(THREAD, JNIHandles::resolve(module));
@ -254,7 +254,7 @@ JvmtiEnv::AddModuleReads(jobject module, jobject to_module) {
// to_module - pre-checked for NULL
jvmtiError
JvmtiEnv::AddModuleExports(jobject module, const char* pkg_name, jobject to_module) {
JavaThread* THREAD = JavaThread::current();
JavaThread* THREAD = JavaThread::current(); // For exception macros.
Handle h_pkg = java_lang_String::create_from_str(pkg_name, THREAD);
// check module
@ -276,7 +276,7 @@ JvmtiEnv::AddModuleExports(jobject module, const char* pkg_name, jobject to_modu
// to_module - pre-checked for NULL
jvmtiError
JvmtiEnv::AddModuleOpens(jobject module, const char* pkg_name, jobject to_module) {
JavaThread* THREAD = JavaThread::current();
JavaThread* THREAD = JavaThread::current(); // For exception macros.
Handle h_pkg = java_lang_String::create_from_str(pkg_name, THREAD);
// check module
@ -297,7 +297,7 @@ JvmtiEnv::AddModuleOpens(jobject module, const char* pkg_name, jobject to_module
// service - pre-checked for NULL
jvmtiError
JvmtiEnv::AddModuleUses(jobject module, jclass service) {
JavaThread* THREAD = JavaThread::current();
JavaThread* THREAD = JavaThread::current(); // For exception macros.
// check module
Handle h_module(THREAD, JNIHandles::resolve(module));
@ -319,7 +319,7 @@ JvmtiEnv::AddModuleUses(jobject module, jclass service) {
// impl_class - pre-checked for NULL
jvmtiError
JvmtiEnv::AddModuleProvides(jobject module, jclass service, jclass impl_class) {
JavaThread* THREAD = JavaThread::current();
JavaThread* THREAD = JavaThread::current(); // For exception macros.
// check module
Handle h_module(THREAD, JNIHandles::resolve(module));
@ -345,10 +345,10 @@ JvmtiEnv::AddModuleProvides(jobject module, jclass service, jclass impl_class) {
// is_modifiable_class_ptr - pre-checked for NULL
jvmtiError
JvmtiEnv::IsModifiableModule(jobject module, jboolean* is_modifiable_module_ptr) {
JavaThread* THREAD = JavaThread::current();
JavaThread* current = JavaThread::current();
// check module
Handle h_module(THREAD, JNIHandles::resolve(module));
Handle h_module(current, JNIHandles::resolve(module));
if (!java_lang_Module::is_instance(h_module())) {
return JVMTI_ERROR_INVALID_MODULE;
}
@ -690,7 +690,7 @@ JvmtiEnv::AddToSystemClassLoaderSearch(const char* segment) {
// The phase is checked by the wrapper that called this function,
// but this thread could be racing with the thread that is
// terminating the VM so we check one more time.
JavaThread* THREAD = JavaThread::current();
JavaThread* THREAD = JavaThread::current(); // For exception macros.
HandleMark hm(THREAD);
// create the zip entry (which will open the zip file and hence

View File

@ -2687,7 +2687,7 @@ jint JvmtiExport::load_agent_library(const char *agent, const char *absParam,
delete agent_lib;
} else {
// Invoke the Agent_OnAttach function
JavaThread* THREAD = JavaThread::current();
JavaThread* THREAD = JavaThread::current(); // For exception macros.
{
extern struct JavaVM_ main_vm;
JvmtiThreadEventMark jem(THREAD);

View File

@ -1380,7 +1380,7 @@ jvmtiError VM_RedefineClasses::load_new_class_versions() {
// load hook event.
state->set_class_being_redefined(the_class, _class_load_kind);
Thread* THREAD = current; // for exception processing
JavaThread* THREAD = current; // For exception macros.
ExceptionMark em(THREAD);
Handle protection_domain(THREAD, the_class->protection_domain());
ClassLoadInfo cl_info(protection_domain);
@ -2108,7 +2108,7 @@ bool VM_RedefineClasses::rewrite_cp_refs_in_methods(InstanceKlass* scratch_class
return true;
}
Thread* THREAD = Thread::current(); // For exception processing
JavaThread* THREAD = JavaThread::current(); // For exception macros.
ExceptionMark em(THREAD);
// rewrite constant pool references in the methods:

View File

@ -47,9 +47,9 @@ bool MethodComparator::methods_EMCP(Method* old_method, Method* new_method) {
ConstantPool* old_cp = old_method->constants();
ConstantPool* new_cp = new_method->constants();
Thread* THREAD = Thread::current();
BytecodeStream s_old(methodHandle(THREAD, old_method));
BytecodeStream s_new(methodHandle(THREAD, new_method));
Thread* current = Thread::current();
BytecodeStream s_old(methodHandle(current, old_method));
BytecodeStream s_new(methodHandle(current, new_method));
Bytecodes::Code c_old, c_new;
while ((c_old = s_old.next()) >= 0) {

View File

@ -342,7 +342,7 @@ oop StackWalk::walk(Handle stackStream, jlong mode,
objArrayHandle frames_array,
TRAPS) {
ResourceMark rm(THREAD);
JavaThread* jt = THREAD->as_Java_thread();
JavaThread* jt = THREAD;
log_debug(stackwalk)("Start walking: mode " JLONG_FORMAT " skip %d frames batch size %d",
mode, skip_frames, frame_count);
@ -407,7 +407,7 @@ oop StackWalk::fetchFirstBatch(BaseFrameStream& stream, Handle stackStream,
int end_index = start_index;
int numFrames = 0;
if (!stream.at_end()) {
KeepStackGCProcessedMark keep_stack(THREAD->as_Java_thread());
KeepStackGCProcessedMark keep_stack(THREAD);
numFrames = fill_in_frames(mode, stream, frame_count, start_index,
frames_array, end_index, CHECK_NULL);
if (numFrames < 1) {
@ -463,7 +463,7 @@ jint StackWalk::fetchNextBatch(Handle stackStream, jlong mode, jlong magic,
objArrayHandle frames_array,
TRAPS)
{
JavaThread* jt = THREAD->as_Java_thread();
JavaThread* jt = THREAD;
BaseFrameStream* existing_stream = BaseFrameStream::from_current(jt, magic, frames_array);
if (existing_stream == NULL) {
THROW_MSG_(vmSymbols::java_lang_InternalError(), "doStackWalk: corrupted buffers", 0L);

View File

@ -35,7 +35,7 @@
extern struct JavaVM_ main_vm;
void ProgrammableUpcallHandler::upcall_helper(JavaThread* thread, jobject rec, address buff) {
JavaThread* THREAD = thread;
JavaThread* THREAD = thread; // For exception macros.
ThreadInVMfromNative tiv(THREAD);
const UpcallMethod& upcall_method = instance().upcall_method;
@ -78,7 +78,7 @@ const ProgrammableUpcallHandler& ProgrammableUpcallHandler::instance() {
}
ProgrammableUpcallHandler::ProgrammableUpcallHandler() {
Thread* THREAD = Thread::current();
JavaThread* THREAD = JavaThread::current(); // For exception macros.
ResourceMark rm(THREAD);
Symbol* sym = SymbolTable::new_symbol(FOREIGN_ABI "ProgrammableUpcallHandler");
Klass* k = SystemDictionary::resolve_or_null(sym, Handle(), Handle(), CATCH);

View File

@ -50,7 +50,6 @@
* This method Returns a char* representation of that enum value.
*/
static const char* lookup_diagnosticArgumentEnum(const char* field_name, oop object) {
Thread* THREAD = Thread::current();
const char* enum_sig = "Lsun/hotspot/parser/DiagnosticCommand$DiagnosticArgumentType;";
TempNewSymbol enumSigSymbol = SymbolTable::new_symbol(enum_sig);
int offset = WhiteBox::offset_for_field(field_name, object, enumSigSymbol);

View File

@ -1002,7 +1002,7 @@ bool WhiteBox::validate_cgroup(const char* proc_cgroups,
}
#endif
bool WhiteBox::compile_method(Method* method, int comp_level, int bci, Thread* THREAD) {
bool WhiteBox::compile_method(Method* method, int comp_level, int bci, JavaThread* THREAD) {
// Screen for unavailable/bad comp level or null method
AbstractCompiler* comp = CompileBroker::compiler(comp_level);
if (method == NULL) {
@ -2080,7 +2080,6 @@ WB_END
int WhiteBox::offset_for_field(const char* field_name, oop object,
Symbol* signature_symbol) {
assert(field_name != NULL && strlen(field_name) > 0, "Field name not valid");
Thread* THREAD = Thread::current();
//Get the class of our object
Klass* arg_klass = object->klass();

View File

@ -67,7 +67,7 @@ class WhiteBox : public AllStatic {
static void register_methods(JNIEnv* env, jclass wbclass, JavaThread* thread,
JNINativeMethod* method_array, int method_count);
static void register_extended(JNIEnv* env, jclass wbclass, JavaThread* thread);
static bool compile_method(Method* method, int comp_level, int bci, Thread* THREAD);
static bool compile_method(Method* method, int comp_level, int bci, JavaThread* THREAD);
#ifdef LINUX
static bool validate_cgroup(const char* proc_cgroups, const char* proc_self_cgroup, const char* proc_self_mountinfo, u1* cg_flags);
#endif

View File

@ -218,7 +218,7 @@ static bool rematerialize_objects(JavaThread* thread, int exec_mode, CompiledMet
if (objects != NULL) {
if (exec_mode == Deoptimization::Unpack_none) {
assert(thread->thread_state() == _thread_in_vm, "assumption");
Thread* THREAD = thread;
JavaThread* THREAD = thread; // For exception macros.
// Clear pending OOM if reallocation fails and return true indicating allocation failure
realloc_failures = Deoptimization::realloc_objects(thread, &deoptee, &map, objects, CHECK_AND_CLEAR_(true));
deoptimized_objects = true;
@ -1802,7 +1802,7 @@ JRT_END
MethodData*
Deoptimization::get_method_data(JavaThread* thread, const methodHandle& m,
bool create_if_missing) {
Thread* THREAD = thread;
JavaThread* THREAD = thread; // For exception macros.
MethodData* mdo = m()->method_data();
if (mdo == NULL && create_if_missing && !HAS_PENDING_EXCEPTION) {
// Build an MDO. Ignore errors like OutOfMemory;
@ -1840,7 +1840,7 @@ void Deoptimization::load_class_by_index(const constantPoolHandle& constant_pool
// to the runtime the stack is no longer guarded. Reguard the
// stack otherwise if we return to the uncommon trap blob and the
// stack bang causes a stack overflow we crash.
JavaThread* jt = THREAD->as_Java_thread();
JavaThread* jt = THREAD;
bool guard_pages_enabled = jt->stack_overflow_state()->reguard_stack_if_needed();
assert(guard_pages_enabled, "stack banging in uncommon trap blob may cause crash");
}

Some files were not shown because too many files have changed in this diff Show More