• Nils Goroll's avatar
    add v_dont_optimize and enable it for vcl_init / vcl_fini · f1c47e48
    Nils Goroll authored
    We add an attribute macro which, for gcc, will disable compiler
    optimizations. The intended use are VCL subs which are called exactly
    once such that any additional compilation effort is wasteful with
    respect to the overall vcl.load time.
    
    We also decorate the vcc-generated C code for vcl_init and vcl_fini
    with v_dont_optimize, which is simple and easy:
    
    	void v_dont_optimize v_matchproto_(vcl_func_f)
    	VGC_function_vcl_fini(VRT_CTX)
    
    	void v_dont_optimize v_matchproto_(vcl_func_f)
    	VGC_function_vcl_init(VRT_CTX)
    
    A more difficult improvement is left to be done: Any custom vcl subs
    which are called from vcl_init and/or vcl_fini _only_ should also be
    decorated with v_dont_optimize.
    
    With the current code base, determining if a custom sub qualifies
    would require helper code in vcc_xref to check all uses and return the
    usage union.
    
    As #3163 requires a similar mechanism and because we are about to
    enter the pre-6.4 release freeze, the better option seems to be to
    implement this "use mask" when/if #3163 gets in and come back to this
    optimization then.
    
    Closes #3230
    f1c47e48
vdef.h 5.29 KB