8205683: Refactor heap allocation to separate concerns

Reviewed-by: pliden, kbarrett
This commit is contained in:
Erik Österlund 2018-06-28 14:22:28 +02:00
parent 7f3a801cae
commit e4dbe9909f
22 changed files with 638 additions and 528 deletions

View file

@ -38,6 +38,7 @@
#include "gc/shared/collectedHeap.inline.hpp"
#include "interpreter/bytecode.hpp"
#include "jfr/jfrEvents.hpp"
#include "logging/log.hpp"
#include "memory/oopFactory.hpp"
#include "memory/referenceType.hpp"
#include "memory/resourceArea.hpp"
@ -661,9 +662,10 @@ JVM_ENTRY(jobject, JVM_Clone(JNIEnv* env, jobject handle))
oop new_obj_oop = NULL;
if (obj->is_array()) {
const int length = ((arrayOop)obj())->length();
new_obj_oop = CollectedHeap::array_allocate(klass, size, length, CHECK_NULL);
new_obj_oop = Universe::heap()->array_allocate(klass, size, length,
/* do_zero */ true, CHECK_NULL);
} else {
new_obj_oop = CollectedHeap::obj_allocate(klass, size, CHECK_NULL);
new_obj_oop = Universe::heap()->obj_allocate(klass, size, CHECK_NULL);
}
HeapAccess<>::clone(obj(), new_obj_oop, size);