< prev index next > src/hotspot/share/memory/metaspaceShared.cpp
Print this page
#include "memory/metaspaceClosure.hpp"
#include "memory/metaspaceShared.hpp"
#include "memory/resourceArea.hpp"
#include "memory/universe.hpp"
#include "oops/compressedOops.inline.hpp"
+ #include "oops/flatArrayKlass.hpp"
+ #include "oops/inlineKlass.hpp"
#include "oops/instanceClassLoaderKlass.hpp"
#include "oops/instanceMirrorKlass.hpp"
#include "oops/instanceRefKlass.hpp"
#include "oops/methodData.hpp"
#include "oops/objArrayKlass.hpp"
// into our own tables.
// Currently, the archive contain ONLY the following types of objects that have C++ vtables.
#define CPP_VTABLE_PATCH_TYPES_DO(f) \
f(ConstantPool) \
! f(InstanceKlass) \
f(InstanceKlass) \
f(InstanceMirrorKlass) \
f(InstanceRefKlass) \
f(Method) \
f(ObjArrayKlass) \
! f(TypeArrayKlass)
class CppVtableInfo {
intptr_t _vtable_size;
intptr_t _cloned_vtable[1];
public:
// into our own tables.
// Currently, the archive contain ONLY the following types of objects that have C++ vtables.
#define CPP_VTABLE_PATCH_TYPES_DO(f) \
f(ConstantPool) \
! f(InstanceClassLoaderKlass) \
f(InstanceKlass) \
f(InstanceMirrorKlass) \
f(InstanceRefKlass) \
f(Method) \
f(ObjArrayKlass) \
! f(TypeArrayKlass) \
+ f(FlatArrayKlass) \
+ f(InlineKlass)
class CppVtableInfo {
intptr_t _vtable_size;
intptr_t _cloned_vtable[1];
public:
RefRelocator refer;
ref->metaspace_pointers_do_at(&refer, new_loc);
return true; // recurse into ref.obj()
}
virtual void push_special(SpecialRef type, Ref* ref, intptr_t* p) {
! assert(type == _method_entry_ref, "only special type allowed for now");
address obj = ref->obj();
address new_obj = get_new_loc(ref);
size_t offset = pointer_delta(p, obj, sizeof(u1));
intptr_t* new_p = (intptr_t*)(new_obj + offset);
! assert(*p == *new_p, "must be a copy");
ArchivePtrMarker::mark_pointer((address*)new_p);
}
};
// Relocate a reference to point to its shallow copy
RefRelocator refer;
ref->metaspace_pointers_do_at(&refer, new_loc);
return true; // recurse into ref.obj()
}
virtual void push_special(SpecialRef type, Ref* ref, intptr_t* p) {
! assert_valid(type);
+
address obj = ref->obj();
address new_obj = get_new_loc(ref);
size_t offset = pointer_delta(p, obj, sizeof(u1));
intptr_t* new_p = (intptr_t*)(new_obj + offset);
! switch (type) {
+ case _method_entry_ref:
+ assert(*p == *new_p, "must be a copy");
+ break;
+ case _internal_pointer_ref:
+ {
+ size_t off = pointer_delta(*((address*)p), obj, sizeof(u1));
+ assert(0 <= intx(off) && intx(off) < ref->size() * BytesPerWord, "must point to internal address");
+ *((address*)new_p) = new_obj + off;
+ }
+ break;
+ default:
+ ShouldNotReachHere();
+ }
ArchivePtrMarker::mark_pointer((address*)new_p);
}
};
// Relocate a reference to point to its shallow copy
< prev index next >