diff --git a/stepper.py b/stepper.py index 980845f..aee0c88 100644 --- a/stepper.py +++ b/stepper.py @@ -65,6 +65,8 @@ def step(insns, terminator, blocks, stack_frames, ssa_env, global_env, heap, TODO('Load') elif isinstance(next_insn, ll.Store): ty = next_insn.ty + base_ty = ty2base_ty(ty, tdecs) + size = base_ty2size(base_ty) value = next_insn.value location = next_insn.location @@ -75,7 +77,12 @@ def step(insns, terminator, blocks, stack_frames, ssa_env, global_env, heap, print('heap[{}] <- {}' .format(location_v, value_v)) - heap[location_v] = value_v + if size == 1: + heap[location_v] = value_v + else: + err(('This emulator cannot store objects larger than 1 cell.' + ' Current size is {}') + .format(size)) elif isinstance(next_insn, ll.Icmp): cnd = next_insn.cnd left = next_insn.left