< prev index next >
src/hotspot/share/oops/valueKlass.cpp
Print this page
*** 51,61 ****
assert(base_offset == first_offset, "inconsistent offsets");
return base_offset;
}
int ValueKlass::raw_value_byte_size() const {
- assert(!is__Value(), "This is not the value type klass you are looking for");
int heapOopAlignedSize = nonstatic_field_size() << LogBytesPerHeapOop;
// If bigger than 64 bits or needs oop alignment, then use jlong aligned
// which for values should be jlong aligned, asserts in raw_field_copy otherwise
if (heapOopAlignedSize >= longSize || contains_oops()) {
return heapOopAlignedSize;
--- 51,60 ----
*** 263,298 ****
} else { // Primitive-only case...
raw_field_copy(src, dst, raw_byte_size);
}
}
- oop ValueKlass::box(Handle src, InstanceKlass* target_klass, TRAPS) {
- assert(src()->klass()->is_value(), "src must be a value type");
- assert(!target_klass->is_value(), "target_klass must not be a value type");
-
- target_klass->initialize(CHECK_0);
- instanceOop box = target_klass->allocate_instance(CHECK_0);
- value_store(data_for_oop(src()), data_for_oop(box), true, false);
-
- assert(!box->klass()->is_value(), "Sanity check");
- return box;
- }
-
- oop ValueKlass::unbox(Handle src, InstanceKlass* target_klass, TRAPS) {
- assert(!src()->klass()->is_value(), "src must not be a value type");
- assert(target_klass->is_value(), "target_klass must be a value type");
- ValueKlass* vtklass = ValueKlass::cast(target_klass);
-
- vtklass->initialize(CHECK_0);
- bool in_heap;
- instanceOop value = vtklass->allocate_buffered_or_heap_instance(&in_heap, CHECK_0);
- value_store(data_for_oop(src()), data_for_oop(value), in_heap, false);
-
- assert(value->klass()->is_value(), "Sanity check");
- return value;
- }
-
// Value type arguments are not passed by reference, instead each
// field of the value type is passed as an argument. This helper
// function collects the fields of the value types (including embedded
// value type's fields) in a list. Included with the field's type is
// the offset of each field in the value type: i2c and c2i adapters
--- 262,271 ----
*** 355,365 ****
void ValueKlass::initialize_calling_convention() {
// Because the pack and unpack handler addresses need to be loadable from generated code,
// they are stored at a fixed offset in the klass metadata. Since value type klasses do
// not have a vtable, the vtable offset is used to store these addresses.
! guarantee(vtable_length() == 0, "vtables are not supported in value klasses");
if (ValueTypeReturnedAsFields || ValueTypePassFieldsAsArgs) {
Thread* THREAD = Thread::current();
assert(!HAS_PENDING_EXCEPTION, "should have no exception");
ResourceMark rm;
const GrowableArray<SigEntry>& sig_vk = collect_fields();
--- 328,338 ----
void ValueKlass::initialize_calling_convention() {
// Because the pack and unpack handler addresses need to be loadable from generated code,
// they are stored at a fixed offset in the klass metadata. Since value type klasses do
// not have a vtable, the vtable offset is used to store these addresses.
! //guarantee(vtable_length() == 0, "vtables are not supported in value klasses");
if (ValueTypeReturnedAsFields || ValueTypePassFieldsAsArgs) {
Thread* THREAD = Thread::current();
assert(!HAS_PENDING_EXCEPTION, "should have no exception");
ResourceMark rm;
const GrowableArray<SigEntry>& sig_vk = collect_fields();
*** 418,428 ****
}
}
// Can this value type be returned as multiple values?
bool ValueKlass::can_be_returned_as_fields() const {
! return !is__Value() && (return_regs() != NULL);
}
// Create handles for all oop fields returned in registers that are going to be live across a safepoint
void ValueKlass::save_oop_fields(const RegisterMap& reg_map, GrowableArray<Handle>& handles) const {
Thread* thread = Thread::current();
--- 391,401 ----
}
}
// Can this value type be returned as multiple values?
bool ValueKlass::can_be_returned_as_fields() const {
! return return_regs() != NULL;
}
// Create handles for all oop fields returned in registers that are going to be live across a safepoint
void ValueKlass::save_oop_fields(const RegisterMap& reg_map, GrowableArray<Handle>& handles) const {
Thread* thread = Thread::current();
< prev index next >