Skip to content
  • Aurelien Jarno's avatar
    eabb7b91
    tcg: use tcg_debug_assert instead of assert (fix performance regression) · eabb7b91
    Aurelien Jarno authored
    
    
    The TCG code is quite performance sensitive, but at the same time can
    also be quite tricky. That is why asserts that can be enabled with the
    --enable-debug-tcg configure option.
    
    This used to work the following way:
    
    | #include "config.h"
    |
    | ...
    |
    | #if !defined(CONFIG_DEBUG_TCG) && !defined(NDEBUG)
    | /* define it to suppress various consistency checks (faster) */
    | #define NDEBUG
    | #endif
    |
    | ...
    |
    | #include <assert.h>
    
    Since commit 757e725b (tcg: Clean up includes) "config.h" as been
    replaced by "qemu/osdep.h" which itself includes <assert.h>. As a
    consequence the assertions are always enabled, even when using
    --disable-debug-tcg, causing a performance regression, especially on
    targets with many registers. For instance on qemu-system-ppc the
    speed difference is about 15%.
    
    tcg_debug_assert is controlled directly by CONFIG_DEBUG_TCG and already
    uses in some places. This patch replaces all the calls to assert into
    calss to tcg_debug_assert.
    
    Cc: Peter Maydell <peter.maydell@linaro.org>
    Cc: Richard Henderson <rth@twiddle.net>
    Signed-off-by: default avatarAurelien Jarno <aurelien@aurel32.net>
    Message-id: 1461228530-14852-1-git-send-email-aurelien@aurel32.net
    Reviewed-by: default avatarPeter Maydell <peter.maydell@linaro.org>
    Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
    eabb7b91
    tcg: use tcg_debug_assert instead of assert (fix performance regression)
    Aurelien Jarno authored
    
    
    The TCG code is quite performance sensitive, but at the same time can
    also be quite tricky. That is why asserts that can be enabled with the
    --enable-debug-tcg configure option.
    
    This used to work the following way:
    
    | #include "config.h"
    |
    | ...
    |
    | #if !defined(CONFIG_DEBUG_TCG) && !defined(NDEBUG)
    | /* define it to suppress various consistency checks (faster) */
    | #define NDEBUG
    | #endif
    |
    | ...
    |
    | #include <assert.h>
    
    Since commit 757e725b (tcg: Clean up includes) "config.h" as been
    replaced by "qemu/osdep.h" which itself includes <assert.h>. As a
    consequence the assertions are always enabled, even when using
    --disable-debug-tcg, causing a performance regression, especially on
    targets with many registers. For instance on qemu-system-ppc the
    speed difference is about 15%.
    
    tcg_debug_assert is controlled directly by CONFIG_DEBUG_TCG and already
    uses in some places. This patch replaces all the calls to assert into
    calss to tcg_debug_assert.
    
    Cc: Peter Maydell <peter.maydell@linaro.org>
    Cc: Richard Henderson <rth@twiddle.net>
    Signed-off-by: default avatarAurelien Jarno <aurelien@aurel32.net>
    Message-id: 1461228530-14852-1-git-send-email-aurelien@aurel32.net
    Reviewed-by: default avatarPeter Maydell <peter.maydell@linaro.org>
    Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
Loading