comparison src/share/vm/prims/jvm.cpp @ 10408:836a62f43af9

Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/
author Doug Simon <doug.simon@oracle.com>
date Wed, 19 Jun 2013 10:45:56 +0200
parents b9a918201d47 f2110083203d
children e376b764fdc7
comparison
equal deleted inserted replaced
10086:e0fb8a213650 10408:836a62f43af9
57 #include "runtime/vframe.hpp" 57 #include "runtime/vframe.hpp"
58 #include "runtime/vm_operations.hpp" 58 #include "runtime/vm_operations.hpp"
59 #include "services/attachListener.hpp" 59 #include "services/attachListener.hpp"
60 #include "services/management.hpp" 60 #include "services/management.hpp"
61 #include "services/threadService.hpp" 61 #include "services/threadService.hpp"
62 #include "trace/tracing.hpp"
62 #include "utilities/copy.hpp" 63 #include "utilities/copy.hpp"
63 #include "utilities/defaultStream.hpp" 64 #include "utilities/defaultStream.hpp"
64 #include "utilities/dtrace.hpp" 65 #include "utilities/dtrace.hpp"
65 #include "utilities/events.hpp" 66 #include "utilities/events.hpp"
66 #include "utilities/histogram.hpp" 67 #include "utilities/histogram.hpp"
1072 if (java_lang_Class::is_primitive(JNIHandles::resolve_non_null(cls))) { 1073 if (java_lang_Class::is_primitive(JNIHandles::resolve_non_null(cls))) {
1073 // There are no signers for primitive types 1074 // There are no signers for primitive types
1074 return NULL; 1075 return NULL;
1075 } 1076 }
1076 1077
1077 Klass* k = java_lang_Class::as_Klass(JNIHandles::resolve_non_null(cls)); 1078 objArrayOop signers = java_lang_Class::signers(JNIHandles::resolve_non_null(cls));
1078 objArrayOop signers = NULL;
1079 if (k->oop_is_instance()) {
1080 signers = InstanceKlass::cast(k)->signers();
1081 }
1082 1079
1083 // If there are no signers set in the class, or if the class 1080 // If there are no signers set in the class, or if the class
1084 // is an array, return NULL. 1081 // is an array, return NULL.
1085 if (signers == NULL) return NULL; 1082 if (signers == NULL) return NULL;
1086 1083
1102 // This call is ignored for primitive types and arrays. 1099 // This call is ignored for primitive types and arrays.
1103 // Signers are only set once, ClassLoader.java, and thus shouldn't 1100 // Signers are only set once, ClassLoader.java, and thus shouldn't
1104 // be called with an array. Only the bootstrap loader creates arrays. 1101 // be called with an array. Only the bootstrap loader creates arrays.
1105 Klass* k = java_lang_Class::as_Klass(JNIHandles::resolve_non_null(cls)); 1102 Klass* k = java_lang_Class::as_Klass(JNIHandles::resolve_non_null(cls));
1106 if (k->oop_is_instance()) { 1103 if (k->oop_is_instance()) {
1107 InstanceKlass::cast(k)->set_signers(objArrayOop(JNIHandles::resolve(signers))); 1104 java_lang_Class::set_signers(k->java_mirror(), objArrayOop(JNIHandles::resolve(signers)));
1108 } 1105 }
1109 } 1106 }
1110 JVM_END 1107 JVM_END
1111 1108
1112 1109
1119 if (java_lang_Class::is_primitive(JNIHandles::resolve(cls))) { 1116 if (java_lang_Class::is_primitive(JNIHandles::resolve(cls))) {
1120 // Primitive types does not have a protection domain. 1117 // Primitive types does not have a protection domain.
1121 return NULL; 1118 return NULL;
1122 } 1119 }
1123 1120
1124 Klass* k = java_lang_Class::as_Klass(JNIHandles::resolve(cls)); 1121 oop pd = java_lang_Class::protection_domain(JNIHandles::resolve(cls));
1125 return (jobject) JNIHandles::make_local(env, k->protection_domain()); 1122 return (jobject) JNIHandles::make_local(env, pd);
1126 JVM_END 1123 JVM_END
1127 1124
1128 1125
1129 // Obsolete since 1.2 (Class.setProtectionDomain removed), although 1126 // Obsolete since 1.2 (Class.setProtectionDomain removed), although
1130 // still defined in core libraries as of 1.5. 1127 // still defined in core libraries as of 1.5.
1139 1136
1140 // cls won't be an array, as this called only from ClassLoader.defineClass 1137 // cls won't be an array, as this called only from ClassLoader.defineClass
1141 if (k->oop_is_instance()) { 1138 if (k->oop_is_instance()) {
1142 oop pd = JNIHandles::resolve(protection_domain); 1139 oop pd = JNIHandles::resolve(protection_domain);
1143 assert(pd == NULL || pd->is_oop(), "just checking"); 1140 assert(pd == NULL || pd->is_oop(), "just checking");
1144 InstanceKlass::cast(k)->set_protection_domain(pd); 1141 java_lang_Class::set_protection_domain(k->java_mirror(), pd);
1145 } 1142 }
1146 } 1143 }
1147 JVM_END 1144 JVM_END
1148 1145
1149 1146
1710 objArrayHandle result (THREAD, result_oop); 1707 objArrayHandle result (THREAD, result_oop);
1711 1708
1712 for (int i = 0; i < num_params; i++) { 1709 for (int i = 0; i < num_params; i++) {
1713 MethodParametersElement* params = mh->method_parameters_start(); 1710 MethodParametersElement* params = mh->method_parameters_start();
1714 // For a 0 index, give a NULL symbol 1711 // For a 0 index, give a NULL symbol
1715 Symbol* const sym = 0 != params[i].name_cp_index ? 1712 Symbol* sym = 0 != params[i].name_cp_index ?
1716 mh->constants()->symbol_at(params[i].name_cp_index) : NULL; 1713 mh->constants()->symbol_at(params[i].name_cp_index) : NULL;
1717 int flags = params[i].flags; 1714 int flags = params[i].flags;
1718 oop param = Reflection::new_parameter(reflected_method, i, sym, 1715 oop param = Reflection::new_parameter(reflected_method, i, sym,
1719 flags, CHECK_NULL); 1716 flags, CHECK_NULL);
1720 result->obj_at_put(i, param); 1717 result->obj_at_put(i, param);
3003 #else /* USDT2 */ 3000 #else /* USDT2 */
3004 HOTSPOT_THREAD_SLEEP_BEGIN( 3001 HOTSPOT_THREAD_SLEEP_BEGIN(
3005 millis); 3002 millis);
3006 #endif /* USDT2 */ 3003 #endif /* USDT2 */
3007 3004
3005 EventThreadSleep event;
3006
3008 if (millis == 0) { 3007 if (millis == 0) {
3009 // When ConvertSleepToYield is on, this matches the classic VM implementation of 3008 // When ConvertSleepToYield is on, this matches the classic VM implementation of
3010 // JVM_Sleep. Critical for similar threading behaviour (Win32) 3009 // JVM_Sleep. Critical for similar threading behaviour (Win32)
3011 // It appears that in certain GUI contexts, it may be beneficial to do a short sleep 3010 // It appears that in certain GUI contexts, it may be beneficial to do a short sleep
3012 // for SOLARIS 3011 // for SOLARIS
3023 thread->osthread()->set_state(SLEEPING); 3022 thread->osthread()->set_state(SLEEPING);
3024 if (os::sleep(thread, millis, true) == OS_INTRPT) { 3023 if (os::sleep(thread, millis, true) == OS_INTRPT) {
3025 // An asynchronous exception (e.g., ThreadDeathException) could have been thrown on 3024 // An asynchronous exception (e.g., ThreadDeathException) could have been thrown on
3026 // us while we were sleeping. We do not overwrite those. 3025 // us while we were sleeping. We do not overwrite those.
3027 if (!HAS_PENDING_EXCEPTION) { 3026 if (!HAS_PENDING_EXCEPTION) {
3027 if (event.should_commit()) {
3028 event.set_time(millis);
3029 event.commit();
3030 }
3028 #ifndef USDT2 3031 #ifndef USDT2
3029 HS_DTRACE_PROBE1(hotspot, thread__sleep__end,1); 3032 HS_DTRACE_PROBE1(hotspot, thread__sleep__end,1);
3030 #else /* USDT2 */ 3033 #else /* USDT2 */
3031 HOTSPOT_THREAD_SLEEP_END( 3034 HOTSPOT_THREAD_SLEEP_END(
3032 1); 3035 1);
3035 // to properly restore the thread state. That's likely wrong. 3038 // to properly restore the thread state. That's likely wrong.
3036 THROW_MSG(vmSymbols::java_lang_InterruptedException(), "sleep interrupted"); 3039 THROW_MSG(vmSymbols::java_lang_InterruptedException(), "sleep interrupted");
3037 } 3040 }
3038 } 3041 }
3039 thread->osthread()->set_state(old_state); 3042 thread->osthread()->set_state(old_state);
3043 }
3044 if (event.should_commit()) {
3045 event.set_time(millis);
3046 event.commit();
3040 } 3047 }
3041 #ifndef USDT2 3048 #ifndef USDT2
3042 HS_DTRACE_PROBE1(hotspot, thread__sleep__end,0); 3049 HS_DTRACE_PROBE1(hotspot, thread__sleep__end,0);
3043 #else /* USDT2 */ 3050 #else /* USDT2 */
3044 HOTSPOT_THREAD_SLEEP_END( 3051 HOTSPOT_THREAD_SLEEP_END(