Skip to content

Commit

Permalink
Breaking change
Browse files Browse the repository at this point in the history
  • Loading branch information
Victorious3 committed May 5, 2024
1 parent bed2b9e commit 641377a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/eval.pr
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ export def get(mem: *, tpe: &typechecking::Type) -> compiler::Value {
return [ kind = compiler::ValueKind::POINTER, tpe = tpe, i = @(mem !*int64) ] !compiler::Value
case typechecking::TypeKind::REFERENCE, typechecking::TypeKind::WEAK_REF
let values = allocate_ref(compiler::Value, 3)
values(0) = [ kind = compiler::ValueKind::POINTER, tpe = typechecking::pointer(builtins::size_t_), i = @(mem !*int64) ] !compiler::Value
values(0) = [ kind = compiler::ValueKind::POINTER, tpe = typechecking::pointer(compiler::ref_meta()), i = @(mem !*int64) ] !compiler::Value
values(1) = [ kind = compiler::ValueKind::POINTER, tpe = typechecking::pointer(tpe.tpe), i = @((mem ++ (size_of type *)) !*int64) ] !compiler::Value
values(2) = [ kind = compiler::ValueKind::POINTER, tpe = typechecking::pointer(builtins::Type_), i = @((mem ++ (size_of type *) * 2) !*int64) ] !compiler::Value
return [ kind = compiler::ValueKind::STRUCT, tpe = tpe, values = values ] !compiler::Value
Expand Down Expand Up @@ -364,7 +364,7 @@ def unwrap_undef(value: compiler::Value) -> compiler::Value {
value = [ kind = compiler::ValueKind::ARRAY, tpe = value.tpe, values = values ] !compiler::Value
} else if value.tpe.kind == typechecking::TypeKind::REFERENCE or value.tpe.kind == typechecking::TypeKind::WEAK_REF {
let values = allocate_ref(compiler::Value, 3)
values(0) = [ kind = compiler::ValueKind::UNDEF, tpe = typechecking::pointer(builtins::size_t_) ] !compiler::Value
values(0) = [ kind = compiler::ValueKind::UNDEF, tpe = typechecking::pointer(compiler::ref_meta()) ] !compiler::Value
values(1) = [ kind = compiler::ValueKind::UNDEF, tpe = typechecking::pointer(value.tpe.tpe) ] !compiler::Value
values(2) = [ kind = compiler::ValueKind::UNDEF, tpe = typechecking::pointer(builtins::Type_) ] !compiler::Value
value = [ kind = compiler::ValueKind::STRUCT, tpe = value.tpe, values = values ] !compiler::Value
Expand Down Expand Up @@ -469,7 +469,7 @@ def eval_GetElementPtr(insn: &compiler::Insn, state: &State) {
}
} else if tpe.kind == typechecking::TypeKind::REFERENCE {
if index == 0 {
tpe = typechecking::pointer(builtins::size_t_)
tpe = typechecking::pointer(compiler::ref_meta())
} else if index == 1 {
addr = addr ++ (size_of type *)
tpe = tpe.tpe
Expand Down

0 comments on commit 641377a

Please sign in to comment.