mescc: Fix simple value tests.

* module/language/c99/compiler.mes (test->jump->info): Test accu
  before jumping.  Fixes simple value tests.
This commit is contained in:
Jan Nieuwenhuizen 2017-03-17 23:49:29 +01:00
parent f03a2e7500
commit b22eee36df
3 changed files with 24 additions and 17 deletions

View file

@ -1073,9 +1073,19 @@ _)))))
(.text (a-jump jump-length))
jump-text
(.text (b-jump body-length)))))))
((array-ref . _) ((jump i386:jump-byte-z) o))
((de-ref _) ((jump i386:jump-byte-z) o))
(_ ((jump i386:Xjump-z) o)))))
((array-ref . _) ((jump (lambda (n)
(append
(i386:accu-zero?)
(i386:jump-byte-z n)))) o))
((de-ref _) ((jump (lambda (n)
(append
(i386:accu-zero?)
(i386:jump-byte-z n)))) o))
(_ ((jump (lambda (n)
(append
(i386:accu-zero?)
(i386:Xjump-z n)))) o)))))
(define (cstring->number s)
(cond ((string-prefix? "0x" s) (string->number (string-drop s 2) 16))

View file

@ -1100,19 +1100,8 @@ make_symbol (SCM s)
return make_symbol_ (s);
#else
SCM x = lookup_symbol_ (s);
// FIXME: does not work with mescc?!
// return x != 0 ? x : make_symbol_ (s);
return x ? x : make_symbol_ (s);
#endif
// FIXME
// #if MES_MINI
// SCM x = 0;
// #else
// SCM x = lookup_symbol_ (s);
// #endif
// //FIXME
// //return x ? x : make_symbol_ (s);
// return x != 0 ? x : make_symbol_ (s);
}
SCM

View file

@ -376,10 +376,7 @@ struct_test ()
int fn = 0;
puts ("t: g_functions[g_cells[fn].cdr].arity\n");
#if __GNUC__
//FIXME
if (g_functions[g_cells[fn].cdr].arity) return 1;
#endif
if (g_functions[g_cells[fn].cdr].arity != 0) return 1;
int (*functionx) (void) = 0;
@ -731,6 +728,17 @@ test (char *p)
}
#endif
int
init ()
{
// g_cells[0].cdr = 0;
// g_cells[1].cdr = 1;
g_functions[0] = g_foo;
g_functions[1] = g_bar;
return 0;
}
int
main (int argc, char *argv[])
{