Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Accumulate NYIs and print them only at the end.

NYIs ("Not Yet Implemented" warnings) were previously printed on the
fly.  Since printing is incredibly slow in C++ and some NYIs are very
frequent, it's better to just increment a counter and print the final
counters at the end.
  • Loading branch information...
commit 66cee8a13e7232997d32b7ecc0bcabf4f2ed26ad 1 parent 3b79b98
@nominolo authored
Showing with 61 additions and 10 deletions.
  1. +23 −0 vm/common.hh
  2. +35 −10 vm/jit.cc
  3. +3 −0  vm/main.cc
View
23 vm/common.hh
@@ -332,6 +332,29 @@ typedef Word BloomFilter;
#define bloomset(b, x) ((b) |= bloombit((x)))
#define bloomtest(b, x) ((b) & bloombit((x)))
+/*
+ * Features not yet implemented.
+ */
+#define NYIDEF(_) \
+ _(GROW_IRBUFFER, "Growing IR Buffer") \
+ _(RECORD_MOV_RES_EXT, "Recording of MOV_RES with out-of-trace input.") \
+ _(RECORD_UPDATE_CAF, "Recording of UPDATE with a CAF argument.") \
+ _(RECORD_EVAL_IND, "Recording of EVAL of an indirection.") \
+ _(TRACE_TRUNCATE, "Trace truncation due to inner loop.") \
+ _(RECORD_CREATE_PAP, "Recording of call which creates a PAP.") \
+ _(RECORD_CALL_PAP, "Recording of a call of a PAP.") \
+ _(RECORD_CALL_THUNK, "Recording of call of a thunk/CAF.")
+
+enum {
+#define NYIENUM(name, descr) NYI_##name,
+ NYIDEF(NYIENUM)
+#undef NYIENUM
+ NYI__MAX
+};
+
+void logNYI(uint32_t nyi_id);
+void printLoggedNYIs(FILE *);
+
_END_LAMBDACHINE_NAMESPACE
#endif /* LAMBDACHINE_COMMON_H */
View
45 vm/jit.cc
@@ -232,11 +232,11 @@ bool Jit::recordGenericApply(uint32_t call_info, Word *base,
uint32_t pointer_mask = call_info >> 8;
switch (fnode->info()->type()) {
case PAP:
- cerr << "NYI: Calling of PAPs." << endl;
+ logNYI(NYI_RECORD_CALL_PAP);
return false;
case THUNK:
case CAF:
- cerr << "NYI: Calling of THUNK/CAFs." << endl;
+ logNYI(NYI_RECORD_CALL_THUNK);
return false;
case FUN: {
const CodeInfoTable *info = (CodeInfoTable *)fnode->info();
@@ -244,7 +244,7 @@ bool Jit::recordGenericApply(uint32_t call_info, Word *base,
if (arity == given_args)
return true;
if (arity > given_args) {
- cerr << "NYI: Partial applications." << endl;
+ logNYI(NYI_RECORD_CREATE_PAP);
return false;
}
@@ -325,7 +325,7 @@ bool Jit::recordIns(BcIns *ins, Word *base, const Code *code) {
return true;
} else {
DBG(cerr << COL_GREEN << "REC: Inner loop. " << buf_.pc_ << COL_RESET);
- cerr << "NYI: Trace truncation due to inner loop.\n";
+ logNYI(NYI_TRACE_TRUNCATE);
goto abort_recording;
}
}
@@ -469,7 +469,7 @@ bool Jit::recordIns(BcIns *ins, Word *base, const Code *code) {
case BcIns::kEVAL: {
Closure *tnode = (Closure *)base[ins->a()];
if (tnode->isIndirection()) {
- cerr << "NYI: EVAL of indirections" << endl;
+ logNYI(NYI_RECORD_EVAL_IND);
goto abort_recording;
}
TRef noderef = buf_.slot(ins->a());
@@ -549,7 +549,7 @@ bool Jit::recordIns(BcIns *ins, Word *base, const Code *code) {
case BcIns::kMOV_RES: {
if (!(IRRef)lastResult_) {
#if !defined(NDEBUG)
- cerr << "NYI: MOV_RES with out-of trace input." << endl;
+ logNYI(NYI_RECORD_MOV_RES_EXT);
#endif
goto abort_recording;
}
@@ -566,11 +566,10 @@ bool Jit::recordIns(BcIns *ins, Word *base, const Code *code) {
InfoTable *info = oldnode->info();
if (info->type() == CAF) {
- cerr << "NYI: UPDATE of a CAF." << endl;
+ logNYI(NYI_RECORD_UPDATE_CAF);
goto abort_recording;
}
-
TRef oldref = buf_.slot(ins->a());
TRef newref = buf_.slot(ins->d());
@@ -704,8 +703,6 @@ bool Jit::recordIns(BcIns *ins, Word *base, const Code *code) {
F->traceId());
finishRecording();
return true;
- cerr << "NYI: Trace through JFUNC?\n";
- goto abort_recording;
}
}
@@ -1009,4 +1006,32 @@ debugTrace(ExitState *ex) {
traceDebugLastHp = (Word *)ex->gpr[RID_HP];
}
+static const char *nyiDescription[NYI__MAX] = {
+#define NYIDESCR(name, descr) descr,
+ NYIDEF(NYIDESCR)
+#undef NYIDESCR
+};
+
+static uint64_t nyiCount[NYI__MAX] = {
+#define NYICOUNT(name, descr) 0,
+ NYIDEF(NYICOUNT)
+#undef NYICOUNT
+};
+
+void
+logNYI(uint32_t nyi_id)
+{
+ LC_ASSERT(nyi_id < NYI__MAX);
+ ++nyiCount[nyi_id];
+}
+
+void
+printLoggedNYIs(FILE *out)
+{
+ for (uint32_t i = 0; i < NYI__MAX; ++i) {
+ if (nyiCount[i] > 0)
+ fprintf(out, "%3lu x NYI: %s\n", nyiCount[i], nyiDescription[i]);
+ }
+}
+
_END_LAMBDACHINE_NAMESPACE
View
3  vm/main.cc
@@ -85,6 +85,9 @@ int main(int argc, char *argv[]) {
delete T;
printf("\n\n");
+ printLoggedNYIs(stdout);
+
+ printf("\n\n");
printGCStats(stdout, &mm, mut_time);
formatTime(stdout, " Startup ", start_time - startup_time);
Please sign in to comment.
Something went wrong with that request. Please try again.