From 5b8d3b169618465047715bc7b976db506c3f4b72 Mon Sep 17 00:00:00 2001 From: mattiasdrp Date: Wed, 18 Sep 2024 14:46:33 +0200 Subject: [PATCH] Lib_ppx_profiler: Revert the attribute list before preprocessing it Fixes #7500 --- src/lib_ppx_profiler/ppx_profiler.ml | 6 +++++- src/lib_shell/prevalidator.ml | 4 ++-- src/lib_store/unix/block_store.ml | 4 ++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/lib_ppx_profiler/ppx_profiler.ml b/src/lib_ppx_profiler/ppx_profiler.ml index 804be2bb36a9..79d7fd803ff7 100644 --- a/src/lib_ppx_profiler/ppx_profiler.ml +++ b/src/lib_ppx_profiler/ppx_profiler.ml @@ -23,7 +23,11 @@ let mapper = inherit Ppxlib.Ast_traverse.map as super method! expression e = - let detected_rewriters = Rewriter.extract_rewriters e.pexp_attributes in + let detected_rewriters = + (* The list of attributes is reverted to make sure that we preprocess + them from left to right *) + Rewriter.extract_rewriters (List.rev e.pexp_attributes) + in (* Remove the handled attributes that have been transformed in rewriters *) Expression.remove_attributes e (* Transform the expression with the help of the list of rewriters *) diff --git a/src/lib_shell/prevalidator.ml b/src/lib_shell/prevalidator.ml index 10db4ddd65d0..3a14e0c0be4e 100644 --- a/src/lib_shell/prevalidator.ml +++ b/src/lib_shell/prevalidator.ml @@ -1427,8 +1427,8 @@ module Make match request with | Request.Flush (hash, event, live_blocks, live_operations) -> ( () - [@profiler.record Format.sprintf "%s" (Block_hash.to_b58check hash)] - [@profiler.stop] ; + [@profiler.stop] + [@profiler.record Format.sprintf "%s" (Block_hash.to_b58check hash)] ; Requests.on_advertise pv.shell ; (* TODO: https://gitlab.com/tezos/tezos/-/issues/1727 Rebase the advertisement instead. *) diff --git a/src/lib_store/unix/block_store.ml b/src/lib_store/unix/block_store.ml index 6c2b69118e94..78296d2a3777 100644 --- a/src/lib_store/unix/block_store.ml +++ b/src/lib_store/unix/block_store.ml @@ -1446,8 +1446,8 @@ let merge_stores ?(cycle_size_limit = default_cycle_size_limit) block_store (* Do not allow multiple merges: force waiting for a potential previous merge. *) () - [@profiler.record "merge store"] - [@profiler.reset_block_section Block_repr.hash new_head] ; + [@profiler.reset_block_section Block_repr.hash new_head] + [@profiler.record "merge store"] ; let*! () = Lwt_mutex.lock block_store.merge_mutex in protect ~on_error:(fun err -> -- GitLab