changeset 21113:0cf5897db25a

Better assertion message for NULL deference in graalJavaAccess
author Tom Rodriguez <tom.rodriguez@oracle.com>
date Wed, 22 Apr 2015 16:42:05 -0700
parents f01ebceea995
children 2daf39328194
files src/share/vm/graal/graalJavaAccess.hpp
diffstat 1 files changed, 10 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/graal/graalJavaAccess.hpp	Wed Apr 22 16:34:32 2015 -0700
+++ b/src/share/vm/graal/graalJavaAccess.hpp	Wed Apr 22 16:42:05 2015 -0700
@@ -273,8 +273,8 @@
 class name : AllStatic {                                                                                                                                       \
   private:                                                                                                                                                     \
     friend class GraalCompiler;                                                                                                                                \
-    static void check(oop obj) {                                                                                                                               \
-        assert(obj != NULL, "NULL field access of class " #name);                                                                                              \
+    static void check(oop obj, const char* field_name) {                                                                                                       \
+        assert(obj != NULL, err_msg("NULL field access of %s.%s", #name, field_name));                                                                         \
         assert(obj->is_a(SystemDictionary::name##_klass()), "wrong class, " #name " expected");                                                                \
     }                                                                                                                                                          \
     static void compute_offsets();                                                                                                                             \
@@ -283,14 +283,14 @@
 
 #define END_CLASS };
 
-#define FIELD(name, type, accessor, cast)                                                                                                                      \
-    static int _##name##_offset;                                                                                                                               \
-    static type name(oop obj)                   { check(obj); return cast obj->accessor(_##name##_offset); } \
-    static type name(Handle& obj)                { check(obj()); return cast obj->accessor(_##name##_offset); } \
-    static type name(jobject obj)               { check(JNIHandles::resolve(obj)); return cast JNIHandles::resolve(obj)->accessor(_##name##_offset); }              \
-    static void set_##name(oop obj, type x)     { check(obj); obj->accessor##_put(_##name##_offset, x); }                                                      \
-    static void set_##name(Handle& obj, type x)  { check(obj()); obj->accessor##_put(_##name##_offset, x); }                                                   \
-    static void set_##name(jobject obj, type x) { check(JNIHandles::resolve(obj)); JNIHandles::resolve(obj)->accessor##_put(_##name##_offset, x); }
+#define FIELD(name, type, accessor, cast)                                                                                                                         \
+    static int _##name##_offset;                                                                                                                                  \
+    static type name(oop obj)                   { check(obj, #name); return cast obj->accessor(_##name##_offset); }                                               \
+    static type name(Handle& obj)                { check(obj(), #name); return cast obj->accessor(_##name##_offset); }                                            \
+    static type name(jobject obj)               { check(JNIHandles::resolve(obj), #name); return cast JNIHandles::resolve(obj)->accessor(_##name##_offset); }     \
+    static void set_##name(oop obj, type x)     { check(obj, #name); obj->accessor##_put(_##name##_offset, x); }                                                  \
+    static void set_##name(Handle& obj, type x)  { check(obj(), #name); obj->accessor##_put(_##name##_offset, x); }                                               \
+    static void set_##name(jobject obj, type x) { check(JNIHandles::resolve(obj), #name); JNIHandles::resolve(obj)->accessor##_put(_##name##_offset, x); }
 
 #define EMPTY_CAST 
 #define CHAR_FIELD(klass, name) FIELD(name, jchar, char_field, EMPTY_CAST)