Index: vm/gc_gen/javasrc_uncomp/org/apache/harmony/drlvm/gc_gen/GCHelper.java =================================================================== --- vm/gc_gen/javasrc_uncomp/org/apache/harmony/drlvm/gc_gen/GCHelper.java (revision 599494) +++ vm/gc_gen/javasrc_uncomp/org/apache/harmony/drlvm/gc_gen/GCHelper.java (working copy) @@ -34,7 +34,8 @@ public static final int TLS_GC_OFFSET = TLSGCOffset(); @Inline - public static Address alloc(int objSize, int allocationHandle) { + private static Address alloc(int objSize, int allocationHandle ) { + Address TLS_BASE = VMHelper.getTlsBaseAddress(); Address allocator_addr = TLS_BASE.plus(TLS_GC_OFFSET); @@ -54,12 +55,23 @@ return VMHelper.newResolvedUsingAllocHandleAndSize(objSize, allocationHandle); } + @Inline + public static Address alloc(Address classHandle) { + int objSize = VMHelper.getTypeSize(classHandle); + int allocationHandle = VMHelper.getAllocationHandle(classHandle); + return alloc(objSize, allocationHandle); + } + + private static final int ARRAY_LEN_OFFSET = 8; - private static final int GC_OBJECT_ALIGNMENT = 4; //TODO: EM64 or IPF could have 8! + private static final int GC_OBJECT_ALIGNMENT = 4; @Inline - public static Address allocArray(int arrayLen, int elemSize, int allocationHandle) { + public static Address allocArray(Address elemClassHandle, int arrayLen) { + Address arrayClassHandle = VMHelper.getArrayClass(elemClassHandle); + int allocationHandle = VMHelper.getAllocationHandle(arrayClassHandle); if (arrayLen >= 0) { + int elemSize = VMHelper.getArrayElemSize(arrayClassHandle); int firstElementOffset = ARRAY_LEN_OFFSET + (elemSize==8?8:4); int size = firstElementOffset + elemSize*arrayLen; size = (((size + (GC_OBJECT_ALIGNMENT - 1)) & (~(GC_OBJECT_ALIGNMENT - 1)))); @@ -80,7 +92,7 @@ public static boolean GEN_MODE = getGenMode(); @Inline - public static void write_barrier_slot_rem(Address p_objBase, Address p_objSlot, Address p_target) { + public static void write_barrier_slot_rem(Address p_target, Address p_objSlot, Address p_objBase) { /* If the slot is in NOS or the target is not in NOS, we simply return*/ if(p_objSlot.GE(NOS_BOUNDARY) || p_target.LT(NOS_BOUNDARY) || !GEN_MODE) {