Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

fix 2 more bugs.

  • Loading branch information...
commit 4af3a2223ae7b83d7ed463d5a9026f650a952bdd 1 parent e69f6fb
Klaas-Jan Stol kjs authored

Showing 2 changed files with 6 additions and 6 deletions. Show diff stats Hide diff stats

  1. +2 2 run_m1.sh
  2. +4 4 src/gencode.c
4 run_m1.sh
@@ -10,6 +10,6 @@ file_suffixe=${1##*.}
10 10
11 11 ./m1 $1 2>/dev/null > $filename.m0
12 12 [ -s $filename.m0 ] || { echo "error: outputs a empty file $filename.m0 when compiling $1"; exit 1; }
13   -./m0_assembler.pl a.m1 >/dev/null
14   -./m0 a.m1b || { exit 1; }
  13 +./m0_assembler.pl $filename.m0 >/dev/null
  14 +./m0 $filename.m0b || { exit 1; }
15 15 exit 0
8 src/gencode.c
@@ -285,7 +285,7 @@ gencode_int(M1_compiler *comp, m1_literal *lit) {
285 285 int num256 = (constindex - remainder) / 256;
286 286
287 287 INS (M0_SET_IMM, "%I, %d, %d", reg.no, num256, remainder);
288   - INS (M0_DEREF, "%I, %d, %d", reg.no, CONSTS, reg.no);
  288 + INS (M0_DEREF, "%I, %d, %I", reg.no, CONSTS, reg.no);
289 289
290 290 fprintf(OUT, "\tset_imm\tI%d, %d, %d\n", reg.no, num256, remainder);
291 291 fprintf(OUT, "\tderef\tI%d, CONSTS, I%d\n", reg.no, reg.no);
@@ -1827,9 +1827,9 @@ gencode_funcall(M1_compiler *comp, m1_funcall *funcall) {
1827 1827 /* retrieve the return value. */
1828 1828 m1_reg idxreg = alloc_reg(comp, VAL_INT);
1829 1829 m1_reg retvaltarget_reg = alloc_reg(comp, funcall->typedecl->valtype);
1830   -
  1830 +
1831 1831 /* load the number of register I0. */
1832   - INS (M0_SET_IMM, "%I, %d, %R", idxreg.no, retvaltarget_reg); // XXX want index of reg. 0 of requested type.
  1832 + INS (M0_SET_IMM, "%I, %d, %R", idxreg.no, 0, retvaltarget_reg); // XXX want index of reg. 0 of requested type.
1833 1833
1834 1834 fprintf(OUT, "\tset_imm\tI%d, 0, %c0\n", idxreg.no, reg_chars[(int)retvaltarget_reg.type]);
1835 1835
@@ -1841,7 +1841,7 @@ gencode_funcall(M1_compiler *comp, m1_funcall *funcall) {
1841 1841 fprintf(OUT, "\tderef\t%c%d, P%d, I%d\n", reg_chars[(int)retvaltarget_reg.type], retvaltarget_reg.no,
1842 1842 cf_reg.no, idxreg.no);
1843 1843
1844   - /* make it available for use by another statement. */
  1844 + /* make it available for use by another statement. */
1845 1845 pushreg(comp->regstack, retvaltarget_reg);
1846 1846
1847 1847 /* we're accessing the callee's CF, so only free its register now.*/

0 comments on commit 4af3a22

Please sign in to comment.
Something went wrong with that request. Please try again.