the test cases without folding.
* dpas/dpas-parser.y, jit/jit-interp.cpp, tests/Makefile.am,
tests/math.pas: test cases and bug fixes for mathematical operations.
+ * dpas/dpas-main.c, include/jit/jit-context.h, jit/jit-context.c,
+ jit/jit-insn.c, tests/Makefile.am: add the "--dont-fold" option
+ to Dynamic Pascal, so that we can run the test cases without folding.
+
2004-05-11 Rhys Weatherley <rweather@southern-storm.com.au>
* include/jit/jit-insn.h, jit/jit-insn.c, jit/jit-interp.cpp,
static int num_include_dirs = 0;
static char **using_seen = 0;
static int num_using_seen = 0;
+static int dont_fold = 0;
/*
* Forward declarations.
{
dpas_dump_functions = 2;
}
+ else if(!jit_strcmp(argv[1], "--dont-fold"))
+ {
+ dont_fold = 1;
+ }
else
{
usage();
{
jit_init();
dpas_init_types();
+ if(dont_fold)
+ {
+ jit_context_set_meta_numeric
+ (dpas_current_context(), JIT_OPTION_DONT_FOLD, 1);
+ }
}
#define JIT_OPTION_CACHE_LIMIT 10000
#define JIT_OPTION_CACHE_PAGE_SIZE 10001
#define JIT_OPTION_PRE_COMPILE 10002
+#define JIT_OPTION_DONT_FOLD 10003
#ifdef __cplusplus
};
* pre-compiled contexts cannot be executed directly. Instead, they
* can be written out to disk in ELF format to be reloaded at
* some future time.
+ *
+ * @vindex JIT_OPTION_DONT_FOLD
+ * @item JIT_OPTION_DONT_FOLD
+ * A numeric option that disables constant folding when it is set to a
+ * non-zero value. This is useful for debugging, as it forces @code{libjit} to
+ * always execute constant expressions at run time, instead of at compile time.
* @end table
*
* Metadata type values of 10000 or greater are reserved for internal use.
}
/* If the arguments are constant, then invoke the intrinsic now */
- if(jit_value_is_constant(arg1) && (!arg2 || jit_value_is_constant(arg2)))
+ if(jit_value_is_constant(arg1) && (!arg2 || jit_value_is_constant(arg2)) &&
+ !jit_context_get_meta_numeric(func->context, JIT_OPTION_DONT_FOLD))
{
const1 = jit_value_get_constant(arg1);
const2 = jit_value_get_constant(arg2);
TESTS = coerce.pas \
math.pas
-TESTS_ENVIRONMENT = $(top_builddir)/dpas/dpas
+TESTS_ENVIRONMENT = $(top_builddir)/dpas/dpas --dont-fold