Skip to content

Commit

Permalink
including julia-defs bytecode file in executable so we depend on 1 less
Browse files Browse the repository at this point in the history
external file
  • Loading branch information
JeffBezanson committed Apr 6, 2010
1 parent 74aefb1 commit cc54849
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
*.o
*.do
*.a
julia-defs.s.bc.inc
jlfrontend.c
jlfrontend_.c
/julia
Expand Down
1 change: 1 addition & 0 deletions Make.inc.Darwin
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
GAMBIT = /opt/local
GAMBITGSC = gambit-gsc
GAMBITGSI = gambit-gsi
GAMBITLIB = $(GAMBIT)/lib/gambit-c/libgambc.a
HFILEDIRS = /opt/local/include $(GAMBIT)/include
LIBDIRS = /opt/local/lib
Expand Down
1 change: 1 addition & 0 deletions Make.inc.Linux
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
GAMBIT = /usr/local/Gambit-C
GAMBITGSC = gsc
GAMBITGSI = gsi
GAMBITLIB = $(GAMBIT)/lib/libgambc.a
HFILEDIRS = /usr/local/include $(GAMBIT)/include
LIBDIRS = /usr/local/lib
Expand Down
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,11 @@ jlfrontend_.c: jlfrontend.c
julia-defs.s.bc: julia-defs.s
llvm-as -f julia-defs.s

codegen.o: intrinsics.cpp
codegen.do: intrinsics.cpp
julia-defs.s.bc.inc: julia-defs.s.bc
$(GAMBITGSI) ./bin2hex.scm < $< > $@

codegen.o: intrinsics.cpp julia-defs.s.bc.inc
codegen.do: intrinsics.cpp julia-defs.s.bc.inc

$(LLT):
cd $(LLTDIR) && $(MAKE)
Expand Down
10 changes: 10 additions & 0 deletions bin2hex.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
(let loop ((b (read-u8))
(i 0))
(if (not (eof-object? b))
(begin
(if (> i 0)
(display ", "))
(display "0x") (display (number->string b 16))
(if (= 0 (modulo (+ 1 i) 16))
(newline))
(loop (read-u8) (+ 1 i)))))
13 changes: 10 additions & 3 deletions codegen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ static jl_sym_t *closure_ref_sym;
- source location tracking, var name metadata
- rootlist to track pointers emitted into code
- function/var name mangling
- include julia-defs.bc in the executable
* include julia-defs.bc in the executable
- experiment with llvm optimization passes, option to disable them
optimizations round 1:
Expand All @@ -118,7 +118,8 @@ static jl_sym_t *closure_ref_sym;
- manually inline simple builtins (tuple,box,boxset,etc.)
- int and float constant table
- dispatch optimizations
- inline space for buffers
* inline space for buffers
* preallocate boxes for small integers
- speed up type caching
- do something about all the string copying from scheme
- speed up scheme pattern matcher by compiling patterns
Expand Down Expand Up @@ -703,6 +704,11 @@ static Function *jlfunc_to_llvm(const std::string &cname, void *addr)

extern "C" JL_CALLABLE(jl_f_tuple);

static const char julia_defs_file[] = {
#include "julia-defs.s.bc.inc"
, 0x0
};

static void init_julia_llvm_env(Module *m)
{
T_int8 = Type::getInt8Ty(getGlobalContext());
Expand All @@ -722,7 +728,8 @@ static void init_julia_llvm_env(Module *m)
T_void = Type::getVoidTy(jl_LLVMContext);

// add needed base definitions to our LLVM environment
MemoryBuffer *deffile = MemoryBuffer::getFile("julia-defs.s.bc");
const char *jdf = &julia_defs_file[0];
MemoryBuffer *deffile = MemoryBuffer::getMemBuffer(jdf, jdf+sizeof(julia_defs_file)-1);
Module *jdefs = ParseBitcodeFile(deffile, getGlobalContext());
delete deffile;

Expand Down

0 comments on commit cc54849

Please sign in to comment.