Skip to content

Commit

Permalink
Steps forward
Browse files Browse the repository at this point in the history
  • Loading branch information
Victorious3 committed Apr 26, 2024
1 parent fd66a0e commit a97403f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/compiler.pr
Original file line number Diff line number Diff line change
Expand Up @@ -1427,10 +1427,10 @@ def convert_ref_to_ref(tpe: &typechecking::Type, value: Value, loc: &Value, stat

// Convert weak ref to strong reference
// Need to check the ref count and return a null reference if its 0
if is_weak_ref(tpe) and is_ref(value.tpe) {
if is_weak_ref(value.tpe) and is_ref(tpe) {
let meta = state.load(ref_meta, extract1_ret, loc)
let refcount = state.extract_value(builtins::int64_, meta, [0], loc)
let iszero = state.icmp(CompareInt::ule, refcount,
let iszero = state.icmp(CompareInt::sle, refcount,
[ kind = ValueKind::INT, tpe = builtins::int64_, i = 0 ] !Value, loc)
let res = state.alloca(value.tpe, loc)

Expand Down Expand Up @@ -1463,7 +1463,7 @@ def convert_ref_to_ref(tpe: &typechecking::Type, value: Value, loc: &Value, stat
br_to_end.value.br_unc.label_ = end
push_label(end, state)

return state.load(value.tpe, res, loc)
return state.load(tpe, res, loc)
}

let start = [ kind = ValueKind::UNDEF, tpe = tpe ] !Value
Expand Down Expand Up @@ -8499,7 +8499,7 @@ def create_destructor(tpe: &typechecking::Type, value: Value, state: &State) {
}

let ref_count_i8_ptr = state.bitcast(pointer(builtins::int8_), ref_count)
state.call("free", null, [ref_count_i8_ptr])
//state.call("free", null, [ref_count_i8_ptr])

value = state.extract_value(pointer(tpe.tpe.tpe), ref, [1])

Expand Down

0 comments on commit a97403f

Please sign in to comment.