From fee18e2889fdf49a2ec5188eeed265cd733b3889 Mon Sep 17 00:00:00 2001 From: Steve Orens Date: Mon, 25 May 2026 07:48:54 -0700 Subject: [PATCH 1/6] clang supports -march=native remove this ancient logical branch pinning -mcpu=apple-m1 on darwin and all other os with -march=native. -march and -mcpu had little effect on runtime performance. set $MARCH and $MCPU as desired when building. --- engine/Makefile | 31 +++++-------------------------- 1 file changed, 5 insertions(+), 26 deletions(-) diff --git a/engine/Makefile b/engine/Makefile index 648f32e9df1..ee0483911f1 100644 --- a/engine/Makefile +++ b/engine/Makefile @@ -123,8 +123,11 @@ ifneq (${LTO_THIN},) OPTS_INTERNAL += -flto=thin -fuse-ld=lld endif -ifneq (${MARCH_NATIVE},) - OPTS_INTERNAL += -march=native +ifneq (${MARCH},) + OPTS_INTERNAL += -march=${MARCH} +endif +ifneq (${MCPU},) + OPTS_INTERNAL += -mcpu=${MCPU} endif ifeq (32,${BITS}) @@ -226,30 +229,6 @@ release: $(MODULE) optimized:CPP_FLAGS += -DNDEBUG optimized:OPTS_INTERNAL += -fomit-frame-pointer -# MacOS's default compiler, `clang`, does not support `-march=native` on Apple -# Silicon chips, and as of 2021-11-22 will return an error like the following -# at compile time: -# -# clang: error: the clang compiler does not support '-march=native' -# -# This conditional preserves the existing default `-march=native` flag on all -# non-Apple systems, and also on Apple Intel systems, while instead setting -# `-mcpu=apple-m1` on Apple Silicon systems to enable any M1-specific -# optimizations that clang supports. -# -# In a future release, presumably when there are M2 chips, M3 chips, and so on, -# hopefully clang will support `-march=native` on these platforms and we can -# eliminate this block. -ifeq (${FLAVOR},Darwin) - ifeq (${ARCH},arm64) - optimized:OPTS_INTERNAL += -mcpu=apple-m1 - else - optimized:OPTS_INTERNAL += -march=native - endif -else - optimized:OPTS_INTERNAL += -march=native -endif - optimized: $(MODULE) install: all From f106dd10c1c128a5a35d19fc70cd3176e0a81810 Mon Sep 17 00:00:00 2001 From: Steve Orens Date: Mon, 25 May 2026 07:49:50 -0700 Subject: [PATCH 2/6] remove danging, unused flag --- engine/Makefile | 2 -- 1 file changed, 2 deletions(-) diff --git a/engine/Makefile b/engine/Makefile index ee0483911f1..a34a1614778 100644 --- a/engine/Makefile +++ b/engine/Makefile @@ -118,10 +118,8 @@ endif ifneq (${LTO_AUTO},) OPTS_INTERNAL += -flto=auto endif - ifneq (${LTO_THIN},) OPTS_INTERNAL += -flto=thin - -fuse-ld=lld endif ifneq (${MARCH},) OPTS_INTERNAL += -march=${MARCH} From 0bdc9900090757b41ce5190e36f05df65a54c9c6 Mon Sep 17 00:00:00 2001 From: Steve Orens Date: Mon, 25 May 2026 08:31:44 -0700 Subject: [PATCH 3/6] remove macos-version-min xcode 11 was a long time ago. plus, flag is for the link step, not the compile step so it was never being applied anyway. --- engine/Makefile | 4 ---- 1 file changed, 4 deletions(-) diff --git a/engine/Makefile b/engine/Makefile index a34a1614778..e02ff091d71 100644 --- a/engine/Makefile +++ b/engine/Makefile @@ -83,10 +83,6 @@ endif # OSX ifeq (${FLAVOR},Darwin) - # Workaround for XCode 11 issues when using optimized builds. Potentially related to - # https://forums.developer.apple.com/thread/121887 - CPP_FLAGS += -mmacosx-version-min=10.12 - # Explicitly state architectures to compile with ifneq ($(MACOS_ARCHS),) OPTS_INTERNAL += $(addprefix -arch ,$(MACOS_ARCHS)) From 3150abc4a614cd7fa7fc077fbf076397988a4564 Mon Sep 17 00:00:00 2001 From: Steve Orens Date: Mon, 25 May 2026 09:19:32 -0700 Subject: [PATCH 4/6] support variant builds via make debug, release and optimized can coexist in engine/build/ --- .gitignore | 1 + engine/Makefile | 44 +++++++++++++++++++++++++++++++------------- 2 files changed, 32 insertions(+), 13 deletions(-) diff --git a/.gitignore b/.gitignore index a7b94dcc9e4..a68e65c271e 100644 --- a/.gitignore +++ b/.gitignore @@ -33,6 +33,7 @@ Win64OpenSSL_Light-* /simc engine/simc engine/sc_rng +engine/build/ cli/simc #SimulationCraft executables diff --git a/engine/Makefile b/engine/Makefile index e02ff091d71..ea16dae438c 100644 --- a/engine/Makefile +++ b/engine/Makefile @@ -105,6 +105,21 @@ endif ifneq (${NO_DEBUG},) CPP_FLAGS += -DNDEBUG endif + +# Variant builds: 'make debug|release|optimized' recurse with VARIANT set and +# OBJ_DIR redirected to build/, so the three configurations get their +# own object/binary directories and never share (and corrupt) each other's +# objects. +ifeq (debug,${VARIANT}) + OPTS_INTERNAL += -g -fno-omit-frame-pointer -O0 -fno-optimize-sibling-calls +endif +ifeq (release,${VARIANT}) + CPP_FLAGS += -DNDEBUG +endif +ifeq (optimized,${VARIANT}) + CPP_FLAGS += -DNDEBUG + OPTS_INTERNAL += -fomit-frame-pointer +endif ifneq (${C++20},) CPP_FLAGS += --std=c++20 endif @@ -201,29 +216,29 @@ endif SRC_H := $(filter %.h, $(SRC)) $(filter %.hh, $(SRC)) $(filter %.hpp, $(SRC)) $(filter %.inc, $(SRC)) SRC_CPP := $(filter %.cpp, $(SRC)) +# Variant builds land under build/; the default build still goes +# in-tree (OBJ_DIR = .). The binary follows OBJ_DIR via TARGET_BIN. +BUILD_DIR = build OBJ_DIR = . OBJ_EXT = o DEP_EXT = d SRC_OBJ := $(SRC_CPP:%.cpp=$(OBJ_DIR)$(PATHSEP)%.$(OBJ_EXT)) SRC_DEPS := $(SRC_CPP:%.cpp=$(OBJ_DIR)$(PATHSEP)%.$(DEP_EXT)) +TARGET_BIN = $(OBJ_DIR)$(PATHSEP)$(MODULE) .PHONY: .FORCE all mostlyclean clean .FORCE: -all: $(MODULE) +all: $(TARGET_BIN) -include $(SRC_DEPS) -debug:OPTS_INTERNAL += -g -fno-omit-frame-pointer -O0 -fno-optimize-sibling-calls -debug: $(MODULE) - -release:CPP_FLAGS += -DNDEBUG -release: $(MODULE) - -optimized:CPP_FLAGS += -DNDEBUG -optimized:OPTS_INTERNAL += -fomit-frame-pointer - -optimized: $(MODULE) +# Build each variant in its own directory by recursing with OBJ_DIR redirected; +# VARIANT (read in the flags section above) selects the extra compile flags. +# 'make debug && make release' leaves both binaries side by side under build/. +.PHONY: debug release optimized +debug release optimized: + @$(MAKE) all OBJ_DIR=$(BUILD_DIR)$(PATHSEP)$@ VARIANT=$@ install: all ifneq (${PREFIX},..) @@ -235,12 +250,14 @@ ifneq (${PREFIX},..) $(COPY) -r $(wildcard ../profiles/*) $(SHARE_INSTALL_PATH) endif -$(MODULE): $(SRC_OBJ) +$(TARGET_BIN): $(SRC_OBJ) -@echo [$(MODULE)] Linking $@ + @$(MKDIR) -p $(dir $@) @$(CXX) $(OPTS_INTERNAL) $(OPTS) $(LINK_FLAGS) $^ -o $@ $(LINK_LIBS) $(OBJ_DIR)$(PATHSEP)%.$(OBJ_EXT): %.cpp $(SRC_H) -@echo [$(MODULE)] Compiling $< + @$(MKDIR) -p $(dir $@) @$(CXX) $(CPP_FLAGS) $(OPTS_INTERNAL) $(OPTS) -c $< -o $@ %.s: %.cpp $(SRC_H) @@ -249,7 +266,7 @@ $(OBJ_DIR)$(PATHSEP)%.$(OBJ_EXT): %.cpp $(SRC_H) # Force regeneration of git_info.o on every recompilation to potntially get the # changed GIT shorthash into the binary -util/git_info.o: .FORCE +$(OBJ_DIR)$(PATHSEP)util/git_info.$(OBJ_EXT): .FORCE # cleanup targets mostlyclean: @@ -259,6 +276,7 @@ mostlyclean: clean: mostlyclean -@echo [$(MODULE)] Cleaning target files @$(REMOVE) $(MODULE) sc_http$(MODULE_EXT) + -@$(REMOVE) -r $(BUILD_DIR) # Unit Tests sc_http$(MODULE_EXT): interfaces$(PATHSEP)sc_http.cpp util$(PATHSEP)sc_io.cpp sc_thread.cpp sc_util.cpp From 95b553ab11b5590856312522e37903abcde2463f Mon Sep 17 00:00:00 2001 From: Steve Orens Date: Mon, 25 May 2026 09:40:59 -0700 Subject: [PATCH 5/6] fix potion issues 1. logical error when to use default_potion() 2. resolve the 'object backing the pointer ' warning for potion_view --- engine/player/player.cpp | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/engine/player/player.cpp b/engine/player/player.cpp index ce6153cc850..aac8a4188a6 100644 --- a/engine/player/player.cpp +++ b/engine/player/player.cpp @@ -12390,20 +12390,12 @@ std::unique_ptr player_t::create_expression( util::string_view expressio if ( splits.size() == 2 && splits[ 0 ] == "potion" ) { - std::string_view potion_view; + std::string potion_name = potion_str.empty() ? default_potion() : potion_str; - if ( !potion_str.empty() ) - { - potion_view = potion_str; - } - else if ( default_potion().empty() ) - { - potion_view = default_potion(); - } - else - { + if ( potion_name.empty() ) return expr_t::create_constant( expression_str, false ); - } + + std::string_view potion_view = potion_name; if ( util::str_compare_ci( potion_view, splits[ 1 ] ) ) return expr_t::create_constant( expression_str, true ); From e6732cfdcabb1221d1f50e5b870e007f587ffb98 Mon Sep 17 00:00:00 2001 From: Steve Orens Date: Mon, 25 May 2026 09:42:17 -0700 Subject: [PATCH 6/6] remove unused declaration --- engine/player/unique_gear_midnight.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/engine/player/unique_gear_midnight.cpp b/engine/player/unique_gear_midnight.cpp index 78ce7f71e2d..abac47056a1 100644 --- a/engine/player/unique_gear_midnight.cpp +++ b/engine/player/unique_gear_midnight.cpp @@ -3778,9 +3778,7 @@ void rune_of_unleashed_fire( special_effect_t& effect ) effect.player->sim->error( UNVERIFIED_VALUE, "Rune of Unleashed Fire: Damage using placeholder value of 977. Heal using placeholder value of 1465." ); - auto coeff = effect.driver()->effectN( 2 ).trigger(); - - // using placeholder values, presumably should be based on coeff->effectN( 1 ) + // using placeholder values, presumably should be based on driver effectN(2).trigger()->effectN(1) auto damage = create_proc_action>( "rune_of_unleashed_fire", effect, 1286970 ); @@ -3817,9 +3815,7 @@ void rune_of_voidtouched_orbs( special_effect_t& effect ) effect.player->sim->error( UNVERIFIED_VALUE, "Rune of Voidtouched Orbs: Damage using placeholder value of 977. Heal using placeholder value of 1465." ); - auto coeff = effect.driver()->effectN( 2 ).trigger(); - - // using placeholder values, presumably should be based on coeff->effectN( 1 ) + // using placeholder values, presumably should be based on driver effectN(2).trigger()->effectN(1) auto damage = create_proc_action>( "rune_of_voidtouched_orbs", effect, 1286716 );