Mercurial > hg > truffle
comparison src/share/vm/code/dependencies.cpp @ 6844:9a9b6e05ffb4
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 | 75f33eecc1b3 |
children | 4735d2c84362 |
comparison
equal
deleted
inserted
replaced
6843:c3e799c37717 | 6844:9a9b6e05ffb4 |
---|---|
331 } | 331 } |
332 bytes.write_byte(code_byte); | 332 bytes.write_byte(code_byte); |
333 for (int j = 0; j < stride; j++) { | 333 for (int j = 0; j < stride; j++) { |
334 if (j == skipj) continue; | 334 if (j == skipj) continue; |
335 ciBaseObject* v = deps->at(i+j); | 335 ciBaseObject* v = deps->at(i+j); |
336 int idx; | |
336 if (v->is_object()) { | 337 if (v->is_object()) { |
337 bytes.write_int(_oop_recorder->find_index(v->as_object()->constant_encoding())); | 338 idx = _oop_recorder->find_index(v->as_object()->constant_encoding()); |
338 } else { | 339 } else { |
339 ciMetadata* meta = v->as_metadata(); | 340 ciMetadata* meta = v->as_metadata(); |
340 bytes.write_int(_oop_recorder->find_index(meta->constant_encoding())); | 341 idx = _oop_recorder->find_index(meta->constant_encoding()); |
341 } | 342 } |
343 bytes.write_int(idx); | |
342 } | 344 } |
343 } | 345 } |
344 } | 346 } |
345 | 347 |
346 // write a sentinel byte to mark the end | 348 // write a sentinel byte to mark the end |
571 DepArgument args[max_arg_count]; | 573 DepArgument args[max_arg_count]; |
572 for (int j = 0; j < nargs; j++) { | 574 for (int j = 0; j < nargs; j++) { |
573 if (type() == call_site_target_value) { | 575 if (type() == call_site_target_value) { |
574 args[j] = argument_oop(j); | 576 args[j] = argument_oop(j); |
575 } else { | 577 } else { |
576 args[j] = argument(j); | 578 args[j] = argument(j); |
577 } | 579 } |
578 } | 580 } |
579 if (_deps != NULL && _deps->log() != NULL) { | 581 if (_deps != NULL && _deps->log() != NULL) { |
580 Dependencies::write_dependency_to(_deps->log(), | 582 Dependencies::write_dependency_to(_deps->log(), |
581 type(), nargs, args, witness); | 583 type(), nargs, args, witness); |
582 } else { | 584 } else { |
663 : JNIHandles::resolve(_deps->oop_recorder()->oop_at(i)); | 665 : JNIHandles::resolve(_deps->oop_recorder()->oop_at(i)); |
664 } | 666 } |
665 | 667 |
666 Metadata* Dependencies::DepStream::argument(int i) { | 668 Metadata* Dependencies::DepStream::argument(int i) { |
667 Metadata* result = recorded_metadata_at(argument_index(i)); | 669 Metadata* result = recorded_metadata_at(argument_index(i)); |
670 | |
671 if (result == NULL) { // Explicit context argument can be compressed | |
672 int ctxkj = dep_context_arg(type()); // -1 if no explicit context arg | |
673 if (ctxkj >= 0 && i == ctxkj && ctxkj+1 < argument_count()) { | |
674 result = ctxk_encoded_as_null(type(), argument(ctxkj+1)); | |
675 } | |
676 } | |
677 | |
668 assert(result == NULL || result->is_klass() || result->is_method(), "must be"); | 678 assert(result == NULL || result->is_klass() || result->is_method(), "must be"); |
669 return result; | 679 return result; |
670 } | 680 } |
671 | 681 |
672 oop Dependencies::DepStream::argument_oop(int i) { | 682 oop Dependencies::DepStream::argument_oop(int i) { |
678 Klass* Dependencies::DepStream::context_type() { | 688 Klass* Dependencies::DepStream::context_type() { |
679 assert(must_be_in_vm(), "raw oops here"); | 689 assert(must_be_in_vm(), "raw oops here"); |
680 | 690 |
681 // Most dependencies have an explicit context type argument. | 691 // Most dependencies have an explicit context type argument. |
682 { | 692 { |
683 int ctxkj = dep_context_arg(_type); // -1 if no explicit context arg | 693 int ctxkj = dep_context_arg(type()); // -1 if no explicit context arg |
684 if (ctxkj >= 0) { | 694 if (ctxkj >= 0) { |
685 Metadata* k = argument(ctxkj); | 695 Metadata* k = argument(ctxkj); |
686 if (k != NULL) { // context type was not compressed away | 696 assert(k != NULL && k->is_klass(), "type check"); |
687 assert(k->is_klass(), "type check"); | 697 return (Klass*)k; |
688 return (Klass*) k; | |
689 } | |
690 // recompute "default" context type | |
691 return ctxk_encoded_as_null(_type, argument(ctxkj+1)); | |
692 } | 698 } |
693 } | 699 } |
694 | 700 |
695 // Some dependencies are using the klass of the first object | 701 // Some dependencies are using the klass of the first object |
696 // argument as implicit context type (e.g. call_site_target_value). | 702 // argument as implicit context type (e.g. call_site_target_value). |
697 { | 703 { |
698 int ctxkj = dep_implicit_context_arg(_type); | 704 int ctxkj = dep_implicit_context_arg(type()); |
699 if (ctxkj >= 0) { | 705 if (ctxkj >= 0) { |
700 Klass* k = argument_oop(ctxkj)->klass(); | 706 Klass* k = argument_oop(ctxkj)->klass(); |
701 assert(k->is_klass(), "type check"); | 707 assert(k != NULL && k->is_klass(), "type check"); |
702 return (Klass*) k; | 708 return (Klass*) k; |
703 } | 709 } |
704 } | 710 } |
705 | 711 |
706 // And some dependencies don't have a context type at all, | 712 // And some dependencies don't have a context type at all, |