comparison src/share/vm/code/dependencies.hpp @ 3894:b27c72d69fd1

7083184: JSR 292: don't store context class argument with call site dependencies Reviewed-by: jrose, never
author twisti
date Mon, 29 Aug 2011 05:07:35 -0700
parents fdb992d83a87
children da91efe96a93
comparison
equal deleted inserted replaced
3893:8805f8c1e23e 3894:b27c72d69fd1
164 }; 164 };
165 enum { 165 enum {
166 LG2_TYPE_LIMIT = 4, // assert(TYPE_LIMIT <= (1<<LG2_TYPE_LIMIT)) 166 LG2_TYPE_LIMIT = 4, // assert(TYPE_LIMIT <= (1<<LG2_TYPE_LIMIT))
167 167
168 // handy categorizations of dependency types: 168 // handy categorizations of dependency types:
169 all_types = ((1<<TYPE_LIMIT)-1) & ((-1)<<FIRST_TYPE), 169 all_types = ((1 << TYPE_LIMIT) - 1) & ((-1) << FIRST_TYPE),
170 non_ctxk_types = (1<<evol_method), 170
171 ctxk_types = all_types & ~non_ctxk_types, 171 non_klass_types = (1 << call_site_target_value),
172 klass_types = all_types & ~non_klass_types,
173
174 non_ctxk_types = (1 << evol_method),
175 implicit_ctxk_types = (1 << call_site_target_value),
176 explicit_ctxk_types = all_types & ~(non_ctxk_types | implicit_ctxk_types),
172 177
173 max_arg_count = 3, // current maximum number of arguments (incl. ctxk) 178 max_arg_count = 3, // current maximum number of arguments (incl. ctxk)
174 179
175 // A "context type" is a class or interface that 180 // A "context type" is a class or interface that
176 // provides context for evaluating a dependency. 181 // provides context for evaluating a dependency.
182 default_context_type_bit = (1<<LG2_TYPE_LIMIT) 187 default_context_type_bit = (1<<LG2_TYPE_LIMIT)
183 }; 188 };
184 189
185 static const char* dep_name(DepType dept); 190 static const char* dep_name(DepType dept);
186 static int dep_args(DepType dept); 191 static int dep_args(DepType dept);
187 static int dep_context_arg(DepType dept) { 192
188 return dept_in_mask(dept, ctxk_types)? 0: -1; 193 static bool is_klass_type( DepType dept) { return dept_in_mask(dept, klass_types ); }
189 } 194
195 static bool has_explicit_context_arg(DepType dept) { return dept_in_mask(dept, explicit_ctxk_types); }
196 static bool has_implicit_context_arg(DepType dept) { return dept_in_mask(dept, implicit_ctxk_types); }
197
198 static int dep_context_arg(DepType dept) { return has_explicit_context_arg(dept) ? 0 : -1; }
199 static int dep_implicit_context_arg(DepType dept) { return has_implicit_context_arg(dept) ? 0 : -1; }
200
190 static void check_valid_dependency_type(DepType dept); 201 static void check_valid_dependency_type(DepType dept);
191 202
192 private: 203 private:
193 // State for writing a new set of dependencies: 204 // State for writing a new set of dependencies:
194 GrowableArray<int>* _dep_seen; // (seen[h->ident] & (1<<dept)) 205 GrowableArray<int>* _dep_seen; // (seen[h->ident] & (1<<dept))
248 check_ctxk(ctxk); 259 check_ctxk(ctxk);
249 assert(!is_concrete_klass(ctxk->as_instance_klass()), "must be abstract"); 260 assert(!is_concrete_klass(ctxk->as_instance_klass()), "must be abstract");
250 } 261 }
251 262
252 void assert_common_1(DepType dept, ciObject* x); 263 void assert_common_1(DepType dept, ciObject* x);
253 void assert_common_2(DepType dept, ciKlass* ctxk, ciObject* x); 264 void assert_common_2(DepType dept, ciObject* x0, ciObject* x1);
254 void assert_common_3(DepType dept, ciKlass* ctxk, ciObject* x, ciObject* x2); 265 void assert_common_3(DepType dept, ciKlass* ctxk, ciObject* x1, ciObject* x2);
255 266
256 public: 267 public:
257 // Adding assertions to a new dependency set at compile time: 268 // Adding assertions to a new dependency set at compile time:
258 void assert_evol_method(ciMethod* m); 269 void assert_evol_method(ciMethod* m);
259 void assert_leaf_type(ciKlass* ctxk); 270 void assert_leaf_type(ciKlass* ctxk);
262 void assert_concrete_with_no_concrete_subtype(ciKlass* ctxk); 273 void assert_concrete_with_no_concrete_subtype(ciKlass* ctxk);
263 void assert_unique_concrete_method(ciKlass* ctxk, ciMethod* uniqm); 274 void assert_unique_concrete_method(ciKlass* ctxk, ciMethod* uniqm);
264 void assert_abstract_with_exclusive_concrete_subtypes(ciKlass* ctxk, ciKlass* k1, ciKlass* k2); 275 void assert_abstract_with_exclusive_concrete_subtypes(ciKlass* ctxk, ciKlass* k1, ciKlass* k2);
265 void assert_exclusive_concrete_methods(ciKlass* ctxk, ciMethod* m1, ciMethod* m2); 276 void assert_exclusive_concrete_methods(ciKlass* ctxk, ciMethod* m1, ciMethod* m2);
266 void assert_has_no_finalizable_subclasses(ciKlass* ctxk); 277 void assert_has_no_finalizable_subclasses(ciKlass* ctxk);
267 void assert_call_site_target_value(ciKlass* ctxk, ciCallSite* call_site, ciMethodHandle* method_handle); 278 void assert_call_site_target_value(ciCallSite* call_site, ciMethodHandle* method_handle);
268 279
269 // Define whether a given method or type is concrete. 280 // Define whether a given method or type is concrete.
270 // These methods define the term "concrete" as used in this module. 281 // These methods define the term "concrete" as used in this module.
271 // For this module, an "abstract" class is one which is non-concrete. 282 // For this module, an "abstract" class is one which is non-concrete.
272 // 283 //
316 static klassOop check_abstract_with_exclusive_concrete_subtypes(klassOop ctxk, klassOop k1, klassOop k2, 327 static klassOop check_abstract_with_exclusive_concrete_subtypes(klassOop ctxk, klassOop k1, klassOop k2,
317 KlassDepChange* changes = NULL); 328 KlassDepChange* changes = NULL);
318 static klassOop check_exclusive_concrete_methods(klassOop ctxk, methodOop m1, methodOop m2, 329 static klassOop check_exclusive_concrete_methods(klassOop ctxk, methodOop m1, methodOop m2,
319 KlassDepChange* changes = NULL); 330 KlassDepChange* changes = NULL);
320 static klassOop check_has_no_finalizable_subclasses(klassOop ctxk, KlassDepChange* changes = NULL); 331 static klassOop check_has_no_finalizable_subclasses(klassOop ctxk, KlassDepChange* changes = NULL);
321 static klassOop check_call_site_target_value(klassOop ctxk, oop call_site, oop method_handle, CallSiteDepChange* changes = NULL); 332 static klassOop check_call_site_target_value(oop call_site, oop method_handle, CallSiteDepChange* changes = NULL);
322 // A returned klassOop is NULL if the dependency assertion is still 333 // A returned klassOop is NULL if the dependency assertion is still
323 // valid. A non-NULL klassOop is a 'witness' to the assertion 334 // valid. A non-NULL klassOop is a 'witness' to the assertion
324 // failure, a point in the class hierarchy where the assertion has 335 // failure, a point in the class hierarchy where the assertion has
325 // been proven false. For example, if check_leaf_type returns 336 // been proven false. For example, if check_leaf_type returns
326 // non-NULL, the value is a subtype of the supposed leaf type. This 337 // non-NULL, the value is a subtype of the supposed leaf type. This
453 int argument_index(int i) { assert(0 <= i && i < argument_count(), "oob"); 464 int argument_index(int i) { assert(0 <= i && i < argument_count(), "oob");
454 return _xi[i]; } 465 return _xi[i]; }
455 oop argument(int i); // => recorded_oop_at(argument_index(i)) 466 oop argument(int i); // => recorded_oop_at(argument_index(i))
456 klassOop context_type(); 467 klassOop context_type();
457 468
469 bool is_klass_type() { return Dependencies::is_klass_type(type()); }
470
458 methodOop method_argument(int i) { 471 methodOop method_argument(int i) {
459 oop x = argument(i); 472 oop x = argument(i);
460 assert(x->is_method(), "type"); 473 assert(x->is_method(), "type");
461 return (methodOop) x; 474 return (methodOop) x;
462 } 475 }