@@ -63,142 +63,6 @@ inline void ClaimMetadataVisitingOopIterateClosure::do_method(Method* m) {
63
63
m->record_gc_epoch ();
64
64
}
65
65
66
- // Implementation of the non-virtual do_oop dispatch.
67
- //
68
- // The same implementation is used for do_metadata, do_klass, and do_cld.
69
- //
70
- // Preconditions:
71
- // - Base has a pure virtual do_oop
72
- // - Only one of the classes in the inheritance chain from OopClosureType to
73
- // Base implements do_oop.
74
- //
75
- // Given the preconditions:
76
- // - If &OopClosureType::do_oop is resolved to &Base::do_oop, then there is no
77
- // implementation of do_oop between Base and OopClosureType. However, there
78
- // must be one implementation in one of the subclasses of OopClosureType.
79
- // In this case we take the virtual call.
80
- //
81
- // - Conversely, if &OopClosureType::do_oop is not resolved to &Base::do_oop,
82
- // then we've found the one and only concrete implementation. In this case we
83
- // take a non-virtual call.
84
- //
85
- // Because of this it's clear when we should call the virtual call and
86
- // when the non-virtual call should be made.
87
- //
88
- // The way we find if &OopClosureType::do_oop is resolved to &Base::do_oop is to
89
- // check if the resulting type of the class of a member-function pointer to
90
- // &OopClosureType::do_oop is equal to the type of the class of a
91
- // &Base::do_oop member-function pointer. Template parameter deduction is used
92
- // to find these types, and then the IsSame trait is used to check if they are
93
- // equal. Finally, SFINAE is used to select the appropriate implementation.
94
- //
95
- // Template parameters:
96
- // T - narrowOop or oop
97
- // Receiver - the resolved type of the class of the
98
- // &OopClosureType::do_oop member-function pointer. That is,
99
- // the klass with the do_oop member function.
100
- // Base - klass with the pure virtual do_oop member function.
101
- // OopClosureType - The dynamic closure type
102
- //
103
- // Parameters:
104
- // closure - The closure to call
105
- // p - The oop (or narrowOop) field to pass to the closure
106
-
107
- template <typename T, typename Receiver, typename Base, typename OopClosureType>
108
- static typename EnableIf<IsSame<Receiver, Base>::value, void >::type
109
- call_do_oop (void (Receiver::*)(T*), void (Base::*)(T*), OopClosureType* closure, T* p) {
110
- closure->do_oop (p);
111
- }
112
-
113
- template <typename T, typename Receiver, typename Base, typename OopClosureType>
114
- static typename EnableIf<!IsSame<Receiver, Base>::value, void >::type
115
- call_do_oop (void (Receiver::*)(T*), void (Base::*)(T*), OopClosureType* closure, T* p) {
116
- // Sanity check
117
- STATIC_ASSERT ((!IsSame<OopClosureType, OopIterateClosure>::value));
118
- closure->OopClosureType ::do_oop (p);
119
- }
120
-
121
- template <typename OopClosureType, typename T>
122
- inline void Devirtualizer::do_oop (OopClosureType* closure, T* p) {
123
- call_do_oop<T>(&OopClosureType::do_oop, &OopClosure::do_oop, closure, p);
124
- }
125
-
126
- // Implementation of the non-virtual do_metadata dispatch.
127
-
128
- template <typename Receiver, typename Base, typename OopClosureType>
129
- static typename EnableIf<IsSame<Receiver, Base>::value, bool >::type
130
- call_do_metadata (bool (Receiver::*)(), bool (Base::*)(), OopClosureType* closure) {
131
- return closure->do_metadata ();
132
- }
133
-
134
- template <typename Receiver, typename Base, typename OopClosureType>
135
- static typename EnableIf<!IsSame<Receiver, Base>::value, bool >::type
136
- call_do_metadata (bool (Receiver::*)(), bool (Base::*)(), OopClosureType* closure) {
137
- return closure->OopClosureType ::do_metadata ();
138
- }
139
-
140
- template <typename OopClosureType>
141
- inline bool Devirtualizer::do_metadata (OopClosureType* closure) {
142
- return call_do_metadata (&OopClosureType::do_metadata, &OopIterateClosure::do_metadata, closure);
143
- }
144
-
145
- // Implementation of the non-virtual do_klass dispatch.
146
-
147
- template <typename Receiver, typename Base, typename OopClosureType>
148
- static typename EnableIf<IsSame<Receiver, Base>::value, void >::type
149
- call_do_klass (void (Receiver::*)(Klass*), void (Base::*)(Klass*), OopClosureType* closure, Klass* k) {
150
- closure->do_klass (k);
151
- }
152
-
153
- template <typename Receiver, typename Base, typename OopClosureType>
154
- static typename EnableIf<!IsSame<Receiver, Base>::value, void >::type
155
- call_do_klass (void (Receiver::*)(Klass*), void (Base::*)(Klass*), OopClosureType* closure, Klass* k) {
156
- closure->OopClosureType ::do_klass (k);
157
- }
158
-
159
- template <typename OopClosureType>
160
- inline void Devirtualizer::do_klass (OopClosureType* closure, Klass* k) {
161
- call_do_klass (&OopClosureType::do_klass, &OopIterateClosure::do_klass, closure, k);
162
- }
163
-
164
- // Implementation of the non-virtual do_cld dispatch.
165
-
166
- template <typename Receiver, typename Base, typename OopClosureType>
167
- static typename EnableIf<IsSame<Receiver, Base>::value, void >::type
168
- call_do_cld (void (Receiver::*)(ClassLoaderData*), void (Base::*)(ClassLoaderData*), OopClosureType* closure, ClassLoaderData* cld) {
169
- closure->do_cld (cld);
170
- }
171
-
172
- template <typename Receiver, typename Base, typename OopClosureType>
173
- static typename EnableIf<!IsSame<Receiver, Base>::value, void >::type
174
- call_do_cld (void (Receiver::*)(ClassLoaderData*), void (Base::*)(ClassLoaderData*), OopClosureType* closure, ClassLoaderData* cld) {
175
- closure->OopClosureType ::do_cld (cld);
176
- }
177
-
178
- template <typename OopClosureType>
179
- void Devirtualizer::do_cld (OopClosureType* closure, ClassLoaderData* cld) {
180
- call_do_cld (&OopClosureType::do_cld, &OopIterateClosure::do_cld, closure, cld);
181
- }
182
-
183
- // Implementation of the non-virtual do_derived_oop dispatch.
184
-
185
- template <typename Receiver, typename Base, typename DerivedOopClosureType>
186
- static typename EnableIf<IsSame<Receiver, Base>::value, void >::type
187
- call_do_derived_oop (void (Receiver::*)(oop*, derived_pointer*), void (Base::*)(oop*, derived_pointer*), DerivedOopClosureType* closure, oop* base, derived_pointer* derived) {
188
- closure->do_derived_oop (base, derived);
189
- }
190
-
191
- template <typename Receiver, typename Base, typename DerivedOopClosureType>
192
- static typename EnableIf<!IsSame<Receiver, Base>::value, void >::type
193
- call_do_derived_oop (void (Receiver::*)(oop*, derived_pointer*), void (Base::*)(oop*, derived_pointer*), DerivedOopClosureType* closure, oop* base, derived_pointer* derived) {
194
- closure->DerivedOopClosureType ::do_derived_oop (base, derived);
195
- }
196
-
197
- template <typename DerivedOopClosureType>
198
- inline void Devirtualizer::do_derived_oop (DerivedOopClosureType* closure, oop* base, derived_pointer* derived) {
199
- call_do_derived_oop (&DerivedOopClosureType::do_derived_oop, &DerivedOopClosure::do_derived_oop, closure, base, derived);
200
- }
201
-
202
66
// Dispatch table implementation for *Klass::oop_oop_iterate
203
67
//
204
68
// It allows for a single call to do a multi-dispatch to an optimized version
0 commit comments