changeset 4028:c64eebdc1199

8000232: NPG: SIGSEGV in Dependencies::DepStream::check_klass_dependency on solaris-x64 Summary: Move decoding into Dependencies::DepStream::argument, so no caller could see encoded context value (NULL) anymore. Reviewed-by: twisti, kvn
author vlivanov
date Fri, 05 Oct 2012 19:29:29 -0700
parents 6d47cfd567eb
children 85fb3ddfd7d9
files src/share/vm/code/dependencies.cpp
diffstat 1 files changed, 14 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/code/dependencies.cpp	Fri Oct 05 18:57:10 2012 -0700
+++ b/src/share/vm/code/dependencies.cpp	Fri Oct 05 19:29:29 2012 -0700
@@ -622,7 +622,15 @@
 }
 
 oop Dependencies::DepStream::argument(int i) {
-  return recorded_oop_at(argument_index(i));
+  oop result = recorded_oop_at(argument_index(i));
+  if (result == NULL) { // Explicit context argument can be compressed
+    int ctxkj = dep_context_arg(type());  // -1 if no explicit context arg
+     if (ctxkj >= 0 && i == ctxkj && ctxkj+1 < argument_count()) {
+       result = ctxk_encoded_as_null(type(), argument(ctxkj+1));
+     }
+  }
+
+  return result;
 }
 
 klassOop Dependencies::DepStream::context_type() {
@@ -630,25 +638,21 @@
 
   // Most dependencies have an explicit context type argument.
   {
-    int ctxkj = dep_context_arg(_type);  // -1 if no explicit context arg
+    int ctxkj = dep_context_arg(type());  // -1 if no explicit context arg
     if (ctxkj >= 0) {
       oop k = argument(ctxkj);
-      if (k != NULL) {       // context type was not compressed away
-        assert(k->is_klass(), "type check");
-        return (klassOop) k;
-      }
-      // recompute "default" context type
-      return ctxk_encoded_as_null(_type, argument(ctxkj+1));
+      assert(k != NULL && k->is_klass(), "type check");
+      return (klassOop) k;
     }
   }
 
   // Some dependencies are using the klass of the first object
   // argument as implicit context type (e.g. call_site_target_value).
   {
-    int ctxkj = dep_implicit_context_arg(_type);
+    int ctxkj = dep_implicit_context_arg(type());
     if (ctxkj >= 0) {
       oop k = argument(ctxkj)->klass();
-      assert(k->is_klass(), "type check");
+      assert(k != NULL && k->is_klass(), "type check");
       return (klassOop) k;
     }
   }