示例#1
0
void *realloc64(void *p, int size){
    register unsigned long *mem = p;
    unsigned int oldsize;
    mem--;
    oldsize = *mem+sizeof(long);
    if(mem < (unsigned long *)sbrk(0) || mem > (unsigned long *)where){
        if(size < 4088){
            mem = realloc(mem, size + sizeof(long));
            *mem = size;
            return (void *)&mem[1];
        } else {
            mem++;
            unsigned long *newmem = malloc64(size);
            memcpy(newmem, mem, oldsize-sizeof(long));
            mem--;
            free(mem);
            return (void *)newmem;
        }
    }
    if(size < 4088){
        mem++;
        unsigned long *newmem = malloc(size+sizeof(long));
        *newmem = size;
        newmem++;
        memcpy(newmem, mem, size);
        free64(mem);
        return (void *)newmem;
    }
    mem = mremap(mem, oldsize, size+sizeof(long), 1);
    *mem = size;
    return (void *)&mem[1];
}
示例#2
0
	void RegisterAllocator::free(const OperandREF &ref)
	{
		for(int i = 0; i < 8; i++)
		{
			if(i == Encoding::ESP || i == Encoding::EBP) continue;

			if(GPR[i].reference == ref)
			{
				free32(i);
			}
		}

		for(int i = 0; i < 8; i++)
		{
			if(MMX[i].reference == ref)
			{
				free64(i);
			}
		}

		for(int i = 0; i < 8; i++)
		{
			if(XMM[i].reference == ref)
			{
				free128(i);
			}
		}
	}
示例#3
0
	void RegisterAllocator::freeAll()
	{
		for(int i = 0; i < 8; i++)
		{
			if(i == Encoding::ESP || i == Encoding::EBP) continue;

			free32(i);
		}

		for(int i = 0; i < 8; i++)
		{
			free64(i);
		}

		for(int i = 0; i < 8; i++)
		{
			free128(i);
		}
	}
示例#4
0
	void RegisterAllocator::free(const OperandMMREG &r64)
	{
		free64(r64.reg);
	}