8000 Merge pull request #1079 from tannewt/faster_qstr_pp · sparkfun/circuitpython@e7ae5a3 · GitHub
[go: up one dir, main page]

Skip to content

Commit e7ae5a3

Browse files
authored
Merge pull request adafruit#1079 from tannewt/faster_qstr_pp
Speed up QSTR creation by pre-filtering files before pre-processing.
2 parents 24b4f28 + b50f46d commit e7ae5a3

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

ports/atmel-samd/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,8 @@ endif
427427
OBJ += $(addprefix $(BUILD)/, $(SRC_S:.s=.o))
428428

429429
SRC_QSTR += $(SRC_C) $(SRC_SUPERVISOR) $(SRC_COMMON_HAL_EXPANDED) $(SRC_SHARED_MODULE_EXPANDED) $(STM_SRC_C)
430+
# Sources that only hold QSTRs after pre-processing.
431+
SRC_QSTR_PREPROCESSOR += peripherals/samd/$(CHIP_FAMILY)/clocks.c
430432

431433
all: $(BUILD)/firmware.bin $(BUILD)/firmware.uf2
432434

py/mkrules.mk

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,9 @@ $(OBJ): | $(HEADER_BUILD)/qstrdefs.generated.h $(HEADER_BUILD)/mpversion.h
7777
# - if anything in QSTR_GLOBAL_DEPENDENCIES is newer, then process all source files ($^)
7878
# - else, if list of newer prerequisites ($?) is not empty, then process just these ($?)
7979
# - else, process all source files ($^) [this covers "make -B" which can set $? to empty]
80-
$(HEADER_BUILD)/qstr.i.last: $(SRC_QSTR) $(QSTR_GLOBAL_DEPENDENCIES) | $(HEADER_BUILD)/mpversion.h
80+
$(HEADER_BUILD)/qstr.i.last: $(SRC_QSTR) $(SRC_QSTR_PREPROCESSOR) $(QSTR_GLOBAL_DEPENDENCIES) | $(HEADER_BUILD)/mpversion.h
8181
$(ECHO) "GEN $@"
82-
$(Q)$(CPP) $(QSTR_GEN_EXTRA_CFLAGS) $(CFLAGS) $(if $(filter $?,$(QSTR_GLOBAL_DEPENDENCIES)),$^,$(if $?,$?,$^)) >$(HEADER_BUILD)/qstr.i.last;
82+
$(Q)grep -lE "(MP_QSTR|i18n)" $(if $(filter $?,$(QSTR_GLOBAL_DEPENDENCIES)),$^,$(if $?,$?,$^)) | xargs $(CPP) $(QSTR_GEN_EXTRA_CFLAGS) $(CFLAGS) $(SRC_QSTR_PREPROCESSOR) >$(HEADER_BUILD)/qstr.i.last;
8383

8484
$(HEADER_BUILD)/qstr.split: $(HEADER_BUILD)/qstr.i.last
8585
$(STEPECHO) "GEN $@"
@@ -210,4 +210,3 @@ tags:
210210
ctags -e -R $(TOP)
211211

212212
-include $(OBJ:.o=.P)
213-

py/py.mk

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,10 @@ endif
278278

279279
# Sources that may contain qstrings
280280
SRC_QSTR_IGNORE = py/nlr%
281+
SRC_QSTR_EMITNATIVE = py/emitn%
281282
SRC_QSTR = $(SRC_MOD) $(filter-out $(SRC_QSTR_IGNORE),$(PY_CORE_O_BASENAME:.o=.c)) $(PY_EXTMOD_O_BASENAME:.o=.c)
283+
# Sources that only hold QSTRs after pre-processing.
284+
SRC_QSTR_PREPROCESSOR = $(addprefix $(TOP)/, $(filter $(SRC_QSTR_EMITNATIVE),$(PY_CORE_O_BASENAME:.o=.c)))
282285

283286
# Anything that depends on FORCE will be considered out-of-date
284287
FORCE:

0 commit comments

Comments
 (0)
0