Skip to content

Commit

Permalink
Merge pull request #24773 from JuliaLang/vc/stdlib
Browse files Browse the repository at this point in the history
Precompile stdlib modules and include them in sysimg
  • Loading branch information
vchuravy authored Nov 26, 2017
2 parents 21afb72 + 006e77a commit e64ad77
Show file tree
Hide file tree
Showing 11 changed files with 31 additions and 5 deletions.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ CORE_SRCS := $(addprefix $(JULIAHOME)/, \
base/reflection.jl \
base/tuple.jl)
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)
@$(call PRINT_JULIA, cd $(JULIAHOME)/base && \
Expand All @@ -208,7 +209,7 @@ $(build_private_libdir)/inference.ji: $(CORE_SRCS) | $(build_private_libdir)
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)
$$(build_private_libdir)/sys$1.o: $$(build_private_libdir)/inference.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
11 changes: 9 additions & 2 deletions base/sysimg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -485,10 +485,17 @@ using Base
unshift!(Base._included_files, (@__MODULE__, joinpath(@__DIR__, "sysimg.jl")))

# load some stdlib packages but don't put their names in Main
Base.require(:DelimitedFiles)
Base.require(:Test)
Base.require(:Base64)
Base.require(:CRC32c)
Base.require(:Dates)
Base.require(:DelimitedFiles)
Base.require(:FileWatching)
Base.require(:Mmap)
Base.require(:Profile)
Base.require(:SharedArrays)
Base.require(:SuiteSparse)
Base.require(:Test)


empty!(LOAD_PATH)

Expand Down
2 changes: 2 additions & 0 deletions stdlib/Base64/src/Base64.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# This file is a part of Julia. License is MIT: https://julialang.org/license

__precompile__(true)

module Base64

export
Expand Down
3 changes: 3 additions & 0 deletions stdlib/CRC32c/src/CRC32c.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@

__precompile__(true)

"""
Standard library module for computing the CRC-32c checksum.
Expand Down
2 changes: 2 additions & 0 deletions stdlib/Dates/src/Dates.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# This file is a part of Julia. License is MIT: https://julialang.org/license

__precompile__(true)

"""
Dates
Expand Down
2 changes: 2 additions & 0 deletions stdlib/FileWatching/src/FileWatching.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# This file is a part of Julia. License is MIT: https://julialang.org/license

__precompile__(true)

"""
Utilities for monitoring files and file descriptors for events.
"""
Expand Down
2 changes: 2 additions & 0 deletions stdlib/Mmap/src/Mmap.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# This file is a part of Julia. License is MIT: https://julialang.org/license

__precompile__(true)

"""
Low level module for mmap (memory mapping of files).
"""
Expand Down
2 changes: 2 additions & 0 deletions stdlib/Profile/src/Profile.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# This file is a part of Julia. License is MIT: https://julialang.org/license

__precompile__(true)

"""
Profiling support, main entry point is the [`@profile`](@ref) macro.
"""
Expand Down
2 changes: 2 additions & 0 deletions stdlib/SharedArrays/src/SharedArrays.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# This file is a part of Julia. License is MIT: https://julialang.org/license

__precompile__(true)

"""
Provide the [`SharedArray`](@ref) type. It represents an array, which is shared across multiple processes, on a single machine.
"""
Expand Down
2 changes: 2 additions & 0 deletions stdlib/SuiteSparse/src/SuiteSparse.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# This file is a part of Julia. License is MIT: https://julialang.org/license

__precompile__(true)

module SuiteSparse

import Base: At_ldiv_B, Ac_ldiv_B, A_ldiv_B!
Expand Down
5 changes: 3 additions & 2 deletions test/compile.jl
Original file line number Diff line number Diff line change
Expand Up @@ -215,10 +215,11 @@ try

modules, deps1 = Base.cache_dependencies(cachefile)
@test modules == merge(Dict(s => Base.module_uuid(getfield(Foo, s)) for s in
[:Base, :Core, Foo2_module, FooBase_module, :Main, :Test]),
[:Base, :Core, Foo2_module, FooBase_module, :Main]),
# plus modules included in the system image
Dict(s => Base.module_uuid(Base.root_module(s)) for s in
[:DelimitedFiles, :Mmap, :Base64, :Dates, :SuiteSparse]))
[:Base64, :CRC32c, :Dates, :DelimitedFiles, :FileWatching, :Mmap,
:Profile, :SharedArrays, :SuiteSparse, :Test]))
@test discard_module.(deps) == deps1

@test current_task()(0x01, 0x4000, 0x30031234) == 2
Expand Down

2 comments on commit e64ad77

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Executing the daily benchmark build, I will reply here when finished:

@nanosoldier runbenchmarks(ALL, isdaily = true)

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something went wrong when running your job:

NanosoldierError: failed to run benchmarks against primary commit: failed process: Process(`sudo cset shield -e su nanosoldier -- -c ./benchscript.sh`, ProcessExited(1)) [1]

Logs and partial data can be found here
cc @ararslan

Please sign in to comment.