Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ check ?= ## Enable only check when running format
order ?=random ## Enable order for spec execution (values: "default" | "random" | seed number)
deref_symlinks ?= ## Dereference symbolic links for `make install`
docs_sanitizer ?= ## Enable sanitization for documentation generation
sequential_codegen ?=$(if $(filter 0,$(supports_preview_mt)),true,)## Enforce sequential codegen in compiler builds. Base compiler before Crystal 1.8 cannot build with `-Dpreview_mt`
sequential_codegen ?=$(if $(filter 0,$(supports_preview_mt)),true,)## Enforce sequential codegen in compiler builds. Base compiler before Crystal 1.8 cannot build with `-Dpreview_mt -Dexecution_context`

O := .build
SOURCES := $(shell find src -name '*.cr')
Expand All @@ -46,7 +46,7 @@ MAN1PAGES := $(patsubst doc/man/%.adoc,man/%.1,$(wildcard doc/man/*.adoc))
override FLAGS += -D strict_multi_assign -D preview_overload_order $(if $(release),--release )$(if $(stats),--stats )$(if $(progress),--progress )$(if $(threads),--threads $(threads) )$(if $(debug),-d )$(if $(static),--static )$(if $(LDFLAGS),--link-flags="$(LDFLAGS)" )$(if $(target),--cross-compile --target $(target) )
# NOTE: USE_PCRE1 is only used for testing compatibility with legacy environments that don't provide libpcre2.
# Newly built compilers should never be distributed with libpcre to ensure syntax consistency.
override COMPILER_FLAGS += $(if $(interpreter),,-Dwithout_interpreter )$(if $(docs_sanitizer),,-Dwithout_libxml2 ) -Dwithout_openssl -Dwithout_zlib$(if $(sequential_codegen),, -Dpreview_mt) $(if $(USE_PCRE1),-Duse_pcre,-Duse_pcre2)
override COMPILER_FLAGS += $(if $(interpreter),,-Dwithout_interpreter )$(if $(docs_sanitizer),,-Dwithout_libxml2 ) -Dwithout_openssl -Dwithout_zlib$(if $(sequential_codegen),, -Dpreview_mt -Dexecution_context) $(if $(USE_PCRE1),-Duse_pcre,-Duse_pcre2)
SPEC_WARNINGS_OFF := --exclude-warnings spec/std --exclude-warnings spec/compiler --exclude-warnings spec/primitives --exclude-warnings src/float/printer --exclude-warnings src/random.cr
override SPEC_FLAGS += $(if $(verbose),-v )$(if $(junit_output),--junit_output $(junit_output) )$(if $(order),--order=$(order) )
CRYSTAL_CONFIG_LIBRARY_PATH := '$$ORIGIN/../lib/crystal'
Expand Down
4 changes: 4 additions & 0 deletions src/compiler/crystal.cr
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,8 @@ require "./requires"

Log.setup_from_env(default_level: :warn, default_sources: "crystal.*")

{% if flag?(:execution_context) %}
Fiber::ExecutionContext.default.resize(Fiber::ExecutionContext.default_workers_count)
{% end %}

Crystal::Command.run
4 changes: 3 additions & 1 deletion src/compiler/crystal/compiler.cr
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,9 @@ module Crystal
property? no_codegen = false

# Maximum number of LLVM modules that are compiled in parallel
property n_threads : Int32 = {% if flag?(:preview_mt) %}
property n_threads : Int32 = {% if flag?(:execution_context) %}
Fiber::ExecutionContext.default_workers_count
{% elsif flag?(:preview_mt) %}
ENV["CRYSTAL_WORKERS"]?.try(&.to_i?) || 4
{% elsif flag?(:win32) %}
1
Expand Down
Loading