Commit graph

59 commits

Author SHA1 Message Date
Alex Shinn
2810fb8b1b sexp_make(_eval)_context now takes an extra parameter to specify the
initial heap size (available as the -h option on the command line).
2009-12-28 13:09:43 +09:00
Alex Shinn
1fda388db9 fixing vm <, >, = comparator cases when both flonums and bignums are disabled 2009-12-28 00:06:46 +09:00
Alex Shinn
f2fb277eab forgot the return value 2009-12-27 16:39:32 +09:00
Alex Shinn
84404ac54a adding sexp_load_standard_parameters to fix -q option to main 2009-12-27 16:38:37 +09:00
Alex Shinn
461fec8e6d adding build-tests script to verify different build options. 2009-12-27 15:44:28 +09:00
Alex Shinn
02a763007d moving disasm to (chibi disasm) module 2009-12-27 01:17:32 +09:00
Alex Shinn
3c2615e2a7 moving file-exists? to (chibi filesystem) 2009-12-27 00:45:28 +09:00
Alex Shinn
e9d6f1857a types are now context-group local by default. 2009-12-26 23:46:54 +09:00
Alex Shinn
7eae77d0f9 converting make-exception to a primitive opcode instead of a foreign
function, since foreign functions will always raise any exception they
return (hence the double catch in issue #15).

also restoring the original exception handler when an exception is
raised in with-exception-handler, so that exceptions within the
handler itself don't cause an infinite loop.  this may change, as
with-exception-handler is meant to be a low-level tool on which to
build either guard or condition-case, but until then the restoring
is necessary.
2009-12-26 16:21:37 +09:00
Alex Shinn
8596e1812a recursive evals now share the same stack.
since in a minimal chibi heap the stack accounts for a large
amount of the space, this makes a big difference - you can
now load (chibi match) in a 2MB heap on a 64-bit system and
it won't grow the heap.
2009-12-26 08:25:57 +09:00
Alex Shinn
bfbc9313ed fixing import bug (was ignoring exports list except when using
only/except/rename/prefix modifiers)
2009-12-24 14:53:30 +09:00
Alex Shinn
ffdce3639b adding import-immutable to minimize heap usage 2009-12-20 16:08:19 +09:00
Alex Shinn
c895db6c48 config env doesn't copy the core env, it just links to it as a parent 2009-12-20 13:27:30 +09:00
Alex Shinn
828c6cc35a adding support for module search paths
You want to use the CHIBI_MODULE_PATH environment variable now,
not CHIBI_MODULE_DIR, and can use : separators as expected.
The default main now also accepts -I<dir> and -A<dir> to prepend
or append module directories.

The default path is ".:./lib:$PREFIX/share/chibi".  The first
two may be removed in a future version.
2009-12-18 21:26:59 +09:00
Alex Shinn
b0bcf1a0e6 oops, broke module loading with that last patch :) 2009-12-18 17:58:02 +09:00
Alex Shinn
d978e750aa moving library initialization logic from main.c to eval.c.
main is just minimal option parsing plus a simple repl now.
still need to switch to using a module path instead of a
single module dir.
2009-12-18 17:31:10 +09:00
Alex Shinn
6fe11ffcd1 Renaming all USE_ settings and all OP_, OPC_ and CORE_ enums
to have an SEXP_ prefix.  Now all values from the headers
are prefixed with either sexp_ or SEXP_, important for ease
of embedding.  "make USE_BOEHM=1" still works as an alias
for "make SEXP_USE_BOEHM=1".

Sorry if this patch breaks your code, it had to be done
sooner or later.
2009-12-18 15:58:23 +09:00
Alex Shinn
6b3b13dec6 adding cases in simplify to optimize let bindings over literals
and non-mutated identifiers.  helps a lot with the default
syntax-rules constructions - in particular reduces the number of
bytecode allocations for (chibi match) from 2397 to 1872.
2009-12-18 11:37:37 +09:00
Alex Shinn
2baae2cc3b adding initial optimization pass
this includes constant folding, dead-code elimination,
and empty let reduction
2009-12-17 16:41:49 +09:00
Alex Shinn
3861a5b599 adding optimization plugin infrastructure 2009-12-17 16:27:55 +09:00
Alex Shinn
9d44cbd99a adding SRFI-0 cond-expand 2009-12-16 20:15:45 +09:00
Alex Shinn
e0c4d1d5bf fixing define splicing for let-syntax (issue #13) 2009-12-16 18:39:11 +09:00
Alex Shinn
e03cef72b3 warning on importing undefined variables 2009-12-13 19:29:35 +09:00
Alex Shinn
178cf109bd fixing segfault when applying a first-class opcode to the wrong # of arguments 2009-12-13 16:59:20 +09:00
Alex Shinn
2ddafc2239 recovering gracefully from out-of-stack-space errors 2009-12-12 17:29:54 +09:00
Alex Shinn
0da9a79bd1 compressing bytecode literal references 2009-12-12 16:29:15 +09:00
Alex Shinn
0efd491c24 fixing nested let-syntax hygiene, simplifying error handling
also providing better errors in some cases, and exiting with
a non-zero status on script errors
2009-12-06 17:40:50 +09:00
Alex Shinn
5d2f5912ce adding parent links to cpointers to prevent freeing shared structures 2009-12-05 17:17:55 +09:00
Alex Shinn
ce9bc2edeb minor bignum bugfixes 2009-11-30 01:10:15 +09:00
Alex Shinn
574b1daa32 using include-shared for shared object files for portability 2009-11-28 17:27:01 +09:00
Alex Shinn
0746c445ed type checking on load, better error message for missing includes 2009-11-28 16:49:31 +09:00
Alex Shinn
353594a028 fixing some 64-bit bignum arithmetic cases 2009-11-28 16:05:59 +09:00
Alex Shinn
8481f543a9 cleanup, making infinities optional, fixing build for plan9 2009-11-23 01:54:22 +09:00
Alex Shinn
66bd9a52bb no more globals!
Each contexts keep a link to the heap which it is a part
of (when using the native GC), as well as a vector of
special globals that it needs quick access to (e.g. the
`quote' and `quasiquote', etc. symbols.  You can use this
to manage multiple completely unrelated VMs in the same
application, and everything will be thread-safe.

The old behavior is still available by editing config.h,
which now includes somewhat better descriptions of all
the settings.
2009-11-23 01:13:42 +09:00
Alex Shinn
3a55e2b6f3 moving debug.c to opt/ dir 2009-11-22 18:20:24 +09:00
Alex Shinn
bb251082f6 fixing a small bug that missed some tail-recursion cases 2009-11-22 18:14:46 +09:00
Alex Shinn
3ecea4d666 adding define_foreign_opt to bind C functions with optional parameters
moving several opcodes to normal FFI functions, considering
doing the same for all I/O opcodes.
2009-11-16 04:04:23 +09:00
Alex Shinn
0581b41b1e adding hash-tables and a more friendly FFI 2009-11-16 00:52:16 +09:00
Alex Shinn
311c567c06 making EQUAL? comparison data-driven
all native types, present and future, now supported.
allows for distinguishing which slots should be used
for comparison (e.g. source info of pairs isn't compared).
2009-11-15 18:45:08 +09:00
Alex Shinn
6db4ed9155 removing strndups 2009-11-11 01:43:47 +09:00
Alex Shinn
f53e4df208 adding support for runtime definition of new types 2009-11-10 21:50:59 +09:00
Alex Shinn
f9b50ba909 renaming env_define to sexp_env_define since it's a public API 2009-11-05 20:51:35 +09:00
Alex Shinn
1cdd7edfa5 adding support for dynamic loading shared libraries
load now recognizes ".so" files and loads them with dlopen,
then calls sexp_init_library(ctx, env) from that library.
2009-11-05 20:41:01 +09:00
Alex Shinn
58a6724dea setting correct top in sexp_apply 2009-11-05 18:54:25 +09:00
Alex Shinn
9c128c49fa removing unintended immutability check from OP_STRING_REF 2009-11-05 06:54:52 +09:00
Alex Shinn
520c660347 installing config file, fixing installed module search path 2009-11-03 12:54:06 +09:00
Alex Shinn
44d0156c80 better type checking in the VM
Fixes http://code.google.com/p/chibi-scheme/issues/detail?id=5
Some non-opcode primitive functions may still need type checking.
2009-11-02 23:52:19 +09:00
Alex Shinn
c4625e1c86 fixnum/integer naming cleanup
Replacing sexp_make_integer, sexp_integerp, etc. with sexp_make_fixnum,
sexp_fixnump, etc.  Defining the old names as variants handling either
fixnums or bignums, or just as aliases for the new terms when compiled
without bignum support.  sexp_make_integer needs to take a context now
in case it generates a bignum.
2009-11-02 23:39:42 +09:00
Alex Shinn
576a20b3bc simplifying gc variable preservation
Adding sexp_gc_var1..6 and corresponding _preserve/release1..6
referring to fixed preservation variable names, to substantially
reduce the boilerplate on C functions which produce temporary sexp
values.  The fixed variable names are safe because we never nest
them within the same C function.  The original macros are still
available for manual naming, block local variables and cases of
more than 6 gc vars.

Consider combining var+preserve into a single macro, since splitting
them is rare.
2009-11-01 19:48:30 +09:00
Alex Shinn
62c390d68e initial module system 2009-10-13 18:29:18 +09:00