bug 360720. various 64-bit type fixes.

This commit is contained in:
wsharp%adobe.com 2006-11-14 22:15:14 +00:00
parent a4eb8a5a41
commit 8ed570e4c1
51 changed files with 447 additions and 392 deletions

View File

@ -80,12 +80,12 @@ namespace MMgc
// assert that the freelist hasn't been tampered with (by writing to the first 4 bytes)
GCAssert(b->firstFree == NULL ||
(b->firstFree >= b->items &&
(((intptr)b->firstFree - (intptr)b->items) % b->size) == 0 &&
(intptr) b->firstFree < ((intptr)b & ~0xfff) + GCHeap::kBlockSize));
(((uintptr)b->firstFree - (uintptr)b->items) % b->size) == 0 &&
(uintptr) b->firstFree < ((uintptr)b & ~0xfff) + GCHeap::kBlockSize));
#ifdef MEMORY_INFO
// ensure previously used item wasn't written to
// -1 because write back pointer space isn't poisoned.
#ifdef MMGC_AMD64
#ifdef MMGC_64BIT
for(int i=3, n=(b->size>>2)-3; i<n; i++)
#else
for(int i=3, n=(b->size>>2)-1; i<n; i++)
@ -108,7 +108,7 @@ namespace MMgc
GCAssert(item != 0);
if(!IsFull(b)) {
// There are more items at the end of the block
b->nextItem = (void *) ((intptr)item+m_itemSize);
b->nextItem = (void *) ((uintptr)item+m_itemSize);
#ifdef MEMORY_INFO
// space made in ctor
item = DebugDecorate(item, size + DebugSize(), 6);
@ -145,7 +145,7 @@ namespace MMgc
static inline void Free(void *item)
{
FixedBlock *b = (FixedBlock*) ((intptr)item & ~0xFFF);
FixedBlock *b = (FixedBlock*) ((uintptr)item & ~0xFFF);
#ifdef MEMORY_INFO
item = DebugFree(item, 0xED, 6);
@ -153,7 +153,7 @@ namespace MMgc
#ifdef _DEBUG
// ensure that we are freeing a pointer on a item boundary
GCAssert(((intptr)item - (intptr)b->items) % b->alloc->m_itemSize == 0);
GCAssert(((uintptr)item - (uintptr)b->items) % b->alloc->m_itemSize == 0);
#endif
// Add this item to the free list
@ -190,7 +190,7 @@ namespace MMgc
static FixedAlloc *GetFixedAlloc(void *item)
{
FixedBlock *b = (FixedBlock*) ((intptr)item & ~0xFFF);
FixedBlock *b = (FixedBlock*) ((uintptr)item & ~0xFFF);
#ifdef _DEBUG
// Attempt to sanity check this ptr: numAllocs * size should be less than kBlockSize
GCAssertMsg(((b->numAlloc * b->size) < GCHeap::kBlockSize), "Size called on ptr not part of FixedBlock");
@ -233,7 +233,7 @@ namespace MMgc
static inline size_t Size(const void *item)
{
FixedBlock *b = (FixedBlock*) ((intptr)item & ~0xFFF);
FixedBlock *b = (FixedBlock*) ((uintptr)item & ~0xFFF);
#ifdef _DEBUG
// Attempt to sanity check this ptr: numAllocs * size should be less than kBlockSize
GCAssertMsg(((b->numAlloc * b->size) < GCHeap::kBlockSize), "Size called on ptr not part of FixedBlock");

View File

@ -128,7 +128,7 @@ namespace MMgc
{
// space made in ctor
item = GetRealPointer(item);
return ((intptr) item & 0xFFF) == 0;
return ((uintptr) item & 0xFFF) == 0;
}
inline void *LargeAlloc(size_t size)

View File

@ -85,10 +85,10 @@ namespace MMgc
const int ZCT::ZCT_START_SIZE = 1;
#endif
#ifdef MMGC_AMD64
const intptr MAX_INTPTR = 0xFFFFFFFFFFFFFFFF;
#ifdef MMGC_64BIT
const uintptr MAX_UINTPTR = 0xFFFFFFFFFFFFFFFF;
#else
const intptr MAX_INTPTR = 0xFFFFFFFF;
const uintptr MAX_UINTPTR = 0xFFFFFFFF;
#endif
// get detailed info on each size class allocators
@ -196,7 +196,7 @@ namespace MMgc
#endif
marking(false),
memStart(MAX_INTPTR),
memStart(MAX_UINTPTR),
memEnd(0),
heap(gcheap),
allocsSinceCollect(0),
@ -225,6 +225,25 @@ namespace MMgc
heapSizeAtLastAlloc(gcheap->GetTotalHeapSize()),
finalizedValue(true)
{
// sanity check for all our types
GCAssert (sizeof(int8) == 1);
GCAssert (sizeof(uint8) == 1);
GCAssert (sizeof(int16) == 2);
GCAssert (sizeof(uint16) == 2);
GCAssert (sizeof(int32) == 4);
GCAssert (sizeof(uint32) == 4);
GCAssert (sizeof(int64) == 8);
GCAssert (sizeof(uint64) == 8);
GCAssert (sizeof(sintptr) == sizeof(void *));
GCAssert (sizeof(uintptr) == sizeof(void *));
#ifdef MMGC_64BIT
GCAssert (sizeof(sintptr) == 8);
GCAssert (sizeof(uintptr) == 8);
#else
GCAssert (sizeof(sintptr) == 4);
GCAssert (sizeof(uintptr) == 4);
#endif
#ifdef MMGC_DRC
zct.gc = this;
#endif
@ -298,7 +317,7 @@ namespace MMgc
uint32* bitsFreelist = m_bitsFreelists[i];
while(bitsFreelist) {
uint32 *next = *(uint32**)bitsFreelist;
if(((intptr)bitsFreelist & 0xfff) == 0) {
if(((uintptr)bitsFreelist & 0xfff) == 0) {
*((void**)bitsFreelist) = pageList;
pageList = (void**)bitsFreelist;
}
@ -836,16 +855,16 @@ bail:
UnmarkGCPages(ptr, size);
}
void GC::SetPageMapValue(intptr addr, int val)
void GC::SetPageMapValue(uintptr addr, int val)
{
intptr index = (addr-memStart) >> 12;
uintptr index = (addr-memStart) >> 12;
GCAssert(index >> 2 < 64 * GCHeap::kBlockSize);
pageMap[index >> 2] |= (val<<((index&0x3)*2));
}
void GC::ClearPageMapValue(intptr addr)
void GC::ClearPageMapValue(uintptr addr)
{
intptr index = (addr-memStart) >> 12;
uintptr index = (addr-memStart) >> 12;
GCAssert(index >> 2 < 64 * GCHeap::kBlockSize);
pageMap[index >> 2] &= ~(3<<((index&0x3)*2));
}
@ -859,7 +878,7 @@ bail:
void GC::MarkGCPages(void *item, uint32 numPages, int to)
{
intptr addr = (intptr)item;
uintptr addr = (uintptr)item;
int shiftAmount=0;
unsigned char *dst = pageMap;
@ -871,7 +890,7 @@ bail:
// in bytes, ie 16k chunks
addr &= ~0x3fff;
// marking earlier pages
if(memStart != MAX_INTPTR) {
if(memStart != MAX_UINTPTR) {
shiftAmount = (memStart - addr) >> 14;
}
memStart = addr;
@ -898,7 +917,7 @@ bail:
}
}
addr = (intptr)item;
addr = (uintptr)item;
while(numPages--)
{
SetPageMapValue(addr, to);
@ -908,7 +927,7 @@ bail:
void GC::UnmarkGCPages(void *item, uint32 numpages)
{
intptr addr = (intptr) item;
uintptr addr = (uintptr) item;
while(numpages--)
{
ClearPageMapValue(addr);
@ -1044,8 +1063,8 @@ bail:
bool GC::IsPointerToGCPage(const void *item)
{
if((intptr)item >= memStart && (intptr)item < memEnd)
return GetPageMapValue((intptr) item) != 0;
if((uintptr)item >= memStart && (uintptr)item < memEnd)
return GetPageMapValue((uintptr) item) != 0;
return false;
}
@ -1173,7 +1192,7 @@ bail:
if(val < _memStart || val >= _memEnd)
continue;
int bits = gc->GetPageMapValue((intptr)val);
int bits = gc->GetPageMapValue((uintptr)val);
bool doit = false;
if (bits == GC::kGCAllocPage) {
doit = GCAlloc::IsRCObject(val) && GCAlloc::FindBeginning(val) == GetRealPointer(val);
@ -1196,7 +1215,7 @@ bail:
int *p = (int*)item;
// skip vtable, first 4 bytes are cleared in Alloc
p++;
#ifdef MMGC_AMD64
#ifdef MMGC_64BIT
p++; // vtable is 8-bytes
size--;
#endif
@ -1437,7 +1456,7 @@ bail:
else
{
GCDebugMsg(false, "GCRoot object: 0x%x\n", container);
if((intptr)container >= memStart && (intptr)container < memEnd)
if((uintptr)container >= memStart && (uintptr)container < memEnd)
PrintStackTrace(container);
}
}
@ -1450,8 +1469,8 @@ bail:
if(size && size <= itemSize) {
// skip traceIndex + data + endMarker
p += (2 + (size>>2));
GCAssert(sizeof(intptr) == sizeof(void*));
*p = (intptr) container;
GCAssert(sizeof(uintptr) == sizeof(void*));
*p = (uintptr) container;
}
}
@ -1459,14 +1478,14 @@ bail:
bool GC::IsRCObject(const void *item)
{
if((intptr)item >= memStart && (intptr)item < memEnd && ((intptr)item&0xfff) != 0)
if((uintptr)item >= memStart && (uintptr)item < memEnd && ((uintptr)item&0xfff) != 0)
{
int bits = GetPageMapValue((intptr)item);
int bits = GetPageMapValue((uintptr)item);
item = GetRealPointer(item);
switch(bits)
{
case kGCAllocPage:
if((char*)item < ((GCAlloc::GCBlock*)((intptr)item&~0xfff))->items)
if((char*)item < ((GCAlloc::GCBlock*)((uintptr)item&~0xfff))->items)
return false;
return GCAlloc::IsRCObject(item);
case kGCLargeAllocPageFirst:
@ -1529,7 +1548,7 @@ bail:
{
// b->firstFree should be either 0 end of free list or a pointer into b, otherwise, someone
// wrote to freed memory and hosed our freelist
GCAssert(freelist == 0 || ((intptr) freelist >= (intptr) b->items && (intptr) freelist < (intptr) b + GCHeap::kBlockSize));
GCAssert(freelist == 0 || ((uintptr) freelist >= (uintptr) b->items && (uintptr) freelist < (uintptr) b + GCHeap::kBlockSize));
freelist = *((void**)freelist);
}
b = b->nextFree;
@ -1547,15 +1566,15 @@ bail:
void GC::UnmarkedScan(const void *mem, size_t size)
{
intptr lowerBound = memStart;
intptr upperBound = memEnd;
uintptr lowerBound = memStart;
uintptr upperBound = memEnd;
intptr *p = (intptr *) mem;
intptr *end = p + (size / sizeof(void*));
uintptr *p = (uintptr *) mem;
uintptr *end = p + (size / sizeof(void*));
while(p < end)
{
intptr val = *p++;
uintptr val = *p++;
if(val < lowerBound || val >= upperBound)
continue;
@ -1584,7 +1603,7 @@ bail:
{
if(findUnmarkedPointers)
{
intptr m = memStart;
uintptr m = memStart;
while(m < memEnd)
{
@ -1636,19 +1655,19 @@ bail:
for(; n<3*(i); n++) b[n] = ' '; \
b[n] = '\0'; }
void GC::ProbeForMatch(const void *mem, size_t size, intptr value, int recurseDepth, int currentDepth)
void GC::ProbeForMatch(const void *mem, size_t size, uintptr value, int recurseDepth, int currentDepth)
{
intptr lowerBound = memStart;
intptr upperBound = memEnd;
uintptr lowerBound = memStart;
uintptr upperBound = memEnd;
intptr *p = (intptr *) mem;
intptr *end = p + (size / sizeof(void*));
uintptr *p = (uintptr *) mem;
uintptr *end = p + (size / sizeof(void*));
int bits = GetPageMapValue((intptr)mem);
int bits = GetPageMapValue((uintptr)mem);
while(p < end)
{
intptr val = *p++;
uintptr val = *p++;
if(val < lowerBound || val >= upperBound)
continue;
@ -1657,7 +1676,7 @@ bail:
if (val == value)
{
// ok so let's see where we are
intptr* where = p-1;
uintptr* where = p-1;
GCHeap::HeapBlock* block = heap->AddrToBlock(where);
//GCAssertMsg(block->inUse(), "Not sure how we got here if the block is not in use?");
GCAssertMsg(block->committed, "Means we are probing uncommitted memory. not good");
@ -1674,8 +1693,8 @@ bail:
int size = fixed->size;
// now compute which element we are
intptr startAt = (intptr) &(fixed->items[0]);
intptr item = ((intptr)where-startAt) / size;
uintptr startAt = (uintptr) &(fixed->items[0]);
uintptr item = ((uintptr)where-startAt) / size;
ptr = (int*) ( startAt + (item*size) );
}
@ -1720,8 +1739,8 @@ bail:
*/
void GC::WhosPointingAtMe(void* me, int recurseDepth, int currentDepth)
{
intptr val = (intptr)me;
intptr m = memStart;
uintptr val = (uintptr)me;
uintptr m = memStart;
char* buffer = 0;
ALLOCA_AND_FILL_WITH_SPACES(buffer, currentDepth);
@ -1846,7 +1865,7 @@ bail:
// TODO: SSE2 version
void GC::MarkItem_MMX(const void *ptr, size_t size, GCStack<GCWorkItem> &work)
{
intptr *p = (intptr*) ptr;
uintptr *p = (uintptr*) ptr;
// deleted things are removed from the queue by setting them to null
if(!p)
return;
@ -1854,8 +1873,8 @@ bail:
bytesMarked += size;
marks++;
intptr *end = p + (size / sizeof(void*));
intptr thisPage = (intptr)p & ~0xfff;
uintptr *end = p + (size / sizeof(void*));
uintptr thisPage = (uintptr)p & ~0xfff;
// since MarkItem recurses we have to do this before entering the loop
if(IsPointerToGCPage(ptr))
@ -1949,13 +1968,13 @@ bail:
void GC::MarkItem(GCWorkItem &wi, GCStack<GCWorkItem> &work)
{
size_t size = wi.GetSize();
intptr *p = (intptr*) wi.ptr;
uintptr *p = (uintptr*) wi.ptr;
bytesMarked += size;
marks++;
intptr *end = p + (size / sizeof(void*));
intptr thisPage = (intptr)p & ~0xfff;
uintptr *end = p + (size / sizeof(void*));
uintptr thisPage = (uintptr)p & ~0xfff;
// set the mark bits on this guy
if(wi.IsGCItem())
@ -1976,8 +1995,8 @@ bail:
GCAssert(!IsPointerToGCPage(wi.ptr));
}
intptr _memStart = memStart;
intptr _memEnd = memEnd;
uintptr _memStart = memStart;
uintptr _memEnd = memEnd;
#ifdef DEBUGGER
numObjects++;
@ -1986,7 +2005,7 @@ bail:
while(p < end)
{
intptr val = *p++;
uintptr val = *p++;
if(val < _memStart || val >= _memEnd)
continue;
@ -1999,7 +2018,7 @@ bail:
//GCAlloc::ConservativeMark(work, (void*) (val&~7), workitem.ptr);
const void* item = (void*) (val&~7);
GCAlloc::GCBlock *block = (GCAlloc::GCBlock*) ((intptr) item & ~0xFFF);
GCAlloc::GCBlock *block = (GCAlloc::GCBlock*) ((uintptr) item & ~0xFFF);
// back up to real beginning
item = GetRealPointer((const void*) item);
@ -2031,7 +2050,7 @@ bail:
realItem = GetUserPointer(realItem);
itemSize -= DebugSize();
#endif
if(((intptr)realItem & ~0xfff) != thisPage)
if(((uintptr)realItem & ~0xfff) != thisPage)
{
*pbits = bits | (GCAlloc::kQueued << shift);
block->gc->PushWorkItem(work, GCWorkItem(realItem, itemSize, true));
@ -2067,7 +2086,7 @@ bail:
// back up to real beginning
item = GetRealPointer((const void*) item);
if(((intptr) item & 0xfff) == sizeof(GCLargeAlloc::LargeBlock))
if(((uintptr) item & 0xfff) == sizeof(GCLargeAlloc::LargeBlock))
{
GCLargeAlloc::LargeBlock *b = GCLargeAlloc::GetBlockHeader(item);
if((b->flags & (GCLargeAlloc::kQueuedFlag|GCLargeAlloc::kMarkFlag)) == 0)
@ -2240,7 +2259,7 @@ bail:
// normalize and divide by 4K to get index
if(!IsPointerToGCPage(item))
return false;
int bits = GetPageMapValue((intptr)item);
int bits = GetPageMapValue((uintptr)item);
switch(bits) {
case 1:
return GCAlloc::IsWhite(item);
@ -2257,15 +2276,15 @@ bail:
void GC::WriteBarrierWrite(const void *address, const void *value)
{
GCAssert(!IsRCObject(value));
*(intptr*)address = (intptr) value;
*(uintptr*)address = (uintptr) value;
}
// optimized version with no RC checks or pointer swizzling
void GC::writeBarrierRC(const void *container, const void *address, const void *value)
{
GCAssert(IsPointerToGCPage(container));
GCAssert(((intptr)container & 3) == 0);
GCAssert(((intptr)address & 2) == 0);
GCAssert(((uintptr)container & 3) == 0);
GCAssert(((uintptr)address & 2) == 0);
GCAssert(address >= container);
GCAssert(address < (char*)container + Size(container));
@ -2284,7 +2303,7 @@ bail:
rc->DecrementRef();
}
#endif
*(intptr*)address = (intptr) value;
*(uintptr*)address = (uintptr) value;
#ifdef MMGC_DRC
rc = (RCObject*)Pointer(value);
if(rc != NULL) {
@ -2348,7 +2367,7 @@ bail:
bool GC::IsGCMemory (const void *item)
{
int bits = GetPageMapValue((intptr)item);
int bits = GetPageMapValue((uintptr)item);
return (bits != 0);
}
@ -2374,7 +2393,7 @@ bail:
if(!m_bitsNext)
m_bitsNext = (uint32*)heap->Alloc(1);
int leftOver = GCHeap::kBlockSize - ((intptr)m_bitsNext & 0xfff);
int leftOver = GCHeap::kBlockSize - ((uintptr)m_bitsNext & 0xfff);
if(leftOver >= numBytes) {
bits = m_bitsNext;
if(leftOver == numBytes)
@ -2494,13 +2513,13 @@ bail:
void GC::WhitePointerScan(const void *mem, size_t size)
{
intptr *p = (intptr *) mem;
uintptr *p = (uintptr *) mem;
// the minus 8 skips the deadbeef and back pointer
intptr *end = p + ((size) / sizeof(void*));
uintptr *end = p + ((size) / sizeof(void*));
while(p < end)
{
intptr val = *p;
uintptr val = *p;
if(val == 0xdeadbeef)
break;
if(IsWhite((const void*) (val&~7)) &&
@ -2522,7 +2541,7 @@ bail:
if(!incrementalValidation)
return;
intptr m = memStart;
uintptr m = memStart;
while(m < memEnd)
{
#ifdef WIN32
@ -2584,7 +2603,7 @@ bail:
while(cb) {
cb->startGCActivity();
cb = cb->nextCB;
}
}
}
void GC::StopGCActivity()
@ -2609,9 +2628,9 @@ bail:
#endif /* DEBUGGER*/
#if defined(_MAC) && (defined(MMGC_IA32) || defined(MMGC_AMD64))
intptr GC::GetStackTop() const
uintptr GC::GetStackTop() const
{
return (intptr)pthread_get_stackaddr_np(pthread_self());
return (uintptr)pthread_get_stackaddr_np(pthread_self());
}
#endif

View File

@ -52,7 +52,7 @@
__asm { mov _stack,esp } ;\
MEMORY_BASIC_INFORMATION __mib;\
VirtualQuery(_stack, &__mib, sizeof(MEMORY_BASIC_INFORMATION)); \
_size = __mib.RegionSize - ((intptr) _stack - (intptr)__mib.BaseAddress);
_size = __mib.RegionSize - ((uintptr) _stack - (uintptr)__mib.BaseAddress);
#else
#define MMGC_GET_STACK_EXENTS(_gc, _stack, _size) \
@ -66,7 +66,7 @@
asm("movl %%esi,%0" : "=r" (save6));\
asm("movl %%edi,%0" : "=r" (save7));\
asm("movl %%esp,%0" : "=r" (_stack));\
_size = (intptr)_gc->GetStackTop() - (intptr)_stack; } while (0)
_size = (uintptr)_gc->GetStackTop() - (uintptr)_stack; } while (0)
#endif
#elif defined MMGC_AMD64
@ -82,7 +82,7 @@
asm("mov %%rsi,%0" : "=r" (save6));\
asm("mov %%rdi,%0" : "=r" (save7));\
asm("mov %%rsp,%0" : "=r" (_stack));\
_size = (intptr)_gc->GetStackTop() - (intptr)_stack; } while (0)
_size = (uintptr)_gc->GetStackTop() - (uintptr)_stack; } while (0)
#elif defined MMGC_PPC
@ -104,7 +104,7 @@
"rlwinm r3,r3,0,0,30\n"\
"cmpi cr0,r3,0\n"\
"bne StackBaseLoop%1%2" : "=b" (__stackBase) : "i" (__FILE__), "i" (__LINE__) : "r3"); \
_size = (intptr) __stackBase - (intptr) _stack;
_size = (uintptr) __stackBase - (uintptr) _stack;
#else
@ -119,7 +119,7 @@
"rlwinm r3,r3,0,0,30\n"\
"cmpi cr0,r3,0\n"\
"bne StackBaseLoop" : "=b" (__stackBase) : : "r3"); \
_size = (intptr) __stackBase - (intptr) _stack;
_size = (uintptr) __stackBase - (uintptr) _stack;
#endif
@ -131,7 +131,7 @@
int regs[7];\
asm("stmia %0,{r4-r10}" : : "r" (regs));\
asm("mov %0,sp" : "=r" (_stack));\
_size = (intptr)StackTop - (intptr)_stack;
_size = (uintptr)StackTop - (uintptr)_stack;
#endif
@ -606,7 +606,7 @@ namespace MMgc
*/
static GC* GetGC(const void *item)
{
GC **gc = (GC**) ((intptr)item&~0xfff);
GC **gc = (GC**) ((uintptr)item&~0xfff);
return *gc;
}
@ -649,7 +649,7 @@ namespace MMgc
void writeBarrier(const void *container, const void *address, const void *value)
{
GCAssert(IsPointerToGCPage(container));
GCAssert(((intptr)address & 3) == 0);
GCAssert(((uintptr)address & 3) == 0);
GCAssert(address >= container);
GCAssert(address < (char*)container + Size(container));
@ -667,7 +667,7 @@ namespace MMgc
*/
__forceinline void WriteBarrierNoSubstitute(const void *container, const void *value)
{
WriteBarrierTrap(container, (const void*)((intptr)value&~7));
WriteBarrierTrap(container, (const void*)((uintptr)value&~7));
}
/**
@ -677,7 +677,7 @@ namespace MMgc
__forceinline void WriteBarrierTrap(const void *container, const void *valuePtr)
{
GCAssert(IsPointerToGCPage(container));
GCAssert(((intptr)valuePtr&7) == 0);
GCAssert(((uintptr)valuePtr&7) == 0);
GCAssert(IsPointerToGCPage(container));
if(marking && valuePtr && GetMark(container) && IsWhite(valuePtr))
{
@ -702,9 +702,9 @@ namespace MMgc
void *FindBeginning(const void *gcItem)
{
GCAssert(gcItem != NULL);
GCAssert(GetPageMapValue((intptr)gcItem) != 0);
GCAssert(GetPageMapValue((uintptr)gcItem) != 0);
void *realItem = NULL;
int bits = GetPageMapValue((intptr)gcItem);
int bits = GetPageMapValue((uintptr)gcItem);
switch(bits)
{
case kGCAllocPage:
@ -716,8 +716,8 @@ namespace MMgc
case kGCLargeAllocPageRest:
while(bits == kGCLargeAllocPageRest)
{
gcItem = (void*) ((intptr)gcItem - GCHeap::kBlockSize);
bits = GetPageMapValue((intptr)gcItem);
gcItem = (void*) ((uintptr)gcItem - GCHeap::kBlockSize);
bits = GetPageMapValue((uintptr)gcItem);
}
realItem = GCLargeAlloc::FindBeginning(gcItem);
break;
@ -791,7 +791,7 @@ namespace MMgc
void ClearWeakRef(const void *obj);
intptr GetStackTop() const;
uintptr GetStackTop() const;
private:
@ -851,16 +851,16 @@ namespace MMgc
// 0 - not in use
// 1 - used by GCAlloc
// 3 - used by GCLargeAlloc
intptr memStart;
intptr memEnd;
uintptr memStart;
uintptr memEnd;
size_t totalGCPages;
unsigned char *pageMap;
inline int GetPageMapValue(intptr addr) const
inline int GetPageMapValue(uintptr addr) const
{
intptr index = (addr-memStart) >> 12;
uintptr index = (addr-memStart) >> 12;
GCAssert(index >> 2 < 64 * GCHeap::kBlockSize);
// shift amount to determine position in the byte (times 2 b/c 2 bits per page)
@ -870,8 +870,8 @@ namespace MMgc
//return (pageMap[addr >> 2] & (3<<shiftAmount)) >> shiftAmount;
return (pageMap[index >> 2] >> shiftAmount) & 3;
}
void SetPageMapValue(intptr addr, int val);
void ClearPageMapValue(intptr addr);
void SetPageMapValue(uintptr addr, int val);
void ClearPageMapValue(uintptr addr);
void MarkGCPages(void *item, uint32 numpages, int val);
void UnmarkGCPages(void *item, uint32 numpages);
@ -963,7 +963,7 @@ public:
private:
#endif
static const void *Pointer(const void *p) { return (const void*)(((intptr)p)&~7); }
static const void *Pointer(const void *p) { return (const void*)(((uintptr)p)&~7); }
#ifdef MEMORY_INFO
public:
@ -1019,7 +1019,7 @@ public:
#ifdef _DEBUG
// Dump a list of objects that have pointers to the given location.
void WhosPointingAtMe(void* me, int recurseDepth=0, int currentDepth=0);
void ProbeForMatch(const void *mem, size_t size, intptr value, int recurseDepth, int currentDepth);
void ProbeForMatch(const void *mem, size_t size, uintptr value, int recurseDepth, int currentDepth);
#endif
};

View File

@ -90,7 +90,7 @@ namespace MMgc
GCAssertMsg(GetNumAlloc() == 0, "You have leaks");
while (m_firstBlock) {
if(((intptr)m_firstBlock->bits & 0xfff) == 0)
if(((uintptr)m_firstBlock->bits & 0xfff) == 0)
m_gc->GetGCHeap()->Free(m_firstBlock->bits);
#ifdef _DEBUG
// go through every item on the free list and make sure it wasn't written to
@ -254,7 +254,7 @@ start:
#ifdef MEMORY_INFO
// ensure previously used item wasn't written to
// -1 because write back pointer space isn't poisoned.
#ifdef MMGC_AMD64
#ifdef MMGC_64BIT
for(int i=3, n=(b->size>>2)-3; i<n; i++)
#else
for(int i=3, n=(b->size>>2)-1; i<n; i++)
@ -273,7 +273,7 @@ start:
#endif
} else {
item = b->nextItem;
if(((intptr)((char*)item + b->size) & 0xfff) != 0) {
if(((uintptr)((char*)item + b->size) & 0xfff) != 0) {
b->nextItem = (char*)item + b->size;
} else {
b->nextItem = NULL;
@ -327,7 +327,7 @@ start:
/* static */
void GCAlloc::Free(void *item)
{
GCBlock *b = (GCBlock*) ((intptr) item & ~0xFFF);
GCBlock *b = (GCBlock*) ((uintptr) item & ~0xFFF);
GCAlloc *a = b->alloc;
#ifdef _DEBUG
@ -612,7 +612,7 @@ start:
/*static*/
int GCAlloc::ConservativeGetMark(const void *item, bool bogusPointerReturnValue)
{
GCBlock *block = (GCBlock*) ((intptr) item & ~0xFFF);
GCBlock *block = (GCBlock*) ((uintptr) item & ~0xFFF);
#ifdef MEMORY_INFO
item = GetRealPointer(item);

View File

@ -87,7 +87,7 @@ namespace MMgc
static int SetMark(const void *item)
{
// Zero low 12 bits of address to get to the Block header
GCBlock *block = (GCBlock*) ((intptr)item & ~0xFFF);
GCBlock *block = (GCBlock*) ((uintptr)item & ~0xFFF);
int index = GetIndex(block, item);
int mask = kMark << ((index&7)<<2);
uint32 *bits = &block->GetBits()[index>>3];
@ -100,21 +100,21 @@ namespace MMgc
static int SetQueued(const void *item)
{
// Zero low 12 bits of address to get to the Block header
GCBlock *block = (GCBlock*) ((intptr)item & ~0xFFF);
GCBlock *block = (GCBlock*) ((uintptr)item & ~0xFFF);
return SetBit(block, GetIndex(block, item), kQueued);
}
static int SetFinalize(const void *item)
{
// Zero low 12 bits of address to get to the Block header
GCBlock *block = (GCBlock*) ((intptr)item & ~0xFFF);
GCBlock *block = (GCBlock*) ((uintptr)item & ~0xFFF);
return SetBit(block, GetIndex(block, item), kFinalize);
}
static int IsWhite(const void *item)
{
// Zero low 12 bits of address to get to the Block header
GCBlock *block = (GCBlock*) ((intptr)item & ~0xFFF);
GCBlock *block = (GCBlock*) ((uintptr)item & ~0xFFF);
// not a real item
if(item < block->items)
@ -130,7 +130,7 @@ namespace MMgc
static int GetMark(const void *item)
{
// Zero low 12 bits of address to get to the Block header
GCBlock *block = (GCBlock*) ((intptr)item & ~0xFFF);
GCBlock *block = (GCBlock*) ((uintptr)item & ~0xFFF);
// Return the "marked" bit
return GetBit(block, GetIndex(block, item), kMark);
@ -139,7 +139,7 @@ namespace MMgc
static void *FindBeginning(const void *item)
{
// Zero low 12 bits of address to get to the Block header
GCBlock *block = (GCBlock*) ((intptr)item & ~0xFFF);
GCBlock *block = (GCBlock*) ((uintptr)item & ~0xFFF);
return block->items + block->size * GetIndex(block, item);
}
@ -147,34 +147,34 @@ namespace MMgc
static void ClearFinalized(const void *item)
{
// Zero low 12 bits of address to get to the Block header
GCBlock *block = (GCBlock*) ((intptr)item & ~0xFFF);
GCBlock *block = (GCBlock*) ((uintptr)item & ~0xFFF);
ClearBits(block, GetIndex(block, item), kFinalize);
}
static int IsFinalized(const void *item)
{
// Zero low 12 bits of address to get to the Block header
GCBlock *block = (GCBlock*) ((intptr)item & ~0xFFF);
GCBlock *block = (GCBlock*) ((uintptr)item & ~0xFFF);
return GetBit(block, GetIndex(block, item), kFinalize);
}
static int HasWeakRef(const void *item)
{
// Zero low 12 bits of address to get to the Block header
GCBlock *block = (GCBlock*) ((intptr)item & ~0xFFF);
GCBlock *block = (GCBlock*) ((uintptr)item & ~0xFFF);
return GetBit(block, GetIndex(block, item), kHasWeakRef);
}
static bool ContainsPointers(const void *item)
{
// Zero low 12 bits of address to get to the Block header
GCBlock *block = (GCBlock*) ((intptr)item & ~0xFFF);
GCBlock *block = (GCBlock*) ((uintptr)item & ~0xFFF);
return block->alloc->ContainsPointers();
}
static bool IsRCObject(const void *item)
{
// Zero low 12 bits of address to get to the Block header
GCBlock *block = (GCBlock*) ((intptr)item & ~0xFFF);
GCBlock *block = (GCBlock*) ((uintptr)item & ~0xFFF);
return item >= block->items && block->alloc->IsRCObject();
}
@ -191,7 +191,7 @@ namespace MMgc
static void SetHasWeakRef(const void *item, bool to)
{
GCBlock *block = (GCBlock*) ((intptr)item & ~0xFFF);
GCBlock *block = (GCBlock*) ((uintptr)item & ~0xFFF);
if(to) {
SetBit(block, GetIndex(block, item), kHasWeakRef);
} else {

View File

@ -104,7 +104,7 @@ namespace MMgc
#endif
// Note: Mask off MSB to avoid negative indices. Mask off bottom
// 2 bits because of alignment. Double it because names, values stored adjacently.
unsigned i = ((0x7FFFFFF8 & (intptr)key)>>1) & bitmask;
unsigned i = ((0x7FFFFFF8 & (uintptr)key)>>1) & bitmask;
const void *k;
while ((k=table[i]) != key && k != NULL)
{

View File

@ -136,7 +136,7 @@ namespace MMgc
HeapBlock *block = &blocks[i];
if(block->baseAddr)
{
int megamapIndex = ((int)(intptr)block->baseAddr) >> 12;
int megamapIndex = ((int)(uintptr)block->baseAddr) >> 12;
GCAssert(m_megamap[megamapIndex] == 0);
}
if(block->inUse() && block->baseAddr)
@ -182,7 +182,7 @@ namespace MMgc
// Check for debug builds only:
// Use the megamap to double-check that we haven't handed
// any of these pages out already.
int megamapIndex = ((int)(intptr)block->baseAddr)>>12;
int megamapIndex = ((int)(uintptr)block->baseAddr)>>12;
for (int i=0; i<size; i++) {
GCAssert(m_megamap[megamapIndex] == 0);
@ -225,7 +225,7 @@ namespace MMgc
// For debug builds only:
// Check the megamap to ensure that all the pages
// being freed are in fact allocated.
int megamapIndex = ((int)(intptr)block->baseAddr) >> 12;
int megamapIndex = ((int)(uintptr)block->baseAddr) >> 12;
for (int i=0; i<block->size; i++) {
if(m_megamap[megamapIndex] != 1) {
GCAssertMsg(false, "Megamap is screwed up, are you freeing freed memory?");
@ -725,7 +725,7 @@ namespace MMgc
void GCHeap::AddToFreeList(HeapBlock *block)
{
GCAssert(m_megamap[((int)(intptr)block->baseAddr)>>12] == 0);
GCAssert(m_megamap[((int)(uintptr)block->baseAddr)>>12] == 0);
int index = GetFreeListIndex(block->size);
HeapBlock *freelist = &freelists[index];
@ -765,7 +765,7 @@ namespace MMgc
// Try to coalesce this block with its predecessor
HeapBlock *prevBlock = block - block->sizePrevious;
if (!prevBlock->inUse() && prevBlock->committed) {
GCAssert(m_megamap[((int)(intptr)prevBlock->baseAddr)>>12] == 0);
GCAssert(m_megamap[((int)(uintptr)prevBlock->baseAddr)>>12] == 0);
// Remove predecessor block from free list
RemoveFromList(prevBlock);

View File

@ -166,7 +166,7 @@ namespace MMgc
if (res == MAP_FAILED)
address = 0;
else
address = (void*)( (intptr)address + size );
address = (void*)( (uintptr)address + size );
return address;
}

View File

@ -153,7 +153,7 @@ namespace MMgc
/* static */
bool GCLargeAlloc::ConservativeGetMark(const void *item, bool bogusPointerReturnValue)
{
if(((intptr) item & 0xfff) == sizeof(LargeBlock))
if(((uintptr) item & 0xfff) == sizeof(LargeBlock))
{
return GetMark(item);
}

View File

@ -77,7 +77,7 @@ namespace MMgc
{
// The pointer should be 4K aligned plus 16 bytes
// Mac inserts 16 bytes for new[] so make it more general
return (((intptr)item & 0xFFF) == sizeof(LargeBlock));
return (((uintptr)item & 0xFFF) == sizeof(LargeBlock));
}
static bool SetMark(const void *item)
@ -158,7 +158,7 @@ namespace MMgc
static LargeBlock* GetBlockHeader(const void *addr)
{
return (LargeBlock*) ((intptr)addr & ~0xFFF);
return (LargeBlock*) ((uintptr)addr & ~0xFFF);
}
static bool NeedsFinalize(LargeBlock *block)

View File

@ -307,7 +307,7 @@ namespace MMgc
size_t DebugSize()
{
#ifdef MMGC_AMD64
#ifdef MMGC_64BIT
// Our writeback pointer is 8 bytes so we need to round up to the next 8 byte
// size. (only 5 DWORDS are used)
return 6 * sizeof(int);
@ -381,7 +381,7 @@ namespace MMgc
mem += (size>>2);
*mem++ = 0xdeadbeef;
*mem = 0;
#ifdef MMGC_AMD64
#ifdef MMGC_64BIT
*(mem+1) = 0;
*(mem+2) = 0;
#endif

View File

@ -192,12 +192,12 @@ namespace MMgc
/**
* Given a user pointer back up to real beginning
*/
inline void *GetRealPointer(const void *item) { return (void*)((intptr) item - 2 * sizeof(int)); }
inline void *GetRealPointer(const void *item) { return (void*)((uintptr) item - 2 * sizeof(int)); }
/**
* Given a user pointer back up to real beginning
*/
inline void *GetUserPointer(const void *item) { return (void*)((intptr) item + 2 * sizeof(int)); }
inline void *GetUserPointer(const void *item) { return (void*)((uintptr) item + 2 * sizeof(int)); }
const char* GetTypeName(int index, void *obj);

View File

@ -325,7 +325,7 @@ namespace MMgc
{
public:
RCPtr() { t = NULL; }
RCPtr(T t) : t(t) { if(t && (intptr)t != 1) t->IncrementRef(); }
RCPtr(T t) : t(t) { if(t && (uintptr)t != 1) t->IncrementRef(); }
~RCPtr()
{
if(t && t != (T)1)
@ -345,10 +345,10 @@ namespace MMgc
T operator=(T tNew)
{
if(t && (intptr)t != 1)
if(t && (uintptr)t != 1)
t->DecrementRef();
t = tNew;
if(t && (intptr)t != 1)
if(t && (uintptr)t != 1)
t->IncrementRef();
// this cast is safe b/c other wise compilation would fail
return (T) t;

View File

@ -63,7 +63,19 @@ namespace MMgc
typedef signed char int8;
// math friendly pointer (64 bits in LP 64 systems)
typedef unsigned long intptr;
#if defined (_MSC_VER) && (_MSC_VER >= 1300)
#define MMGC_TYPE_IS_POINTER_SIZED __w64
#else
#define MMGC_TYPE_IS_POINTER_SIZED
#endif
#ifdef MMGC_64BIT
typedef MMGC_TYPE_IS_POINTER_SIZED uint64 uintptr;
typedef MMGC_TYPE_IS_POINTER_SIZED int64 sintptr;
#else
typedef MMGC_TYPE_IS_POINTER_SIZED uint32 uintptr;
typedef MMGC_TYPE_IS_POINTER_SIZED int32 sintptr;
#endif
/* wchar is our version of wchar_t, since wchar_t is different sizes
on different platforms, but we want to use UTF-16 uniformly. */

View File

@ -48,6 +48,7 @@
#define MMGC_IA32
#elif defined (__x86_64__)
#define MMGC_AMD64
#define MMGC_64BIT
#elif defined (__ppc__)
#define MMGC_PPC
#endif

View File

@ -331,7 +331,7 @@ namespace avmplus
MODRM(r, disp, base);
}
void CodegenMIR::XORPD(Register dest, intptr addr)
void CodegenMIR::XORPD(Register dest, uintptr addr)
{
incInstructionCount();
#ifdef AVMPLUS_VERBOSE
@ -501,7 +501,7 @@ namespace avmplus
incInstructionCount();
#ifdef AVMPLUS_VERBOSE
if (verbose())
core->console.format(" %A call %A\n", mip, offset+(intptr)(mip+5));
core->console.format(" %A call %A\n", mip, offset+(uintptr)(mip+5));
#endif /* AVMPLUS_VERBOSE */
*mip++ = 0xE8;
@ -974,7 +974,7 @@ namespace avmplus
#endif
byte* next_ip = mip+4; // branch rel. to next instr
CALL (info->m_handler_addr - (intptr)next_ip - 1); // call the method as an instance method
CALL (info->m_handler_addr - (uintptr)next_ip - 1); // call the method as an instance method
#ifdef AVMPLUS_CDECL
int popAmount = (pushCount+1)*4;

View File

@ -161,12 +161,12 @@ namespace avmplus
static const int epilogue_size = 208;
#ifndef AVMPLUS_MAC
#define FUNCADDR(addr) (intptr)addr
#define FUNCADDR(addr) (uintptr)addr
#else
#if TARGET_RT_MAC_MACHO
#define FUNCADDR(addr) (intptr)addr
#define FUNCADDR(addr) (uintptr)addr
#else
#define FUNCADDR(addr) (*((intptr*)addr))
#define FUNCADDR(addr) (*((uintptr*)addr))
#endif
#endif
@ -177,12 +177,12 @@ namespace avmplus
#endif /* AVMPLUS_VERBOSE */
#if defined(_MSC_VER) && !defined(AVMPLUS_ARM)
#define SETJMP ((intptr)_setjmp3)
#define SETJMP ((uintptr)_setjmp3)
#else
#ifdef AVMPLUS_MAC_CARBON
#define SETJMP setjmpAddress
#else
#define SETJMP ((intptr)setjmp)
#define SETJMP ((uintptr)setjmp)
#endif
#endif /* _MSC_VER */
@ -198,7 +198,7 @@ namespace avmplus
*/
// format 1
OP* CodegenMIR::Ins(MirOpcode code, intptr v)
OP* CodegenMIR::Ins(MirOpcode code, uintptr v)
{
OP* ip = this->ip;
#ifndef FEATURE_BUFFER_GUARD
@ -237,7 +237,7 @@ namespace avmplus
}
// format 2
OP* CodegenMIR::Ins(MirOpcode code, OP* a1, intptr v2)
OP* CodegenMIR::Ins(MirOpcode code, OP* a1, uintptr v2)
{
OP* ip = this->ip;
#ifndef FEATURE_BUFFER_GUARD
@ -600,10 +600,10 @@ namespace avmplus
*/
AvmAssert(sizeof(OP) == 16);
#ifdef AVMPLUS_64BIT
AvmAssert(0); // 64bit - needs fixes - is intptr right for slot/currIns??
AvmAssert(0); // 64bit - needs fixes - is uintptr right for slot/currIns??
#endif
intptr* slot = (intptr*)currIns;
if (*slot == (intptr)elm || *(slot+1) == (intptr)elm || *(slot+2) == (intptr)elm)
uintptr* slot = (uintptr*)currIns;
if (*slot == (uintptr)elm || *(slot+1) == (uintptr)elm || *(slot+2) == (uintptr)elm)
{
remove = true;
}
@ -611,7 +611,7 @@ namespace avmplus
((currIns->code&~MIR_float&~MIR_oper) == MIR_cm) ||
((currIns->code&~MIR_float&~MIR_oper) == MIR_cs) ||
((currIns->code&~MIR_float) == MIR_ci) ) &&
(*(slot+3) == (intptr)elm) )
(*(slot+3) == (uintptr)elm) )
{
remove = true;
}
@ -660,7 +660,7 @@ namespace avmplus
}
// store to register + offset
void CodegenMIR::storeIns(OP* value, intptr disp, OP* base)
void CodegenMIR::storeIns(OP* value, uintptr disp, OP* base)
{
OP* ip = this->ip;
#ifndef FEATURE_BUFFER_GUARD
@ -1031,17 +1031,17 @@ namespace avmplus
if (core->sse2)
funcaddr = COREADDR(AvmCore::doubleToAtom_sse2);
#endif
return callIns(MIR_cmop, funcaddr, 2, InsConst((intptr)core), native);
return callIns(MIR_cmop, funcaddr, 2, InsConst((uintptr)core), native);
}
if (t == INT_TYPE)
{
return callIns(MIR_cmop, COREADDR(AvmCore::intToAtom), 2,
InsConst((intptr)core), native);
InsConst((uintptr)core), native);
}
if (t == UINT_TYPE)
{
return callIns(MIR_cmop, COREADDR(AvmCore::uintToAtom), 2,
InsConst((intptr)core), native);
InsConst((uintptr)core), native);
}
if (t == BOOLEAN_TYPE)
{
@ -1153,7 +1153,7 @@ namespace avmplus
// store the traits ptr so the debugger knows what was stored.
if (i < state->verifier->local_count)
{
storeIns(InsConst((intptr)v.traits ), i*sizeof(Traits*), localTraits);
storeIns(InsConst((uintptr)v.traits ), i*sizeof(Traits*), localTraits);
storeIns(Ins(MIR_usea, v.ins), i*sizeof(void*), localPtrs);
}
else if (i >= state->verifier->scopeBase && i < state->verifier->scopeBase + state->verifier->max_scope)
@ -1718,7 +1718,7 @@ namespace avmplus
return overflow;
// if this fails, we aren't estimating a big enough space for MIR
intptr curSize = (intptr)ip-(intptr)ipStart;
uintptr curSize = (uintptr)ip-(uintptr)ipStart;
if (curSize >= mirBuffSize)
{
// start over with bigger buffer.
@ -1727,7 +1727,7 @@ namespace avmplus
if (core->sprof.sprofile)
{
core->console << "INFO: MIR buffer expanding ("
<< " abc " << (abcEnd-abcStart)
<< " abc " << int(abcEnd-abcStart)
<< " factor " << expansionFactor
<< " pro " << prologue_size << " epi " << epilogue_size
<< " est " << mirBuffSize
@ -1791,7 +1791,7 @@ namespace avmplus
if (atom->code == MIR_imm)
return InsConst(atom->imm & ~7);
else
return binaryIns(MIR_and, atom, InsConst(intptr(~7)));
return binaryIns(MIR_and, atom, InsConst(uintptr(~7)));
}
}
@ -1941,7 +1941,7 @@ namespace avmplus
if (core->dprof.dprofile)
{
callIns(MIR_cm, COREADDR(DynamicProfiler::mark), 2,
(intptr)&core->dprof, InsConst(OP_prologue));
(uintptr)&core->dprof, InsConst(OP_prologue));
}
#endif
@ -1959,7 +1959,7 @@ namespace avmplus
storeIns(capturedDxns, 0, dxns);
// dxnsSave = AvmCore::dxnsAddr
dxnsAddrSave = loadIns(MIR_ldop, offsetof(AvmCore, dxnsAddr), InsConst((intptr)core));
dxnsAddrSave = loadIns(MIR_ldop, offsetof(AvmCore, dxnsAddr), InsConst((uintptr)core));
}
for (int i=0, n = state->verifier->stackBase+state->stackDepth; i < n; i++)
@ -2160,7 +2160,7 @@ namespace avmplus
// _ef.beginTry(core);
callIns(MIR_cm, EFADDR(ExceptionFrame::beginTry), 2,
leaIns(0,_ef), InsConst((intptr)core));
leaIns(0,_ef), InsConst((uintptr)core));
// spill prior to jmp so that our stack is cleared of
// any transient locals.
@ -2189,7 +2189,7 @@ namespace avmplus
// ISSUE why do we have to redefine ef? it is NULL when exception happens
OP* pc = loadIns(MIR_ld, 0, _save_eip);
OP* handler = callIns(MIR_cm, COREADDR(AvmCore::beginCatch), 5,
InsConst((intptr)core), leaIns(0,_ef), InsConst((intptr)info), pc, ee);
InsConst((uintptr)core), leaIns(0,_ef), InsConst((uintptr)info), pc, ee);
// jump to catch handler
Ins(MIR_jmpi, handler, (int32)offsetof(ExceptionHandler, target));
@ -2208,16 +2208,16 @@ namespace avmplus
if (state->insideTryBlock)
storeIns(InsConst(state->pc), 0, _save_eip);
OP* interrupted = loadIns(MIR_ld, (intptr)&core->interrupted, NULL);
OP* interrupted = loadIns(MIR_ld, (uintptr)&core->interrupted, NULL);
OP* br = Ins(MIR_jne, binaryIns(MIR_ucmp, interrupted, InsConst(0)));
mirPatchPtr(&br->target, interrupt_label);
}
// this is not fatal but its good to know if our prologue estimation code is off.
#if defined(AVMPLUS_PROFILE) && defined(_DEBUG)
sizingStats[SZ_ABC] = (intptr)abcEnd-(intptr)abcStart;
sizingStats[SZ_ABC] = (uintptr)abcEnd-(uintptr)abcStart;
sizingStats[SZ_MIREXP] = expansionFactor;
intptr actual_prologue_size = ((intptr)ip-(intptr)ipStart);
uintptr actual_prologue_size = ((uintptr)ip-(uintptr)ipStart);
sizingStats[SZ_MIRPRO] = (double)(actual_prologue_size-prologue_size) / prologue_size;
AvmAssertMsg( prologue_size >= actual_prologue_size , "Increase prologue_size estimation\n");
#endif
@ -2275,7 +2275,7 @@ namespace avmplus
#endif
// core->codeContext = env;
storeIns(ldargIns(_env), (intptr)&core->codeContextAtom, 0);
storeIns(ldargIns(_env), (uintptr)&core->codeContextAtom, 0);
}
if (!f || f->usesDefaultXmlNamespace())
@ -2321,7 +2321,7 @@ namespace avmplus
dxnsAddr = leaIns(offsetof(ScopeChain, defaultXmlNamespace), scope);
}
storeIns(dxnsAddr, (intptr)&core->dxnsAddr, 0);
storeIns(dxnsAddr, (uintptr)&core->dxnsAddr, 0);
}
void CodegenMIR::merge(const Value& current, Value& target)
@ -2390,7 +2390,7 @@ namespace avmplus
if (state->insideTryBlock)
storeIns(InsConst(state->pc), 0, _save_eip);
OP* interrupted = loadIns(MIR_ld, (intptr)&core->interrupted, NULL);
OP* interrupted = loadIns(MIR_ld, (uintptr)&core->interrupted, NULL);
OP* br = Ins(MIR_jne, binaryIns(MIR_ucmp, interrupted, InsConst(0)));
mirPatchPtr(&br->target, interrupt_label);
}
@ -2416,7 +2416,7 @@ namespace avmplus
saveState();
}
void CodegenMIR::emitIntConst(FrameState* state, int index, intptr c)
void CodegenMIR::emitIntConst(FrameState* state, int index, uintptr c)
{
this->state = state;
localSet(index, InsConst(c));
@ -2425,7 +2425,7 @@ namespace avmplus
void CodegenMIR::emitDoubleConst(FrameState* state, int index, double* pd)
{
this->state = state;
localSet(index, loadIns(MIR_fldop, (intptr)pd, NULL));
localSet(index, loadIns(MIR_fldop, (uintptr)pd, NULL));
}
void CodegenMIR::emitCoerce(FrameState* state, int loc, Traits* result)
@ -2470,7 +2470,7 @@ namespace avmplus
{
// * -> Number
localSet(loc, callIns(MIR_fcmop, COREADDR(AvmCore::number), 2,
InsConst((intptr)core), loadAtomRep(loc)));
InsConst((uintptr)core), loadAtomRep(loc)));
}
}
else if (result == INT_TYPE)
@ -2521,7 +2521,7 @@ namespace avmplus
{
// * -> int
localSet(loc, callIns(MIR_cmop, COREADDR(AvmCore::integer), 2,
InsConst((intptr)core), loadAtomRep(loc)));
InsConst((uintptr)core), loadAtomRep(loc)));
}
}
else if (result == UINT_TYPE)
@ -2570,7 +2570,7 @@ namespace avmplus
{
// * -> uint
localSet(loc, callIns(MIR_cmop, COREADDR(AvmCore::toUInt32), 2,
InsConst((intptr)core), loadAtomRep(loc)));
InsConst((uintptr)core), loadAtomRep(loc)));
}
}
else if (result == BOOLEAN_TYPE)
@ -2589,7 +2589,7 @@ namespace avmplus
{
// * -> Boolean
localSet(loc, callIns(MIR_cmop, COREADDR(AvmCore::boolean), 2,
InsConst((intptr)core), loadAtomRep(loc)));
InsConst((uintptr)core), loadAtomRep(loc)));
}
}
else if (result == STRING_TYPE)
@ -2597,34 +2597,34 @@ namespace avmplus
if (in == INT_TYPE)
{
localSet(loc, callIns(MIR_cmop, COREADDR(AvmCore::intToString), 2,
InsConst((intptr)core), localGet(loc)));
InsConst((uintptr)core), localGet(loc)));
}
else if (in == UINT_TYPE)
{
localSet(loc, callIns(MIR_cmop, COREADDR(AvmCore::uintToString), 2,
InsConst((intptr)core), localGet(loc)));
InsConst((uintptr)core), localGet(loc)));
}
else if (in == NUMBER_TYPE)
{
localSet(loc, callIns(MIR_cmop, COREADDR(AvmCore::doubleToString), 2,
InsConst((intptr)core), localGet(loc)));
InsConst((uintptr)core), localGet(loc)));
}
else if (in == BOOLEAN_TYPE)
{
// load "true" or "false"
OP *index = binaryIns(MIR_lsh, localGet(loc), InsConst(2));
localSet(loc, loadIns(MIR_ldop, (intptr)&core->booleanStrings, index));
localSet(loc, loadIns(MIR_ldop, (uintptr)&core->booleanStrings, index));
}
else if (value.notNull)
{
// not eligible for CSE, and we know it's not null/undefined
localSet(loc, callIns(MIR_cm, COREADDR(AvmCore::string), 2,
InsConst((intptr)core), loadAtomRep(loc)));
InsConst((uintptr)core), loadAtomRep(loc)));
}
else
{
localSet(loc, callIns(MIR_cm, COREADDR(AvmCore::coerce_s), 2,
InsConst((intptr)core), loadAtomRep(loc)));
InsConst((uintptr)core), loadAtomRep(loc)));
}
}
else if (in && !in->isMachineType && !result->isMachineType
@ -2633,7 +2633,7 @@ namespace avmplus
OP* toplevel = loadToplevel(ldargIns(_env));
// coerceobj is void, but we mustn't optimize it out; verifier only calls it when required
callIns(MIR_cm, TOPLEVELADDR(Toplevel::coerceobj), 3,
toplevel, localGet(loc), InsConst((intptr)result));
toplevel, localGet(loc), InsConst((uintptr)result));
// the input pointer has now been checked but it's still the same value.
// verifier remembers this fact by updating the verify time type.
}
@ -2641,7 +2641,7 @@ namespace avmplus
{
// result is a ScriptObject based type.
localSet(loc, callIns(MIR_cm, ENVADDR(MethodEnv::coerceAtom2SO), 3,
ldargIns(_env), loadAtomRep(loc), InsConst((intptr)result)));
ldargIns(_env), loadAtomRep(loc), InsConst((uintptr)result)));
}
else
{
@ -2651,7 +2651,7 @@ namespace avmplus
OP* out = callIns(MIR_cmop, TOPLEVELADDR(Toplevel::coerce), 3,
toplevel,
value,
InsConst((intptr)result));
InsConst((uintptr)result));
// store the result
localSet(loc, atomToNativeRep(result, out));
@ -2689,7 +2689,7 @@ namespace avmplus
if (core->dprof.dprofile)
{
callIns(MIR_cm, COREADDR(DynamicProfiler::mark), 1,
(intptr)&core->dprof, InsConst(opcode));
(uintptr)&core->dprof, InsConst(opcode));
}
#else
(void)opcode;
@ -2799,7 +2799,7 @@ namespace avmplus
}
}
void CodegenMIR::emit(FrameState* state, AbcOpcode opcode, intptr op1, intptr op2, Traits* result)
void CodegenMIR::emit(FrameState* state, AbcOpcode opcode, uintptr op1, uintptr op2, Traits* result)
{
this->state = state;
emitPrep(opcode);
@ -2961,7 +2961,7 @@ namespace avmplus
wbAddr = FUNCADDR(AvmCore::atomWriteBarrier);
}
callIns(op, wbAddr, 4,
InsConst((intptr)core->GetGC()),
InsConst((uintptr)core->GetGC()),
ptr,
leaIns(offset, ptr),
value);
@ -2991,7 +2991,7 @@ namespace avmplus
// restore AvmCore::dxnsAddr if we set it to a stack addr in our frame
if(info->setsDxns()) {
storeIns(dxnsAddrSave, (intptr)&core->dxnsAddr, 0);
storeIns(dxnsAddrSave, (uintptr)&core->dxnsAddr, 0);
}
#ifdef DEBUGGER
@ -3026,7 +3026,7 @@ namespace avmplus
// implicitly coerce undefined to the return type
OP* toplevel = loadToplevel(ldargIns(_env));
retvalue = callIns(MIR_cmop, TOPLEVELADDR(Toplevel::coerce), 3,
toplevel, retvalue, InsConst((intptr)t));
toplevel, retvalue, InsConst((uintptr)t));
retvalue = atomToNativeRep(t, retvalue);
}
}
@ -3046,7 +3046,7 @@ namespace avmplus
//sp[0] = typeof(sp[0]);
OP* value = loadAtomRep(op1);
OP* i3 = callIns(MIR_cmop, COREADDR(AvmCore::_typeof), 2,
InsConst((intptr)core), value);
InsConst((uintptr)core), value);
AvmAssert(result == STRING_TYPE);
localSet(op1, i3);
break;
@ -3109,7 +3109,7 @@ namespace avmplus
// *sp = core->intToAtom(~integer(*sp));
AvmAssert(state->value(op1).traits == INT_TYPE);
OP* value = localGet(op1);
OP* out = binaryIns(MIR_xor, value, InsConst(intptr(~0)));
OP* out = binaryIns(MIR_xor, value, InsConst(uintptr(~0)));
localSet(op1, out);
break;
}
@ -3169,7 +3169,7 @@ namespace avmplus
saveState();
//throwAtom(*sp--);
callIns(MIR_cm, COREADDR(AvmCore::throwAtom), 2,
InsConst((intptr)core), value);
InsConst((uintptr)core), value);
break;
}
@ -3271,7 +3271,7 @@ namespace avmplus
OP* argv = leaIns(0, ap);
OP* i3 = callIns(MIR_cm, ENVADDR(MethodEnv::newfunction), 4,
envArg, InsConst((intptr)func), outer, argv);
envArg, InsConst((uintptr)func), outer, argv);
InsDealloc(ap);
@ -3453,7 +3453,7 @@ namespace avmplus
OP* envArg = ldargIns(_env);
OP* activationVTable = callIns(MIR_cm, ENVADDR(MethodEnv::getActivation), 1, envArg);
OP* activation = callIns(MIR_cm, COREADDR(AvmCore::newActivation), 3,
InsConst((intptr)core), activationVTable, InsConst(0));
InsConst((uintptr)core), activationVTable, InsConst(0));
localSet(dest, ptrToNativeRep(result, activation));
break;
@ -3465,7 +3465,7 @@ namespace avmplus
int dest = sp+1;
OP* activation = callIns(MIR_cm, ENVADDR(MethodEnv::newcatch), 2,
ldargIns(_env), InsConst((intptr)result));
ldargIns(_env), InsConst((uintptr)result));
localSet(dest, ptrToNativeRep(result, activation));
break;
@ -3599,7 +3599,7 @@ namespace avmplus
// framep[op2] = env->finddef(name)
Multiname* multiname = (Multiname*) op1;
int dest = op2;
OP* name = InsConst((intptr)multiname->getName());
OP* name = InsConst((uintptr)multiname->getName());
OP* out;
AvmAssert(multiname->isBinding());
@ -3607,14 +3607,14 @@ namespace avmplus
{
out = callIns(MIR_cmop, ENVADDR(MethodEnv::finddefNsset), 3,
ldargIns(_env),
InsConst((intptr)multiname->getNsset()),
InsConst((uintptr)multiname->getNsset()),
name);
}
else
{
out = callIns(MIR_cmop, ENVADDR(MethodEnv::finddefNs), 3,
ldargIns(_env),
InsConst((intptr)multiname->getNamespace()),
InsConst((uintptr)multiname->getNamespace()),
name);
}
localSet(dest, ptrToNativeRep(result, out));
@ -3701,7 +3701,7 @@ namespace avmplus
OP* obj = loadAtomRep(objDisp);
// copy the compile-time namespace to the temp multiname
OP* mSpace = InsConst((intptr)multiname->ns);
OP* mSpace = InsConst((uintptr)multiname->ns);
storeIns(mSpace, offsetof(Multiname, ns), _tempname);
OP *multi = leaIns(0, _tempname);
@ -3811,7 +3811,7 @@ namespace avmplus
OP* envarg = ldargIns(_env);
// copy the compile-time namespace to the temp multiname
OP* mSpace = InsConst((intptr)multiname->ns);
OP* mSpace = InsConst((uintptr)multiname->ns);
storeIns(mSpace, offsetof(Multiname, ns), _tempname);
OP *multi = leaIns(0, _tempname);
@ -3881,7 +3881,7 @@ namespace avmplus
if( !multiname->isRtns() )
{
// copy the compile-time namespace to the temp multiname
OP* mSpace = InsConst((intptr)multiname->ns);
OP* mSpace = InsConst((uintptr)multiname->ns);
storeIns(mSpace, offsetof(Multiname, ns), _tempname);
}
else
@ -3912,7 +3912,7 @@ namespace avmplus
case OP_convert_s:
{
localSet(op1, callIns(MIR_cm, COREADDR(AvmCore::string), 2,
InsConst((intptr)core), loadAtomRep(op1)));
InsConst((uintptr)core), loadAtomRep(op1)));
break;
}
@ -3921,7 +3921,7 @@ namespace avmplus
//sp[0] = core->ToXMLString(sp[0]);
OP* value = loadAtomRep(op1);
OP* i3 = callIns(MIR_cmop, COREADDR(AvmCore::ToXMLString), 2,
InsConst((intptr)core), value);
InsConst((uintptr)core), value);
AvmAssert(result == STRING_TYPE);
localSet(op1, i3);
break;
@ -3932,7 +3932,7 @@ namespace avmplus
//sp[0] = core->EscapeAttributeValue(sp[0]);
OP* value = loadAtomRep(op1);
OP* i3 = callIns(MIR_cmop, COREADDR(AvmCore::EscapeAttributeValue), 2,
InsConst((intptr)core), value);
InsConst((uintptr)core), value);
AvmAssert(result == STRING_TYPE);
localSet(op1, i3);
break;
@ -3989,7 +3989,7 @@ namespace avmplus
OP* lhs = localGet(sp-1);
OP* rhs = localGet(sp);
OP* out = callIns(MIR_cmop, COREADDR(AvmCore::concatStrings), 3,
InsConst((intptr)core), lhs, rhs);
InsConst((uintptr)core), lhs, rhs);
localSet(sp-1, out);
break;
}
@ -4067,7 +4067,7 @@ namespace avmplus
OP* obj = loadAtomRep(op2);
OP* itraits = InsConst(op1);
OP* out = callIns(MIR_cm, COREADDR(AvmCore::istypeAtom), 3,
InsConst((intptr)core), obj, itraits);
InsConst((uintptr)core), obj, itraits);
out = atomToNativeRep(result, out);
localSet(op2, out);
break;
@ -4085,7 +4085,7 @@ namespace avmplus
OP* obj = loadAtomRep(sp-1);
OP* i3 = callIns(MIR_cm, COREADDR(AvmCore::istypeAtom), 3,
InsConst((intptr)core), obj, traits);
InsConst((uintptr)core), obj, traits);
i3 = atomToNativeRep(result, i3);
localSet(sp-1, i3);
@ -4098,7 +4098,7 @@ namespace avmplus
OP* ns = callIns(MIR_cm,
COREADDR(AvmCore::newPublicNamespace),
2,
InsConst((intptr)core),
InsConst((uintptr)core),
uri);
storeIns(ns, 0, dxns);
break;
@ -4108,11 +4108,11 @@ namespace avmplus
{
OP* atom = loadAtomRep(op1);
OP* uri = callIns(MIR_cm, COREADDR(AvmCore::intern), 2,
InsConst((intptr)core), atom);
InsConst((uintptr)core), atom);
OP* ns = callIns(MIR_cm,
COREADDR(AvmCore::newPublicNamespace),
2,
InsConst((intptr)core),
InsConst((uintptr)core),
uri);
storeIns(ns, 0, dxns);
break;
@ -4126,7 +4126,7 @@ namespace avmplus
{
// todo refactor api's so we don't have to pass argv/argc
OP* debugger = loadIns(MIR_ldop, offsetof(AvmCore, debugger),
InsConst((intptr)core));
InsConst((uintptr)core));
callIns(MIR_cm, DEBUGGERADDR(Debugger::debugFile), 2,
debugger,
InsConst(op1));
@ -4137,7 +4137,7 @@ namespace avmplus
{
// todo refactor api's so we don't have to pass argv/argc
OP* debugger = loadIns(MIR_ldop, offsetof(AvmCore, debugger),
InsConst((intptr)core));
InsConst((uintptr)core));
callIns(MIR_cm, DEBUGGERADDR(Debugger::debugLine), 2,
debugger,
InsConst(op1));
@ -4162,7 +4162,7 @@ namespace avmplus
if (core->dprof.dprofile)
{
callIns(MIR_cm, COREADDR(DynamicProfiler::mark), 1,
(intptr)&core->dprof, InsConst(opcode));
(uintptr)&core->dprof, InsConst(opcode));
}
#endif /* AVMPLUS_PROFILE */
@ -4354,7 +4354,7 @@ namespace avmplus
OP* lhs = loadAtomRep(lhsi);
OP* rhs = loadAtomRep(rhsi);
OP* atom = callIns(MIR_cm, COREADDR(AvmCore::compare), 3,
InsConst((intptr)core), lhs, rhs);
InsConst((uintptr)core), lhs, rhs);
// caller will use jlt for (a<b) and jge for !(a<b)
// compare ^8 <8
@ -4375,7 +4375,7 @@ namespace avmplus
OP* lhs = loadAtomRep(lhsi);
OP* rhs = loadAtomRep(rhsi);
OP* atom = callIns(MIR_cm, COREADDR(AvmCore::compare), 3,
InsConst((intptr)core), rhs, lhs);
InsConst((uintptr)core), rhs, lhs);
// assume caller will use jle for (a<=b) and jgt for !(a<=b)
// compare ^1 <=4
@ -4413,7 +4413,7 @@ namespace avmplus
OP* lhs = loadAtomRep(lhsi);
OP* rhs = loadAtomRep(rhsi);
OP* out = callIns(MIR_cm, funcaddr,
3, InsConst((intptr)core), lhs, rhs);
3, InsConst((uintptr)core), lhs, rhs);
// assume caller will use MIR_jeq or MIR_jne
return binaryIns(MIR_icmp, out, InsConst(trueAtom));
@ -4487,7 +4487,7 @@ namespace avmplus
// this is not fatal but its good to know if our epilogue estimation code is off.
#if defined(AVMPLUS_PROFILE) && defined(_DEBUG)
intptr actual_size = ((intptr)ip-(intptr)ipStart);
uintptr actual_size = ((uintptr)ip-(uintptr)ipStart);
int actual_epilogue_size = 0;//((int)ip-(int)_epilogue);
sizingStats[SZ_MIR] = actual_size;
sizingStats[SZ_MIRWASTE] = ((double)(mirBuffSize-actual_size)) / mirBuffSize;
@ -4538,10 +4538,10 @@ namespace avmplus
{
case MIR_bb:
{
intptr prev = blockStart-begin;
intptr bbprev = (intptr) ( (bbNums.get(prev) > (int*)0) ? bbNums.get(prev) : bbNums.put(prev, (int*)bbNum++) );
intptr current = ins-begin;
intptr bbcurrent = (intptr) ( (bbNums.get(current) > (int*)0) ? bbNums.get(current) : bbNums.put(current, (int*)bbNum++) );
uintptr prev = blockStart-begin;
uintptr bbprev = (uintptr) ( (bbNums.get(prev) > (int*)0) ? bbNums.get(prev) : bbNums.put(prev, (int*)bbNum++) );
uintptr current = ins-begin;
uintptr bbcurrent = (uintptr) ( (bbNums.get(current) > (int*)0) ? bbNums.get(current) : bbNums.put(current, (int*)bbNum++) );
if (!blockDone)
{
@ -4557,9 +4557,9 @@ namespace avmplus
case MIR_ret:
{
intptr prev = blockStart-begin;
intptr bbprev = (intptr) ( (bbNums.get(prev) > (int*)0) ? bbNums.get(prev) : bbNums.put(prev, (int*)bbNum++) );
intptr bbexit = (intptr) bbNums.get(end-begin);
uintptr prev = blockStart-begin;
uintptr bbprev = (uintptr) ( (bbNums.get(prev) > (int*)0) ? bbNums.get(prev) : bbNums.put(prev, (int*)bbNum++) );
uintptr bbexit = (uintptr) bbNums.get(end-begin);
core->console << "BB" << (int)bbprev << "_" << (int)prev << " -> BB" << (int)bbexit<< "_" << (int)(end-begin) << " [weight=2] \n";
blockDone = true;
break;
@ -4580,11 +4580,11 @@ namespace avmplus
{
// immediate jump
OP* target = ins->target; // target is absolute, -1 anticipates ins++ below
intptr t = target - begin;
intptr prev = blockStart-begin;
uintptr t = target - begin;
uintptr prev = blockStart-begin;
AvmAssert(target->code == MIR_bb);
intptr bbprev = (intptr) ( (bbNums.get(prev) > (int*)0) ? bbNums.get(prev) : bbNums.put(prev, (int*)bbNum++) );
intptr bbt = (intptr) ( (bbNums.get(t) > (int*)0) ? bbNums.get(t) : bbNums.put(t, (int*)bbNum++) );
uintptr bbprev = (uintptr) ( (bbNums.get(prev) > (int*)0) ? bbNums.get(prev) : bbNums.put(prev, (int*)bbNum++) );
uintptr bbt = (uintptr) ( (bbNums.get(t) > (int*)0) ? bbNums.get(t) : bbNums.put(t, (int*)bbNum++) );
core->console << "BB" << (int)bbprev << "_" << (int)prev << " -> BB" << (int)bbt << "_" << (int)t << " [weight=2] \n";
blockDone = true;
@ -4599,12 +4599,12 @@ namespace avmplus
case MIR_jnlt:
{
OP* target = ins->target; // target is absolute
intptr t = target - begin;
intptr prev = blockStart-begin;
intptr bbprev = (intptr) ( (bbNums.get(prev) > (int*)0) ? bbNums.get(prev) : bbNums.put(prev, (int*)bbNum++) );
intptr bbt = (intptr) ( (bbNums.get(t) > (int*)0) ? bbNums.get(t) : bbNums.put(t, (int*)bbNum++) );
intptr next = ins+1-begin;
intptr bbnext = (intptr) ( (bbNums.get(next) > (int*)0) ? bbNums.get(next) : bbNums.put(next, (int*)bbNum++) );
uintptr t = target - begin;
uintptr prev = blockStart-begin;
uintptr bbprev = (uintptr) ( (bbNums.get(prev) > (int*)0) ? bbNums.get(prev) : bbNums.put(prev, (int*)bbNum++) );
uintptr bbt = (uintptr) ( (bbNums.get(t) > (int*)0) ? bbNums.get(t) : bbNums.put(t, (int*)bbNum++) );
uintptr next = ins+1-begin;
uintptr bbnext = (uintptr) ( (bbNums.get(next) > (int*)0) ? bbNums.get(next) : bbNums.put(next, (int*)bbNum++) );
AvmAssert(target->code == MIR_bb);
core->console << "BB" << (int)bbprev << "_" << (int)prev << " -> BB" << (int)bbt << "_" << (int)t << " [taillabel=T] \n";
@ -4624,10 +4624,10 @@ namespace avmplus
ins++;
}
intptr prev = blockStart-begin;
intptr bbprev = (intptr) ( (bbNums.get(prev) > (int*)0) ? bbNums.get(prev) : bbNums.put(prev, (int*)bbNum++) );
intptr current = ins-begin-1;
int bbcurrent = (intptr) ( (bbNums.get(current) > (int*)0) ? bbNums.get(current) : bbNums.put(current, (int*)bbNum++) );
uintptr prev = blockStart-begin;
uintptr bbprev = (uintptr) ( (bbNums.get(prev) > (int*)0) ? bbNums.get(prev) : bbNums.put(prev, (int*)bbNum++) );
uintptr current = ins-begin-1;
int bbcurrent = (uintptr) ( (bbNums.get(current) > (int*)0) ? bbNums.get(current) : bbNums.put(current, (int*)bbNum++) );
if (!blockDone)
{
core->console << "BB" << (int)bbprev << "_" << (int)prev << " -> BB" << (int)bbcurrent << "_" << (int)current << " [weight=2] \n";
@ -4659,7 +4659,7 @@ namespace avmplus
else
{
// copy the compile-time name to the temp name
OP* mName = InsConst((intptr)multiname->name);
OP* mName = InsConst((uintptr)multiname->name);
storeIns(mName, offsetof(Multiname,name), _tempname);
}
@ -4675,7 +4675,7 @@ namespace avmplus
else
{
// copy the compile-time namespace to the temp multiname
OP* mSpace = InsConst((intptr)multiname->ns);
OP* mSpace = InsConst((uintptr)multiname->ns);
storeIns(mSpace, offsetof(Multiname, ns), _tempname);
}
@ -4694,7 +4694,7 @@ namespace avmplus
else
{
callIns(MIR_cm, COREADDR(AvmCore::initMultinameLate), 3,
InsConst((intptr)core),
InsConst((uintptr)core),
leaIns(0, _tempname),
nameAtom);
}
@ -4803,7 +4803,7 @@ namespace avmplus
buffer << mirNames[op->code] << " ";
#endif
const char *name;
if (names != NULL && ((intptr)(name = (const char *)names->get(op->addr)) != undefinedAtom) && name )
if (names != NULL && ((uintptr)(name = (const char *)names->get(op->addr)) != undefinedAtom) && name )
{
buffer << name;
}
@ -5028,7 +5028,7 @@ namespace avmplus
code = getMDBuffer(pool);
// place the case table at the beginning of the md buffer
// 64bit - needs to be a table of intptrs?
// 64bit - needs to be a table of uintptrs?
casePtr = (uint32*)&code[0];
mipStart = mip = (MDInstruction*) (casePtr+case_count);
@ -5276,7 +5276,7 @@ namespace avmplus
#ifdef _DEBUG
// not terminal but good to know if our prologue estimation is off
intptr actual = (intptr)mip - (intptr)mipStart;
uintptr actual = (uintptr)mip - (uintptr)mipStart;
AvmAssertMsg( actual <= md_prologue_size, "Increase md_prologue_size estimate\n");
#endif /* _DEBUG */
}
@ -5616,8 +5616,8 @@ namespace avmplus
if (core->sprof.sprofile)
{
int asByteCount = abcEnd-abcStart;
intptr mirBytes = (intptr)ipEnd-(intptr)ipStart;
intptr mdBytes = (intptr)mip - (intptr)&code[0];
uintptr mirBytes = (uintptr)ipEnd-(uintptr)ipStart;
uintptr mdBytes = (uintptr)mip - (uintptr)&code[0];
Stringp name = info->name;
if (!name) name = core->kEmptyString;
core->console
@ -5627,9 +5627,9 @@ namespace avmplus
#endif
<< "\n "
<< "abc " << asByteCount
<< " mir " << mirBytes
<< " mir " << int(mirBytes)
//<< "/" << 100*(mirBytes-asByteCount)/asByteCount << "% "
<< " md " << mdBytes
<< " md " << int(mdBytes)
//<< "/"<<100*(mdBytes-asByteCount)/asByteCount << "%"
<< "\n";
}
@ -5664,7 +5664,7 @@ namespace avmplus
info->flags |= AbstractFunction::TURBO;
#endif /* AVMPLUS_INTERP */
intptr mipEnd = (intptr) mip;
uintptr mipEnd = (uintptr) mip;
(void)mipEnd;
bindMethod(info);
@ -5680,7 +5680,7 @@ namespace avmplus
#ifdef _DEBUG
// not terminal but good to know if our epilogue estimation is off
intptr actual_epilogue_size = ( (intptr)mipEnd - (intptr)mipEpilog );
uintptr actual_epilogue_size = ( (uintptr)mipEnd - (uintptr)mipEpilog );
AvmAssertMsg( actual_epilogue_size <= md_epilogue_size , "Increase md_epilogue_size estimate\n");
if ((byte*)mipEnd >= pool->codeBuffer->end())
AvmAssert(false);
@ -5700,7 +5700,7 @@ namespace avmplus
double mdrate = mInstructionCount / mddiff; // K instructions per second (diff in ms)
double mirrate = (ipEnd-ipStart) / mirdiff; // K OP's per sec
double mdperc = mddiff/alldiff*100;
intptr size = mipEnd - (intptr)mipStart;
uintptr size = mipEnd - (uintptr)mipStart;
// perf
core->console << " " << (int)mirrate << "K mir/s "
@ -5709,7 +5709,7 @@ namespace avmplus
<< (int)(1000*alldiff) << " micros\n";
// sizing
core->console << " " << (size) << " bytes from "
core->console << " " << int(size) << " bytes from "
<< InsNbr(ip) << " MIR instructions "
<< (mInstructionCount) << " MD. max span "
<< longestSpan
@ -7411,7 +7411,7 @@ namespace avmplus
#endif
// save code pointers on MethodInfo
ReadOnlyScriptBufferImpl* buff = new (core->GetGC()) ReadOnlyScriptBufferImpl(code, (intptr)mip - (intptr)&code[0]);
ReadOnlyScriptBufferImpl* buff = new (core->GetGC()) ReadOnlyScriptBufferImpl(code, (uintptr)mip - (uintptr)&code[0]);
ScriptBuffer sc(buff);
#if defined(_MAC) && !TARGET_RT_MAC_MACHO
@ -7448,7 +7448,7 @@ namespace avmplus
// make the code executable
MMgc::GCHeap* heap = core->GetGC()->GetGCHeap();
heap->SetExecuteBit(mipStart, (intptr)mip - (intptr)mipStart, true);
heap->SetExecuteBit(mipStart, (uintptr)mip - (uintptr)mipStart, true);
}
#endif /* AVMPLUS_JIT_READONLY */
@ -7481,7 +7481,7 @@ namespace avmplus
if (overflow)
return;
intptr threshold = (intptr)pool->codeBuffer->uncommitted() - maxBytesPerMIRIns;
uintptr threshold = (uintptr)pool->codeBuffer->uncommitted() - maxBytesPerMIRIns;
#else
(void)maxBytesPerMIRIns;
#endif /* FEATURE_BUFFER_GUARD */
@ -7517,10 +7517,10 @@ namespace avmplus
#ifndef FEATURE_BUFFER_GUARD
// now check to see if we are about to overflow our buffer, if so
// bring in the next page and update the threshold
if ( (intptr)mip > threshold)
if ( (uintptr)mip > threshold)
{
pool->codeBuffer->grow();
threshold = (intptr)pool->codeBuffer->uncommitted() - maxBytesPerMIRIns;
threshold = (uintptr)pool->codeBuffer->uncommitted() - maxBytesPerMIRIns;
// check for buffer overrun
if (overflow)
@ -8211,7 +8211,7 @@ namespace avmplus
#else
static uint32 __attribute__ ((aligned (16))) negateMask[] = {0,0x80000000,0,0};
#endif
XORPD(r,(intptr)negateMask);
XORPD(r,(uintptr)negateMask);
}
else
{
@ -9269,11 +9269,11 @@ namespace avmplus
case MIR_jmpt:
{
// copy MIR case table entries to MD case table
intptr disp = (intptr)casePtr;
uintptr disp = (uintptr)casePtr;
for (int i=1, n=ip->size; i <= n; i++) {
OP* target = ip->args[i];
spillTmps(target);
*casePtr++ = (intptr)target;
*casePtr++ = (uintptr)target;
}
// The pattern for an indirect jump is the following:
@ -10002,7 +10002,7 @@ namespace avmplus
/* set position of label (will trigger patching) */
void CodegenMIR::mdLabel(MdLabel* l, void* v)
{
l->value = (intptr)v;
l->value = (uintptr)v;
while(l->nextPatch)
{
uint32* ins = l->nextPatch; // next patch is a pointer
@ -10015,7 +10015,7 @@ namespace avmplus
void CodegenMIR::mdLabel(OP* l, void* v)
{
AvmAssert(l->code == MIR_bb);
l->pos = (intptr)v;
l->pos = (uintptr)v;
while(l->nextPatch)
{
uint32* ins = l->nextPatch; // next patch is a pointer
@ -10126,7 +10126,7 @@ namespace avmplus
#if defined (AVMPLUS_IA32) || defined(AVMPLUS_AMD64)
MDInstruction* savedMip = mip;
mip = (MDInstruction* )where;
IMM32( labelvalue-(intptr)mip-4 ); // relative branch (minus the size of the immediate)
IMM32( labelvalue-(uintptr)mip-4 ); // relative branch (minus the size of the immediate)
mip = savedMip;
#endif /* AVMPLUS_IA32 */
@ -10156,7 +10156,7 @@ namespace avmplus
callIns(MIR_cm, COREADDR(AvmCore::sample), 1, InsConst((int32)core));
br->target = Ins(MIR_bb);
*/
callIns(MIR_cm, COREADDR(AvmCore::sampleCheck), 1, InsConst((intptr)core));
callIns(MIR_cm, COREADDR(AvmCore::sampleCheck), 1, InsConst((uintptr)core));
}
#endif

View File

@ -47,7 +47,7 @@ namespace avmplus
#define BIT_VALUE_FITS(v,n) ( BIT_EXTRACT(v,n-1,0) == (v) )
// rounding v up to the given 2^ quantity
#define BIT_ROUND_UP(v,q) ( (((intptr)v)+(q)-1) & ~((q)-1) )
#define BIT_ROUND_UP(v,q) ( (((uintptr)v)+(q)-1) & ~((q)-1) )
/**
* The CodegenMIR class is a dynamic code generator which translates
@ -186,7 +186,7 @@ namespace avmplus
void epilogue(FrameState* state);
bool prologue(FrameState* state);
void emitCall(FrameState* state, AbcOpcode opcode, int method_id, int argc, Traits* result);
void emit(FrameState* state, AbcOpcode opcode, intptr op1=0, intptr op2=0, Traits* result=NULL);
void emit(FrameState* state, AbcOpcode opcode, uintptr op1=0, uintptr op2=0, Traits* result=NULL);
void emitIf(FrameState* state, AbcOpcode opcode, int target, int lhs, int rhs);
void emitSwap(FrameState* state, int i, int j);
void emitCopy(FrameState* state, int src, int dest);
@ -194,7 +194,7 @@ namespace avmplus
void emitKill(FrameState* state, int i);
void emitBlockStart(FrameState* state);
void emitBlockEnd(FrameState* state);
void emitIntConst(FrameState* state, int index, intptr c);
void emitIntConst(FrameState* state, int index, uintptr c);
void emitDoubleConst(FrameState* state, int index, double* pd);
void emitCoerce(FrameState* state, int index, Traits* type);
void emitCheckNull(FrameState* state, int index);
@ -824,13 +824,13 @@ namespace avmplus
OP* InsAt(int nbr) { return ipStart+nbr; }
int InsNbr(OP* ins) { AvmAssert(ins >= ipStart); return (ins-ipStart); }
OP* InsConst(intptr value) { return Ins(MIR_imm, value); }
OP* InsConst(uintptr value) { return Ins(MIR_imm, value); }
OP* InsAlloc(size_t s) { return Ins(MIR_alloc, (int32)s); }
void InsDealloc(OP* alloc);
OP* ldargIns(ArgNumber arg) { return &methodArgs[arg]; }
OP* Ins(MirOpcode code, intptr v=0);
OP* Ins(MirOpcode code, OP* a1, intptr a2);
OP* Ins(MirOpcode code, uintptr v=0);
OP* Ins(MirOpcode code, OP* a1, uintptr a2);
OP* Ins(MirOpcode code, OP* a1, OP* a2=0);
OP* defineArgInsPos(int spOffset);
OP* defineArgInsReg(Register r);
@ -853,7 +853,7 @@ namespace avmplus
OP* cmpLe(int lhs, int rhs);
OP* cmpEq(int funcaddr, int lhs, int rhs);
void storeIns(OP* v, intptr disp, OP* base);
void storeIns(OP* v, uintptr disp, OP* base);
OP* leaIns(int disp, OP* base);
OP* callIns(int32 addr, uint32 argCount, MirOpcode code);
@ -1418,7 +1418,7 @@ namespace avmplus
void UCOMISD(Register xmm1, Register xmm2) { SSE(0x660f2e, xmm1, xmm2); }
void MOVAPD(Register dest, Register src) { SSE(0x660f28, dest, src); }
void XORPD(Register dest, intptr src);
void XORPD(Register dest, uintptr src);
void SSE(int op, Register r, int disp, Register base);
void ADDSD(Register r, int disp, Register base) { SSE(0xf20f58, r, disp, base); }
@ -1590,7 +1590,7 @@ namespace avmplus
// 64bit - not sure about this
#ifdef AVMPLUS_AMD64
AvmAssert(0);
CALL (addr - (5+(intptr)mip));
CALL (addr - (5+(uintptr)mip));
#endif
}

View File

@ -314,7 +314,7 @@ namespace avmplus
MODRM(r, disp, base);
}
void CodegenMIR::XORPD(Register dest, intptr addr)
void CodegenMIR::XORPD(Register dest, uintptr addr)
{
incInstructionCount();
#ifdef AVMPLUS_VERBOSE

View File

@ -64,8 +64,8 @@ namespace avmplus
{
bytes.add(OP_abs_jump);
#ifdef AVMPLUS_64BIT
writeInt((int)(intptr)pc);
writeInt((int)(((intptr)pc) >> 32));
writeInt((int)(uintptr)pc);
writeInt((int)(((uintptr)pc) >> 32));
#else
writeInt((int)pc);
#endif

View File

@ -149,9 +149,9 @@ namespace avmplus
return pool->core;
}
intptr iid() const
uintptr iid() const
{
return ((intptr)this)>>3;
return ((uintptr)this)>>3;
}
bool usesCallerContext() const

View File

@ -87,6 +87,25 @@ namespace avmplus
AvmCore::AvmCore(GC *g) : GCRoot(g), console(NULL), mirBuffers(g, 4), gcInterface(g)
{
// sanity check for all our types
AvmAssert (sizeof(int8) == 1);
AvmAssert (sizeof(uint8) == 1);
AvmAssert (sizeof(int16) == 2);
AvmAssert (sizeof(uint16) == 2);
AvmAssert (sizeof(int32) == 4);
AvmAssert (sizeof(uint32) == 4);
AvmAssert (sizeof(int64) == 8);
AvmAssert (sizeof(uint64) == 8);
AvmAssert (sizeof(sintptr) == sizeof(void *));
AvmAssert (sizeof(uintptr) == sizeof(void *));
#ifdef AVMPLUS_64BIT
AvmAssert (sizeof(sintptr) == 8);
AvmAssert (sizeof(uintptr) == 8);
#else
AvmAssert (sizeof(sintptr) == 4);
AvmAssert (sizeof(uintptr) == 4);
#endif
// set default mode flags
#ifdef AVMPLUS_VERBOSE
verbose = false;
@ -1374,8 +1393,9 @@ return the result of the comparison ToPrimitive(x) == y.
{
buffer << opNames[opcode];
uint32 index = readU30(pc);
String *s = format(pool->cpool_string[index]->atom());
if (index < pool->cpool_string.size())
buffer << " " << pool->cpool_string[index]->atom();
buffer << " " << s;
break;
}
case OP_pushint:
@ -2628,7 +2648,7 @@ return the result of the comparison ToPrimitive(x) == y.
}
// compute the hash function
int hashCode = ((intptr)ns->getURI())>>3;
int hashCode = ((uintptr)ns->getURI())>>3;
int bitMask = m - 1;
@ -3479,7 +3499,7 @@ return the result of the comparison ToPrimitive(x) == y.
bitMask = (1<<shift)-1;
}
intptr hashCode = StackTrace::hashCode(e, depth);
uintptr hashCode = StackTrace::hashCode(e, depth);
uint32 j = (hashCode&0x7FFFFFFF) & bitMask;
uint32 n = 7;
while (stackTraces[j] != NULL && !stackTraces[j]->equals(e,depth)) {

View File

@ -109,7 +109,7 @@ const int kBufferPadding = 16;
void stopSampling();
void clearSamples();
intptr timerHandle;
uintptr timerHandle;
Hashtable *fakeMethodInfos;
void initSampling();
#endif
@ -514,7 +514,7 @@ const int kBufferPadding = 16;
#ifdef AVMPLUS_VERBOSE
/** Disassembles an opcode and places the text in str. */
static void formatOpcode(PrintWriter& out, const byte *pc, AbcOpcode opcode, int off, PoolObject* pool);
void formatOpcode(PrintWriter& out, const byte *pc, AbcOpcode opcode, int off, PoolObject* pool);
static void formatMultiname(PrintWriter& out, uint32 index, PoolObject* pool);
#endif
@ -1339,7 +1339,7 @@ const int kBufferPadding = 16;
{
double *ptr = (double*)GetGC()->Alloc(sizeof(double), 0);
*ptr = n;
return kDoubleType | (intptr)ptr;
return kDoubleType | (uintptr)ptr;
}
void rehashStrings(int newlen);

View File

@ -370,9 +370,9 @@ namespace avmplus
wchar intbuf[256];
int len;
MathUtils::convertIntegerToString(value, intbuf, len);
wchar *intptr = intbuf;
while (*intptr) {
*buffer++ = *intptr++;
wchar *uintptr = intbuf;
while (*uintptr) {
*buffer++ = *uintptr++;
}
}
break;

View File

@ -78,7 +78,7 @@ namespace avmplus
childNode->setParent (this);
if (!m_children)
{
m_children = intptr(childNode) | SINGLECHILDBIT;
m_children = uintptr(childNode) | SINGLECHILDBIT;
return;
}
@ -122,11 +122,11 @@ namespace avmplus
E4XNode *firstChild = (E4XNode *) (m_children & ~SINGLECHILDBIT);
AtomArray *aa = new (gc()) AtomArray(2);
aa->push (AvmCore::gcObjectToAtom(firstChild));
m_children = intptr(aa);
m_children = uintptr(aa);
}
else if (!m_children)
{
m_children = intptr(new (gc()) AtomArray (1));
m_children = uintptr(new (gc()) AtomArray (1));
}
}
@ -134,7 +134,7 @@ namespace avmplus
{
// m_children->insert (i, a)
convertToAtomArray();
AtomArray *aa = ((AtomArray *)(intptr)m_children);
AtomArray *aa = ((AtomArray *)(uintptr)m_children);
aa->insert (i, AvmCore::gcObjectToAtom(x));
}
@ -142,7 +142,7 @@ namespace avmplus
{
// m_children->removeAt (i)
convertToAtomArray();
AtomArray *aa = ((AtomArray *)(intptr)m_children);
AtomArray *aa = ((AtomArray *)(uintptr)m_children);
aa->removeAt (i);
}
@ -150,12 +150,12 @@ namespace avmplus
{
if ((i == 0) && (m_children & SINGLECHILDBIT))
{
m_children = intptr(x) | SINGLECHILDBIT;
m_children = uintptr(x) | SINGLECHILDBIT;
}
else
{
convertToAtomArray();
AtomArray *aa = ((AtomArray *)(intptr)m_children);
AtomArray *aa = ((AtomArray *)(uintptr)m_children);
aa->setAt (i, AvmCore::gcObjectToAtom(x));
}
}
@ -171,7 +171,7 @@ namespace avmplus
}
else
{
AtomArray *aa = (AtomArray *)(intptr)this->m_children;
AtomArray *aa = (AtomArray *)(uintptr)this->m_children;
E4XNode *x = (E4XNode *) AvmCore::atomToGCObject(aa->getAt(i));
return x;
}
@ -255,13 +255,13 @@ namespace avmplus
(ns->getPrefix() == core->kEmptyString->atom() && ns->getURI() == core->kEmptyString))
{
//m_nameOrAux = int (name);
WBRC(core->GetGC(), this, &m_nameOrAux, intptr(name));
WBRC(core->GetGC(), this, &m_nameOrAux, uintptr(name));
return;
}
E4XNodeAux *aux = new (core->GetGC()) E4XNodeAux (name, ns);
//m_nameOrAux = AUXBIT | int(aux);
WB(core->GetGC(), this, &m_nameOrAux, AUXBIT | intptr(aux));
WB(core->GetGC(), this, &m_nameOrAux, AUXBIT | uintptr(aux));
}
void E4XNode::setQName (AvmCore *core, Multiname *mn)
@ -668,7 +668,7 @@ namespace avmplus
if (numChildren())
{
AvmAssert(y->m_children == 0);
y->m_children = intptr(new (core->GetGC()) AtomArray (numChildren()));
y->m_children = uintptr(new (core->GetGC()) AtomArray (numChildren()));
for (uint32 k = 0; k < _length(); k++)
{
E4XNode *child = _getAt(k);
@ -834,7 +834,7 @@ namespace avmplus
if (!m_children)
{
m_children = intptr(new (core->GetGC()) AtomArray (n));
m_children = uintptr(new (core->GetGC()) AtomArray (n));
}
if (xl)
@ -890,7 +890,7 @@ namespace avmplus
i = _length();
// add a blank spot for this child
if (!m_children)
m_children = intptr(new (core->GetGC()) AtomArray (1));
m_children = uintptr(new (core->GetGC()) AtomArray (1));
convertToAtomArray();
AtomArray *aa = ((AtomArray *)(int)m_children);
aa->push (Atom(0));
@ -968,7 +968,7 @@ namespace avmplus
Stringp str = (String *)(nameOrAux);
E4XNodeAux *aux = new (core->GetGC()) E4XNodeAux (str, core->publicNamespace, f);
//m_nameOrAux = AUXBIT | int(aux);
WB(core->GetGC(), this, &m_nameOrAux, AUXBIT | intptr(aux));
WB(core->GetGC(), this, &m_nameOrAux, AUXBIT | uintptr(aux));
}
}

View File

@ -142,7 +142,7 @@ namespace avmplus
// containing a name + namespace as well as a notification function.
// E4XNodeAux *
// String *
intptr m_nameOrAux;
uintptr m_nameOrAux;
#define AUXBIT 0x1
public:

View File

@ -120,7 +120,7 @@ namespace avmplus
void ExceptionFrame::throwException(Exception *exception)
{
longjmp(jmpbuf, (intptr)exception);
longjmp(jmpbuf, (uintptr)exception);
}
void ExceptionFrame::beginCatch()

View File

@ -79,7 +79,7 @@ namespace avmplus
{
// Take the address of a local variable to get
// stack pointer
intptr sp = (intptr)&core;
uintptr sp = (uintptr)&core;
if (sp < core->minstack)
{
env->vtable->traits->core->stackOverflow(env);
@ -362,7 +362,7 @@ namespace avmplus
continue;
case OP_pushdouble:
sp++;
sp[0] = kDoubleType|(intptr)cpool_double[readU30(pc)];
sp[0] = kDoubleType|(uintptr)cpool_double[readU30(pc)];
continue;
case OP_pushnamespace:
sp++;
@ -1419,7 +1419,7 @@ namespace avmplus
if (interruptable && core->interrupted)
env->interrupt();
#ifdef AVMPLUS_64BIT
const byte *target = (const byte *) (AvmCore::readU30(pc) | (intptr(AvmCore::readU30(pc)) << 32));
const byte *target = (const byte *) (AvmCore::readU30(pc) | (uintptr(AvmCore::readU30(pc)) << 32));
#else
const byte *target = (const byte *) AvmCore::readU30(pc);
#endif
@ -1521,21 +1521,21 @@ namespace avmplus
// stack
core->console << " stack:";
for (int i=stackBase; i <= sp; i++) {
core->console << " " << framep[i];
core->console << " " << core->format(framep[i]);
}
core->console << '\n';
// scope chain
core->console << " scope: ";
for (int i=scopeBase; i <= scopep; i++) {
core->console << framep[i] << " ";
core->console << core->format(framep[i]) << " ";
}
core->console << '\n';
// locals
core->console << " locals: ";
for (int i=0; i < scopeBase; i++) {
core->console << framep[i] << " ";
core->console << core->format(framep[i]) << " ";
}
core->console << '\n';
@ -1548,7 +1548,7 @@ namespace avmplus
}
#endif
core->console << off << ':';
AvmCore::formatOpcode(core->console, pc, opcode, off, pool);
core->formatOpcode(core->console, pc, opcode, off, pool);
core->console << '\n';
}
#endif

View File

@ -257,7 +257,7 @@ namespace avmplus
VTable* const activation;
WeakKeyHashtable* const methodTable;
};
intptr activationOrMCTable;
uintptr activationOrMCTable;
// low 2 bits of activationOrMCTable
enum { kActivation=0, kMethodTable, kActivationMethodTablePair };
@ -266,7 +266,7 @@ namespace avmplus
int getType() const { return activationOrMCTable&3; }
void setActivationOrMCTable(void *ptr, int type)
{
WB(core()->GetGC(), this, &activationOrMCTable, (intptr)ptr|type);
WB(core()->GetGC(), this, &activationOrMCTable, (uintptr)ptr|type);
}
};

View File

@ -78,7 +78,7 @@ namespace avmplus
// Note: Mask off MSB to avoid negative indices. Mask off bottom
// 3 bits because it doesn't contribute to hash. Triple it
// because names, namespaces, and values are stored adjacently.
unsigned i = ((0x7FFFFFF8 & (intptr)name) >> 3) & bitmask;
unsigned i = ((0x7FFFFFF8 & (uintptr)name) >> 3) & bitmask;
Stringp k;
while (((k=t[i].name) != name || t[i].ns != ns) && k != NULL)
{
@ -150,7 +150,7 @@ namespace avmplus
// Note: Mask off MSB to avoid negative indices. Mask off bottom
// 3 bits because it doesn't contribute to hash. Triple it
// because names, namespaces, and values are stored adjacently.
unsigned i = ((0x7FFFFFF8 & (intptr)mnameName)>>3) & bitMask;
unsigned i = ((0x7FFFFFF8 & (uintptr)mnameName)>>3) & bitMask;
int j;
Stringp atomName;

View File

@ -62,7 +62,7 @@ namespace avmplus
void Namespace::setUri(Stringp uri, NamespaceType flags)
{
WBRC(GC::GetGC(this), this, &m_uri, (sint32)flags | (intptr) uri);
WBRC(GC::GetGC(this), this, &m_uri, (sint32)flags | (uintptr) uri);
}
void Namespace::setPrefix (Atom pre)

View File

@ -44,7 +44,7 @@ namespace avmplus
friend class AvmCore;
// Should these be Stringp's?
Atom m_prefix;
intptr m_uri; // Uses 3 bits for flags, but otherwise is really a Stringp
uintptr m_uri; // Uses 3 bits for flags, but otherwise is really a Stringp
public:
enum NamespaceType
{
@ -59,7 +59,7 @@ namespace avmplus
~Namespace();
Atom getPrefix() const { return m_prefix; };
Stringp getURI() const { return (Stringp)(((intptr)m_uri)&~7); };
Stringp getURI() const { return (Stringp)(((uintptr)m_uri)&~7); };
Atom atom() const { return AtomConstants::kNamespaceType | (Atom)this; }

View File

@ -49,8 +49,8 @@ namespace avmplus
static double daylightSavingTA(double time);
static uint64 currentTimeMillis();
static intptr startIntWriteTimer(uint32 millis, int *addr);
static void stopTimer(intptr handle);
static uintptr startIntWriteTimer(uint32 millis, int *addr);
static void stopTimer(uintptr handle);
};
}

View File

@ -199,7 +199,7 @@ namespace avmplus
case CONSTANT_Double:
if( index >= constantDoubleCount )
toplevel->throwVerifyError(kCpoolIndexRangeError, core->toErrorString(index), core->toErrorString(constantDoubleCount));
return kDoubleType|(intptr)cpool_double[index];
return kDoubleType|(uintptr)cpool_double[index];
case CONSTANT_Utf8:
if( index >= constantStringCount )

View File

@ -144,7 +144,7 @@ namespace avmplus
return *this;
}
PrintWriter& PrintWriter::operator<< (intptr value)
PrintWriter& PrintWriter::operator<< (uint64 value)
{
#ifdef AVMPLUS_64BIT
AvmAssert(0); // convertInteger routine needs to be upgraded to handle 64-bit ints
@ -254,18 +254,7 @@ namespace avmplus
AvmAssert(0); // this is only supported in AVMPLUS_VERBOSE builds
return *this;
#endif
}
PrintWriter& PrintWriter::operator<< (Atom atom)
{
#ifdef AVMPLUS_VERBOSE
return *this << m_core->format(atom);
#else
(void)atom;
AvmAssert(0); // this is only supported in AVMPLUS_VERBOSE builds
return *this;
#endif
}
}
void PrintWriter::writeHexNibble(uint8 value)
{

View File

@ -115,7 +115,7 @@ namespace avmplus
PrintWriter& operator<< (char value);
PrintWriter& operator<< (wchar value);
PrintWriter& operator<< (int value);
PrintWriter& operator<< (intptr value);
PrintWriter& operator<< (uint64 value);
PrintWriter& operator<< (uint32 value);
PrintWriter& operator<< (double value);
PrintWriter& operator<< (Stringp str);
@ -149,7 +149,6 @@ namespace avmplus
PrintWriter& operator<< (const Traits* obj);
PrintWriter& operator<< (AbstractFunction* obj);
PrintWriter& operator<< (Multiname* obj);
PrintWriter& operator<< (Atom atom);
PrintWriter& operator<< (Namespace* str);
};
}

View File

@ -60,7 +60,7 @@ namespace avmplus
void setDelegate(ScriptObject *d) { WBRC(MMgc::GC::GetGC(this), this, &delegate, d); }
Atom atom() const {
return kObjectType|(intptr)this;
return kObjectType|(uintptr)this;
}
virtual Atom toAtom() const {

View File

@ -144,14 +144,14 @@ namespace avmplus
}
/*static*/
intptr StackTrace::hashCode(StackTrace::Element *e, int depth)
uintptr StackTrace::hashCode(StackTrace::Element *e, int depth)
{
intptr hashCode = 0;
uintptr hashCode = 0;
while(depth--)
{
hashCode ^= intptr(e->info)>>3;
hashCode ^= intptr(e->filename)>>3;
hashCode ^= (intptr)e->linenum;
hashCode ^= uintptr(e->info)>>3;
hashCode ^= uintptr(e->filename)>>3;
hashCode ^= (uintptr)e->linenum;
e++;
}
return hashCode;

View File

@ -59,7 +59,7 @@ namespace avmplus
int linenum;
};
bool equals(StackTrace::Element *e, int depth);
static intptr hashCode(StackTrace::Element *e, int depth);
static uintptr hashCode(StackTrace::Element *e, int depth);
Element elements[1];
private:

View File

@ -110,7 +110,7 @@ namespace avmplus
{
m_length = s1->length() + s2->length();
AvmAssert(m_length >= 0);
setPrefixOrOffsetOrNumber(intptr(s1) | PREFIXFLAG);
setPrefixOrOffsetOrNumber(uintptr(s1) | PREFIXFLAG);
if (s2->needsNormalization()) s2->normalize();
setBuf(s2->m_buf);
#ifdef DEBUGGER
@ -1180,7 +1180,7 @@ namespace avmplus
return new (gc) String(this, start, end-start);
}
void String::setPrefixOrOffsetOrNumber(intptr value)
void String::setPrefixOrOffsetOrNumber(uintptr value)
{
#ifdef MMGC_DRC
// first decrement existing prefix

View File

@ -372,7 +372,7 @@ namespace avmplus
// 0x02 a prefix string is stored
// 0x03 a 30-bit offset is stored
// manual WB when needed
intptr m_prefixOrOffsetOrNumber;
uintptr m_prefixOrOffsetOrNumber;
#define STRINGFLAGS 0x03
#define NUMBERFLAG 0x01
#define PREFIXFLAG 0x02
@ -406,7 +406,7 @@ namespace avmplus
// with NUMBERTYPE. This is only valid for non-prefix, non-offset interned strings.
void generateIntegerEquivalent(AvmCore *core);
void setPrefixOrOffsetOrNumber(intptr value);
void setPrefixOrOffsetOrNumber(uintptr value);
static const wchar lowerCaseBase[];
static const wchar upperCaseBase[];

View File

@ -979,7 +979,7 @@ namespace avmplus
// always can get to the current value.
AvmCore* core = this->core();
#ifdef _DEBUG
AvmAssert(!core->dxnsAddr || (intptr)(*core->dxnsAddr) != 0xcccccccc);
AvmAssert(!core->dxnsAddr || (uintptr)(*core->dxnsAddr) != 0xcccccccc);
#endif
if (!core->dxnsAddr || !(*core->dxnsAddr))
throwTypeError(kNoDefaultNamespaceError);

View File

@ -553,7 +553,7 @@ namespace avmplus
return Multiname::format(core, ns, name);
else
return core->concatStrings(core->newString("Traits@"),
core->formatAtomPtr((intptr)this));
core->formatAtomPtr((uintptr)this));
}
#endif
@ -572,9 +572,9 @@ namespace avmplus
// 3 bits because it doesn't contribute to hash.
// [ed] math assumes t is 8-aligned!
AvmAssert((((intptr)t) & 7) == 0);
AvmAssert((((uintptr)t) & 7) == 0);
unsigned i = (((intptr)t)>>3) & bitMask;
unsigned i = (((uintptr)t)>>3) & bitMask;
Traitsp k;
while ((k=set[i]) != t && k != NULL)
{
@ -857,7 +857,7 @@ namespace avmplus
{
// build conflict stub
CodegenMIR mir(pool);
imt[i] = BIND_ITRAMP | (intptr)mir.emitImtThunk(e);
imt[i] = BIND_ITRAMP | (uintptr)mir.emitImtThunk(e);
AvmAssert((imt[i]&7)==BIND_ITRAMP); // addr must be 8-aligned
}
}

View File

@ -282,7 +282,7 @@ namespace avmplus
bool unreachable = false;
FrameState* blockState;
if ( blockStates && (blockState = blockStates->get((intptr)pc)) != 0 )
if ( blockStates && (blockState = blockStates->get((uintptr)pc)) != 0 )
{
// send a bbend prior to the merge
if (mir) mir->emitBlockEnd(state);
@ -312,7 +312,7 @@ namespace avmplus
if (!blockState->targetOfBackwardsBranch)
{
blockStates->remove((intptr)pc);
blockStates->remove((uintptr)pc);
core->GetGC()->Free(blockState);
}
}
@ -382,7 +382,7 @@ namespace avmplus
// Set these registers to killed in the catch state
if (pc == code_pos + handler->from)
{
FrameState *catchState = blockStates->get((intptr)target);
FrameState *catchState = blockStates->get((uintptr)target);
AvmAssert(catchState != 0);
for (const byte *temp = pc; temp <= code_pos + handler->to; )
@ -614,7 +614,7 @@ namespace avmplus
//checkStack(0,0)
#ifdef DEBUGGER
Atom filename = checkCpoolOperand(imm30, kStringType);
if (mir) mir->emit(state, opcode, (intptr)AvmCore::atomToString(filename));
if (mir) mir->emit(state, opcode, (uintptr)AvmCore::atomToString(filename));
#endif
break;
}
@ -625,7 +625,7 @@ namespace avmplus
if (!info->isFlagSet(AbstractFunction::SETS_DXNS))
verifyFailed(kIllegalSetDxns, core->toErrorString(info));
Atom uri = checkCpoolOperand(imm30, kStringType);
if (mir) mir->emit(state, opcode, (intptr)AvmCore::atomToString(uri));
if (mir) mir->emit(state, opcode, (uintptr)AvmCore::atomToString(uri));
break;
}
@ -647,7 +647,7 @@ namespace avmplus
if (index > 0 && index < pool->constantStringCount)
{
Stringp value = pool->cpool_string[index];
if (mir)mir->emitIntConst(state, sp+1, (intptr)value);
if (mir)mir->emitIntConst(state, sp+1, (uintptr)value);
state->push(STRING_TYPE, value != NULL);
}
else
@ -722,7 +722,7 @@ namespace avmplus
if (index > 0 && index < pool->constantNsCount)
{
Namespace* value = pool->cpool_ns[index];
if (mir)mir->emitIntConst(state, sp+1, (intptr)value);
if (mir)mir->emitIntConst(state, sp+1, (uintptr)value);
state->push(NAMESPACE_TYPE, value != NULL);
}
else
@ -953,7 +953,7 @@ namespace avmplus
{
mir->emitSetDxns(state);
emitCoerce(CLASS_TYPE, state->sp());
mir->emit(state, opcode, (intptr)(void*)pool->cinits[imm30], sp, ctraits);
mir->emit(state, opcode, (uintptr)(void*)pool->cinits[imm30], sp, ctraits);
}
state->pop_push(1, ctraits, true);
break;
@ -976,14 +976,14 @@ namespace avmplus
if (script != (AbstractFunction*)BIND_NONE && script != (AbstractFunction*)BIND_AMBIGUOUS)
{
// found a single matching traits
if (mir) mir->emit(state, opcode, (intptr)&multiname, sp+1, script->declaringTraits);
if (mir) mir->emit(state, opcode, (uintptr)&multiname, sp+1, script->declaringTraits);
state->push(script->declaringTraits, true);
}
else
{
// no traits, or ambiguous reference. use Object, anticipating
// a runtime exception
if (mir) mir->emit(state, opcode, (intptr)&multiname, sp+1, OBJECT_TYPE);
if (mir) mir->emit(state, opcode, (uintptr)&multiname, sp+1, OBJECT_TYPE);
state->push(OBJECT_TYPE, true);
}
break;
@ -1046,7 +1046,7 @@ namespace avmplus
if (mir)
{
mir->emitSetContext(state, NULL);
mir->emit(state, opcode, (intptr)&multiname);
mir->emit(state, opcode, (uintptr)&multiname);
}
state->pop(n);
@ -1078,7 +1078,7 @@ namespace avmplus
if (mir)
{
emitCheckNull(sp-(n-1));
mir->emit(state, opcode, (intptr)&multiname, 0, NULL);
mir->emit(state, opcode, (uintptr)&multiname, 0, NULL);
}
state->pop_push(n, NULL);
break;
@ -1107,7 +1107,7 @@ namespace avmplus
if (mir)
{
emitCheckNull(sp-(n-1));
mir->emit(state, opcode, (intptr)&multiname, 0, BOOLEAN_TYPE);
mir->emit(state, opcode, (uintptr)&multiname, 0, BOOLEAN_TYPE);
}
state->pop_push(n, BOOLEAN_TYPE);
break;
@ -1128,7 +1128,7 @@ namespace avmplus
if (t && t->isMachineType)
resultType = OBJECT_TYPE;
if (mir)
mir->emit(state, OP_astype, (intptr)t, index, resultType);
mir->emit(state, OP_astype, (uintptr)t, index, resultType);
state->pop_push(1, t);
}
@ -1216,7 +1216,7 @@ namespace avmplus
checkStack(1,1);
// resolve operand into a traits, and test if value is that type
Traits* itraits = checkTypeName(imm30); // CONSTANT_Multiname
if (mir) mir->emit(state, opcode, (intptr)itraits, sp, BOOLEAN_TYPE);
if (mir) mir->emit(state, opcode, (uintptr)itraits, sp, BOOLEAN_TYPE);
state->pop();
state->pop();
state->push(OBJECT_TYPE);
@ -1492,7 +1492,7 @@ namespace avmplus
if (mir)
{
mir->emitSetContext(state, NULL);
mir->emit(state, opcode, (intptr)&multiname, argc, NULL);
mir->emit(state, opcode, (uintptr)&multiname, argc, NULL);
}
state->pop_push(n, NULL);
if (opcode == OP_callpropvoid)
@ -1543,7 +1543,7 @@ namespace avmplus
if (mir)
{
mir->emitSetContext(state, NULL);
mir->emit(state, opcode, (intptr)&multiname, argc, NULL);
mir->emit(state, opcode, (uintptr)&multiname, argc, NULL);
}
state->pop_push(n, NULL);
break;
@ -1595,7 +1595,7 @@ namespace avmplus
if (mir)
{
mir->emitSetContext(state, NULL);
mir->emit(state, opcode, (intptr)&multiname, argc, NULL);
mir->emit(state, opcode, (uintptr)&multiname, argc, NULL);
}
state->pop_push(n, NULL);
if (opcode == OP_callsupervoid)
@ -1659,7 +1659,7 @@ namespace avmplus
if (mir)
{
mir->emitSetContext(state, NULL);
mir->emit(state, opcode, (intptr)&multiname, 0, propType);
mir->emit(state, opcode, (uintptr)&multiname, 0, propType);
}
state->pop_push(n, propType);
break;
@ -1722,7 +1722,7 @@ namespace avmplus
#endif
mir->emitSetContext(state, NULL);
mir->emit(state, opcode, (intptr)&multiname);
mir->emit(state, opcode, (uintptr)&multiname);
}
state->pop(n);
@ -2219,7 +2219,7 @@ namespace avmplus
const byte* new_pc = (const byte*) imm30;
#ifdef AVMPLUS_64BIT
new_pc = (const byte *) (intptr(new_pc) | (((intptr) imm30b) << 32));
new_pc = (const byte *) (uintptr(new_pc) | (((uintptr) imm30b) << 32));
const byte* new_code_end = new_pc + AvmCore::readU30 (nextpc);
#else
const byte* new_code_end = new_pc + imm30b;
@ -2411,7 +2411,7 @@ namespace avmplus
else
{
// found a single matching traits
mir->emit(state, OP_finddef, (intptr)&multiname, state->sp()+1, script->declaringTraits);
mir->emit(state, OP_finddef, (uintptr)&multiname, state->sp()+1, script->declaringTraits);
}
}
state->push(script->declaringTraits, true);
@ -2426,7 +2426,7 @@ namespace avmplus
{
uint32 n=1;
checkPropertyMultiname(n, multiname);
if (mir) mir->emit(state, opcode, (intptr)&multiname, 0, OBJECT_TYPE);
if (mir) mir->emit(state, opcode, (uintptr)&multiname, 0, OBJECT_TYPE);
state->pop_push(n-1, OBJECT_TYPE, true);
}
}
@ -2478,7 +2478,7 @@ namespace avmplus
if (mir)
{
mir->emitSetContext(state, NULL);
mir->emit(state, OP_getproperty, (intptr)&multiname, 0, propType);
mir->emit(state, OP_getproperty, (uintptr)&multiname, 0, propType);
}
state->pop_push(n, propType);
}
@ -2562,11 +2562,11 @@ namespace avmplus
{
blockStates = new (core->GetGC()) SortedIntMap<FrameState*>(core->GetGC(), 128);
}
if ( (targetState = blockStates->get((intptr)target)) == 0 )
if ( (targetState = blockStates->get((uintptr)target)) == 0 )
{
targetState = newFrameState();
targetState->pc = target - code_pos;
blockStates->put((intptr)target, targetState);
blockStates->put((uintptr)target, targetState);
labelCount++;
}
return targetState;

View File

@ -2972,7 +2972,7 @@ namespace avmplus
for (uint32 i = 0; i < nsArray->getLength(); i++)
{
Namespace *ns = AvmCore::atomToNamespace (nsArray->getAt(i));
AvmAssert(intptr(ns));
AvmAssert(uintptr(ns));
#ifdef STRING_DEBUG
Stringp s1 = ns->getURI();
Stringp s2 = uri;

View File

@ -250,7 +250,7 @@ namespace avmplus
{
for(int i=0; i<count; i++)
{
core->console << arr[i];
core->console << core->format (arr[i]);
if (i+1 < count)
core->console << ", ";
}
@ -260,7 +260,7 @@ namespace avmplus
if (!fnc->isFlagSet(AbstractFunction::SUGGEST_INTERP))
{
core->console << " @ 0x";
core->console.writeHexDWord( (intptr)fnc->impl32);
core->console.writeHexDWord( (uintptr)fnc->impl32);
}
core->console << "\n";
astrace = lvl;
@ -644,7 +644,7 @@ namespace avmplus
AbstractFunction* m = trace->info;
if (trace->filename)
{
intptr index = (intptr)debugger->pool2abcIndex.get(Atom((PoolObject*)m->pool));
uintptr index = (uintptr)debugger->pool2abcIndex.get(Atom((PoolObject*)m->pool));
AbcFile* abc = (AbcFile*)debugger->abcAt(index);
source = abc->sourceNamed(trace->filename);

View File

@ -51,7 +51,6 @@ namespace avmplus
typedef unsigned int uint32;
typedef signed int sint32;
typedef signed int int32;
typedef unsigned long intptr;
#ifdef _MSC_VER
typedef __int64 int64;
typedef __int64 sint64;
@ -74,9 +73,24 @@ namespace avmplus
#define NULL 0
#endif
typedef signed long Atom;
typedef signed long Binding;
typedef signed long CodeContextAtom;
// math friendly pointer (64 bits in LP 64 systems)
#if defined (_MSC_VER) && (_MSC_VER >= 1300)
#define AVMPLUS_TYPE_IS_POINTER_SIZED __w64
#else
#define AVMPLUS_TYPE_IS_POINTER_SIZED
#endif
#ifdef AVMPLUS_64BIT
typedef AVMPLUS_TYPE_IS_POINTER_SIZED uint64 uintptr;
typedef AVMPLUS_TYPE_IS_POINTER_SIZED int64 sintptr;
#else
typedef AVMPLUS_TYPE_IS_POINTER_SIZED uint32 uintptr;
typedef AVMPLUS_TYPE_IS_POINTER_SIZED int32 sintptr;
#endif
typedef sintptr Atom;
typedef sintptr Binding;
typedef sintptr CodeContextAtom;
inline uint32 urshift(Atom atom, int amount)
{

View File

@ -414,6 +414,7 @@
1DEB928608733DD80010E9CD /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(NATIVE_ARCH_64_BIT)";
COPY_PHASE_STRIP = NO;
GCC_DYNAMIC_NO_PIC = NO;
GCC_ENABLE_FIX_AND_CONTINUE = YES;
@ -434,7 +435,7 @@
1DEB928708733DD80010E9CD /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = i386;
ARCHS = x86_64;
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
GCC_MODEL_TUNING = G5;
INSTALL_PATH = "$(HOME)/bin";

View File

@ -72,7 +72,7 @@ namespace avmplus
return NULL;
}
intptr OSDep::startIntWriteTimer(uint32 millis, int *addr)
uintptr OSDep::startIntWriteTimer(uint32 millis, int *addr)
{
pthread_t p;
IntWriteTimerData *data = new IntWriteTimerData();
@ -80,10 +80,10 @@ namespace avmplus
data->addr = addr;
pthread_create(&p, NULL, timerThread, data);
data->thread = p;
return (intptr)data;
return (uintptr)data;
}
void OSDep::stopTimer(intptr handle)
void OSDep::stopTimer(uintptr handle)
{
IntWriteTimerData *data = (IntWriteTimerData*) handle;
data->addr = NULL;

View File

@ -281,7 +281,7 @@ namespace avmshell
// this
Atom a = nullObjectAtom;
frame->dhis(a);
core->console << a << ".";
core->console << core->format(a) << ".";
// method
MethodInfo* info = functionFor(src, line);
@ -300,7 +300,7 @@ namespace avmshell
if ( info && (info->getArgName(i) != core->kundefined) )
core->console << info->getArgName(i) << "=";
core->console << *ptr++;
core->console << core->format(*ptr++);
if (i<count-1)
core->console << ",";
}
@ -515,7 +515,7 @@ namespace avmshell
if (info && (info->getLocalName(i) != core->kundefined) )
core->console << info->getLocalName(i) << " = ";
core->console << *ptr++;
core->console << core->format(*ptr++);
//if (i<count-1)
core->console << "\n";
}
@ -578,7 +578,7 @@ namespace avmshell
// match!
Atom a = ease2Atom(to, ptr[i]);
if (a == undefinedAtom)
core->console << " Type mismatch : current value is " << ptr[i];
core->console << " Type mismatch : current value is " << core->format(ptr[i]);
else
frame->setArgument(i, a);
return;
@ -594,7 +594,7 @@ namespace avmshell
// match!
Atom a = ease2Atom(to, ptr[i]);
if (a == undefinedAtom)
core->console << " Type mismatch : current value is " << ptr[i];
core->console << " Type mismatch : current value is " << core->format(ptr[i]);
else
frame->setLocal(i, a);
return;