changeset 4795:f49e0508a38a

4965252: JvmtiExport::post_raw_field_modification jni ref handling is odd Reviewed-by: coleenp, sspitsyn
author rbackman
date Wed, 15 May 2013 11:30:54 +0200
parents 513a5298c1dd
children 243469d929e6 6ce351ac7339
files src/share/vm/prims/jvmtiExport.cpp
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/prims/jvmtiExport.cpp	Tue May 14 17:33:07 2013 +0000
+++ b/src/share/vm/prims/jvmtiExport.cpp	Wed May 15 11:30:54 2013 +0200
@@ -1624,15 +1624,19 @@
     }
   }
 
+  assert(sig_type != '[', "array should have sig_type == 'L'");
+  bool handle_created = false;
+
   // convert oop to JNI handle.
-  if (sig_type == 'L' || sig_type == '[') {
+  if (sig_type == 'L') {
+    handle_created = true;
     value->l = (jobject)JNIHandles::make_local(thread, (oop)value->l);
   }
 
   post_field_modification(thread, method, location, field_klass, object, field, sig_type, value);
 
   // Destroy the JNI handle allocated above.
-  if (sig_type == 'L') {
+  if (handle_created) {
     JNIHandles::destroy_local(value->l);
   }
 }