Skip to content
12 changes: 6 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -114,20 +114,20 @@ $(build_private_libdir)/sys%ji: $(build_private_libdir)/sys%o
.PRECIOUS: $(build_private_libdir)/sys%o

$(build_private_libdir)/sys%$(SHLIB_EXT): $(build_private_libdir)/sys%o
$(CXX) -shared -fPIC -L$(build_private_libdir) -L$(build_libdir) -L$(build_shlibdir) -o $@ $< \
@$(call PRINT_LINK, $(CXX) -shared -fPIC -L$(build_private_libdir) -L$(build_libdir) -L$(build_shlibdir) -o $@ $< \
$$([ $(OS) = Darwin ] && echo -Wl,-undefined,dynamic_lookup || echo -Wl,--unresolved-symbols,ignore-all ) \
$$([ $(OS) = WINNT ] && echo -ljulia -lssp)
$$([ $(OS) = WINNT ] && echo -ljulia -lssp))
$(DSYMUTIL) $@

$(build_private_libdir)/sys0.o:
@$(QUIET_JULIA) cd base && \
$(call spawn,$(JULIA_EXECUTABLE)) --build $(call cygpath_w,$(build_private_libdir)/sys0) sysimg.jl
@$(call PRINT_JULIA, cd base && \
$(call spawn,$(JULIA_EXECUTABLE)) --build $(call cygpath_w,$(build_private_libdir)/sys0) sysimg.jl)

$(build_private_libdir)/sys.o: VERSION base/*.jl base/pkg/*.jl base/linalg/*.jl base/sparse/*.jl $(build_datarootdir)/julia/helpdb.jl $(build_datarootdir)/man/man1/julia.1 $(build_private_libdir)/sys0.$(SHLIB_EXT)
@$(QUIET_JULIA) cd base && \
@$(call PRINT_JULIA, cd base && \
$(call spawn,$(JULIA_EXECUTABLE)) --build $(call cygpath_w,$(build_private_libdir)/sys) \
-J$(call cygpath_w,$(build_private_libdir))/$$([ -e $(build_private_libdir)/sys.ji ] && echo sys.ji || echo sys0.ji) -f sysimg.jl \
|| (echo "*** This error is usually fixed by running 'make clean'. If the error persists, try 'make cleanall'. ***" && false)
|| (echo "*** This error is usually fixed by running 'make clean'. If the error persists, try 'make cleanall'. ***" && false))

run-julia-debug run-julia-release: run-julia-%:
$(MAKE) $(QUIET_MAKE) run-julia JULIA_EXECUTABLE="$(JULIA_EXECUTABLE_$*)"
Expand Down
3 changes: 3 additions & 0 deletions src/builtins.c
Original file line number Diff line number Diff line change
Expand Up @@ -1130,6 +1130,9 @@ DLLEXPORT size_t jl_static_show(JL_STREAM *out, jl_value_t *v)
if (v == NULL) {
n += JL_PRINTF(out, "#<null>");
}
else if (0 < (intptr_t)v && (intptr_t)v < 4096) {
n += JL_PRINTF(out, "#<%d>", (int)(intptr_t)v);
}
else if (jl_is_lambda_info(v)) {
jl_lambda_info_t *li = (jl_lambda_info_t*)v;
n += jl_static_show(out, (jl_value_t*)li->module);
Expand Down
12 changes: 7 additions & 5 deletions src/ccall.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -668,8 +668,9 @@ static Value *emit_llvmcall(jl_value_t **args, size_t nargs, jl_codectx_t *ctx)
jl_value_t *argi = args[4+i];
Value *arg;
bool needroot = false;
bool escape = (tti == (jl_value_t*)jl_any_type);
if (t == jl_pvalue_llvmt || !jl_isbits(tti)) {
arg = emit_expr(argi, ctx, true);
arg = emit_expr(argi, ctx, escape, true);
if (t == jl_pvalue_llvmt && arg->getType() != jl_pvalue_llvmt) {
arg = boxed(arg, ctx);
needroot = true;
Expand Down Expand Up @@ -803,7 +804,7 @@ static Value *mark_or_box_ccall_result(Value *result, jl_value_t *rt_expr, jl_va
if (!static_rt && rt != (jl_value_t*)jl_any_type) {
// box if type was not statically known
int nbits = try_to_determine_bitstype_nbits(rt_expr, ctx);
return allocate_box_dynamic(emit_expr(rt_expr, ctx),
return allocate_box_dynamic(emit_expr(rt_expr, ctx, true),
ConstantInt::get(T_size, nbits/8),
result);
}
Expand Down Expand Up @@ -998,7 +999,7 @@ static Value *emit_ccall(jl_value_t **args, size_t nargs, jl_codectx_t *ctx)
if (fptr == (void *) &jl_array_ptr ||
(f_lib==NULL && f_name && !strcmp(f_name,"jl_array_ptr"))) {
assert(lrt->isPointerTy());
Value *ary = emit_expr(args[4], ctx);
Value *ary = emit_expr(args[4], ctx, true);
JL_GC_POP();
return mark_or_box_ccall_result(builder.CreateBitCast(emit_arrayptr(ary),lrt),
args[2], rt, static_rt, ctx);
Expand All @@ -1012,7 +1013,7 @@ static Value *emit_ccall(jl_value_t **args, size_t nargs, jl_codectx_t *ctx)
addressOf = true;
argi = jl_exprarg(argi,0);
}
Value *ary = boxed(emit_expr(argi, ctx),ctx);
Value *ary = boxed(emit_expr(argi, ctx, true),ctx);
JL_GC_POP();
return mark_or_box_ccall_result(builder.CreateBitCast(emit_nthptr_addr(ary, addressOf?1:0), lrt),
args[2], rt, static_rt, ctx);
Expand Down Expand Up @@ -1103,8 +1104,9 @@ static Value *emit_ccall(jl_value_t **args, size_t nargs, jl_codectx_t *ctx)
}
Value *arg;
bool needroot = false;
bool escape = (jargty == (jl_value_t*)jl_any_type);
if (largty == jl_pvalue_llvmt || largty->isStructTy()) {
arg = emit_expr(argi, ctx, true);
arg = emit_expr(argi, ctx, escape, true);
if (largty == jl_pvalue_llvmt && arg->getType() != jl_pvalue_llvmt) {
arg = boxed(arg,ctx);
needroot = true;
Expand Down
14 changes: 9 additions & 5 deletions src/cgutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -616,12 +616,15 @@ static bool has_julia_type(Value *v)

static jl_value_t *julia_type_of_without_metadata(Value *v, bool err=true)
{
if (dyn_cast<AllocaInst>(v) != NULL ||
dyn_cast<GetElementPtrInst>(v) != NULL) {
// an alloca always has llvm type pointer
return llvm_type_to_julia(v->getType()->getContainedType(0), err);
Type *T = v->getType();
if (T != jl_pvalue_llvmt) {
if (dyn_cast<AllocaInst>(v) != NULL ||
dyn_cast<GetElementPtrInst>(v) != NULL) {
// an alloca always has llvm type pointer
return llvm_type_to_julia(T->getContainedType(0), err);
}
}
return llvm_type_to_julia(v->getType(), err);
return llvm_type_to_julia(T, err);
}

static jl_value_t *julia_type_of(Value *v)
Expand Down Expand Up @@ -1431,6 +1434,7 @@ static Value *init_bits_value(Value *newv, Value *jt, Type *t, Value *v)
// allocate a box where the type might not be known at compile time
static Value *allocate_box_dynamic(Value *jlty, Value *nb, Value *v)
{
// TODO: allocate on the stack if !envescapes
if (v->getType()->isPointerTy()) {
v = builder.CreatePtrToInt(v, T_size);
}
Expand Down
Loading