Skip to content

Commit

Permalink
var slots too
Browse files Browse the repository at this point in the history
  • Loading branch information
carnaval committed May 20, 2016
1 parent 04bba52 commit 64e38b9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/cgutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -834,7 +834,7 @@ static LoadInst *build_load (Value *ptr, jl_value_t *jltype) {
return builder.CreateAlignedLoad(ptr, julia_alignment(ptr, jltype, 0));
}

static Value *emit_unbox(Type *to, const jl_cgval_t &x, jl_value_t *jt, Value* dest = NULL);
static Value *emit_unbox(Type *to, const jl_cgval_t &x, jl_value_t *jt, Value* dest = NULL, bool volatile_store = false);

static jl_cgval_t typed_load(Value *ptr, Value *idx_0based, jl_value_t *jltype,
jl_codectx_t *ctx, MDNode *tbaa, unsigned alignment = 0)
Expand Down
10 changes: 4 additions & 6 deletions src/codegen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2966,9 +2966,9 @@ static void emit_assignment(jl_value_t *l, jl_value_t *r, jl_codectx_t *ctx)
if (!slot.isboxed && !slot.isimmutable) { // emit a copy of values stored in mutable slots
Type *vtype = julia_type_to_llvm(slot.typ);
assert(vtype != T_pjlvalue);
slot = mark_julia_type(
emit_unbox(vtype, slot, slot.typ),
false, slot.typ, ctx);
Value *dest = emit_static_alloca(vtype);
emit_unbox(vtype, slot, slot.typ, dest);
slot = mark_julia_slot(dest, slot.typ, tbaa_stack);
}
if (slot.isboxed && slot.isimmutable) {
// see if inference had a better type for the ssavalue than the expression (after inlining getfield on a Tuple)
Expand Down Expand Up @@ -3045,9 +3045,7 @@ static void emit_assignment(jl_value_t *l, jl_value_t *r, jl_codectx_t *ctx)
else {
// store unboxed
assert(vi.value.ispointer());
builder.CreateStore(
emit_unbox(julia_type_to_llvm(vi.value.typ), rval_info, vi.value.typ),
vi.value.V, vi.isVolatile);
emit_unbox(julia_type_to_llvm(vi.value.typ), rval_info, vi.value.typ, vi.value.V, vi.isVolatile);
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/intrinsics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ static Constant *julia_const_to_llvm(jl_value_t *e, bool nested=false)
static jl_cgval_t ghostValue(jl_value_t *ty);

// emit code to unpack a raw value from a box into registers or a stack slot
static Value *emit_unbox(Type *to, const jl_cgval_t &x, jl_value_t *jt, Value *dest)
static Value *emit_unbox(Type *to, const jl_cgval_t &x, jl_value_t *jt, Value *dest, bool volatile_store)
{
assert(to != T_pjlvalue);
// TODO: fully validate that x.typ == jt?
Expand Down Expand Up @@ -294,7 +294,7 @@ static Value *emit_unbox(Type *to, const jl_cgval_t &x, jl_value_t *jt, Value *d
}
if (!dest)
return unboxed;
builder.CreateStore(unboxed, dest);
builder.CreateStore(unboxed, dest, volatile_store);
return NULL;
}

Expand Down Expand Up @@ -331,7 +331,7 @@ static Value *emit_unbox(Type *to, const jl_cgval_t &x, jl_value_t *jt, Value *d
if (dest) {
// callers using the dest argument only use it for a stack slot for now
alignment = 0;
builder.CreateMemCpy(dest, p, jl_datatype_size(jt), alignment, false, x.tbaa);
builder.CreateMemCpy(dest, p, jl_datatype_size(jt), alignment, volatile_store, x.tbaa);
return NULL;
}
else {
Expand Down

0 comments on commit 64e38b9

Please sign in to comment.