Fri, 05 Oct 2012 19:29:29 -0700
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
src/share/vm/code/dependencies.cpp | file | annotate | diff | comparison | revisions |
1.1 --- a/src/share/vm/code/dependencies.cpp Fri Oct 05 18:57:10 2012 -0700 1.2 +++ b/src/share/vm/code/dependencies.cpp Fri Oct 05 19:29:29 2012 -0700 1.3 @@ -333,12 +333,14 @@ 1.4 for (int j = 0; j < stride; j++) { 1.5 if (j == skipj) continue; 1.6 ciBaseObject* v = deps->at(i+j); 1.7 + int idx; 1.8 if (v->is_object()) { 1.9 - bytes.write_int(_oop_recorder->find_index(v->as_object()->constant_encoding())); 1.10 + idx = _oop_recorder->find_index(v->as_object()->constant_encoding()); 1.11 } else { 1.12 ciMetadata* meta = v->as_metadata(); 1.13 - bytes.write_int(_oop_recorder->find_index(meta->constant_encoding())); 1.14 + idx = _oop_recorder->find_index(meta->constant_encoding()); 1.15 } 1.16 + bytes.write_int(idx); 1.17 } 1.18 } 1.19 } 1.20 @@ -573,8 +575,8 @@ 1.21 if (type() == call_site_target_value) { 1.22 args[j] = argument_oop(j); 1.23 } else { 1.24 - args[j] = argument(j); 1.25 - } 1.26 + args[j] = argument(j); 1.27 + } 1.28 } 1.29 if (_deps != NULL && _deps->log() != NULL) { 1.30 Dependencies::write_dependency_to(_deps->log(), 1.31 @@ -665,6 +667,14 @@ 1.32 1.33 Metadata* Dependencies::DepStream::argument(int i) { 1.34 Metadata* result = recorded_metadata_at(argument_index(i)); 1.35 + 1.36 + if (result == NULL) { // Explicit context argument can be compressed 1.37 + int ctxkj = dep_context_arg(type()); // -1 if no explicit context arg 1.38 + if (ctxkj >= 0 && i == ctxkj && ctxkj+1 < argument_count()) { 1.39 + result = ctxk_encoded_as_null(type(), argument(ctxkj+1)); 1.40 + } 1.41 + } 1.42 + 1.43 assert(result == NULL || result->is_klass() || result->is_method(), "must be"); 1.44 return result; 1.45 } 1.46 @@ -680,25 +690,21 @@ 1.47 1.48 // Most dependencies have an explicit context type argument. 1.49 { 1.50 - int ctxkj = dep_context_arg(_type); // -1 if no explicit context arg 1.51 + int ctxkj = dep_context_arg(type()); // -1 if no explicit context arg 1.52 if (ctxkj >= 0) { 1.53 Metadata* k = argument(ctxkj); 1.54 - if (k != NULL) { // context type was not compressed away 1.55 - assert(k->is_klass(), "type check"); 1.56 - return (Klass*) k; 1.57 - } 1.58 - // recompute "default" context type 1.59 - return ctxk_encoded_as_null(_type, argument(ctxkj+1)); 1.60 + assert(k != NULL && k->is_klass(), "type check"); 1.61 + return (Klass*)k; 1.62 } 1.63 } 1.64 1.65 // Some dependencies are using the klass of the first object 1.66 // argument as implicit context type (e.g. call_site_target_value). 1.67 { 1.68 - int ctxkj = dep_implicit_context_arg(_type); 1.69 + int ctxkj = dep_implicit_context_arg(type()); 1.70 if (ctxkj >= 0) { 1.71 Klass* k = argument_oop(ctxkj)->klass(); 1.72 - assert(k->is_klass(), "type check"); 1.73 + assert(k != NULL && k->is_klass(), "type check"); 1.74 return (Klass*) k; 1.75 } 1.76 }