Request for review 7170638: Use DTRACE_PROBE[N] in JNI Set and SetStatic Field.

Mark Wielaard mjw at redhat.com
Mon Oct 1 14:32:36 PDT 2012


On Mon, Oct 01, 2012 at 08:20:32PM +0200, Mark Wielaard wrote:
> On Mon, 2012-10-01 at 08:22 -0400, Keith McGuigan wrote:
> > Those lines in jni.cpp are bordering on "ludicrous" character length, 
> > IMO.  I know we don't have an hard-set character limit (much to my 
> > chagrin), but we should at least try to keep it reasonable to and close 
> > what else is in the surrounding code.  (My bad for not mentioning this 
> > eariler.)
> 
> Please feel free to add a \ line continuation before the second
> DTRACE_PROBE macro on each line. That would still be ~100 character, but
> that would be shorter than some of the surrounding code, and seems like
> a "natural" break place. Normally I don't like such long lines either
> and keep to < 76 so things fit nicely in my terminal window, but since
> this file already had 160+ character lines I thought I would go with the
> flow.

The attached jni.cpp patch does this and seems to work for me.

Cheers,

Mark
-------------- next part --------------
# 7170638: Use DTRACE_PROBE[N] in JNI Set and SetStatic Field.
# Summary: Don't use HS_DTRACE_PROBE_CDECL_N and HS_DTRACE_PROBE_N directly.
# Contributed-by: Mark Wielaard <mjw at redhat.com>

--- openjdk/hotspot/src/share/vm/prims/jni.cpp	2012-10-01 21:32:29.382193266 +0200
+++ openjdk/hotspot/src/share/vm/prims/jni.cpp	2012-10-01 21:34:42.061549400 +0200
@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012 Red Hat, Inc.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -2820,10 +2821,8 @@
 JNI_QUICK_ENTRY(void, jni_Set##Result##Field(JNIEnv *env, jobject obj, jfieldID fieldID, Argument value)) \
   JNIWrapper("Set" XSTR(Result) "Field"); \
 \
-  HS_DTRACE_PROBE_CDECL_N(hotspot_jni, Set##Result##Field__entry, \
-    ( JNIEnv*, jobject, jfieldID FP_SELECT_##Result(COMMA Argument,/*empty*/) ) ); \
-  HS_DTRACE_PROBE_N(hotspot_jni, Set##Result##Field__entry, \
-    ( env, obj, fieldID FP_SELECT_##Result(COMMA value,/*empty*/) ) ); \
+  FP_SELECT_##Result(DTRACE_PROBE4(hotspot_jni, Set##Result##Field__entry, env, obj, fieldID, value), \
+                     DTRACE_PROBE3(hotspot_jni, Set##Result##Field__entry, env, obj, fieldID)); \
 \
   oop o = JNIHandles::resolve_non_null(obj); \
   Klass* k = o->klass(); \
@@ -3130,10 +3129,8 @@
 \
 JNI_ENTRY(void, jni_SetStatic##Result##Field(JNIEnv *env, jclass clazz, jfieldID fieldID, Argument value)) \
   JNIWrapper("SetStatic" XSTR(Result) "Field"); \
-  HS_DTRACE_PROBE_CDECL_N(hotspot_jni, SetStatic##Result##Field__entry,\
-    ( JNIEnv*, jclass, jfieldID FP_SELECT_##Result(COMMA Argument,/*empty*/) ) ); \
-  HS_DTRACE_PROBE_N(hotspot_jni, SetStatic##Result##Field__entry, \
-    ( env, clazz, fieldID FP_SELECT_##Result(COMMA value,/*empty*/) ) ); \
+  FP_SELECT_##Result(DTRACE_PROBE4(hotspot_jni, SetStatic##Result##Field__entry, env, clazz, fieldID, value), \
+                     DTRACE_PROBE3(hotspot_jni, SetStatic##Result##Field__entry, env, clazz, fieldID)); \
 \
   JNIid* id = jfieldIDWorkaround::from_static_jfieldID(fieldID); \
   assert(id->is_static_field_id(), "invalid static field id"); \


More information about the hotspot-dev mailing list