< prev index next >

src/hotspot/share/services/attachListener.cpp

Print this page

 64 }
 65 
 66 static jint get_properties(AttachOperation* op, outputStream* out, Symbol* serializePropertiesMethod) {
 67   JavaThread* THREAD = JavaThread::current(); // For exception macros.
 68   HandleMark hm(THREAD);
 69 
 70   // load VMSupport
 71   Symbol* klass = vmSymbols::jdk_internal_vm_VMSupport();
 72   InstanceKlass* k = load_and_initialize_klass(klass, THREAD);
 73   if (HAS_PENDING_EXCEPTION) {
 74     java_lang_Throwable::print(PENDING_EXCEPTION, out);
 75     CLEAR_PENDING_EXCEPTION;
 76     return JNI_ERR;
 77   }
 78 
 79   // invoke the serializePropertiesToByteArray method
 80   JavaValue result(T_OBJECT);
 81   JavaCallArguments args;
 82 
 83 
 84   Symbol* signature = vmSymbols::serializePropertiesToByteArray_signature();
 85   JavaCalls::call_static(&result,
 86                          k,
 87                          serializePropertiesMethod,
 88                          signature,
 89                          &args,
 90                          THREAD);
 91   if (HAS_PENDING_EXCEPTION) {
 92     java_lang_Throwable::print(PENDING_EXCEPTION, out);
 93     CLEAR_PENDING_EXCEPTION;
 94     return JNI_ERR;
 95   }
 96 
 97   // The result should be a [B
 98   oop res = result.get_oop();
 99   assert(res->is_typeArray(), "just checking");
100   assert(TypeArrayKlass::cast(res->klass())->element_type() == T_BYTE, "just checking");
101 
102   // copy the bytes to the output stream
103   typeArrayOop ba = typeArrayOop(res);
104   jbyte* addr = typeArrayOop(res)->byte_at_addr(0);

 64 }
 65 
 66 static jint get_properties(AttachOperation* op, outputStream* out, Symbol* serializePropertiesMethod) {
 67   JavaThread* THREAD = JavaThread::current(); // For exception macros.
 68   HandleMark hm(THREAD);
 69 
 70   // load VMSupport
 71   Symbol* klass = vmSymbols::jdk_internal_vm_VMSupport();
 72   InstanceKlass* k = load_and_initialize_klass(klass, THREAD);
 73   if (HAS_PENDING_EXCEPTION) {
 74     java_lang_Throwable::print(PENDING_EXCEPTION, out);
 75     CLEAR_PENDING_EXCEPTION;
 76     return JNI_ERR;
 77   }
 78 
 79   // invoke the serializePropertiesToByteArray method
 80   JavaValue result(T_OBJECT);
 81   JavaCallArguments args;
 82 
 83 
 84   Symbol* signature = vmSymbols::void_byte_array_signature();
 85   JavaCalls::call_static(&result,
 86                          k,
 87                          serializePropertiesMethod,
 88                          signature,
 89                          &args,
 90                          THREAD);
 91   if (HAS_PENDING_EXCEPTION) {
 92     java_lang_Throwable::print(PENDING_EXCEPTION, out);
 93     CLEAR_PENDING_EXCEPTION;
 94     return JNI_ERR;
 95   }
 96 
 97   // The result should be a [B
 98   oop res = result.get_oop();
 99   assert(res->is_typeArray(), "just checking");
100   assert(TypeArrayKlass::cast(res->klass())->element_type() == T_BYTE, "just checking");
101 
102   // copy the bytes to the output stream
103   typeArrayOop ba = typeArrayOop(res);
104   jbyte* addr = typeArrayOop(res)->byte_at_addr(0);
< prev index next >