@@ -65,7 +65,7 @@ typedef struct _ciMethodDataRecord {
6565 const char * _signature;
6666
6767 int _state;
68- int _current_mileage ;
68+ int _invocation_counter ;
6969
7070 intptr_t * _data;
7171 char * _orig_data;
@@ -115,6 +115,7 @@ class CompileReplay : public StackObj {
115115 Handle _protection_domain;
116116 bool _protection_domain_initialized;
117117 Handle _loader;
118+ int _version;
118119
119120 GrowableArray<ciMethodRecord*> _ci_method_records;
120121 GrowableArray<ciMethodDataRecord*> _ci_method_data_records;
@@ -159,6 +160,7 @@ class CompileReplay : public StackObj {
159160 _iklass = NULL ;
160161 _entry_bci = 0 ;
161162 _comp_level = 0 ;
163+ _version = 0 ;
162164
163165 test ();
164166 }
@@ -638,6 +640,11 @@ class CompileReplay : public StackObj {
638640 tty->print_cr (" # %s" , _bufptr);
639641 }
640642 skip_remaining ();
643+ } else if (strcmp (" version" , cmd) == 0 ) {
644+ _version = parse_int (" version" );
645+ if (_version < 0 || _version > REPLAY_VERSION) {
646+ tty->print_cr (" # unrecognized version %d, expected 0 <= version <= %d" , _version, REPLAY_VERSION);
647+ }
641648 } else if (strcmp (" compile" , cmd) == 0 ) {
642649 process_compile (CHECK);
643650 } else if (strcmp (" ciMethod" , cmd) == 0 ) {
@@ -802,7 +809,7 @@ class CompileReplay : public StackObj {
802809 rec->_instructions_size = parse_int (" instructions_size" );
803810 }
804811
805- // ciMethodData <klass> <name> <signature> <state> <current_mileage > orig <length> <byte>* data <length> <ptr>* oops <length> (<offset> <klass>)* methods <length> (<offset> <klass> <name> <signature>)*
812+ // ciMethodData <klass> <name> <signature> <state> <invocation_counter > orig <length> <byte>* data <length> <ptr>* oops <length> (<offset> <klass>)* methods <length> (<offset> <klass> <name> <signature>)*
806813 void process_ciMethodData (TRAPS) {
807814 Method* method = parse_method (CHECK);
808815 if (had_error ()) return ;
@@ -827,7 +834,11 @@ class CompileReplay : public StackObj {
827834 // collect and record all the needed information for later
828835 ciMethodDataRecord* rec = new_ciMethodData (method);
829836 rec->_state = parse_int (" state" );
830- rec->_current_mileage = parse_int (" current_mileage" );
837+ if (_version < 1 ) {
838+ parse_int (" current_mileage" );
839+ } else {
840+ rec->_invocation_counter = parse_int (" invocation_counter" );
841+ }
831842
832843 rec->_orig_data = parse_data (" orig" , rec->_orig_data_length );
833844 if (rec->_orig_data == NULL ) {
@@ -876,17 +887,18 @@ class CompileReplay : public StackObj {
876887 void process_instanceKlass (TRAPS) {
877888 // just load the referenced class
878889 Klass* k = parse_klass (CHECK);
879- if (!_protection_domain_initialized && k != NULL ) {
880- assert (_protection_domain () == NULL , " must be uninitialized" );
881- // The first entry is the holder class of the method for which a replay compilation is requested.
882- // Use the same protection domain to load all subsequent classes in order to resolve all classes
883- // in signatures of inlinees. This ensures that inlining can be done as stated in the replay file.
884- _protection_domain = Handle (_thread, k->protection_domain ());
885- }
886890
887- // Only initialize the protection domain handle with the protection domain of the very first entry.
888- // This also ensures that older replay files work.
889- _protection_domain_initialized = true ;
891+ if (_version >= 1 ) {
892+ if (!_protection_domain_initialized && k != NULL ) {
893+ assert (_protection_domain () == NULL , " must be uninitialized" );
894+ // The first entry is the holder class of the method for which a replay compilation is requested.
895+ // Use the same protection domain to load all subsequent classes in order to resolve all classes
896+ // in signatures of inlinees. This ensures that inlining can be done as stated in the replay file.
897+ _protection_domain = Handle (_thread, k->protection_domain ());
898+ }
899+
900+ _protection_domain_initialized = true ;
901+ }
890902
891903 if (k == NULL ) {
892904 return ;
@@ -1413,7 +1425,7 @@ void ciReplay::initialize(ciMethodData* m) {
14131425 tty->cr ();
14141426 } else {
14151427 m->_state = rec->_state ;
1416- m->_current_mileage = rec->_current_mileage ;
1428+ m->_invocation_counter = rec->_invocation_counter ;
14171429 if (rec->_data_length != 0 ) {
14181430 assert (m->_data_size + m->_extra_data_size == rec->_data_length * (int )sizeof (rec->_data [0 ]) ||
14191431 m->_data_size == rec->_data_length * (int )sizeof (rec->_data [0 ]), " must agree" );
0 commit comments