Skip to content

Commit

Permalink
only limit argument lists that are growing by recursion
Browse files Browse the repository at this point in the history
seems to basically work, however triggers an LLVM assertion
  • Loading branch information
JeffBezanson committed Feb 26, 2015
1 parent 93af265 commit 3ff3656
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
11 changes: 10 additions & 1 deletion base/inference.jl
Original file line number Diff line number Diff line change
Expand Up @@ -736,8 +736,17 @@ function abstract_call_gf(f, fargs, argtypes, e)
# limit argument type tuple based on size of definition signature.
# for example, given function f(T, Any...), limit to 3 arguments
# instead of the default (MAX_TUPLETYPE_LEN)
sp = inference_stack
limit = false
# look at the stack to detect recursive calls with growing argument lists
while sp !== EmptyCallStack()
if linfo.ast === sp.ast && length(argtypes) > length(sp.types)
limit = true; break
end
sp = sp.prev
end
ls = length(sig)
if ls > lsig+1 && !(isdefined(Main.Base,:promote_typeof) && f === Main.Base.promote_typeof)
if limit && ls > lsig+1 && !(isdefined(Main.Base,:promote_typeof) && f === Main.Base.promote_typeof)
fst = sig[lsig+1]
allsame = true
# allow specializing on longer arglists if all the trailing
Expand Down
10 changes: 5 additions & 5 deletions src/codegen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -637,10 +637,10 @@ static Function *to_function(jl_lambda_info_t *li, bool cstyle)
// print out the function's LLVM code
//jl_printf(JL_STDERR, "%s:%d\n",
// ((jl_sym_t*)li->file)->name, li->line);
//if (verifyFunction(*f,PrintMessageAction)) {
// f->dump();
// abort();
//}
if (verifyFunction(*f,PrintMessageAction)) {
f->dump();
abort();
}
if (old != NULL) {
builder.SetInsertPoint(old);
builder.SetCurrentDebugLocation(olddl);
Expand Down Expand Up @@ -698,7 +698,7 @@ extern "C" void jl_generate_fptr(jl_function_t *f)
#endif

Function *llvmf = (Function*)li->functionObject;

llvmf->dump();
#ifdef USE_MCJIT
li->fptr = (jl_fptr_t)(intptr_t)jl_ExecutionEngine->getFunctionAddress(llvmf->getName());
#else
Expand Down

0 comments on commit 3ff3656

Please sign in to comment.