diff -r 4c7feafa28c3 rpython/translator/c/src/linuxmemchk.c --- a/rpython/translator/c/src/linuxmemchk.c Wed Apr 10 07:50:25 2013 -0700 +++ b/rpython/translator/c/src/linuxmemchk.c Wed Apr 10 11:04:21 2013 -0700 @@ -30,12 +30,12 @@ static struct _alloc_s* _na_find(void* data) { int err; - long data1; + ptrdiff_t data1; struct _alloc_s* s; _na_assert(_na_start+PAGESIZE <= data && data < _na_start+MALLOC_BIGBUFFER-PAGESIZE, "corrupted na_start"); - data1 = (long) data; + data1 = (ptrdiff_t) data; data1 &= ~(PAGESIZE-1); data1 -= PAGESIZE; err = mprotect((void*) data1, PAGESIZE, PROT_READ|PROT_WRITE); diff -r 4c7feafa28c3 rpython/translator/c/src/obmalloc.c --- a/rpython/translator/c/src/obmalloc.c Wed Apr 10 07:50:25 2013 -0700 +++ b/rpython/translator/c/src/obmalloc.c Wed Apr 10 11:04:21 2013 -0700 @@ -442,7 +442,7 @@ arenabase = bp; nfreepools = ARENA_SIZE / POOL_SIZE; assert(POOL_SIZE * nfreepools == ARENA_SIZE); - excess = (uint) ((long)bp & POOL_SIZE_MASK); + excess = (uint) ((ptrdiff_t)bp & POOL_SIZE_MASK); if (excess != 0) { --nfreepools; arenabase += POOL_SIZE - excess; diff -r 4c7feafa28c3 rpython/translator/c/src/stack.c --- a/rpython/translator/c/src/stack.c Wed Apr 10 07:50:25 2013 -0700 +++ b/rpython/translator/c/src/stack.c Wed Apr 10 11:04:21 2013 -0700 @@ -7,18 +7,18 @@ /* the current stack is in the interval [end-length:end]. We assume a stack that grows downward here. */ char *_LLstacktoobig_stack_end = NULL; -long _LLstacktoobig_stack_length = MAX_STACK_SIZE; +ptrdiff_t _LLstacktoobig_stack_length = MAX_STACK_SIZE; char _LLstacktoobig_report_error = 1; static RPyThreadStaticTLS end_tls_key; void LL_stack_set_length_fraction(double fraction) { - _LLstacktoobig_stack_length = (long)(MAX_STACK_SIZE * fraction); + _LLstacktoobig_stack_length = (ptrdiff_t)(MAX_STACK_SIZE * fraction); } -char LL_stack_too_big_slowpath(long current) +char LL_stack_too_big_slowpath(ptrdiff_t current) { - long diff, max_stack_size; + ptrdiff_t diff, max_stack_size; char *baseptr, *curptr = (char*)current; /* The stack_end variable is updated to match the current value @@ -47,12 +47,12 @@ } else { diff = baseptr - curptr; - if (((unsigned long)diff) <= (unsigned long)max_stack_size) { + if (diff <= max_stack_size) { /* within bounds, probably just had a thread switch */ _LLstacktoobig_stack_end = baseptr; return 0; } - if (((unsigned long)-diff) <= (unsigned long)max_stack_size) { + if (-diff <= max_stack_size) { /* stack underflowed: the initial estimation of the stack base must be revised */ } diff -r 4c7feafa28c3 rpython/translator/c/src/stacklet/stacklet.c --- a/rpython/translator/c/src/stacklet/stacklet.c Wed Apr 10 07:50:25 2013 -0700 +++ b/rpython/translator/c/src/stacklet/stacklet.c Wed Apr 10 11:04:21 2013 -0700 @@ -331,22 +331,22 @@ char **_stacklet_translate_pointer(stacklet_handle context, char **ptr) { char *p = (char *)ptr; - long delta; + ptrdiff_t delta; if (context == NULL) return ptr; delta = p - context->stack_start; - if (((unsigned long)delta) < ((unsigned long)context->stack_saved)) { + if (delta < ((ptrdiff_t)context->stack_saved)) { /* a pointer to a saved away word */ char *c = (char *)(context + 1); return (char **)(c + delta); } - if (((unsigned long)delta) >= - (unsigned long)(context->stack_stop - context->stack_start)) { + if delta >= + (ptrdiff_t)(context->stack_stop - context->stack_start)) { /* out-of-stack pointer! it's only ok if we are the main stacklet and we are reading past the end, because the main stacklet's stack stop is not exactly known. */ assert(delta >= 0); - assert(((long)context->stack_stop) & 1); + assert(((ptrdiff_t)context->stack_stop) & 1); } return ptr; } diff -r 4c7feafa28c3 rpython/translator/c/src/thread_nt.c --- a/rpython/translator/c/src/thread_nt.c Wed Apr 10 07:50:25 2013 -0700 +++ b/rpython/translator/c/src/thread_nt.c Wed Apr 10 11:04:21 2013 -0700 @@ -48,7 +48,7 @@ long RPyThreadStart(void (*func)(void)) { - unsigned long rv; + ptrdiff_t rv; callobj obj; obj.id = -1; /* guilty until proved innocent */ @@ -58,7 +58,7 @@ return -1; rv = _beginthread(bootstrap, _pypythread_stacksize, &obj); - if (rv == (unsigned long)-1) { + if (rv == (ptrdiff_t)-1) { /* I've seen errno == EAGAIN here, which means "there are * too many threads". */ @@ -84,7 +84,7 @@ return _pypythread_stacksize; } -long RPyThreadSetStackSize(long newsize) +long RPyThreadSetStackSize(ptrdiff_t newsize) { if (newsize == 0) { /* set to default */ _pypythread_stacksize = 0;