Bug 509890 - Convert InsList to SeqBuilder<> and Allocator, r=gal.

--HG--
extra : rebase_source : 22303e739a0a6669c634595149028872aa7bd334
This commit is contained in:
Edwin Smith 2009-08-04 13:11:53 -04:00
Родитель 7c8c065e2c
Коммит 22816c122c
6 изменённых файлов: 21 добавлений и 23 удалений

Просмотреть файл

@ -3117,7 +3117,7 @@ class RegExpNativeCompiler {
#ifdef NJ_VERBOSE #ifdef NJ_VERBOSE
debug_only_stmt( debug_only_stmt(
if (js_LogController.lcbits & LC_TMRegexp) { if (js_LogController.lcbits & LC_TMRegexp) {
lir = new (&gc) VerboseWriter(&gc, lir, lirbuf->names, lir = new (&gc) VerboseWriter(*alloc, lir, lirbuf->names,
&js_LogController); &js_LogController);
} }
) )

Просмотреть файл

@ -1710,7 +1710,8 @@ TraceRecorder::TraceRecorder(JSContext* cx, VMSideExit* _anchor, Fragment* _frag
debug_only_stmt( debug_only_stmt(
if (js_LogController.lcbits & LC_TMRecorder) { if (js_LogController.lcbits & LC_TMRecorder) {
lir = verbose_filter lir = verbose_filter
= new (&gc) VerboseWriter(&gc, lir, lirbuf->names, &js_LogController); = new (&gc) VerboseWriter(*traceMonitor->allocator, lir,
lirbuf->names, &js_LogController);
} }
) )
if (nanojit::AvmCore::config.soft_float) if (nanojit::AvmCore::config.soft_float)

Просмотреть файл

@ -55,17 +55,15 @@ namespace nanojit
InsList block; InsList block;
bool flushnext; bool flushnext;
public: public:
VerboseBlockReader(LirFilter *in, Assembler *a, LirNameMap *n) VerboseBlockReader(Allocator& alloc, LirFilter *in, Assembler *a, LirNameMap *n)
: LirFilter(in), assm(a), names(n), block(a->_gc), flushnext(false) : LirFilter(in), assm(a), names(n), block(alloc), flushnext(false)
{} {}
void flush() { void flush() {
flushnext = false; flushnext = false;
if (!block.isEmpty()) { if (!block.isEmpty()) {
for (int j=0,n=block.size(); j < n; j++) { for (Seq<LIns*>* p = block.get(); p != NULL; p = p->tail)
LIns *i = block[j]; assm->outputf(" %s", names->formatIns(p->head));
assm->outputf(" %s", names->formatIns(i));
}
block.clear(); block.clear();
} }
} }
@ -732,7 +730,7 @@ namespace nanojit
// end of pipeline // end of pipeline
verbose_only( verbose_only(
VerboseBlockReader vbr(prev, this, frag->lirbuf->names); VerboseBlockReader vbr(alloc, prev, this, frag->lirbuf->names);
if (_logc->lcbits & LC_Assembly) if (_logc->lcbits & LC_Assembly)
prev = &vbr; prev = &vbr;
) )
@ -927,7 +925,7 @@ namespace nanojit
reader->pos()->isop(LIR_ret) || reader->pos()->isop(LIR_ret) ||
reader->pos()->isop(LIR_xtbl)); reader->pos()->isop(LIR_xtbl));
InsList pending_lives(_gc); InsList pending_lives(alloc);
for (LInsp ins = reader->read(); !ins->isop(LIR_start) && !error(); for (LInsp ins = reader->read(); !ins->isop(LIR_start) && !error();
ins = reader->read()) ins = reader->read())
@ -1429,9 +1427,8 @@ namespace nanojit
{ {
// ensure that exprs spanning the loop are marked live at the end of the loop // ensure that exprs spanning the loop are marked live at the end of the loop
reserveSavedRegs(); reserveSavedRegs();
for (int i=0, n=pending_lives.size(); i < n; i++) { for (Seq<LIns*>* p = pending_lives.get(); p != NULL; p = p->tail)
findMemFor(pending_lives[i]); findMemFor(p->head);
}
/* /*
* TODO: I'm not positive, but I think the following line needs to be * TODO: I'm not positive, but I think the following line needs to be
* added, otherwise the pending_lives will build up and never get * added, otherwise the pending_lives will build up and never get

Просмотреть файл

@ -240,7 +240,6 @@ namespace nanojit
Allocator &alloc; Allocator &alloc;
CodeAlloc& _codeAlloc; CodeAlloc& _codeAlloc;
avmplus::GC* _gc;
DWB(Fragment*) _thisfrag; DWB(Fragment*) _thisfrag;
RegAllocMap* _branchStateMap; RegAllocMap* _branchStateMap;

Просмотреть файл

@ -776,6 +776,7 @@ namespace nanojit
}; };
typedef LIns* LInsp; typedef LIns* LInsp;
typedef SeqBuilder<LIns*> InsList;
LIns* FASTCALL callArgN(LInsp i, uint32_t n); LIns* FASTCALL callArgN(LInsp i, uint32_t n);
extern const uint8_t operandCount[]; extern const uint8_t operandCount[];
@ -936,9 +937,9 @@ namespace nanojit
DWB(LirNameMap*) names; DWB(LirNameMap*) names;
LogControl* logc; LogControl* logc;
public: public:
VerboseWriter(GC *gc, LirWriter *out, VerboseWriter(Allocator& alloc, LirWriter *out,
LirNameMap* names, LogControl* logc) LirNameMap* names, LogControl* logc)
: LirWriter(out), code(gc), names(names), logc(logc) : LirWriter(out), code(alloc), names(names), logc(logc)
{} {}
LInsp add(LInsp i) { LInsp add(LInsp i) {
@ -955,12 +956,14 @@ namespace nanojit
void flush() void flush()
{ {
int n = code.size(); if (!code.isEmpty()) {
if (n) { int32_t count = 0;
for (int i=0; i < n; i++) for (Seq<LIns*>* p = code.get(); p != NULL; p = p->tail) {
logc->printf(" %s\n",names->formatIns(code[i])); logc->printf(" %s\n",names->formatIns(p->head));
count++;
}
code.clear(); code.clear();
if (n > 1) if (count > 1)
logc->printf("\n"); logc->printf("\n");
} }
} }

Просмотреть файл

@ -117,11 +117,9 @@ namespace nanojit
* ------------------------------------------- * -------------------------------------------
*/ */
class Fragment; class Fragment;
class LIns;
typedef avmplus::AvmCore AvmCore; typedef avmplus::AvmCore AvmCore;
typedef avmplus::OSDep OSDep; typedef avmplus::OSDep OSDep;
typedef avmplus::GCSortedMap<const void*,Fragment*,avmplus::LIST_GCObjects> FragmentMap; typedef avmplus::GCSortedMap<const void*,Fragment*,avmplus::LIST_GCObjects> FragmentMap;
typedef avmplus::List<LIns*,avmplus::LIST_NonGCObjects> InsList;
const uint32_t MAXARGS = 8; const uint32_t MAXARGS = 8;