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

WIP: generate sysimg.so #3625

Closed
wants to merge 7 commits into from
Closed
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
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ COMMIT:
$(BUILD)/$(JL_PRIVATE_LIBDIR)/sys.ji: VERSION base/*.jl base/pkg/*.jl base/linalg/*.jl base/sparse/*.jl $(BUILD)/share/julia/helpdb.jl $(BUILD)/share/man/man1/julia.1
@$(MAKE) $(QUIET_MAKE) COMMIT
$(QUIET_JULIA) cd base && \
(test -f $(BUILD)/$(JL_PRIVATE_LIBDIR)/sys.ji || $(call spawn,$(JULIA_EXECUTABLE)) -bf sysimg.jl) && $(call spawn,$(JULIA_EXECUTABLE)) -f sysimg.jl || echo "*** This error is usually fixed by running 'make clean'. If the error persists, try 'make cleanall'. ***"
(test -f $(BUILD)/$(JL_PRIVATE_LIBDIR)/sys.ji || $(call spawn,$(JULIA_EXECUTABLE)) -bf sysimg.jl) && $(call spawn,$(BUILD)/bin/llc) -filetype=obj -relocation-model=pic -o sysimg.o $(BUILD)/$(JL_PRIVATE_LIBDIR)/sys.bc && $(call spawn,$(CXX)) -shared -fPIC -ljulia-debug -L$(BUILD)/lib -o $(BUILD)/lib/sysimg.so sysimg.o && $(call spawn,$(JULIA_EXECUTABLE)) -f sysimg.jl || echo "*** This error is usually fixed by running 'make clean'. If the error persists, try 'make cleanall'. ***"

run-julia-debug run-julia-release: run-julia-%:
$(MAKE) $(QUIET_MAKE) run-julia JULIA_EXECUTABLE="$(JULIA_EXECUTABLE_$*)"
Expand Down
7 changes: 7 additions & 0 deletions base/stream.jl
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,13 @@ function reinit_stdio()
STDERR = init_stdio(ccall(:jl_stderr_stream,Ptr{Void},()),2)
end

function reinit_stdio_fake()
global STDIN, STDERR, STDOUT
STDIN = init_stdio(ccall(:jl_stdin_stream ,Ptr{Void},()),0)
STDOUT = init_stdio(ccall(:jl_stdout_stream,Ptr{Void},()),1)
STDERR = init_stdio(ccall(:jl_stderr_stream,Ptr{Void},()),2)
end

flush(::TTY) = nothing

function wait_connected(x)
Expand Down
7 changes: 6 additions & 1 deletion base/sysimg.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Disable deleteBody after function generation
# TODO: this does not work. get "ccall not defined" error
#ccall(:jl_set_imaging_mode, Void, (Uint8,), 1)

baremodule Base

eval(x) = Core.eval(Base,x)
Expand Down Expand Up @@ -99,7 +103,7 @@ include("stat.jl")
include("fs.jl")
importall .FS
include("process.jl")
reinit_stdio()
reinit_stdio_fake()
ccall(:jl_get_uv_hooks, Void, ())
include("grisu.jl")
import .Grisu.print_shortest
Expand Down Expand Up @@ -390,4 +394,5 @@ let JL_PRIVATE_LIBDIR = get(ENV, "JL_PRIVATE_LIBDIR", "lib/julia")
# create system image file
ccall(:jl_save_system_image, Void, (Ptr{Uint8},),
"$JULIA_HOME/../$JL_PRIVATE_LIBDIR/sys.ji")
ccall(:jl_dump_bitcode, Void, (Ptr{Uint8},), "$JULIA_HOME/../$JL_PRIVATE_LIBDIR/sys.bc")
end
2 changes: 1 addition & 1 deletion src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ flisp/libflisp.a: flisp/*.h flisp/*.c support/libsupport.a
$(MAKE) -C flisp

$(BUILD)/$(JL_LIBDIR)/libjulia-debug.$(SHLIB_EXT): julia.expmap $(DOBJS) flisp/libflisp.a support/libsupport.a $(LIBUV)
$(QUIET_LINK) $(CXX) $(DEBUGFLAGS) $(DOBJS) $(RPATH_ORIGIN) -shared -o $@ $(LDFLAGS) $(LIBS)
$(QUIET_LINK) $(CXX) $(DEBUGFLAGS) $(DOBJS) $(RPATH_ORIGIN) -shared -o $@ $(LDFLAGS) $(LIBS)
$(INSTALL_NAME_CMD)libjulia-debug.$(SHLIB_EXT) $@
libjulia-debug.a: julia.expmap $(DOBJS) flisp/libflisp.a support/libsupport.a
rm -f $@
Expand Down
Loading