42 // relies on such assertions must be discarded if they are overturned
43 // by changes in the runtime system. We can think of these assertions
44 // as approximate invariants, because we expect them to be overturned
45 // very infrequently. We are willing to perform expensive recovery
46 // operations when they are overturned. The benefit, of course, is
47 // performing optimistic optimizations (!) on the object code.
48 //
49 // Changes in the class hierarchy due to dynamic linking or
50 // class evolution can violate dependencies. There is enough
51 // indexing between classes and nmethods to make dependency
52 // checking reasonably efficient.
53
54 class ciEnv;
55 class nmethod;
56 class OopRecorder;
57 class xmlStream;
58 class CompileLog;
59 class DepChange;
60 class KlassDepChange;
61 class CallSiteDepChange;
62 class No_Safepoint_Verifier;
63
64 class Dependencies: public ResourceObj {
65 public:
66 // Note: In the comments on dependency types, most uses of the terms
67 // subtype and supertype are used in a "non-strict" or "inclusive"
68 // sense, and are starred to remind the reader of this fact.
69 // Strict uses of the terms use the word "proper".
70 //
71 // Specifically, every class is its own subtype* and supertype*.
72 // (This trick is easier than continually saying things like "Y is a
73 // subtype of X or X itself".)
74 //
75 // Sometimes we write X > Y to mean X is a proper supertype of Y.
76 // The notation X > {Y, Z} means X has proper subtypes Y, Z.
77 // The notation X.m > Y means that Y inherits m from X, while
78 // X.m > Y.m means Y overrides X.m. A star denotes abstractness,
79 // as *I > A, meaning (abstract) interface I is a super type of A,
80 // or A.*m > B.m, meaning B.m implements abstract method A.m.
81 //
82 // In this module, the terms "subtype" and "supertype" refer to
696 class ContextStream : public StackObj {
697 private:
698 DepChange& _changes;
699 friend class DepChange;
700
701 // iteration variables:
702 ChangeType _change_type;
703 Klass* _klass;
704 Array<Klass*>* _ti_base; // i.e., transitive_interfaces
705 int _ti_index;
706 int _ti_limit;
707
708 // start at the beginning:
709 void start();
710
711 public:
712 ContextStream(DepChange& changes)
713 : _changes(changes)
714 { start(); }
715
716 ContextStream(DepChange& changes, No_Safepoint_Verifier& nsv)
717 : _changes(changes)
718 // the nsv argument makes it safe to hold oops like _klass
719 { start(); }
720
721 bool next();
722
723 ChangeType change_type() { return _change_type; }
724 Klass* klass() { return _klass; }
725 };
726 friend class DepChange::ContextStream;
727 };
728
729
730 // A class hierarchy change coming through the VM (under the Compile_lock).
731 // The change is structured as a single new type with any number of supers
732 // and implemented interface types. Other than the new type, any of the
733 // super types can be context types for a relevant dependency, which the
734 // new type could invalidate.
735 class KlassDepChange : public DepChange {
736 private:
|
42 // relies on such assertions must be discarded if they are overturned
43 // by changes in the runtime system. We can think of these assertions
44 // as approximate invariants, because we expect them to be overturned
45 // very infrequently. We are willing to perform expensive recovery
46 // operations when they are overturned. The benefit, of course, is
47 // performing optimistic optimizations (!) on the object code.
48 //
49 // Changes in the class hierarchy due to dynamic linking or
50 // class evolution can violate dependencies. There is enough
51 // indexing between classes and nmethods to make dependency
52 // checking reasonably efficient.
53
54 class ciEnv;
55 class nmethod;
56 class OopRecorder;
57 class xmlStream;
58 class CompileLog;
59 class DepChange;
60 class KlassDepChange;
61 class CallSiteDepChange;
62 class NoSafepointVerifier;
63
64 class Dependencies: public ResourceObj {
65 public:
66 // Note: In the comments on dependency types, most uses of the terms
67 // subtype and supertype are used in a "non-strict" or "inclusive"
68 // sense, and are starred to remind the reader of this fact.
69 // Strict uses of the terms use the word "proper".
70 //
71 // Specifically, every class is its own subtype* and supertype*.
72 // (This trick is easier than continually saying things like "Y is a
73 // subtype of X or X itself".)
74 //
75 // Sometimes we write X > Y to mean X is a proper supertype of Y.
76 // The notation X > {Y, Z} means X has proper subtypes Y, Z.
77 // The notation X.m > Y means that Y inherits m from X, while
78 // X.m > Y.m means Y overrides X.m. A star denotes abstractness,
79 // as *I > A, meaning (abstract) interface I is a super type of A,
80 // or A.*m > B.m, meaning B.m implements abstract method A.m.
81 //
82 // In this module, the terms "subtype" and "supertype" refer to
696 class ContextStream : public StackObj {
697 private:
698 DepChange& _changes;
699 friend class DepChange;
700
701 // iteration variables:
702 ChangeType _change_type;
703 Klass* _klass;
704 Array<Klass*>* _ti_base; // i.e., transitive_interfaces
705 int _ti_index;
706 int _ti_limit;
707
708 // start at the beginning:
709 void start();
710
711 public:
712 ContextStream(DepChange& changes)
713 : _changes(changes)
714 { start(); }
715
716 ContextStream(DepChange& changes, NoSafepointVerifier& nsv)
717 : _changes(changes)
718 // the nsv argument makes it safe to hold oops like _klass
719 { start(); }
720
721 bool next();
722
723 ChangeType change_type() { return _change_type; }
724 Klass* klass() { return _klass; }
725 };
726 friend class DepChange::ContextStream;
727 };
728
729
730 // A class hierarchy change coming through the VM (under the Compile_lock).
731 // The change is structured as a single new type with any number of supers
732 // and implemented interface types. Other than the new type, any of the
733 // super types can be context types for a relevant dependency, which the
734 // new type could invalidate.
735 class KlassDepChange : public DepChange {
736 private:
|