Store specialized variables of expect lookups in expect frames

This commit is contained in:
Ayaz Hafiz 2022-12-14 16:00:18 -06:00
parent 16209ef866
commit fe90355265
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58
6 changed files with 101 additions and 36 deletions

View file

@ -46,12 +46,19 @@ pub fn get_values<'a>(
let app = arena.alloc(app);
for (i, variable) in variables.iter().enumerate() {
let start = app.memory.deref_usize(start_offset + i * 8);
let size_of_lookup_header = 8 /* pointer to value */ + 4 /* type variable */;
let start = app
.memory
.deref_usize(start_offset + i * size_of_lookup_header);
let variable = app.memory.deref_u32(
start_offset + i * size_of_lookup_header + 8, /* skip the pointer */
);
let variable = unsafe { Variable::from_index(variable) };
app.offset = start;
let expr = {
let variable = *variable;
// TODO: pass layout_cache to jit_to_ast directly
let mut layout_cache = LayoutCache::new(layout_interner.fork(), target_info);
let layout = layout_cache.from_var(arena, variable, subs).unwrap();

View file

@ -574,14 +574,13 @@ fn render_expect_failure<'a>(
None => panic!("region {failure_region:?} not in list of expects"),
Some(current) => current,
};
let subs = arena.alloc(&mut data.subs);
let (symbols, variables) = split_expect_lookups(subs, current);
let (symbols, variables) = split_expect_lookups(&data.subs, current);
let (offset, expressions) = crate::get_values(
target_info,
arena,
subs,
&data.subs,
interns,
layout_interner,
start,
@ -591,7 +590,7 @@ fn render_expect_failure<'a>(
renderer.render_failure(
writer,
subs,
&mut data.subs,
&symbols,
&variables,
&expressions,