From 0dae9014febfb455acf7301b7a0ebaa0cca392bc Mon Sep 17 00:00:00 2001 From: Brendan Hansknecht Date: Sat, 19 Feb 2022 10:59:32 -0800 Subject: [PATCH] Update comments --- compiler/gen_dev/src/generic64/mod.rs | 5 ++--- compiler/gen_dev/src/generic64/storage.rs | 13 +++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/compiler/gen_dev/src/generic64/mod.rs b/compiler/gen_dev/src/generic64/mod.rs index e07b593149..6639d27d6f 100644 --- a/compiler/gen_dev/src/generic64/mod.rs +++ b/compiler/gen_dev/src/generic64/mod.rs @@ -58,8 +58,7 @@ pub trait CallConv( buf: &mut Vec<'a, u8>, storage_manager: &mut StorageManager<'a, GeneralReg, FloatReg, ASM, Self>, @@ -69,7 +68,7 @@ pub trait CallConv( buf: &mut Vec<'a, u8>, storage_manager: &mut StorageManager<'a, GeneralReg, FloatReg, ASM, Self>, diff --git a/compiler/gen_dev/src/generic64/storage.rs b/compiler/gen_dev/src/generic64/storage.rs index 8d154a06ee..93c3734073 100644 --- a/compiler/gen_dev/src/generic64/storage.rs +++ b/compiler/gen_dev/src/generic64/storage.rs @@ -29,19 +29,20 @@ enum RegStorage { #[derive(Copy, Clone, Debug, PartialEq, Eq)] enum StackStorage { /// Primitives are 8 bytes or less. That generally live in registers but can move stored on the stack. - /// Their data must always be 8 byte aligned and will be moved as a block. + /// Their data, when on the stack, must always be 8 byte aligned and will be moved as a block. /// They are never part of a struct, union, or more complex value. - /// The rest of the bytes should be zero due to how these are loaded. + /// The rest of the bytes should be the sign extension due to how these are loaded. Primitive { // Offset from the base pointer in bytes. base_offset: i32, // Optional register also holding the value. reg: Option>, }, - /// Referenced Primitives are primitives within a complex structure. - /// They have no guarantees about alignment or zeroed bits. - /// When they are loaded, they should be aligned and zeroed. - /// After loading, they should just be stored in a register. + /// Referenced Primitives are primitives within a complex structures. + /// They have no guarantees about the bits around them and cannot simply be loaded as an 8 byte value. + /// For example, a U8 in a struct must be loaded as a single byte and sign extended. + /// If it was loaded as an 8 byte value, a bunch of garbage data would be loaded with the U8. + /// After loading, they should just be stored in a register, removing the reference. ReferencedPrimitive { // Offset from the base pointer in bytes. base_offset: i32,