Commit d4a60b26 authored by Marius Wachtler's avatar Marius Wachtler

Workaround an LLVM limitatation by canceling OSR when there are more than 225 life symbols

LLVM has a limit of about ~255 operands per machine instructions, which we could exceed
with our patchpoints usage.
parent 9887d8a7
...@@ -462,7 +462,7 @@ Value ASTInterpreter::visit_jump(AST_Jump* node) { ...@@ -462,7 +462,7 @@ Value ASTInterpreter::visit_jump(AST_Jump* node) {
if (ENABLE_OSR && backedge && (globals->cls == module_cls)) { if (ENABLE_OSR && backedge && (globals->cls == module_cls)) {
bool can_osr = !FORCE_INTERPRETER && (globals->cls == module_cls); bool can_osr = !FORCE_INTERPRETER && (globals->cls == module_cls);
if (can_osr && edgecount++ > OSR_THRESHOLD_INTERPRETER) { if (can_osr && edgecount++ == OSR_THRESHOLD_INTERPRETER) {
eraseDeadSymbols(); eraseDeadSymbols();
const OSREntryDescriptor* found_entry = nullptr; const OSREntryDescriptor* found_entry = nullptr;
...@@ -495,6 +495,15 @@ Value ASTInterpreter::visit_jump(AST_Jump* node) { ...@@ -495,6 +495,15 @@ Value ASTInterpreter::visit_jump(AST_Jump* node) {
} }
} }
// LLVM has a limit on the number of operands a machine instruction can have (~255),
// in order to not hit the limit with the patchpoints cancel OSR when we have a high number of symbols.
if (sorted_symbol_table.size() > 225) {
static StatCounter times_osr_cancel("num_osr_cancel_to_many_syms");
times_osr_cancel.log();
next_block = node->target;
return Value();
}
if (generator) if (generator)
sorted_symbol_table[source_info->getInternedStrings().get(PASSED_GENERATOR_NAME)] = generator; sorted_symbol_table[source_info->getInternedStrings().get(PASSED_GENERATOR_NAME)] = generator;
......
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