Merge branch 'master' of oss.readytalk.com:/var/local/git/avian into armvfp

Conflicts:
	src/arm.cpp
This commit is contained in:
JET
2012-05-17 12:22:18 -06:00
132 changed files with 3958 additions and 1937 deletions

View File

@ -127,6 +127,8 @@ inline int ldmfd(int Rn, int rlist) { return BLOCKXFER(AL, 0, 1, 0, 1, 1, Rn, rl
inline int stmfd(int Rn, int rlist) { return BLOCKXFER(AL, 1, 0, 0, 1, 0, Rn, rlist); }
inline int swp(int Rd, int Rm, int Rn) { return SWAP(AL, 0, Rn, Rd, Rm); }
inline int swpb(int Rd, int Rm, int Rn) { return SWAP(AL, 1, Rn, Rd, Rm); }
// breakpoint instruction, this really has its own instruction format
inline int bkpt(int16_t immed) { return 0xe1200070 | (((unsigned)immed & 0xffff) >> 4 << 8) | (immed & 0xf); }
// COPROCESSOR INSTRUCTIONS
inline int cdp(int coproc, int opcode_1, int CRd, int CRn, int CRm, int opcode_2) { return COOP(AL, opcode_1, CRn, CRd, coproc, opcode_2, CRm); }
inline int mcr(int coproc, int opcode_1, int Rd, int CRn, int CRm, int opcode_2=0) { return COREG(AL, opcode_1, 0, CRn, Rd, coproc, opcode_2, CRm); }
@ -236,7 +238,6 @@ inline int fmstat() { return fmrx(15, FPSCR); }
bool vfpSupported() {
return true; // TODO
}
}
const uint64_t MASK_LO32 = 0xffffffff;
@ -341,7 +342,7 @@ class Context {
public:
Context(System* s, Allocator* a, Zone* zone):
s(s), zone(zone), client(0), code(s, a, 1024), tasks(0), result(0),
firstBlock(new (zone->allocate(sizeof(MyBlock))) MyBlock(this, 0)),
firstBlock(new(zone) MyBlock(this, 0)),
lastBlock(firstBlock), poolOffsetHead(0), poolOffsetTail(0),
constantPool(0), constantPoolCount(0)
{ }
@ -459,8 +460,7 @@ class Offset: public Promise {
Promise*
offset(Context* c, bool forTrace = false)
{
return new (c->zone->allocate(sizeof(Offset)))
Offset(c, c->lastBlock, c->code.length(), forTrace);
return new(c->zone) Offset(c, c->lastBlock, c->code.length(), forTrace);
}
bool
@ -527,8 +527,7 @@ class OffsetTask: public Task {
void
appendOffsetTask(Context* c, Promise* promise, Promise* instructionOffset)
{
c->tasks = new (c->zone->allocate(sizeof(OffsetTask))) OffsetTask
(c->tasks, promise, instructionOffset);
c->tasks = new(c->zone) OffsetTask(c->tasks, promise, instructionOffset);
}
inline unsigned
@ -769,17 +768,14 @@ appendConstantPoolEntry(Context* c, Promise* constant, Promise* callOffset)
if (constant->resolved()) {
// make a copy, since the original might be allocated on the
// stack, and we need our copy to live until assembly is complete
constant = new (c->zone->allocate(sizeof(ResolvedPromise)))
ResolvedPromise(constant->value());
constant = new(c->zone) ResolvedPromise(constant->value());
}
c->constantPool = new (c->zone->allocate(sizeof(ConstantPoolEntry)))
ConstantPoolEntry(c, constant, c->constantPool, callOffset);
c->constantPool = new(c->zone) ConstantPoolEntry(c, constant, c->constantPool, callOffset);
++ c->constantPoolCount;
PoolOffset* o = new (c->zone->allocate(sizeof(PoolOffset))) PoolOffset
(c->lastBlock, c->constantPool, c->code.length() - c->lastBlock->offset);
PoolOffset* o = new(c->zone) PoolOffset(c->lastBlock, c->constantPool, c->code.length() - c->lastBlock->offset);
if (DebugPool) {
fprintf(stderr, "add pool offset %p %d to block %p\n",
@ -798,8 +794,7 @@ void
appendPoolEvent(Context* c, MyBlock* b, unsigned offset, PoolOffset* head,
PoolOffset* tail)
{
PoolEvent* e = new (c->zone->allocate(sizeof(PoolEvent))) PoolEvent
(head, tail, offset);
PoolEvent* e = new(c->zone) PoolEvent(head, tail, offset);
if (b->poolEventTail) {
b->poolEventTail->next = e;
@ -1839,8 +1834,7 @@ branchCM(Context* con, TernaryOperation op, unsigned size,
ShiftMaskPromise*
shiftMaskPromise(Context* c, Promise* base, unsigned shift, int64_t mask)
{
return new (c->zone->allocate(sizeof(ShiftMaskPromise)))
ShiftMaskPromise(base, shift, mask);
return new(c->zone) ShiftMaskPromise(base, shift, mask);
}
void
@ -1934,6 +1928,12 @@ return_(Context* c)
emit(c, bx(LinkRegister));
}
void
trap(Context* c)
{
emit(c, bkpt());
}
void
memoryBarrier(Context*) {}
@ -1947,7 +1947,7 @@ argumentFootprint(unsigned footprint)
void
nextFrame(ArchitectureContext* c, uint32_t* start, unsigned size UNUSED,
unsigned footprint, void* link, void*,
unsigned footprint, void* link, bool,
unsigned targetParameterFootprint UNUSED, void** ip, void** stack)
{
assert(c, *ip >= start);
@ -2021,6 +2021,7 @@ populateTables(ArchitectureContext* c)
zo[LoadBarrier] = memoryBarrier;
zo[StoreStoreBarrier] = memoryBarrier;
zo[StoreLoadBarrier] = memoryBarrier;
zo[Trap] = trap;
uo[index(c, LongCall, C)] = CAST1(longCallC);
@ -2252,12 +2253,12 @@ class MyArchitecture: public Assembler::Architecture {
}
virtual void nextFrame(void* start, unsigned size, unsigned footprint,
void* link, void* stackLimit,
void* link, bool mostRecent,
unsigned targetParameterFootprint, void** ip,
void** stack)
{
::nextFrame(&c, static_cast<uint32_t*>(start), size, footprint, link,
stackLimit, targetParameterFootprint, ip, stack);
mostRecent, targetParameterFootprint, ip, stack);
}
virtual void* frameIp(void* stack) {
@ -2508,9 +2509,7 @@ class MyAssembler: public Assembler {
{
Register stack(StackRegister);
Memory stackLimit(ThreadRegister, stackLimitOffsetFromThread);
Constant handlerConstant
(new (c.zone->allocate(sizeof(ResolvedPromise)))
ResolvedPromise(handler));
Constant handlerConstant(new(c.zone) ResolvedPromise(handler));
branchRM(&c, JumpIfGreaterOrEqual, TargetBytesPerWord, &stack, &stackLimit,
&handlerConstant);
}
@ -2815,8 +2814,7 @@ class MyAssembler: public Assembler {
MyBlock* b = c.lastBlock;
b->size = c.code.length() - b->offset;
if (startNew) {
c.lastBlock = new (c.zone->allocate(sizeof(MyBlock)))
MyBlock(&c, c.code.length());
c.lastBlock = new (c.zone) MyBlock(&c, c.code.length());
} else {
c.lastBlock = 0;
}
@ -2887,8 +2885,7 @@ Assembler*
makeAssembler(System* system, Allocator* allocator, Zone* zone,
Assembler::Architecture* architecture)
{
return new (zone->allocate(sizeof(MyAssembler)))
MyAssembler(system, allocator, zone,
return new(zone) MyAssembler(system, allocator, zone,
static_cast<MyArchitecture*>(architecture));
}