From 31b2582d1304e9667c4f11daa7347c96d56fa7c9 Mon Sep 17 00:00:00 2001 From: Fabian Date: Wed, 10 Nov 2021 21:39:50 -0500 Subject: [PATCH] Avoid generating memory read for profiling info in release mode --- src/rust/codegen.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/rust/codegen.rs b/src/rust/codegen.rs index 018f7831..75b17486 100644 --- a/src/rust/codegen.rs +++ b/src/rust/codegen.rs @@ -2239,8 +2239,10 @@ pub fn gen_condition_fn(ctx: &mut JitContext, condition: u8) { } pub fn gen_move_registers_from_locals_to_memory(ctx: &mut JitContext) { - let instruction = memory::read32s(ctx.start_of_current_instruction) as u32; - ::opstats::gen_opstat_unguarded_register(ctx.builder, instruction); + if cfg!(feature = "profiler") { + let instruction = memory::read32s(ctx.start_of_current_instruction) as u32; + ::opstats::gen_opstat_unguarded_register(ctx.builder, instruction); + } for i in 0..8 { ctx.builder @@ -2250,8 +2252,10 @@ pub fn gen_move_registers_from_locals_to_memory(ctx: &mut JitContext) { } } pub fn gen_move_registers_from_memory_to_locals(ctx: &mut JitContext) { - let instruction = memory::read32s(ctx.start_of_current_instruction) as u32; - ::opstats::gen_opstat_unguarded_register(ctx.builder, instruction); + if cfg!(feature = "profiler") { + let instruction = memory::read32s(ctx.start_of_current_instruction) as u32; + ::opstats::gen_opstat_unguarded_register(ctx.builder, instruction); + } for i in 0..8 { ctx.builder