From 10b6fe1de74b82fa386a3ca6e49f64e801339e34 Mon Sep 17 00:00:00 2001 From: Quentin Carbonneaux <quentin.carbonneaux@yale.edu> Date: Thu, 17 Sep 2015 21:12:54 -0400 Subject: [PATCH] add hack in emit to support stack arguments The number stored in the .val field of SLOTs has to be sign extended, so we can reach into the caller's frame when necessary (arguments passed on the stack). --- lisc/emit.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lisc/emit.c b/lisc/emit.c index 535bf18..7b15229 100644 --- a/lisc/emit.c +++ b/lisc/emit.c @@ -80,9 +80,11 @@ Next: fprintf(f, "%%%s", rsub[ref.val][ty]); break; case RSlot: - Slot: - fprintf(f, "%d(%%rbp)", -4 * ref.val); + Slot: { + struct { int i:14; } x = {ref.val}; /* fixme, HACK */ + fprintf(f, "%d(%%rbp)", -4 * x.i); break; + } case RCon: fputc('$', f); Con: