src/share/vm/oops/instanceKlass.hpp

Print this page
rev 6796 : [mq]: templateOopIterate
rev 6798 : [mq]: oneSwitch
rev 6800 : [mq]: replaceTemplateDispatchWithMacroDispatch

@@ -117,11 +117,12 @@
                 int itable_len,
                 int static_field_size,
                 int nonstatic_oop_map_size,
                 ReferenceType rt,
                 AccessFlags access_flags,
-                bool is_anonymous);
+                bool is_anonymous,
+                DispatchTag tag = _instance);
  public:
   static InstanceKlass* allocate_instance_klass(
                                           ClassLoaderData* loader_data,
                                           int vtable_len,
                                           int itable_len,

@@ -132,11 +133,11 @@
                                           Symbol* name,
                                           Klass* super_klass,
                                           bool is_anonymous,
                                           TRAPS);
 
-  InstanceKlass() { assert(DumpSharedSpaces || UseSharedSpaces, "only for CDS"); }
+  InstanceKlass(DispatchTag tag = _instance) : Klass(tag) { assert(DumpSharedSpaces || UseSharedSpaces, "only for CDS"); }
 
   // See "The Java Virtual Machine Specification" section 2.16.2-5 for a detailed description
   // of the class loading & initialization procedure, and the use of the states.
   enum ClassState {
     allocated,                          // allocated (but not yet linked)

@@ -951,33 +952,19 @@
   PARALLEL_GC_DECLS
 
   // Naming
   const char* signature_name() const;
 
-  // Iterators
-  int oop_oop_iterate(oop obj, ExtendedOopClosure* blk) {
-    return oop_oop_iterate_v(obj, blk);
-  }
+  template <bool nv, typename OopClosureType>
+  int oop_oop_iterate(oop obj, OopClosureType* blk);
 
-  int oop_oop_iterate_m(oop obj, ExtendedOopClosure* blk, MemRegion mr) {
-    return oop_oop_iterate_v_m(obj, blk, mr);
-  }
-
-#define InstanceKlass_OOP_OOP_ITERATE_DECL(OopClosureType, nv_suffix)      \
-  int  oop_oop_iterate##nv_suffix(oop obj, OopClosureType* blk);           \
-  int  oop_oop_iterate##nv_suffix##_m(oop obj, OopClosureType* blk,        \
-                                      MemRegion mr);
-
-  ALL_OOP_OOP_ITERATE_CLOSURES_1(InstanceKlass_OOP_OOP_ITERATE_DECL)
-  ALL_OOP_OOP_ITERATE_CLOSURES_2(InstanceKlass_OOP_OOP_ITERATE_DECL)
+  template <bool nv, typename OopClosureType>
+  int oop_oop_iterate_m(oop obj, OopClosureType* blk, MemRegion mr);
 
 #if INCLUDE_ALL_GCS
-#define InstanceKlass_OOP_OOP_ITERATE_BACKWARDS_DECL(OopClosureType, nv_suffix) \
-  int  oop_oop_iterate_backwards##nv_suffix(oop obj, OopClosureType* blk);
-
-  ALL_OOP_OOP_ITERATE_CLOSURES_1(InstanceKlass_OOP_OOP_ITERATE_BACKWARDS_DECL)
-  ALL_OOP_OOP_ITERATE_CLOSURES_2(InstanceKlass_OOP_OOP_ITERATE_BACKWARDS_DECL)
+  template <bool nv, typename OopClosureType>
+  int  oop_oop_iterate_backwards(oop obj, OopClosureType* blk);
 #endif // INCLUDE_ALL_GCS
 
   u2 idnum_allocated_count() const      { return _idnum_allocated_count; }
 
 private: