diff --git a/builtin/Builtin.vix b/builtin/Builtin.vix index 5194cbfc..243adabd 100644 --- a/builtin/Builtin.vix +++ b/builtin/Builtin.vix @@ -17,6 +17,7 @@ mulInt : Int -> Int -> Int subInt : Int -> Int -> Int EmptyRepresentation : Type +PointerRepresentation : Type WordRepresentation : Type maxRepresentation : Type -> Type -> Type diff --git a/src/Builtin.hs b/src/Builtin.hs index 3fde1db5..87f22de9 100644 --- a/src/Builtin.hs +++ b/src/Builtin.hs @@ -100,6 +100,10 @@ pattern WordRepresentationName :: Name.Qualified pattern WordRepresentationName = "Sixten.Builtin.WordRepresentation" +pattern PointerRepresentationName :: Name.Qualified +pattern PointerRepresentationName = + "Sixten.Builtin.PointerRepresentation" + pattern AddRepresentationName :: Name.Qualified pattern AddRepresentationName = "Sixten.Builtin.addRepresentation" diff --git a/src/ClosureConverted/Representation2.hs b/src/ClosureConverted/Representation2.hs index 5aaf6a37..74af9ff1 100644 --- a/src/ClosureConverted/Representation2.hs +++ b/src/ClosureConverted/Representation2.hs @@ -223,7 +223,7 @@ compileData env dataTypeName (Syntax.ConstructorDefinitions constructors) = do (boxity, maybeTags) <- fetch $ Query.ConstructorRepresentations dataTypeName case boxity of Boxed -> - pure $ Syntax.Global (Name.Lifted Builtin.WordRepresentationName 0) + pure $ Syntax.Global (Name.Lifted Builtin.PointerRepresentationName 0) Unboxed -> do compiledConstructorFields <- forM (OrderedHashMap.toList constructors) \(_, type_) -> do type' <- Evaluation.evaluate env type_ @@ -238,7 +238,7 @@ compileData env dataTypeName (Syntax.ConstructorDefinitions constructors) = do Just _ -> Syntax.Apply (Name.Lifted Builtin.AddRepresentationName 0) - [ Syntax.Global (Name.Lifted Builtin.WordRepresentationName 0) + [ Syntax.Global (Name.Lifted Builtin.IntName 0) , maxFieldSize ] diff --git a/src/Lower.hs b/src/Lower.hs index b96e6411..5d3b795e 100644 --- a/src/Lower.hs +++ b/src/Lower.hs @@ -146,6 +146,7 @@ mkCall = \cases mkLoad :: Operand -> Representation -> Value mkLoad = \cases (Global (Name.Lifted Builtin.EmptyRepresentationName 0)) _ -> Operand $ Representation mempty + (Global (Name.Lifted Builtin.PointerRepresentationName 0)) _ -> Operand $ Representation Representation.pointer (Global (Name.Lifted Builtin.UnitName 0)) _ -> Operand $ Representation mempty (Global (Name.Lifted Builtin.IntName 0)) _ -> Operand $ Representation Representation.int operand repr -> Load operand repr