diff --git a/agent/src/share/classes/sun/jvm/hotspot/oops/OopUtilities.java b/agent/src/share/classes/sun/jvm/hotspot/oops/OopUtilities.java index aa5f2bc21b1e37ed3460e01415d72d5f47e9ec66..80da199e2def90d70ecd974217ea6e8ab2d90c7c 100644 --- a/agent/src/share/classes/sun/jvm/hotspot/oops/OopUtilities.java +++ b/agent/src/share/classes/sun/jvm/hotspot/oops/OopUtilities.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2016, 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 @@ -219,7 +219,7 @@ public class OopUtilities implements /* imports */ JVMTIThreadState { if (threadNameField == null) { SystemDictionary sysDict = VM.getVM().getSystemDictionary(); InstanceKlass k = sysDict.getThreadKlass(); - threadNameField = (OopField) k.findField("name", "[C"); + threadNameField = (OopField) k.findField("name", "Ljava/lang/String;"); threadGroupField = (OopField) k.findField("group", "Ljava/lang/ThreadGroup;"); threadEETopField = (LongField) k.findField("eetop", "J"); threadTIDField = (LongField) k.findField("tid", "J"); @@ -258,7 +258,7 @@ public class OopUtilities implements /* imports */ JVMTIThreadState { public static String threadOopGetName(Oop threadOop) { initThreadFields(); - return charArrayToString((TypeArray) threadNameField.getValue(threadOop)); + return stringOopToString(threadNameField.getValue(threadOop)); } /** May return null if, e.g., thread was not started */ diff --git a/src/share/vm/classfile/javaClasses.cpp b/src/share/vm/classfile/javaClasses.cpp index c245cc58f1a08b92c2404d601aa679f8b7ca94bd..65900a23f3d325d3acdc8f2ad23212d27a37579d 100644 --- a/src/share/vm/classfile/javaClasses.cpp +++ b/src/share/vm/classfile/javaClasses.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2016, 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 @@ -936,7 +936,7 @@ void java_lang_Thread::compute_offsets() { assert(_group_offset == 0, "offsets should be initialized only once"); Klass* k = SystemDictionary::Thread_klass(); - compute_offset(_name_offset, k, vmSymbols::name_name(), vmSymbols::char_array_signature()); + compute_offset(_name_offset, k, vmSymbols::name_name(), vmSymbols::string_signature()); compute_offset(_group_offset, k, vmSymbols::group_name(), vmSymbols::threadgroup_signature()); compute_offset(_contextClassLoader_offset, k, vmSymbols::contextClassLoader_name(), vmSymbols::classloader_signature()); compute_offset(_inheritedAccessControlContext_offset, k, vmSymbols::inheritedAccessControlContext_name(), vmSymbols::accesscontrolcontext_signature()); @@ -966,15 +966,12 @@ void java_lang_Thread::set_thread(oop java_thread, JavaThread* thread) { } -typeArrayOop java_lang_Thread::name(oop java_thread) { - oop name = java_thread->obj_field(_name_offset); - assert(name == NULL || (name->is_typeArray() && TypeArrayKlass::cast(name->klass())->element_type() == T_CHAR), "just checking"); - return typeArrayOop(name); +oop java_lang_Thread::name(oop java_thread) { + return java_thread->obj_field(_name_offset); } -void java_lang_Thread::set_name(oop java_thread, typeArrayOop name) { - assert(java_thread->obj_field(_name_offset) == NULL, "name should be NULL"); +void java_lang_Thread::set_name(oop java_thread, oop name) { java_thread->obj_field_put(_name_offset, name); } diff --git a/src/share/vm/classfile/javaClasses.hpp b/src/share/vm/classfile/javaClasses.hpp index 5e497e6aa068f0ef67ac57c11415e4879deaa8e8..02784dcb4d682fe7faae25b2761b0fe575ad03c1 100644 --- a/src/share/vm/classfile/javaClasses.hpp +++ b/src/share/vm/classfile/javaClasses.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2016, 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 @@ -343,8 +343,8 @@ class java_lang_Thread : AllStatic { // Set JavaThread for instance static void set_thread(oop java_thread, JavaThread* thread); // Name - static typeArrayOop name(oop java_thread); - static void set_name(oop java_thread, typeArrayOop name); + static oop name(oop java_thread); + static void set_name(oop java_thread, oop name); // Priority static ThreadPriority priority(oop java_thread); static void set_priority(oop java_thread, ThreadPriority priority); diff --git a/src/share/vm/prims/jvmtiEnv.cpp b/src/share/vm/prims/jvmtiEnv.cpp index c9d53cff4efd8213603aadc28d547f51ac78ff51..402f8167281ae58b2fd528197e3f3d684d14d651 100644 --- a/src/share/vm/prims/jvmtiEnv.cpp +++ b/src/share/vm/prims/jvmtiEnv.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2016, 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 @@ -946,7 +946,7 @@ JvmtiEnv::GetThreadInfo(jthread thread, jvmtiThreadInfo* info_ptr) { return JVMTI_ERROR_INVALID_THREAD; Handle thread_obj(current_thread, thread_oop); - typeArrayHandle name; + Handle name; ThreadPriority priority; Handle thread_group; Handle context_class_loader; @@ -954,7 +954,7 @@ JvmtiEnv::GetThreadInfo(jthread thread, jvmtiThreadInfo* info_ptr) { { MutexLocker mu(Threads_lock); - name = typeArrayHandle(current_thread, java_lang_Thread::name(thread_obj())); + name = Handle(current_thread, java_lang_Thread::name(thread_obj())); priority = java_lang_Thread::priority(thread_obj()); thread_group = Handle(current_thread, java_lang_Thread::threadGroup(thread_obj())); is_daemon = java_lang_Thread::is_daemon(thread_obj()); @@ -965,7 +965,7 @@ JvmtiEnv::GetThreadInfo(jthread thread, jvmtiThreadInfo* info_ptr) { { const char *n; if (name() != NULL) { - n = UNICODE::as_utf8((jchar*) name->base(T_CHAR), name->length()); + n = java_lang_String::as_utf8_string(name()); } else { n = UNICODE::as_utf8(NULL, 0); } diff --git a/src/share/vm/prims/jvmtiTrace.cpp b/src/share/vm/prims/jvmtiTrace.cpp index 279e23ab3c6f2710658406901e2ea140fb85c055..c705ecfd9fbf265667bb21f8639e5227853687bd 100644 --- a/src/share/vm/prims/jvmtiTrace.cpp +++ b/src/share/vm/prims/jvmtiTrace.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2016, 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 @@ -266,11 +266,11 @@ const char *JvmtiTrace::safe_get_thread_name(Thread *thread) { if (threadObj == NULL) { return "NULL"; } - typeArrayOop name = java_lang_Thread::name(threadObj); + oop name = java_lang_Thread::name(threadObj); if (name == NULL) { return ""; } - return UNICODE::as_utf8((jchar*) name->base(T_CHAR), name->length()); + return java_lang_String::as_utf8_string(name); } diff --git a/src/share/vm/runtime/thread.cpp b/src/share/vm/runtime/thread.cpp index 4866ec1ef3ac3851153a2ca7c1900830494d2758..0dc86d9651f5990d3004af348e56221db75877d3 100644 --- a/src/share/vm/runtime/thread.cpp +++ b/src/share/vm/runtime/thread.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2016, 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 @@ -2926,13 +2926,13 @@ const char* JavaThread::get_thread_name_string(char* buf, int buflen) const { const char* name_str; oop thread_obj = threadObj(); if (thread_obj != NULL) { - typeArrayOop name = java_lang_Thread::name(thread_obj); + oop name = java_lang_Thread::name(thread_obj); if (name != NULL) { if (buf == NULL) { - name_str = UNICODE::as_utf8((jchar*) name->base(T_CHAR), name->length()); + name_str = java_lang_String::as_utf8_string(name); } else { - name_str = UNICODE::as_utf8((jchar*) name->base(T_CHAR), name->length(), buf, buflen); + name_str = java_lang_String::as_utf8_string(name, buf, buflen); } } else if (is_attaching_via_jni()) { // workaround for 6412693 - see 6404306