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
debug_only_stmt(
if (js_LogController.lcbits & LC_TMRegexp) {
lir = new (&gc) VerboseWriter(&gc, lir, lirbuf->names,
lir = new (&gc) VerboseWriter(*alloc, lir, lirbuf->names,
&js_LogController);
}
)

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

@ -1710,7 +1710,8 @@ TraceRecorder::TraceRecorder(JSContext* cx, VMSideExit* _anchor, Fragment* _frag
debug_only_stmt(
if (js_LogController.lcbits & LC_TMRecorder) {
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)

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

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

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

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

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

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

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

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