Commit 0f531fea authored by Kevin Modzelewski's avatar Kevin Modzelewski

Don't try to specialize when interpreting.

1) because we haven't seen the types multiple times yet,
so creating a new function specialization could be wasteful, and
2) the interpreter can't make use of the type specialization.

Specializing at the interpreter does let us start counting how
many times each specialization is used, and the function entry
counts are the only way we have right now of telling that a
particular specialization should be moved to a higher tier.
But I don't think we should do that using this mechanism.
parent 9f5bfdfd
......@@ -202,6 +202,13 @@ CompiledFunction* compileFunction(CLFunction* f, FunctionSpecialization* spec, E
printf("%s\n", ss.str().c_str());
}
#ifndef NDEBUG
if (effort == EffortLevel::INTERPRETED) {
for (auto arg_type : spec->arg_types)
assert(arg_type == UNKNOWN);
}
#endif
// Do the analysis now if we had deferred it earlier:
if (source->cfg == NULL) {
source->cfg = computeCFG(source, source->body);
......
......@@ -2433,17 +2433,21 @@ static CompiledFunction* pickVersion(CLFunction* f, int num_output_args, Box* oa
abort();
}
EffortLevel new_effort = initialEffort();
std::vector<ConcreteCompilerType*> arg_types;
for (int i = 0; i < num_output_args; i++) {
Box* arg = getArg(i, oarg1, oarg2, oarg3, oargs);
assert(arg); // only builtin functions can pass NULL args
if (new_effort == EffortLevel::INTERPRETED) {
arg_types.push_back(UNKNOWN);
} else {
Box* arg = getArg(i, oarg1, oarg2, oarg3, oargs);
assert(arg); // only builtin functions can pass NULL args
arg_types.push_back(typeFromClass(arg->cls));
arg_types.push_back(typeFromClass(arg->cls));
}
}
FunctionSpecialization* spec = new FunctionSpecialization(UNKNOWN, arg_types);
EffortLevel new_effort = initialEffort();
// this also pushes the new CompiledVersion to the back of the version list:
chosen_cf = compileFunction(f, spec, new_effort, NULL);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment