Bug 468484 - Minor adjustments to match changes in tamarin, r=gal.

This commit is contained in:
Graydon Hoare 2008-12-10 17:25:46 -08:00
parent 37cfe58e72
commit ba3dc13800
10 changed files with 49 additions and 45 deletions

View File

@ -70,7 +70,7 @@ namespace nanojit
return ins->resv() == 0;
}
public:
public:
DeadCodeFilter(LirFilter *in, const CallInfo *f) : LirFilter(in), functions(f) {}
LInsp read() {
for (;;) {
@ -145,7 +145,7 @@ namespace nanojit
*/
Assembler::Assembler(Fragmento* frago)
: hasLoop(0)
, _frago(frago)
, _frago(frago)
, _gc(frago->core()->gc)
, _labels(_gc)
, _patches(_gc)
@ -257,12 +257,12 @@ namespace nanojit
setError(ResvFull);
item = 1;
}
Reservation *r = &_resvTable[item];
Reservation *r = &_resvTable[item];
_resvFree = r->arIndex;
r->reg = UnknownReg;
r->arIndex = 0;
r->used = 1;
i->setresv(item);
r->used = 1;
i->setresv(item);
return r;
}
@ -925,7 +925,7 @@ namespace nanojit
NanoAssertMsgf(error() || _fpuStkDepth == 0,"_fpuStkDepth %d",_fpuStkDepth);
internalReset(); // clear the reservation tables and regalloc
NanoAssert(!_branchStateMap || _branchStateMap->isEmpty());
NanoAssert( !_branchStateMap || _branchStateMap->isEmpty());
_branchStateMap = 0;
#ifdef AVMPLUS_ARM
@ -1319,7 +1319,6 @@ namespace nanojit
NanoAssert(label->addr == 0 && label->regs.isValid());
//evictRegs(~_allocator.free);
intersectRegisterState(label->regs);
//asm_align_code();
label->addr = _nIns;
}
verbose_only( if (_verbose) { outputAddr=true; asm_output("[%s]", _thisfrag->lirbuf->names->formatRef(ins)); } )

View File

@ -331,7 +331,6 @@ namespace nanojit
};
// platform specific implementation (see NativeXXX.cpp file)
void nInit(uint32_t flags);
void nInit(AvmCore *);
Register nRegisterAllocFromSet(int32_t set);
void nRegisterResetAll(RegAlloc& a);

View File

@ -95,7 +95,7 @@ namespace nanojit
if (start)
_unused = &start->lir[0];
//buffer_count++;
//fprintf(stderr, "LirBuffer %x start %x\n", (int)this, (int)_start);
//fprintf(stderr, "LirBuffer %x unused %x\n", (int)this, (int)_unused);
}
LirBuffer::~LirBuffer()
@ -126,6 +126,7 @@ namespace nanojit
// doesn't include embedded constants nor LIR_skip payload
return _stats.lir;
}
int32_t LirBuffer::byteCount()
{
return ((_pages.size() ? _pages.size()-1 : 0) * sizeof(Page)) +
@ -138,9 +139,7 @@ namespace nanojit
if (page)
_pages.add(page);
else
{
_noMem = 1;
}
return page;
}
@ -1093,8 +1092,8 @@ namespace nanojit
op = LIR_callh;
LInsp args2[MAXARGS*2]; // arm could require 2 args per double
int32_t j = 0;
int32_t i = 0;
while (j < argc) {
int32_t i = 0;
while (j < argc) {
argt >>= 2;
ArgSize a = ArgSize(argt&3);
if (a == ARGSIZE_F) {
@ -1249,7 +1248,7 @@ namespace nanojit
#ifdef MEMORY_INFO
// m_list.set_meminfo_name("LInsHashSet.list");
#endif
LInsp *list = (LInsp*) gc->Alloc(sizeof(LInsp)*m_cap);
LInsp *list = (LInsp*) gc->Alloc(sizeof(LInsp)*m_cap, GC::kZero);
WB(gc, this, &m_list, list);
}
@ -1343,7 +1342,7 @@ namespace nanojit
void FASTCALL LInsHashSet::grow()
{
const uint32_t newcap = m_cap << 1;
LInsp *newlist = (LInsp*) m_gc->Alloc(newcap * sizeof(LInsp));
LInsp *newlist = (LInsp*) m_gc->Alloc(newcap * sizeof(LInsp), GC::kZero);
LInsp *list = m_list;
#ifdef MEMORY_INFO
// newlist.set_meminfo_name("LInsHashSet.list");
@ -1550,7 +1549,7 @@ namespace nanojit
}
void add(LInsp i, LInsp use) {
if (!i->isconst() && !i->isconstq() && !live.containsKey(i)) {
NanoAssert(unsigned(i->opcode()) < sizeof(lirNames) / sizeof(lirNames[0]));
NanoAssert(size_t(i->opcode()) < sizeof(lirNames) / sizeof(lirNames[0]));
live.put(i,use);
}
}
@ -1583,7 +1582,7 @@ namespace nanojit
LirReader br(lirbuf);
StackFilter sf(&br, gc, lirbuf, lirbuf->sp);
StackFilter r(&sf, gc, lirbuf, lirbuf->rp);
int total = 0;
int total = 0;
if (lirbuf->state)
live.add(lirbuf->state, r.pos());
for (LInsp i = r.read(); i != 0; i = r.read())
@ -1602,7 +1601,7 @@ namespace nanojit
if (live.contains(i))
{
live.retire(i,gc);
NanoAssert(unsigned(i->opcode()) < sizeof(operandCount) / sizeof(operandCount[0]));
NanoAssert(size_t(i->opcode()) < sizeof(operandCount) / sizeof(operandCount[0]));
if (i->isStore()) {
live.add(i->oprnd2(),i); // base
live.add(i->oprnd1(),i); // val
@ -1742,7 +1741,7 @@ namespace nanojit
}
#endif
} else {
NanoAssert(unsigned(ref->opcode()) < sizeof(lirNames) / sizeof(lirNames[0]));
NanoAssert(size_t(ref->opcode()) < sizeof(lirNames) / sizeof(lirNames[0]));
copyName(ref, lirNames[ref->opcode()], lircounts.add(ref->opcode()));
}
StringNullTerminatedUTF8 cname(gc, names.get(ref)->name);
@ -2165,11 +2164,11 @@ namespace nanojit
return out->insStorei(v, b, d);
}
LInsp LoadFilter::insCall(const CallInfo *call, LInsp args[])
LInsp LoadFilter::insCall(const CallInfo *ci, LInsp args[])
{
if (!call->_cse)
if (!ci->_cse)
exprs.clear();
return out->insCall(call, args);
return out->insCall(ci, args);
}
LInsp LoadFilter::ins0(LOpcode op)

View File

@ -235,7 +235,7 @@ namespace nanojit
*
* For pointing to instructions further than this range LIR_tramp is used.
*/
union
union
{
u_type u;
c_type c;
@ -246,12 +246,7 @@ namespace nanojit
};
enum {
callInfoWords =
#ifdef NANOJIT_64BIT
2
#else
1
#endif
callInfoWords = sizeof(LIns*)/sizeof(u_type)
};
uint32_t reference(LIns*) const;
@ -500,7 +495,7 @@ namespace nanojit
class LirNameMap MMGC_SUBCLASS_DECL
{
template <class Key>
class CountMap : public avmplus::SortedMap<Key, int, avmplus::LIST_NonGCObjects> {
class CountMap: public avmplus::SortedMap<Key, int, avmplus::LIST_NonGCObjects> {
public:
CountMap(avmplus::GC*gc) : avmplus::SortedMap<Key, int, avmplus::LIST_NonGCObjects>(gc) {}
int add(Key k) {
@ -553,12 +548,12 @@ namespace nanojit
DWB(LirNameMap*) names;
public:
VerboseWriter(avmplus::GC *gc, LirWriter *out, LirNameMap* names)
: LirWriter(out), code(gc), names(names)
: LirWriter(out), code(gc), names(names)
{}
LInsp add(LInsp i) {
if (i)
code.add(i);
if (i)
code.add(i);
return i;
}
@ -588,7 +583,6 @@ namespace nanojit
return add_flush(out->insBranch(v, condition, to));
}
LIns* ins0(LOpcode v) {
if (v == LIR_label || v == LIR_start) {
flush();
@ -597,7 +591,7 @@ namespace nanojit
}
LIns* ins1(LOpcode v, LInsp a) {
return isRet(v) ? add_flush(out->ins1(v, a)) : add(out->ins1(v, a));
return isRet(v) ? add_flush(out->ins1(v, a)) : add(out->ins1(v, a));
}
LIns* ins2(LOpcode v, LInsp a, LInsp b) {
return v == LIR_2 ? out->ins2(v,a,b) : add(out->ins2(v, a, b));
@ -714,7 +708,6 @@ namespace nanojit
struct
{
uint32_t lir; // # instructions
uint32_t pages; // pages consumed
}
_stats;
@ -760,7 +753,7 @@ namespace nanojit
LInsp insCall(const CallInfo *call, LInsp args[]);
LInsp insGuard(LOpcode op, LInsp cond, LIns *x);
LInsp insBranch(LOpcode v, LInsp condition, LInsp to);
LInsp insAlloc(int32_t size);
LInsp insAlloc(int32_t size);
// buffer mgmt
LInsp skip(size_t);
@ -783,7 +776,7 @@ namespace nanojit
public:
LirFilter *in;
LirFilter(LirFilter *in) : in(in) {}
virtual ~LirFilter() {}
virtual ~LirFilter(){}
virtual LInsp read() {
return in->read();

View File

@ -100,7 +100,7 @@ namespace nanojit {
if (verbose_enabled()) {\
outline[0]='\0';\
if (outputAddr) sprintf(outline, " %10p ",_nIns);\
else sprintf(outline, " ");\
else sprintf(outline, " ");\
sprintf(&outline[14], ##__VA_ARGS__);\
Assembler::outputAlign(outline, 45);\
RegAlloc::formatRegisters(_allocator, outline, _thisfrag);\

View File

@ -1108,11 +1108,11 @@ Assembler::asm_prep_fcall(Reservation*, LInsp)
}
NIns*
Assembler::asm_branch(bool branchOnFalse, LInsp cond, NIns* targ, bool /*far*/)
Assembler::asm_branch(bool branchOnFalse, LInsp cond, NIns* targ, bool far)
{
// ignore far -- we figure this out on our own.
// XXX noone actually uses the far param in nj anyway... (always false)
(void)far;
NIns* at = 0;
LOpcode condop = cond->opcode();

View File

@ -93,6 +93,7 @@ namespace nanojit
void Assembler::nInit(AvmCore* core)
{
(void) core;
OSDep::getDate();
}

View File

@ -121,7 +121,6 @@ namespace nanojit
}
}
}
NanoAssert(a != 0);
return a;
}

View File

@ -253,10 +253,24 @@ namespace avmplus {
static GCHeap heap;
public:
/**
* flags to be passed as second argument to alloc
*/
enum AllocFlags
{
kZero=1,
kContainsPointers=2,
kFinalize=4,
kRCObject=8
};
static inline void*
Alloc(uint32_t bytes)
Alloc(uint32_t bytes, int flags=kZero)
{
if (flags & kZero)
return calloc(1, bytes);
else
return malloc(bytes);
}
static inline void

View File

@ -172,12 +172,12 @@ namespace nanojit
#define verbose_output if (verbose_enabled()) Assembler::output
#define verbose_outputf if (verbose_enabled()) Assembler::outputf
#define verbose_enabled() (_verbose)
#define verbose_only(x) x
#define verbose_only(...) __VA_ARGS__
#else
#define verbose_output
#define verbose_outputf
#define verbose_enabled()
#define verbose_only(x)
#define verbose_only(...)
#endif /*NJ_VERBOSE*/
#ifdef _DEBUG