hpacket.comm.tstamp = gethrtime ();
hpacket.mtype = MALLOC_TRACE;
hpacket.size = (Size_type) size;
- hpacket.vaddr = (Vaddr_type) ret;
- hpacket.ovaddr = (Vaddr_type) 0;
+ hpacket.vaddr = (intptr_t) ret;
hpacket.comm.frinfo = collector_interface->getFrameInfo (heap_hndl, hpacket.comm.tstamp, FRINFO_FROM_STACK, &hpacket);
collector_interface->writeDataRecord (heap_hndl, (Common_packet*) & hpacket);
POP_REENTRANCE (guard);
hpacket.comm.tsize = sizeof ( Heap_packet);
hpacket.comm.tstamp = ts;
hpacket.mtype = FREE_TRACE;
- hpacket.size = (Size_type) 0;
- hpacket.vaddr = (Vaddr_type) ptr;
- hpacket.ovaddr = (Vaddr_type) 0;
+ hpacket.vaddr = (intptr_t) ptr;
hpacket.comm.frinfo = collector_interface->getFrameInfo (heap_hndl, hpacket.comm.tstamp, FRINFO_FROM_STACK, &hpacket);
collector_interface->writeDataRecord (heap_hndl, (Common_packet*) & hpacket);
POP_REENTRANCE (guard);
hpacket.comm.tstamp = ts;
hpacket.mtype = REALLOC_TRACE;
hpacket.size = (Size_type) size;
- hpacket.vaddr = (Vaddr_type) ret;
- hpacket.ovaddr = (Vaddr_type) ptr;
+ hpacket.vaddr = (intptr_t) ret;
hpacket.comm.frinfo = collector_interface->getFrameInfo (heap_hndl, hpacket.comm.tstamp, FRINFO_FROM_STACK, &hpacket);
collector_interface->writeDataRecord (heap_hndl, (Common_packet*) & hpacket);
POP_REENTRANCE (guard);
hpacket.comm.tstamp = gethrtime ();
hpacket.mtype = MALLOC_TRACE;
hpacket.size = (Size_type) size;
- hpacket.vaddr = (Vaddr_type) ret;
- hpacket.ovaddr = (Vaddr_type) 0;
+ hpacket.vaddr = (intptr_t) ret;
hpacket.comm.frinfo = collector_interface->getFrameInfo (heap_hndl, hpacket.comm.tstamp, FRINFO_FROM_STACK, &hpacket);
collector_interface->writeDataRecord (heap_hndl, (Common_packet*) & hpacket);
POP_REENTRANCE (guard);
hpacket.comm.tstamp = gethrtime ();
hpacket.mtype = MALLOC_TRACE;
hpacket.size = (Size_type) size;
- hpacket.vaddr = (Vaddr_type) ret;
- hpacket.ovaddr = (Vaddr_type) 0;
+ hpacket.vaddr = (intptr_t) ret;
hpacket.comm.frinfo = collector_interface->getFrameInfo (heap_hndl, hpacket.comm.tstamp, FRINFO_FROM_STACK, &hpacket);
collector_interface->writeDataRecord (heap_hndl, (Common_packet*) & hpacket);
POP_REENTRANCE (guard);
hpacket.comm.tstamp = gethrtime ();
hpacket.mtype = MALLOC_TRACE;
hpacket.size = (Size_type) (size * esize);
- hpacket.vaddr = (Vaddr_type) ret;
- hpacket.ovaddr = (Vaddr_type) 0;
+ hpacket.vaddr = (intptr_t) ret;
hpacket.comm.frinfo = collector_interface->getFrameInfo (heap_hndl, hpacket.comm.tstamp, FRINFO_FROM_STACK, &hpacket);
collector_interface->writeDataRecord (heap_hndl, (Common_packet*) & hpacket);
POP_REENTRANCE (guard);
hpacket.comm.tstamp = gethrtime ();
hpacket.mtype = mtype;
hpacket.size = (Size_type) size;
- hpacket.vaddr = (Vaddr_type) vaddr;
- hpacket.ovaddr = (Vaddr_type) 0;
+ hpacket.vaddr = (intptr_t) vaddr;
hpacket.comm.frinfo = collector_interface->getFrameInfo (heap_hndl, hpacket.comm.tstamp, FRINFO_FROM_STACK, &hpacket);
collector_interface->writeDataRecord (heap_hndl, (Common_packet*) & hpacket);
POP_REENTRANCE (guard);
#define CONTEXT_SP REG_ESP
#endif /* WSIZE() */
#define SETFUNCTIONCONTEXT(ucp,funcp) \
- (ucp)->uc_mcontext.gregs[CONTEXT_PC] = (greg_t)(funcp); \
+ (ucp)->uc_mcontext.gregs[CONTEXT_PC] = (intptr_t)(funcp); \
(ucp)->uc_mcontext.gregs[CONTEXT_SP] = 0; \
(ucp)->uc_mcontext.gregs[CONTEXT_FP] = 0;
: // "=m" (*ptr) // output
: "m" (*ptr)); // input
}
+
/**
* This function subtrackts the value "off" of the value stored in target
* to occur in an atomic manner, and returns new value stored in target.
);
return (r - offset);
}
+
/**
* This function returns the value of the stack pointer register
*/
__collector_getsp ()
{
void *r;
-#if WSIZE(64)
- __asm__ __volatile__("movq %%rsp, %0"
-#else
+#if WSIZE(32) || defined(__ILP32__)
__asm__ __volatile__("movl %%esp, %0"
-#endif
+#else
+ __asm__ __volatile__("movq %%rsp, %0"
+#endif
: "=r" (r)); // output
return r;
}
+
/**
* This function returns the value of the frame pointer register
*/
__collector_getfp ()
{
void *r;
-#if WSIZE(64)
- __asm__ __volatile__("movq %%rbp, %0"
-#else
+#if WSIZE(32) || defined(__ILP32__)
__asm__ __volatile__("movl %%ebp, %0"
+#else
+ __asm__ __volatile__("movq %%rbp, %0"
#endif
: "=r" (r)); // output
return r;
}
+
/**
* This function returns the value of the processor counter register
*/
__collector_getpc ()
{
void *r;
- __asm__ __volatile__(
-#if WSIZE(32)
- " call 1f \n"
- "1: popl %0 \n"
+#if defined(__x86_64)
+ __asm__ __volatile__("lea (%%rip), %0" : "=r" (r));
#else
- " call 1f \n"
- "1: popq %0 \n"
+ __asm__ __volatile__("call 1f \n"
+ "1: popl %0" : "=r" (r));
#endif
- : "=r" (r)); // output
return r;
}
__collector_cas_ptr (void *mem, void *cmp, void *new)
{
void *r;
-#if WSIZE(32)
+#if WSIZE(32) || defined(__ILP32__)
r = (void *) __collector_cas_32 ((volatile uint32_t *)mem, (uint32_t) cmp, (uint32_t)new);
#else
__asm__ __volatile__("lock; cmpxchgq %2, (%1)"
if (ap->a_type == AT_SYSINFO_EHDR)
{
// newer Linuxes do not have a_ptr field, they just have a_val
- ehdr = (ELF_EHDR*) ap->a_un.a_val;
+ ehdr = (ELF_EHDR*)(intptr_t) ap->a_un.a_val;
if (ehdr != NULL)
break;
}
if (grnt - reqt >= sync_threshold)
{
Sync_packet spacket;
- collector_memset (&spacket, 0, sizeof ( Sync_packet));
- spacket.comm.tsize = sizeof ( Sync_packet);
+ collector_memset (&spacket, 0, sizeof (Sync_packet));
+ spacket.comm.tsize = sizeof (Sync_packet);
spacket.comm.tstamp = grnt;
spacket.requested = reqt;
- spacket.objp = (Vaddr_type) object;
+ spacket.objp = (intptr_t) object;
spacket.comm.frinfo = collector_interface->getFrameInfo (sync_hndl, spacket.comm.tstamp, FRINFO_FROM_STACK_ARG, &spacket);
collector_interface->writeDataRecord (sync_hndl, (Common_packet*) & spacket);
}
if (grnt - reqt >= sync_threshold)
{
Sync_packet spacket;
- collector_memset (&spacket, 0, sizeof ( Sync_packet));
- spacket.comm.tsize = sizeof ( Sync_packet);
+ collector_memset (&spacket, 0, sizeof (Sync_packet));
+ spacket.comm.tsize = sizeof (Sync_packet);
spacket.comm.tstamp = grnt;
spacket.requested = reqt;
- spacket.objp = (Vaddr_type) mp;
+ spacket.objp = (intptr_t) mp;
spacket.comm.frinfo = collector_interface->getFrameInfo (sync_hndl, spacket.comm.tstamp, FRINFO_FROM_STACK, &spacket);
collector_interface->writeDataRecord (sync_hndl, (Common_packet*) & spacket);
}
if (grnt - reqt >= sync_threshold)
{
Sync_packet spacket;
- collector_memset (&spacket, 0, sizeof ( Sync_packet));
- spacket.comm.tsize = sizeof ( Sync_packet);
+ collector_memset (&spacket, 0, sizeof (Sync_packet));
+ spacket.comm.tsize = sizeof (Sync_packet);
spacket.comm.tstamp = grnt;
spacket.requested = reqt;
- spacket.objp = (Vaddr_type) mutex;
+ spacket.objp = (intptr_t) mutex;
spacket.comm.frinfo = collector_interface->getFrameInfo (sync_hndl, spacket.comm.tstamp, FRINFO_FROM_STACK_ARG, &spacket);
collector_interface->writeDataRecord (sync_hndl, (Common_packet*) & spacket);
}
spacket.comm.tsize = sizeof ( Sync_packet);
spacket.comm.tstamp = grnt;
spacket.requested = reqt;
- spacket.objp = (Vaddr_type) mutex;
+ spacket.objp = (intptr_t) mutex;
spacket.comm.frinfo = collector_interface->getFrameInfo (sync_hndl, spacket.comm.tstamp, FRINFO_FROM_STACK_ARG, &spacket);
collector_interface->writeDataRecord (sync_hndl, (Common_packet*) & spacket);
}
spacket.comm.tsize = sizeof ( Sync_packet);
spacket.comm.tstamp = grnt;
spacket.requested = reqt;
- spacket.objp = (Vaddr_type) sp;
+ spacket.objp = (intptr_t) sp;
#if ARCH(Intel) && WSIZE(32)
spacket.comm.frinfo = collector_interface->getFrameInfo (sync_hndl, spacket.comm.tstamp, FRINFO_FROM_STACK_ARG, &spacket);
{ \
context->uc_link = NULL; \
void *sp = __collector_getsp(); \
- GET_SP(context) = (greg_t)sp; \
- GET_FP(context) = (greg_t)__collector_getfp(); \
- GET_PC(context) = (greg_t)__collector_getpc(); \
+ GET_SP(context) = (intptr_t)sp; \
+ GET_FP(context) = (intptr_t)__collector_getfp(); \
+ GET_PC(context) = (intptr_t)__collector_getpc(); \
context->uc_stack.ss_sp = sp; \
context->uc_stack.ss_size = 0x100000; \
}