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

Couple ispointer fixes #15312

Merged
merged 1 commit into from
Mar 2, 2016
Merged
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
13 changes: 12 additions & 1 deletion src/cgutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1567,6 +1567,15 @@ static bool emit_getfield_unknownidx(jl_cgval_t *ret, const jl_cgval_t &strct, V
jl_value_t *jt = jl_field_type(stt, 0);
idx = emit_bounds_check(strct, (jl_value_t*)stt, idx, ConstantInt::get(T_size, nfields), ctx);
Value *ptr = data_pointer(strct, ctx);
if (!stt->mutabl) {
// just compute the pointer and let user load it when necessary
Type *fty = julia_type_to_llvm(jt);
Value *addr = builder.CreateGEP(builder.CreatePointerCast(ptr, PointerType::get(fty,0)), idx);
jl_cgval_t fieldval = mark_julia_slot(addr, jt);
Copy link
Member

Choose a reason for hiding this comment

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

fieldval.isimmutable = true?

fieldval.gcroot = strct.gcroot;
*ret = fieldval;
return true;
}
*ret = typed_load(ptr, idx, jt, ctx, stt->mutabl ? tbaa_user : tbaa_immut);
return true;
}
Expand Down Expand Up @@ -1653,7 +1662,9 @@ static jl_cgval_t emit_getfield_knownidx(const jl_cgval_t &strct, unsigned idx,
LLVM37_param(julia_type_to_llvm(strct.typ))
strct.V, 0, idx);
assert(!jt->mutabl);
return typed_load(addr, NULL, jfty, ctx, tbaa_immut);
jl_cgval_t fieldval = mark_julia_slot(addr, jfty);
fieldval.gcroot = strct.gcroot;
return fieldval;
}
else {
assert(strct.V->getType()->isVectorTy());
Expand Down
4 changes: 3 additions & 1 deletion src/codegen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4712,8 +4712,10 @@ static void emit_function(jl_lambda_info_t *lam, jl_llvm_functions_t *declaratio
else if (specsig) {
if (type_is_ghost(llvmArgType)) // this argument is not actually passed
theArg = ghostValue(argType);
else if (llvmArgType->isAggregateType())
else if (llvmArgType->isAggregateType()) {
theArg = mark_julia_slot(&*AI++, argType); // this argument is by-pointer
theArg.isimmutable = true;
}
else
theArg = mark_julia_type(&*AI++, isboxed, argType, &ctx, /*needsgcroot*/false);
}
Expand Down