hotspot/src/share/vm/code/dependencies.hpp
changeset 4493 9204129f065e
parent 1 489c9b5090e2
child 5547 f4b087cbb361
equal deleted inserted replaced
4492:63c49e60fc25 4493:9204129f065e
   468 // The change is structured as a single new type with any number of supers
   468 // The change is structured as a single new type with any number of supers
   469 // and implemented interface types.  Other than the new type, any of the
   469 // and implemented interface types.  Other than the new type, any of the
   470 // super types can be context types for a relevant dependency, which the
   470 // super types can be context types for a relevant dependency, which the
   471 // new type could invalidate.
   471 // new type could invalidate.
   472 class DepChange : public StackObj {
   472 class DepChange : public StackObj {
   473  private:
   473  public:
   474   enum ChangeType {
   474   enum ChangeType {
   475     NO_CHANGE = 0,              // an uninvolved klass
   475     NO_CHANGE = 0,              // an uninvolved klass
   476     Change_new_type,            // a newly loaded type
   476     Change_new_type,            // a newly loaded type
   477     Change_new_sub,             // a super with a new subtype
   477     Change_new_sub,             // a super with a new subtype
   478     Change_new_impl,            // an interface with a new implementation
   478     Change_new_impl,            // an interface with a new implementation
   479     CHANGE_LIMIT,
   479     CHANGE_LIMIT,
   480     Start_Klass = CHANGE_LIMIT  // internal indicator for ContextStream
   480     Start_Klass = CHANGE_LIMIT  // internal indicator for ContextStream
   481   };
   481   };
   482 
   482 
       
   483  private:
   483   // each change set is rooted in exactly one new type (at present):
   484   // each change set is rooted in exactly one new type (at present):
   484   KlassHandle _new_type;
   485   KlassHandle _new_type;
   485 
   486 
   486   void initialize();
   487   void initialize();
   487 
   488 
   508   //     ...
   509   //     ...
   509   //   }
   510   //   }
   510   // }
   511   // }
   511   class ContextStream : public StackObj {
   512   class ContextStream : public StackObj {
   512    private:
   513    private:
   513     DepChange&       _changes;
   514     DepChange&  _changes;
   514     friend class DepChange;
   515     friend class DepChange;
   515 
   516 
   516     // iteration variables:
   517     // iteration variables:
   517     ChangeType            _change_type;
   518     ChangeType  _change_type;
   518     klassOop              _klass;
   519     klassOop    _klass;
   519     objArrayOop           _ti_base;    // i.e., transitive_interfaces
   520     objArrayOop _ti_base;    // i.e., transitive_interfaces
   520     int                   _ti_index;
   521     int         _ti_index;
   521     int                   _ti_limit;
   522     int         _ti_limit;
   522 
   523 
   523     // start at the beginning:
   524     // start at the beginning:
   524     void start() {
   525     void start() {
   525       klassOop new_type = _changes.new_type();
   526       klassOop new_type = _changes.new_type();
   526       _change_type = (new_type == NULL ? NO_CHANGE: Start_Klass);
   527       _change_type = (new_type == NULL ? NO_CHANGE: Start_Klass);
   528       _ti_base = NULL;
   529       _ti_base = NULL;
   529       _ti_index = 0;
   530       _ti_index = 0;
   530       _ti_limit = 0;
   531       _ti_limit = 0;
   531     }
   532     }
   532 
   533 
       
   534    public:
   533     ContextStream(DepChange& changes)
   535     ContextStream(DepChange& changes)
   534       : _changes(changes)
   536       : _changes(changes)
   535     { start(); }
   537     { start(); }
   536 
   538 
   537    public:
       
   538     ContextStream(DepChange& changes, No_Safepoint_Verifier& nsv)
   539     ContextStream(DepChange& changes, No_Safepoint_Verifier& nsv)
   539       : _changes(changes)
   540       : _changes(changes)
   540       // the nsv argument makes it safe to hold oops like _klass
   541       // the nsv argument makes it safe to hold oops like _klass
   541     { start(); }
   542     { start(); }
   542 
   543 
   543     bool next();
   544     bool next();
   544 
   545 
       
   546     ChangeType change_type()     { return _change_type; }
   545     klassOop   klass()           { return _klass; }
   547     klassOop   klass()           { return _klass; }
   546   };
   548   };
   547   friend class DepChange::ContextStream;
   549   friend class DepChange::ContextStream;
   548 
   550 
   549   void print();
   551   void print();