Skip to content

Commit

Permalink
Enable FPO again on non-windows or freebsd
Browse files Browse the repository at this point in the history
This was enabled when we were porting to 3.7 for better unwinding.
The unwinding should have been improved (thanks to registering JIT functions to libunwind
and a new libunwind version) on non-windows a lot that we don't need this anymore.

The performance impact of this is likely small but it makes `code_native` for simple functions
quite a bit simpler and has the biggest yet effect on the code size in system image (-4%).
  • Loading branch information
yuyichao committed Nov 1, 2017
1 parent 3df06a6 commit c8ca085
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/codegen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
// also, use ELF because RuntimeDyld COFF X86_64 doesn't seem to work (fails to generate function pointers)?
#define FORCE_ELF
#endif
#if defined(_OS_WINDOWS_) || defined(_OS_FREEBSD_)
# define JL_DISABLE_FPO
#endif
#if defined(_CPU_X86_)
#define JL_NEED_FLOATTEMP_VAR 1
#endif
Expand Down Expand Up @@ -4164,7 +4167,9 @@ static Function *gen_cfun_wrapper(jl_function_t *ff, jl_value_t *jlrettype, jl_t
funcName.str(), M);
jl_init_function(cw);
cw->setAttributes(sig.attributes);
#ifdef JL_DISABLE_FPO
cw->addFnAttr("no-frame-pointer-elim", "true");
#endif
Function *cw_proto = function_proto(cw);

jl_codectx_t ctx(jl_LLVMContext);
Expand Down Expand Up @@ -4343,7 +4348,9 @@ static Function *gen_cfun_wrapper(jl_function_t *ff, jl_value_t *jlrettype, jl_t
GlobalVariable::InternalLinkage, funcName.str(), M);
jl_init_function(gf_thunk);
gf_thunk->setAttributes(returninfo.decl->getAttributes());
#ifdef JL_DISABLE_FPO
gf_thunk->addFnAttr("no-frame-pointer-elim", "true");
#endif
// build a specsig -> jl_apply_generic converter thunk
// this builds a method that calls jl_apply_generic (as a closure over a singleton function pointer),
// but which has the signature of a specsig
Expand Down Expand Up @@ -4570,7 +4577,9 @@ static Function *gen_jlcall_wrapper(jl_method_instance_t *lam, const jl_returnin
add_return_attr(w, Attribute::NonNull);
w->addFnAttr("thunk");
jl_init_function(w);
#ifdef JL_DISABLE_FPO
w->addFnAttr("no-frame-pointer-elim", "true");
#endif
Function::arg_iterator AI = w->arg_begin();
Value *fArg = &*AI++;
Value *argArray = &*AI++;
Expand Down Expand Up @@ -5011,7 +5020,9 @@ static std::unique_ptr<Module> emit_function(
declarations->specFunctionObject = NULL;
}

#ifdef JL_DISABLE_FPO
f->addFnAttr("no-frame-pointer-elim", "true");
#endif
if (jlrettype == (jl_value_t*)jl_bottom_type)
f->setDoesNotReturn();
#if defined(_OS_WINDOWS_) && !defined(_CPU_X86_64_)
Expand Down

0 comments on commit c8ca085

Please sign in to comment.