Skip to content

Commit

Permalink
refactor inference.jl into multiple files for readability/maintainabi…
Browse files Browse the repository at this point in the history
…lity [ci skip]
  • Loading branch information
jrevels committed Jan 12, 2018
1 parent ec9e92e commit f610a64
Show file tree
Hide file tree
Showing 41 changed files with 4,489 additions and 4,360 deletions.
2 changes: 1 addition & 1 deletion HISTORY.md
Expand Up @@ -584,7 +584,7 @@ Deprecated or removed
* `Base.promote_type(op::Type, Ts::Type...)` has been removed as part of an overhaul
of `broadcast`'s promotion mechanism. If you need the functionality of that
`Base.promote_type` method, consider defining it locally via
`Core.Inference.return_type(op, Tuple{Ts...})` ([#18642]).
`Core.Compiler.return_type(op, Tuple{Ts...})` ([#18642]).

* `bitbroadcast` has been deprecated in favor of `broadcast`, which now produces a
`BitArray` instead of `Array{Bool}` for functions yielding a boolean result ([#19771]).
Expand Down
20 changes: 9 additions & 11 deletions Makefile
Expand Up @@ -94,13 +94,13 @@ julia-src-release julia-src-debug : julia-src-% : julia-deps julia_flisp.boot.in
julia-ui-release julia-ui-debug : julia-ui-% : julia-src-%
@$(MAKE) $(QUIET_MAKE) -C $(BUILDROOT)/ui julia-$*

julia-inference : julia-base julia-ui-$(JULIA_BUILD_MODE) $(build_prefix)/.examples
@$(MAKE) $(QUIET_MAKE) -C $(BUILDROOT) $(build_private_libdir)/inference.ji JULIA_BUILD_MODE=$(JULIA_BUILD_MODE)
julia-base-compiler : julia-base julia-ui-$(JULIA_BUILD_MODE) $(build_prefix)/.examples
@$(MAKE) $(QUIET_MAKE) -C $(BUILDROOT) $(build_private_libdir)/basecompiler.ji JULIA_BUILD_MODE=$(JULIA_BUILD_MODE)

julia-sysimg-release : julia-inference julia-ui-release
julia-sysimg-release : julia-base-compiler julia-ui-release
@$(MAKE) $(QUIET_MAKE) -C $(BUILDROOT) $(build_private_libdir)/sys.$(SHLIB_EXT) JULIA_BUILD_MODE=release

julia-sysimg-debug : julia-inference julia-ui-debug
julia-sysimg-debug : julia-base-compiler julia-ui-debug
@$(MAKE) $(QUIET_MAKE) -C $(BUILDROOT) $(build_private_libdir)/sys-debug.$(SHLIB_EXT) JULIA_BUILD_MODE=debug

julia-debug julia-release : julia-% : julia-ui-% julia-sysimg-% julia-symlink julia-libccalltest julia-base-cache
Expand Down Expand Up @@ -174,19 +174,17 @@ $(build_private_libdir)/%.$(SHLIB_EXT): $(build_private_libdir)/%.o
@$(DSYMUTIL) $@

CORE_SRCS := $(addprefix $(JULIAHOME)/, \
base/boot.jl base/coreimg.jl \
base/boot.jl base/compiler/compiler.jl \
base/docs/core.jl \
base/abstractarray.jl \
base/array.jl \
base/bool.jl \
base/abstractdict.jl \
base/codevalidation.jl \
base/error.jl \
base/essentials.jl \
base/generator.jl \
base/expr.jl \
base/hashing.jl \
base/inference.jl \
base/int.jl \
base/bitset.jl \
base/number.jl \
Expand All @@ -201,15 +199,15 @@ CORE_SRCS := $(addprefix $(JULIAHOME)/, \
BASE_SRCS := $(sort $(shell find $(JULIAHOME)/base -name \*.jl) $(shell find $(BUILDROOT)/base -name \*.jl))
STDLIB_SRCS := $(sort $(shell find $(JULIAHOME)/stdlib/*/src -name \*.jl))

$(build_private_libdir)/inference.ji: $(CORE_SRCS) | $(build_private_libdir)
$(build_private_libdir)/basecompiler.ji: $(CORE_SRCS) | $(build_private_libdir)
@$(call PRINT_JULIA, cd $(JULIAHOME)/base && \
$(call spawn,$(JULIA_EXECUTABLE)) -C "$(JULIA_CPU_TARGET)" --output-ji $(call cygpath_w,$@) \
--startup-file=no -g0 -O0 coreimg.jl)
--startup-file=no -g0 -O0 compiler/compiler.jl)

RELBUILDROOT := $(shell $(JULIAHOME)/contrib/relative_path.sh "$(JULIAHOME)/base" "$(BUILDROOT)/base/")
COMMA:=,
define sysimg_builder
$$(build_private_libdir)/sys$1.o: $$(build_private_libdir)/inference.ji $$(JULIAHOME)/VERSION $$(BASE_SRCS) $$(STDLIB_SRCS)
$$(build_private_libdir)/sys$1.o: $$(build_private_libdir)/basecompiler.ji $$(JULIAHOME)/VERSION $$(BASE_SRCS) $$(STDLIB_SRCS)
@$$(call PRINT_JULIA, cd $$(JULIAHOME)/base && \
if $$(call spawn,$3) $2 -C "$$(JULIA_CPU_TARGET)" --output-o $$(call cygpath_w,$$@).tmp $$(JULIA_SYSIMG_BUILD_FLAGS) \
--startup-file=no --warn-overwrite=yes --sysimage $$(call cygpath_w,$$<) sysimg.jl $$(RELBUILDROOT); then \
Expand Down Expand Up @@ -522,7 +520,7 @@ distcleanall: cleanall
.PHONY: default debug release check-whitespace release-candidate \
julia-debug julia-release julia-deps \
julia-ui-release julia-ui-debug julia-src-release julia-src-debug \
julia-symlink julia-base julia-inference julia-sysimg-release julia-sysimg-debug \
julia-symlink julia-base julia-base-compiler julia-sysimg-release julia-sysimg-debug \
test testall testall1 test clean distcleanall cleanall clean-* \
run-julia run-julia-debug run-julia-release run \
install binary-dist light-source-dist.tmp light-source-dist \
Expand Down
6 changes: 3 additions & 3 deletions base/array.jl
Expand Up @@ -492,18 +492,18 @@ function _collect_indices(indsA, A)
copyto!(B, CartesianIndices(axes(B)), A, CartesianIndices(indsA))
end

# define this as a macro so that the call to Inference
# define this as a macro so that the call to Core.Compiler
# gets inlined into the caller before recursion detection
# gets a chance to see it, so that recursive calls to the caller
# don't trigger the inference limiter
if isdefined(Core, :Inference)
if isdefined(Core, :Compiler)
macro default_eltype(itr)
I = esc(itr)
return quote
if $I isa Generator && ($I).f isa Type
($I).f
else
Core.Inference.return_type(first, Tuple{typeof($I)})
Core.Compiler.return_type(first, Tuple{typeof($I)})
end
end
end
Expand Down

0 comments on commit f610a64

Please sign in to comment.