diff options
author | Ori Bernstein <ori@eigenstate.org> | 2015-09-27 22:52:17 -0700 |
---|---|---|
committer | Ori Bernstein <ori@eigenstate.org> | 2015-09-27 22:52:17 -0700 |
commit | c8c4b88ecadf05438561c05f97500e35843218c4 (patch) | |
tree | 950afbb15a71d129fdf5bab862ebe8d17eaeac59 /6/isel.c | |
parent | ac306beff772b0a894ca95e0e0d0fe3029c7f8e4 (diff) | |
download | mc-c8c4b88ecadf05438561c05f97500e35843218c4.tar.gz |
Don't index directly off of %rax.
We use it for function returns. We also use it for environment of
called closures. This means we clobbered it. Oops.
Diffstat (limited to '6/isel.c')
-rw-r--r-- | 6/isel.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -104,7 +104,7 @@ static Loc *varloc(Isel *s, Node *n) l = locmeml(htget(s->globls, n), rip, NULL, mode(n)); } else if (hthas(s->envoff, n)) { off = ptoi(htget(s->envoff, n)); - l = locmem(off, locphysreg(Rrax), NULL, mode(n)); + l = locmem(off, s->envp, NULL, mode(n)); } else if (hthas(s->stkoff, n)) { off = ptoi(htget(s->stkoff, n)); l = locmem(-off, locphysreg(Rrbp), NULL, mode(n)); @@ -980,6 +980,8 @@ static void prologue(Isel *s, Func *fn, size_t sz) g(s, Imov, phys, s->calleesave[i], NULL); } } + if (s->envp) + g(s, Imov, locphysreg(Rrax), s->envp, NULL); addarglocs(s, fn); s->nsaved = i; s->stksz = stksz; /* need to update if we spill */ |