You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by xl...@apache.org on 2007/12/29 09:26:51 UTC
svn commit: r607396 - in /harmony/enhanced/drlvm/trunk/vm:
gc_gen/src/common/gc_platform.h vmcore/include/object_layout.h
Author: xli
Date: Sat Dec 29 00:26:48 2007
New Revision: 607396
URL: http://svn.apache.org/viewvc?rev=607396&view=rev
Log:
HARMONY-5304 : [drlvm][gc_gen] assert in ClassCastTest from the reliability test suite:
apr_atomic_casptr() does not work correctly for 64-bit values, leave port_atomic_cas64() for 64-bit platforms. Also changed vt field in obj header to be 32bit (with 32 bits padding for 64bit platform.
Modified:
harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_platform.h
harmony/enhanced/drlvm/trunk/vm/vmcore/include/object_layout.h
Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_platform.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_platform.h?rev=607396&r1=607395&r2=607396&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_platform.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_platform.h Sat Dec 29 00:26:48 2007
@@ -128,7 +128,11 @@
POINTER_SIZE_INT swap,
POINTER_SIZE_INT cmp)
{
- return (POINTER_SIZE_INT)apr_atomic_casptr((volatile void **)mem, (void*)swap, (void*)cmp);
+#ifdef POINTER64
+ return port_atomic_cas64(mem, swap, cmp);
+#else
+ return apr_atomic_cas32(mem, swap, cmp);
+#endif
}
inline uint32 atomic_cas32(volatile apr_uint32_t *mem,
Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/include/object_layout.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/include/object_layout.h?rev=607396&r1=607395&r2=607396&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/include/object_layout.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/include/object_layout.h Sat Dec 29 00:26:48 2007
@@ -224,25 +224,33 @@
uint32 vt_offset;
POINTER_SIZE_INT padding;
};
- POINTER_SIZE_INT obj_info;
+ union {
+ uint32 obj_info;
+ POINTER_SIZE_INT padding2;
+ };
+
VTable *vt_unsafe() { return (VTable*)(vt_offset + vm_get_vtable_base()); }
VTable *vt() { assert(vt_offset); return vt_unsafe(); }
static VTable *allocation_handle_to_vtable(Allocation_Handle ah) {
return (VTable *) ((POINTER_SIZE_INT)ah + vm_get_vtable_base());
}
- static unsigned header_offset() { return sizeof(POINTER_SIZE_INT); }
static bool are_vtable_pointers_compressed() { return true; }
#else // USE_COMPRESSED_VTABLE_POINTERS
VTable *vt_raw;
- POINTER_SIZE_INT obj_info;
+ union {
+ uint32 obj_info;
+ POINTER_SIZE_INT padding;
+ };
VTable *vt_unsafe() { return vt_raw; }
VTable *vt() { assert(vt_raw); return vt_unsafe(); }
static VTable *allocation_handle_to_vtable(Allocation_Handle ah) {
return (VTable *) ah;
}
- static unsigned header_offset() { return sizeof(VTable *); }
static bool are_vtable_pointers_compressed() { return false; }
#endif // USE_COMPRESSED_VTABLE_POINTERS
+
+ static unsigned header_offset() { return (unsigned)(POINTER_SIZE_INT)(&((ManagedObject*)NULL)->obj_info); }
+
/// returns the size of constant object header part (vt pointer and obj_info)
static size_t get_constant_header_size() { return sizeof(ManagedObject); }
/// returns the size of object header including dynamically enabled fields.
@@ -250,10 +258,10 @@
return get_constant_header_size() + (_tag_pointer ? sizeof(void*) : 0);
}
- POINTER_SIZE_INT get_obj_info() { return obj_info; }
- void set_obj_info(POINTER_SIZE_INT value) { obj_info = value; }
- POINTER_SIZE_INT* get_obj_info_addr() {
- return (POINTER_SIZE_INT*)((char*)this + header_offset());
+ uint32 get_obj_info() { return obj_info; }
+ void set_obj_info(uint32 value) { obj_info = value; }
+ uint32* get_obj_info_addr() {
+ return (uint32*)((char*)this + header_offset());
}
/**
@@ -324,5 +332,6 @@
#endif
#endif // _OBJECT_LAYOUT_H_
+