Ensure Lazy has stable behaviour with afl-instrument.
When AFL instrumentation is enabled, the inlining of Lazy.force is disabled, so that the GC optimisation of removing Forward_tag blocks is no longer visible in the instrumentation output.master
parent
5c449dd3d8
commit
8095e5a10f
|
@ -1478,6 +1478,8 @@ let get_mod_field modname field =
|
|||
|
||||
let code_force_lazy_block =
|
||||
get_mod_field "CamlinternalLazy" "force_lazy_block"
|
||||
let code_force_lazy =
|
||||
get_mod_field "CamlinternalLazy" "force"
|
||||
;;
|
||||
|
||||
(* inline_lazy_force inlines the beginning of the code of Lazy.force. When
|
||||
|
@ -1540,6 +1542,17 @@ let inline_lazy_force_switch arg loc =
|
|||
sw_failaction = Some varg }, loc ))))
|
||||
|
||||
let inline_lazy_force arg loc =
|
||||
if !Clflags.afl_instrument then
|
||||
(* Disable inlining optimisation if AFL instrumentation active,
|
||||
so that the GC forwarding optimisation is not visible in the
|
||||
instrumentation output. (PR#???) *)
|
||||
Lapply{ap_should_be_tailcall = false;
|
||||
ap_loc=loc;
|
||||
ap_func=Lazy.force code_force_lazy;
|
||||
ap_args=[arg];
|
||||
ap_inlined=Default_inline;
|
||||
ap_specialised=Default_specialise}
|
||||
else
|
||||
if !Clflags.native_code then
|
||||
(* Lswitch generates compact and efficient native code *)
|
||||
inline_lazy_force_switch arg loc
|
||||
|
|
|
@ -20,7 +20,8 @@ case $1 in
|
|||
' -pp "$AWK -f expand_module_aliases.awk"';;
|
||||
stdlib__pervasives.cm[iox]|stdlib__pervasives.p.cmx) echo ' -nopervasives';;
|
||||
camlinternalOO.cmx|camlinternalOO.p.cmx) echo ' -inline 0 -afl-inst-ratio 0';;
|
||||
# never instrument camlinternalOO (PR#7725)
|
||||
camlinternalLazy.cmx|camlinternalLazy.p.cmx) echo ' -afl-inst-ratio 0';;
|
||||
# never instrument camlinternalOO or camlinternalLazy (PR#7725)
|
||||
stdlib__buffer.cmx|stdlib__buffer.p.cmx) echo ' -inline 3';;
|
||||
# make sure add_char is inlined (PR#5872)
|
||||
stdlib__buffer.cm[io]) echo ' -w A';;
|
||||
|
|
Loading…
Reference in New Issue