Fix use of GEP (was using byte offset, not index)

This commit is contained in:
Richard Feldman 2020-03-21 13:37:37 -04:00
parent 4182e51877
commit cc8683d241
7 changed files with 48 additions and 33 deletions

View file

@ -143,10 +143,12 @@ impl<'a> Builtin<'a> {
pub const SET_WORDS: u32 = Builtin::MAP_WORDS; // Set is an alias for Map with {} for value
pub const LIST_WORDS: u32 = 2;
/// Layout of collection wrapper - a struct of (pointer, length, capacity)
/// Layout of collection wrapper for List and Str - a struct of (pointre, length).
///
/// We choose this layout (with pointer first) because it's how
/// Rust slices are laid out, meaning we can cast to/from them for free.
pub const WRAPPER_PTR: u32 = 0;
pub const WRAPPER_LEN: u32 = 1;
pub const WRAPPER_CAPACITY: u32 = 2;
pub fn stack_size(&self, pointer_size: u32) -> u32 {
use Builtin::*;