< prev index next >

src/hotspot/share/memory/dynamicArchive.cpp

Print this page


 120     return get_new_loc(ref->obj());
 121   }
 122 
 123   template <typename T> bool has_new_loc(T obj) {
 124     address* pp = _new_loc_table.get((address)obj);
 125     return pp != NULL;
 126   }
 127 
 128   static intx _method_comparator_name_delta;
 129 
 130   static int dynamic_dump_method_comparator(Method* a, Method* b) {
 131     Symbol* a_name = a->name();
 132     Symbol* b_name = b->name();
 133 
 134     if (!MetaspaceShared::is_in_shared_metaspace(a_name)) {
 135       // a_name points to a Symbol in the top archive.
 136       // When this method is called, a_name is still pointing to the output space.
 137       // Translate it to point to the output space, so that it can be compared with
 138       // Symbols in the base archive.
 139       a_name = (Symbol*)(address(a_name) + _method_comparator_name_delta);
 140       //tty->print_cr("%p", a_name);
 141     }
 142     if (!MetaspaceShared::is_in_shared_metaspace(b_name)) {
 143       b_name = (Symbol*)(address(b_name) + _method_comparator_name_delta);
 144       //tty->print_cr("%p", b_name);
 145     }
 146 
 147     return a_name->fast_compare(b_name);
 148   }
 149 
 150 protected:
 151   enum FollowMode {
 152     make_a_copy, point_to_it, set_to_null
 153   };
 154 
 155 public:
 156   void copy(MetaspaceClosure::Ref* ref, bool read_only) {
 157     int bytes = ref->size() * BytesPerWord;
 158     address old_obj = ref->obj();
 159     address new_obj = copy_impl(ref, read_only, bytes);
 160 
 161     assert(new_obj != NULL, "must be");
 162     assert(new_obj != old_obj, "must be");
 163     bool isnew = _new_loc_table.put(old_obj, new_obj);
 164     assert(isnew, "must be");




 120     return get_new_loc(ref->obj());
 121   }
 122 
 123   template <typename T> bool has_new_loc(T obj) {
 124     address* pp = _new_loc_table.get((address)obj);
 125     return pp != NULL;
 126   }
 127 
 128   static intx _method_comparator_name_delta;
 129 
 130   static int dynamic_dump_method_comparator(Method* a, Method* b) {
 131     Symbol* a_name = a->name();
 132     Symbol* b_name = b->name();
 133 
 134     if (!MetaspaceShared::is_in_shared_metaspace(a_name)) {
 135       // a_name points to a Symbol in the top archive.
 136       // When this method is called, a_name is still pointing to the output space.
 137       // Translate it to point to the output space, so that it can be compared with
 138       // Symbols in the base archive.
 139       a_name = (Symbol*)(address(a_name) + _method_comparator_name_delta);

 140     }
 141     if (!MetaspaceShared::is_in_shared_metaspace(b_name)) {
 142       b_name = (Symbol*)(address(b_name) + _method_comparator_name_delta);

 143     }
 144 
 145     return a_name->fast_compare(b_name);
 146   }
 147 
 148 protected:
 149   enum FollowMode {
 150     make_a_copy, point_to_it, set_to_null
 151   };
 152 
 153 public:
 154   void copy(MetaspaceClosure::Ref* ref, bool read_only) {
 155     int bytes = ref->size() * BytesPerWord;
 156     address old_obj = ref->obj();
 157     address new_obj = copy_impl(ref, read_only, bytes);
 158 
 159     assert(new_obj != NULL, "must be");
 160     assert(new_obj != old_obj, "must be");
 161     bool isnew = _new_loc_table.put(old_obj, new_obj);
 162     assert(isnew, "must be");


< prev index next >