Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor inference.jl into multiple files for readability/maintainability #25517

Merged
merged 1 commit into from Jan 16, 2018
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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