Skip to content

Commit

Permalink
Merge pull request #36920 from JuliaLang/yyc/codegen/track
Browse files Browse the repository at this point in the history
Some cleanup and comment for addrspace tracking in codegen
  • Loading branch information
vtjnash committed Aug 6, 2020
2 parents afe562c + 964fc9f commit dec8f72
Show file tree
Hide file tree
Showing 5 changed files with 166 additions and 162 deletions.
10 changes: 6 additions & 4 deletions src/ccall.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,7 @@ static Value *llvm_type_rewrite(

// --- argument passing and scratch space utilities ---

// Returns T_prjlvalue
static Value *runtime_apply_type_env(jl_codectx_t &ctx, jl_value_t *ty)
{
// box if concrete type was not statically known
Expand Down Expand Up @@ -441,7 +442,7 @@ static Value *julia_to_native(
// We're passing Any
if (toboxed) {
assert(!byRef); // don't expect any ABI to pass pointers by pointer
return maybe_decay_untracked(boxed(ctx, jvinfo));
return boxed(ctx, jvinfo);
}
assert(jl_is_datatype(jlto) && julia_struct_has_layout((jl_datatype_t*)jlto, jlto_env));

Expand Down Expand Up @@ -1028,6 +1029,7 @@ static jl_cgval_t emit_llvmcall(jl_codectx_t &ctx, jl_value_t **args, size_t nar

// --- code generator for ccall itself ---

// Returns T_prjlvalue
static Value *box_ccall_result(jl_codectx_t &ctx, Value *result, Value *runtime_dt, jl_value_t *rt)
{
// XXX: need to handle parameterized zero-byte types (singleton)
Expand Down Expand Up @@ -1278,7 +1280,7 @@ static bool verify_ref_type(jl_codectx_t &ctx, jl_value_t* ref, jl_unionall_t *u
else {
Value *notany = ctx.builder.CreateICmpNE(
boxed(ctx, runtime_sp),
maybe_decay_untracked(literal_pointer_val(ctx, (jl_value_t*)jl_any_type)));
track_pjlvalue(ctx, literal_pointer_val(ctx, (jl_value_t*)jl_any_type)));
error_unless(ctx, notany, make_errmsg(fname, n, rt_err_msg_notany));
always_error = false;
}
Expand Down Expand Up @@ -1729,7 +1731,7 @@ static jl_cgval_t emit_ccall(jl_codectx_t &ctx, jl_value_t **args, size_t nargs)
emit_typeof_boxed(ctx, val),
val.isghost ? ConstantPointerNull::get(T_pint8_derived) :
ctx.builder.CreateBitCast(
decay_derived(data_pointer(ctx, val)),
decay_derived(ctx, data_pointer(ctx, val)),
T_pint8_derived)
};
Value *ret = ctx.builder.CreateCall(prepare_call(jl_object_id__func), makeArrayRef(args));
Expand Down Expand Up @@ -1795,7 +1797,7 @@ jl_cgval_t function_sig_t::emit_a_ccall(
v = julia_to_native(ctx, largty, toboxed, jargty_in_env, unionall_env, arg, byRef, ai);
bool issigned = jl_signed_type && jl_subtype(jargty, (jl_value_t*)jl_signed_type);
if (byRef) {
v = decay_derived(v);
v = decay_derived(ctx, v);
// julia_to_native should already have done the alloca and store
assert(v->getType() == pargty);
}
Expand Down
Loading

2 comments on commit dec8f72

@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 package evaluation, I will reply here when finished:

@nanosoldier runtests(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.

Your package evaluation job has completed - possible new issues were detected. A full report can be found here. cc @maleadt

Please sign in to comment.