4965252: JvmtiExport::post_raw_field_modification jni ref handling is odd

Wed, 15 May 2013 11:30:54 +0200

author
rbackman
date
Wed, 15 May 2013 11:30:54 +0200
changeset 5131
f49e0508a38a
parent 5104
513a5298c1dd
child 5132
243469d929e6
child 5140
6ce351ac7339

4965252: JvmtiExport::post_raw_field_modification jni ref handling is odd
Reviewed-by: coleenp, sspitsyn

src/share/vm/prims/jvmtiExport.cpp file | annotate | diff | comparison | revisions
     1.1 --- a/src/share/vm/prims/jvmtiExport.cpp	Tue May 14 17:33:07 2013 +0000
     1.2 +++ b/src/share/vm/prims/jvmtiExport.cpp	Wed May 15 11:30:54 2013 +0200
     1.3 @@ -1624,15 +1624,19 @@
     1.4      }
     1.5    }
     1.6  
     1.7 +  assert(sig_type != '[', "array should have sig_type == 'L'");
     1.8 +  bool handle_created = false;
     1.9 +
    1.10    // convert oop to JNI handle.
    1.11 -  if (sig_type == 'L' || sig_type == '[') {
    1.12 +  if (sig_type == 'L') {
    1.13 +    handle_created = true;
    1.14      value->l = (jobject)JNIHandles::make_local(thread, (oop)value->l);
    1.15    }
    1.16  
    1.17    post_field_modification(thread, method, location, field_klass, object, field, sig_type, value);
    1.18  
    1.19    // Destroy the JNI handle allocated above.
    1.20 -  if (sig_type == 'L') {
    1.21 +  if (handle_created) {
    1.22      JNIHandles::destroy_local(value->l);
    1.23    }
    1.24  }

mercurial