Michael Gran [Fri, 21 Aug 2009 04:31:58 +0000 (21:31 -0700)]
Type-limits error in GC environment initialization
* libguile/gc-malloc.c (scm_gc_init_malloc): GUILE_INIT_MALLOC_LIMIT
is cast to unsigned then tested as if it were still signed
Michael Gran [Fri, 21 Aug 2009 03:30:12 +0000 (20:30 -0700)]
Avoid accessing symbol internals in call_dsubr_1 and DEVAL
The symbol's characters are only accessed in case they are needed
for an error message. This can be avoided by passing the symbol
all the way to a error message function.
* libguile/__scm.h (SCM_WTA_DISPATCH_1_SUBR): new macro
* libguile/error.c (scm_i_wrong_type_arg_symbol): new error function
* libguile/error.h: declaration of scm_i_wrong_type_arg_symbol
* libguile/eval.c (call_dsubr_1): use new macro SCM_WTA_DISPATCH_1_SUBR
to avoid having to unpack the symbol's chars
* libguile/eval.i.c: use new macro SCM_WTA_DISPATCH_1_SUBR
Michael Gran [Thu, 20 Aug 2009 16:42:38 +0000 (09:42 -0700)]
Use string and symbol accessors with obarrays and keyword-dash-symbols
* libguile/deprecated.c (intern_obarray_soft): new function
(scm_intern_obarray_soft, scm_string_to_obarray_symbol): use
intern_obarray_soft
(scm_gentemp): don't unpack string chars, use intern_obarray_soft
* libguile/discouraged.c (scm_make_keyword_from_dash_symbol): use
symbol accessor
Ludovic Courtès [Thu, 20 Aug 2009 23:33:16 +0000 (01:33 +0200)]
Aggregate `guile-readline' makefiles.
* configure.ac: Don't produce `guile-readline/ice-9/Makefile'.
* guile-readline/Makefile.am (SUBDIRS): Remove.
(ice9dir, nobase_ice9_DATA): New, formerly under `ice-9'.
(ETAGS_ARGS, EXTRA_DIST): Augment.
(DEFS): Move outside of `if'.
(MKDEP): Remove.
* guile-readline/ice-9/Makefile.am: Remove.
Ludovic Courtès [Thu, 20 Aug 2009 23:18:20 +0000 (01:18 +0200)]
Don't use a sub-`configure' for `guile-readline'.
* acinclude.m4 (GUILE_READLINE): New macro, based on the former
`guile-readline/configure.ac'.
* configure.ac: Remove `AC_CONFIG_SUBDIRS' invocation. Add
`GUILE_READLINE' invocation. Produce files under `guile-readline'.
* guile-readline/Makefile.am: Conditionalize the meat under
`HAVE_READLINE'.
(INCLUDES): Rename to...
(AM_CPPFLAGS): this. Users updates.
(AM_CFLAGS): New variable.
(libguilereadline_v_@LIBGUILEREADLINE_MAJOR@_la_LIBADD): Add
$(READLINE_LIBS).
* guile-readline/readline.c: Include <config.h>.
* guile-readline/configure.ac, guile-readline/autogen.sh: Remove.
Andy Wingo [Thu, 20 Aug 2009 12:33:38 +0000 (14:33 +0200)]
eval is actually compile
* module/ice-9/boot-9.scm (eval): Here at the tail of boot-9, replace
the root definition of `eval' with a procedure that will call
`compile'.
* test-suite/tests/syntax.test ("top-level define"):
("internal define"): Run unmemoization tests in the interpreter, using
primitive-eval.
Andy Wingo [Thu, 20 Aug 2009 12:27:38 +0000 (14:27 +0200)]
programs have their own tc7 now
* libguile/tags.h (scm_tc7_program):
* libguile/programs.h: Programs now have their own tc7 code. Fix up the
macros appropriately.
* libguile/programs.c: Remove smobby bits, leaving marking, printing,
and application for other parts of Guile.
* libguile/debug.c (scm_procedure_source):
* libguile/eval.c (scm_trampoline_0, scm_trampoline_1)
(scm_trampoline_2): Add cases for tc7_program.
* libguile/eval.i.c (CEVAL, SCM_APPLY):
* libguile/evalext.c (scm_self_evaluating_p):
* libguile/gc-card.c (scm_i_sweep_card, scm_i_tag_name):
* libguile/gc-mark.c (1):
* libguile/print.c (iprin1):
* libguile/procs.c (scm_procedure_p, scm_thunk_p)
* libguile/vm-i-system.c (make-closure): Adapt to new procedure
representation.
* libguile/procprop.c (scm_i_procedure_arity): Do the right thing for
programs.
* test-suite/tests/procprop.test ("procedure-arity"): Arity test now
succeeds.
* libguile/goops.c (scm_class_of): Programs now belong to the class
<procedure>, not a smob class.
* libguile/vm.h (struct vm, struct vm_cont):
* libguile/vm-engine.c (vm_engine):
* libguile/frames.h (SCM_FRAME_BYTE_CAST, struct vm_frame):
* libguile/frames.c (scm_c_make_vm_frame): Fix usages of scm_byte_t,
changing them to scm_t_uint8.
Andy Wingo [Thu, 20 Aug 2009 10:55:05 +0000 (12:55 +0200)]
eval-elisp uses primitive-eval
* lang/elisp/interface.scm (eval-elisp): Use primitive-eval, as we will
be switching the evaluator soon.
Andy Wingo [Thu, 20 Aug 2009 10:48:11 +0000 (12:48 +0200)]
define @bind using syntax-case
* module/ice-9/boot-9.scm (@bind): Define a VM-compatible syntax
definition for this old evaluator primitive.
* test-suite/tests/dynamic-scope.test: Change the expected error
messages.
Andy Wingo [Thu, 20 Aug 2009 10:47:11 +0000 (12:47 +0200)]
use primitive-eval in run-vm-tests.scm
* testsuite/run-vm-tests.scm (run-vm-tests): Use primitive-eval, as
we'll be changing eval soon.
Andy Wingo [Thu, 20 Aug 2009 10:46:36 +0000 (12:46 +0200)]
better VM error messages
* libguile/vm-engine.c: Attempt to make error messages more friendly
and uniform with historical expectation.
Andy Wingo [Sat, 15 Aug 2009 12:27:15 +0000 (14:27 +0200)]
update docs for calling convention change
* doc/ref/vm.texi: Update.
Andy Wingo [Sat, 15 Aug 2009 12:15:56 +0000 (14:15 +0200)]
push new frame on stack before procedure & args
* libguile/_scm.h (SCM_OBJCODE_MINOR_VERSION): Bump
* libguile/vm-engine.c (vm_engine): Push a frame corresponding to the
mv-call.
* libguile/vm-i-system.c: Renumber ops.
(new-frame): New op, pushes a frame.
(call, mv-call): No need to shuffle args, though we do need to pop the
frame in the non-vm call case.
(goto/args): Inconsequential tweaks.
(call/cc): Push a frame if needed.
* module/language/tree-il/compile-glil.scm (flatten): Emit `new-frame'
as appropriate.
* test-suite/tests/tree-il.test: Fix to expect new-frame.
Andy Wingo [Sat, 15 Aug 2009 12:13:08 +0000 (14:13 +0200)]
reorder frame layout
* libguile/frames.h: Reorder the frame layout so the return address
comes below the arguments.working
(SCM_FRAME_SET_RETURN_ADDRESS, SCM_FRAME_SET_MV_RETURN_ADDRESS): New
macros.
* libguile/frames.c (scm_vm_frame_arguments): Use the macros to access
the arguments.
* libguile/vm-engine.c (vm_engine): Fix for new calling convention.
* libguile/vm-engine.h (INIT_FRAME): New macro. Does part of what
NEW_FRAME used to do.
* libguile/vm-i-system.c (call, mv-call): Shuffle args up to make room
for the stack, and adapt to new calling convention.
(goto/args): Shuffling down is easier now.
(return, return/args): Adapt to new frame layout.
* libguile/vm.c (vm_mark_stack): Adapt to new frame layout, and the
possibility of there being crap on the stack.
(really_make_boot_program): Remove extraneous comment.
Andy Wingo [Sat, 15 Aug 2009 12:11:51 +0000 (14:11 +0200)]
remove dead weight from vm-i-system.c
* libguile/vm-i-system.c: Remove mark, list-mark, cons-mark,
vector-mark, and list-break, as they are no longer used.
(call, goto/args, mv-call): Remove bits about trampolines, which was
slower, and VM continuations, which are not used (we use Guile's
continuations as the applicable objects).
Renumber ops.
* libguile/_scm.h (SCM_OBJCODE_MINOR_VERSION): Bump.
Andy Wingo [Thu, 20 Aug 2009 16:46:09 +0000 (18:46 +0200)]
disable autocompilation in the test suite
* check-guile.in: Disable autocompilation while working in the test
suite, for now at least. We'll enable it again later.
Andy Wingo [Thu, 20 Aug 2009 15:56:44 +0000 (17:56 +0200)]
autocompiled files before installation go to a cache dir in the builddir
* libguile/load.c (scm_init_load_path): Append a slash after
XDG_CACHE_HOME.
* meta/gdb-uninstalled-guile.in:
* meta/guile.in (XDG_CACHE_HOME): Export this var so we write to a cache
within the build directory. Probably we should have a GUILE_CACHE_DIR
to be more specific, though.
* Makefile.am (clean-local): Clear the cache when making clean.
Michael Gran [Thu, 20 Aug 2009 14:23:22 +0000 (07:23 -0700)]
type limits error in string-tabulate
* libguile/srfi-13.c (scm_string_tabulate): test range of signed integer
before casting it to unsigned size_t
Michael Gran [Wed, 19 Aug 2009 12:25:47 +0000 (05:25 -0700)]
Update srfi-13 functions for Unicode
* libguile/srfi-13.c (MY_SUBF_VALIDATE_SUBSTRING_SPEC): new macro
(MY_VALIDATE_SUBSTRING_SPEC_COPY): now unused, removed
(MY_VALIDATE_SUBSTRING_SPEC_UCOPY): now unused, removed
(REF_IN_CHARSET): new macro
(race_error)[0]: unused, removed
(scm_string_any, scm_string_every, scm_string_tabulate)
(scm_substring_to_list, scm_reverse_string_to_list)
(scm_reverse_list_to_string, scm_string_join)
(s_scm_srfi13_substring_copy, scm_string_copy, scm_string_copy_x)
(scm_string_pad, scm_string_pad_right, scm_string_trim)
(scm_string_trim_right, scm_string_trim_both, scm_substring_fill_x):
(scm_string_compare, scm_string_compare_ci): modified for
both wide and narrow strings
(compare_string): new function
(scm_string_eq, scm_string_neq, scm_string_lt, scm_string_gt)
(scm_string_le, scm_string_ge, scm_string_ci_eq, scm_string_ci_neq)
(scm_string_ci_lt, scm-string_ci_gt, scm_string_ci_le, scm_string_ci_gt)
(scm_substring_hash, scm_string_prefix_length, scm_string_suffix_length)
(scm_string_prefix_length_ci, scm_string_suffix_length_ci)
(scm_string_prefix_p, scm_string_prefix_ci_p, scm_string_suffix_p)
(scm_string_suffix_ci_p, scm_string_index, scm_string_index_right)
(scm_string_skip, scm_string_skip_right, scm_string_count)
(scm_string_contains, scm_string_contains_ci, string_upcase_x)
(scm_substring_upcase_x, scm_substring_upcase, string_downcase_x)
(scm_string_downcase_x, scm_string_downcase, scm_string_titlecase_x)
(scm_string_titlecase, scm_string_capitalize, scm_string_reverse)
(scm_string_reverse_x, scm_string_map, scm_string_map_x)
(scm_string_fold, scm_string_fold_right, scm_string_unfold)
(scm_string_unfold_right, scm_xsubstring, scm_string_xcopy_x)
(scm_string_replace, scm_string_tokenize, scm_string_split)
(scm_string_filter, scm_string_delete): modified for both wide and
narrow strings
Michael Gran [Thu, 20 Aug 2009 06:21:18 +0000 (23:21 -0700)]
Some srfi-13 test with wide strings
* test-suite/tests/srfi-13.test: more tests
Michael Gran [Thu, 20 Aug 2009 04:21:29 +0000 (21:21 -0700)]
Updates to benchmarks for srfi-13
Test more of the positive paths. Add test for string-prefix-ci?
string-suffix-ci? and string-hash-ci. Update the counts per test
to give approximately the same bench/interp time for each test for
1.8.7.
* benchmark-suite/benchmarks/srfi-13.bm: update benchmarks
Michael Gran [Thu, 20 Aug 2009 04:47:19 +0000 (21:47 -0700)]
Avoid possible mutex hang on error message output
Avoid possible mutex hang when scm_lfwrite_substr is used in error
message output and when an error has caused the stringbuf write
mutex to not be unlocked. scm_lfwrite_substr makes a substring:
making a substring requires that mutex.
Hopefully, all cases of non-local jumps when the stringbuf write
lock is held have been eliminated anyway, making this O.B.E.
* libguile/ports.c (scm_lfwrite_str): include functionality in this
function instead of making this a special case of scm_lfwrite_substr
Michael Gran [Thu, 20 Aug 2009 05:12:33 +0000 (22:12 -0700)]
Add VM exception in strings.test
* test-suite/tests/strings.test (exception:wrong-type-arg): change regex
Michael Gran [Thu, 20 Aug 2009 04:26:11 +0000 (21:26 -0700)]
Try to optimize scm_string for speed
* libguile/strings.c (scm_string): optimize for speed
Michael Gran [Thu, 20 Aug 2009 04:24:23 +0000 (21:24 -0700)]
Rename string-width to string-bytes-per-char
* libguile/strings.h: rename scm_string_width to scm_string_bytes_per_char
* libguile/strings.c (scm_string_width): renamed to scm_string_bytes_per_char
(scm_string_bytes_per_char): renamed from scm_string_width
* module/language/assembly/compile-bytecode.scm (write-bytecode): string-width
-> string-bytes-per-char
* module/language/glil/compile-assembly.scm (dump-object): string-width
-> string-bytes-per-char
Michael Gran [Thu, 20 Aug 2009 04:25:23 +0000 (21:25 -0700)]
Misleading error message text in scm_i_string_writable_wide_chars
* libguile/strings.c (scm_i_string_writable_wide_chars): change error text
Andy Wingo [Wed, 19 Aug 2009 10:20:58 +0000 (12:20 +0200)]
procedure-documentation works on vm procedures
* libguile/procs.c (scm_procedure_documentation): Add a hack so that
this function works for compiled procedures too.
Michael Gran [Wed, 19 Aug 2009 05:32:08 +0000 (22:32 -0700)]
Display wide strings using escapes
* libguile/print.c (iprin1): for now, display wide strings
as escaped strings
Michael Gran [Wed, 19 Aug 2009 04:14:56 +0000 (21:14 -0700)]
Avoid double-casts of stringbuf
Conversion from char to scm_t_wchar require an intermediate cast to
unsigned char. By changing the return type of SCM_STRINGBUF_INLINE_CHARS
to unsigned char *, doublecasts in the code can be avoided. Also,
some clarification of return types.
* libguile/strings.c (STRINGBUF_OUTLINE_CHARS)
(STRINGBUF_INLINE_CHARS): now returns unsigned char *; all callers changed.
Michael Gran [Wed, 19 Aug 2009 04:13:38 +0000 (21:13 -0700)]
Avoid compilation warnings in SCM_MAKE_CHAR
* libguile/chars.h (SCM_MAKE_CHAR): change inequality
Michael Gran [Wed, 19 Aug 2009 02:42:38 +0000 (19:42 -0700)]
Benchmarks for common character and string procedures
* benchmark-suite/benchmarks/chars.bm: new benchmarks
* benchmark-suite/benchmarks/srfi-13.bm: new benchmarks
Andy Wingo [Tue, 18 Aug 2009 15:52:46 +0000 (17:52 +0200)]
remove (ice-9 lineio)'s dependency on (ice-9 readline)
* module/ice-9/lineio.scm: Use (ice-9 rdelim) instead of (ice-9
readline) to remove readline dependency.
Andy Wingo [Tue, 18 Aug 2009 09:05:17 +0000 (11:05 +0200)]
`load' autocompiles
* libguile/load.h:
* libguile/load.c (scm_sys_warn_autocompilation_enabled): New primitive,
not exported. Since `load' autocompiles now, it should warn in the
same way that the bits hardcoded into C warn.
(scm_try_autocompile): Use scm_sys_warn_autocompilation_enabled.
* module/ice-9/boot-9.scm (autocompiled-file-name): New helper.
(load): Try autocompiling the argument, if appropriate. Will
autocompile files passed on Guile's command line. `primitive-load' is
unaffected.
Ludovic Courtès [Mon, 17 Aug 2009 21:06:49 +0000 (23:06 +0200)]
Thanks, Mike.
Ludovic Courtès [Mon, 17 Aug 2009 21:05:50 +0000 (23:05 +0200)]
Ludovic Courtès [Sat, 15 Aug 2009 12:41:46 +0000 (14:41 +0200)]
Bump version number for 1.9.2.
* GUILE-VERSION (GUILE_MICRO_VERSION): Increment.
Ludovic Courtès [Sat, 15 Aug 2009 12:35:29 +0000 (14:35 +0200)]
Turn off auto-compilation to stand-alone tests.
* test-suite/standalone/Makefile.am (TESTS_ENVIRONMENT): Add
"GUILE_AUTO_COMPILE=0".
Ludovic Courtès [Sat, 15 Aug 2009 12:26:17 +0000 (14:26 +0200)]
Update the manual and `NEWS' regarding `guile-2.0.pc'.
* NEWS: Mention `guile-2.0.pc'.
* doc/ref/autoconf.texi (Autoconf Macros): Update to `guile-2.0'.
Ludovic Courtès [Sat, 15 Aug 2009 10:53:59 +0000 (12:53 +0200)]
Add proper `--help' and `--version' for `guile-tools compile'.
* configure.ac: Produce `meta/guile-tools'.
* meta/Makefile.am (EXTRA_DIST): Add `guile-tools.in'.
(bin_SCRIPTS): Remove `guile-tools'.
* meta/uninstalled-env.in (PATH): Add "${top_builddir}/meta".
* module/scripts/compile.scm (%options): Add `--version'.
(parse-args): Show the offending option name upon error.
(show-version): New.
(compile): Use `%guile-bug-report-address'.
Andy Wingo [Sat, 15 Aug 2009 10:49:44 +0000 (12:49 +0200)]
update NEWS for 1.9.2
* NEWS: Update.
Ludovic Courtès [Sat, 15 Aug 2009 10:06:28 +0000 (12:06 +0200)]
Update `.gitignore' for GNU Global.
Ludovic Courtès [Sat, 15 Aug 2009 10:05:36 +0000 (12:05 +0200)]
Switch from `guile-1.8.pc' to `guile-2.0.pc'.
* configure.ac: Produce guile-2.0*.pc.
* meta/Makefile.am (EXTRA_DIST): Rename guile-1.8*.pc.in to
guile-2.0*.pc.in.
(pkgconfig_DATA): Update accordingly.
* meta/guile-config (guile-module): Likewise.
Ludovic Courtès [Thu, 13 Aug 2009 21:59:51 +0000 (23:59 +0200)]
Uncomment run-time objcode alignment check.
This should now work thanks to the changes in
28b119ee3da0f4b14cb87e638794d22843778cda ("make sure all programs are
8-byte aligned"). This commit is a follow-up to
ec99fe8ecb412e49e8e981246eb62ca46b32754b ("Add FIXMEs about misaligned
objcode-metas.").
* libguile/objcodes.c (scm_c_make_objcode_slice): Uncomment assertion
that checks for proper alignment of PTR.
* module/language/assembly/compile-bytecode.scm (write-bytecode): Update
comment about META's alignment.
Ludovic Courtès [Thu, 13 Aug 2009 21:36:46 +0000 (23:36 +0200)]
Remove deprecated semi-public memoizers.
* libguile/eval.c (scm_m_expand_body, scm_macroexp, scm_unmemocar):
Remove.
(scm_m_undefine): Make `static'.
* libguile/eval.h (scm_m_undefine, scm_m_expand_body, scm_unmemocar,
scm_macroexp): Remove declarations.
Ludovic Courtès [Thu, 13 Aug 2009 21:08:35 +0000 (23:08 +0200)]
Make the evaluator's memoizers private.
* libguile/eval.c (macroexp): Move upwards.
(scm_m_quote, scm_m_begin, scm_m_if, scm_m_set_x, scm_m_and, scm_m_or,
scm_m_case, scm_m_cond, scm_m_lambda, scm_m_letstar, scm_m_do,
scm_m_quasiquote, scm_m_delay, scm_m_generalized_set_x,
scm_m_define, scm_m_letrec, scm_m_let, scm_m_at, scm_m_atat,
scm_m_apply, scm_m_cont, scm_m_nil_cond, scm_m_atfop,
scm_m_atbind, scm_m_atslot_ref, scm_m_atslot_set_x,
scm_m_at_call_with_values, scm_m_eval_when): New static
declarations; definitions made static.
(s_atslot_ref, s_atslot_set_x): New, from `goops.c'.
* libguile/eval.h (scm_m_quote, scm_m_begin, scm_m_if, scm_m_set_x,
scm_m_vref, scm_m_vset, scm_m_and, scm_m_or, scm_m_case, scm_m_cond,
scm_m_lambda, scm_m_letstar, scm_m_do, scm_m_quasiquote, scm_m_delay,
scm_m_generalized_set_x, scm_m_future, scm_m_define, scm_m_letrec,
scm_m_let, scm_m_at, scm_m_atat, scm_m_apply, scm_m_cont,
scm_m_nil_cond, scm_m_atfop, scm_m_atbind, scm_m_atslot_ref,
scm_m_atslot_set_x, scm_m_atdispatch, scm_m_at_call_with_values,
scm_m_eval_when): Remove public declarations.
* libguile/goops.c (s_atslot_ref, s_atslot_set_x): Remove.
Ludovic Courtès [Thu, 13 Aug 2009 14:16:08 +0000 (16:16 +0200)]
compiler.test: Enforce evaluation order.
* test-suite/tests/compiler.test ("psyntax")["redefinition", "compile in
current module", "compile in fresh module"]: Use `begin' to enforce
evaluation order. Thanks Andy!
Ludovic Courtès [Wed, 12 Aug 2009 17:22:19 +0000 (19:22 +0200)]
Allow fresh modules to be passed to `compile'.
* module/ice-9/boot-9.scm (module-name): When making MOD non-anonymous,
bind it in the `(%app modules)' name space.
* test-suite/tests/compiler.test ("psyntax")["compile in current
module", "compile in fresh module"]: New tests.
* test-suite/tests/modules.test ("foundations")["modules don't remain
anonymous"]: New test.
Ludovic Courtès [Thu, 13 Aug 2009 13:39:12 +0000 (15:39 +0200)]
Allow redefinitions in compiled code as in `(define round round)'.
* module/ice-9/psyntax-pp.scm: Regenerate.
* module/ice-9/psyntax.scm (chi-top)[define-form]: If a same-named
imported variable exists, take its value instead of `#f'.
* test-suite/tests/compiler.test ("psyntax")["redefinition"]: New tests.
Andy Wingo [Wed, 12 Aug 2009 21:38:05 +0000 (23:38 +0200)]
update docs for recent vm/compiler work
* doc/ref/compiler.texi:
* doc/ref/vm.texi: Update for recent changes.
* module/language/assembly/disassemble.scm (disassemble-load-program):
Don't print nops, they are distracting.
Andy Wingo [Wed, 12 Aug 2009 18:44:30 +0000 (20:44 +0200)]
"fix" <let>-bound lambda expressions too
* module/language/tree-il/compile-glil.scm (compile-glil): Compute
warnings before optimizing, as unreferenced variables will be
optimized out.
* libguile/_scm.h: Fix C99 comment.
* module/language/tree-il/fix-letrec.scm (partition-vars): Also analyze
let-bound vars.
(fix-letrec!): Fix a bug whereby a set! to an unreffed var would be
called for value, not effect. Also "fix" <let>-bound lambda
expressions -- really speeds up pmatch.
* test-suite/tests/tree-il.test ("lexical sets", "the or hack"): Update
to take into account the new optimizations.
Michael Gran [Wed, 12 Aug 2009 15:30:59 +0000 (08:30 -0700)]
Don't include libunistring headers in Guile public headers
This requres the creation of a new type
scm_t_string_failed_conversion_handler to replace libunistring's
enum iconveh_ilseq_handler.
* libguile/strings.h: don't include <uniconv.h>
(scm_t_string_failed_conversion_handler): new enum type
(SCM_FAILED_CONVERSION_ERROR, SCM_FAILED_CONVERSION_QUESTION_MARK):
(SCM_FAILED_CONVERSION_ESCAPE_SEQUENCE): new enum type values
* libguile/strings.c (scm_to_stringn): now takes type
scm_t_string_failed_conversion_handler. All callers changed.
* libguile/print.c: include <uniconv.h>
* libguile/ports.c (scm_lfwrite_substr): use
scm_t_string_conversion_handler's constants
* libguile/gen-scmconfig.c (SCM_ICONVEH_ERROR):
(SCM_ICONVEH_QUESTION_MARK, SCM_ICONVEH_ESCAPE_SEQUENCE): store
iconveh_ilseq_hander constants as #define's
Michael Gran [Wed, 12 Aug 2009 16:21:37 +0000 (09:21 -0700)]
Regression, scm_string fails to test for circular lists
* libguile/string.c (scm_string): Restores the functionality
where scm_string tests for circular lists
* test-suite/tests/strings.test: add test for circular lists
Michael Gran [Wed, 12 Aug 2009 15:50:12 +0000 (08:50 -0700)]
Some signed/unsigned comparison and conversions
* libguile/ports.c (scm_lfwrite_str, scm_lfwrite_substr): signed/unsigned
conversion and comparison
* libguile/strings.c (scm_string_append): signed/unsigned comparison
Andy Wingo [Wed, 12 Aug 2009 14:33:49 +0000 (16:33 +0200)]
rework the vm support for wide strings
* libguile/_scm.h (SCM_OBJCODE_MINOR_VERSION): Bump.
* libguile/vm-engine.c (vm_error_bad_wide_string_length): New error
case.
* libguile/vm-i-loader.c (load-unsigned-integer, load-integer)
(load-keyword): Remove these instructions. The former two are
obsoleted by make-int64/make-uint64, the latter via make-keyword.
(load-string): Only handle narrow strings.
(load-symbol): Only handle narrow symbols. The wide case is handled
via make-symbol.
(load-wide-string): New instruction, for wide strings.
* libguile/vm-i-system.c (define): Move here from loaders.c, as now it
just takes a sym on the stack.
(make-keyword, make-symbol): New instructions.
* module/language/assembly.scm: Remove removed instructions. No more
width byte in load-string etc.
* module/language/assembly/compile-bytecode.scm (write-bytecode): Adapt
to change in instruction set.
* module/language/glil/compile-assembly.scm (glil->assembly): Compile
define by pushing the sym then emitting (define).
(dump-object): Dump narrow and wide strings differently. Use
make-keyword and make-symbol as appropriate.
* module/language/tree-il/compile-glil.scm (flatten): When compiling a
ref to a primitive (not a call), first see if the primitive is
actually bound in the root module. (That's not the case with e.g.
bytevector-u8-ref).
* module/system/xref.scm (program-callee-rev-vars): Don't parse out
"nexts".
* test-suite/tests/asm-to-bytecode.test ("compiler"): Adapt to bytecode
format change.
Michael Gran [Wed, 12 Aug 2009 07:26:12 +0000 (00:26 -0700)]
Fix disassembly of strings and symbols
* module/language/assembly/decompile-bytecode.scm (decode-bytecode):
fix disassembly of strings, symbols, keywords, and defines
Michael Gran [Wed, 12 Aug 2009 05:52:49 +0000 (22:52 -0700)]
Quiet signed/unsigned comparison warnings in chars.[ch]
* libguile/chars.h (SCM_MAKE_CHAR): quiet signed/unsigned
comparison warnings
* libguile/chars.c (scm_i_charname):
(scm_i_charname_to_char): quiet signed/unsigned comparison
warnings
Michael Gran [Wed, 12 Aug 2009 05:01:20 +0000 (22:01 -0700)]
Avoid unitialized and unused warnings in scm_string_append
* libguile/strings.c (scm_string_append): avoid warnings
Michael Gran [Wed, 12 Aug 2009 04:27:20 +0000 (21:27 -0700)]
Revert to locale-dependent toupper and tolower
To avoid leaving Guile in a broken state, the conversion
from locale-dependent case modification to Unicode case modification
should be an atomic commit
* libguile/chars.c (scm_c_upcase): revert to locale-dependent
toupper and tolower
Michael Gran [Wed, 12 Aug 2009 04:12:52 +0000 (21:12 -0700)]
Only pass ints to tolower and toupper
* libguile/strings.c (unistring_escapes_to_guile_escapes): cast
tolower's parameter to int
* libguile/read.c (CHAR_DOWNCASE): cast tolower's parameter to int
Andy Wingo [Tue, 11 Aug 2009 22:14:44 +0000 (00:14 +0200)]
debitrot the ecmascript compiler
* module/Makefile.am (ECMASCRIPT_LANG_SOURCES):
* module/language/ecmascript/compile-ghil.scm:
* module/language/ecmascript/compile-tree-il.scm: SOURCES): Replace the
GHIL compiler with a ->tree-il compiler. Not fully functional, but the
basics work.
* module/language/ecmascript/spec.scm: Only include the tree-il compiler.
* module/language/ecmascript/tokenize.scm (read-punctuation): Avoid
mutating a constant.
Andy Wingo [Tue, 11 Aug 2009 19:16:05 +0000 (21:16 +0200)]
make the fallback path look less like line noise
* libguile/_scm.h:
* libguile/load.c: Rework to only include the relevant pieces in the
fallback path.
Andy Wingo [Tue, 11 Aug 2009 18:25:19 +0000 (20:25 +0200)]
include objcode cookie in the fallback path
* libguile/_scm.h (SCM_OBJCODE_COOKIE): Move the objcode cookie define
here, so that load.c can use it. This is a private header.
* libguile/load.c (FALLBACK_DIR): Include the objcode cookie in the
fallback path. Should fix problems when objcode changes incompatibly
during the 1.9 series.
* libguile/objcodes.c: Adapt to SCM_OBJCODE_COOKIE move.
This should fix http://article.gmane.org/gmane.lisp.guile.devel/9059.
Michael Gran [Tue, 11 Aug 2009 05:55:29 +0000 (22:55 -0700)]
More string and symbol tests
* test-suite/tests/strings.test: more tests
* test-suite/tests/symbols.test: more tests
Michael Gran [Tue, 11 Aug 2009 05:18:47 +0000 (22:18 -0700)]
Fix %string-dump and %symbol-dump fields
* libguile/strings.c (scm_sys_string_dump): don't print
stringbuf. Print read-only status.
(scm_sys_symbol_dump): don't print stringbuf. Print interned
status.
Ludovic Courtès [Mon, 10 Aug 2009 17:24:34 +0000 (19:24 +0200)]
Change `defined?' to accept a module as its second argument.
Reported by Daniel Kraft <d@domob.eu>.
* doc/ref/api-binding.texi (Binding Reflection): Update documentation of
`defined?'.
* libguile/evalext.c (scm_defined_p): Expect a module as the second
argument, not a lexical environment.
Michael Gran [Mon, 10 Aug 2009 12:51:05 +0000 (05:51 -0700)]
Make scm_charprint and scm_i_string_wide_chars SCM_INTERNAL.
Also, scm_charprint is renamed to scm_i_charprint.
* libguile/strings.h: make scm_i_string_wide_chars internal.
* libguile/print.h: rename scm_charprint to scm_i_charprint. Make
internal.
* libguile/print.c (scm_i_charprint): renamed from scm_charprint
(scm_charprint): renamed to scm_i_charprint. All callers changed.
Michael Gran [Mon, 10 Aug 2009 07:09:33 +0000 (00:09 -0700)]
Improve %string-dump and %symbol-dump
%string-dump and %symbol-dump are modified to return assocation lists
of string and symbol attributes instead of printing to stderr. They
are no longer conditional on SCM_DEBUG.
* libguile/strings.c (scm_sys_string_dump)
(scm_sys_symbol_dump): now returns alist of properties. No longer
require that SCM_DEBUG be defined.
(scm_sys_stringbuf_hist): now conditional on
SCM_STRING_LENGTH_HISTOGRAM
* libguile/strings.h: scm_sys_string_dump and scm_sys_symbol dump
are now declared as API
Michael Gran [Mon, 10 Aug 2009 01:06:59 +0000 (18:06 -0700)]
More comments for string functions
* libguile/strings.c: comments
Michael Gran [Sun, 9 Aug 2009 23:01:20 +0000 (16:01 -0700)]
Missing parentheses in SCM_MAKE_CHAR macro
* libguile/chars.h (SCM_MAKE_CHAR): missing parentheses
Michael Gran [Sun, 9 Aug 2009 22:58:49 +0000 (15:58 -0700)]
Port position macros shouldn't require enclosing braces
The port position macros incorrectly required enclosing braces
when used within if statements.
* libguile/ports.h (SCM_INCLINE, SCM_ZEROCOL, SCM_INCCOL)
(SCM_DECCOL, SCM_TABCOL): enclose macro in do/while
* libguile/ports.c (update_port_lf): remove extra braces
Ludovic Courtès [Sun, 9 Aug 2009 21:40:11 +0000 (23:40 +0200)]
Use a linker version script for libguile.
* libguile/Makefile.am (libguile_la_LDFLAGS)[HAVE_LD_VERSION_SCRIPT]:
Use `libguile.map'.
(EXTRA_DIST): Add `libguile.map'.
* libguile/libguile.map: New file.
Ludovic Courtès [Sun, 9 Aug 2009 21:05:37 +0000 (23:05 +0200)]
Use Gnulib's `lib-symbol-versions' module.
* m4/gnulib-cache.m4: Add `lib-symbol-versions'.
Ludovic Courtès [Sun, 9 Aug 2009 18:21:41 +0000 (20:21 +0200)]
Remove bogus `configure' test for GNU libunistring.
* configure.ac: Remove explicit test for libunistring, which conflicted
with Gnulib's own test. This fixes commit
f4863880f5ef539cb545999c19b6b5c0eec9382d.
Michael Gran [Sat, 8 Aug 2009 09:35:08 +0000 (02:35 -0700)]
Merge commit 'origin/master'
Michael Gran [Sat, 8 Aug 2009 09:35:00 +0000 (02:35 -0700)]
Add Unicode strings and symbols
This adds full Unicode strings as a datatype, and it adds some
minimal functionality. The terminal and port encoding is assumed
to be ISO-8859-1. Non-ISO-8859-1 characters are written or
input as string character escapes.
The string character escapes now have 3 forms: \xXX \uXXXX and
\UXXXXXX, for unprintable characters that have 2, 4 or 6 hex digits.
The process for writing to strings has been modified. There is now a
function scm_i_string_start_writing that does the copy-on-write
conversion if necessary.
To compile strings that may be wide, the VM storage of strings and
string-likes has changed.
Most string-using functions have not yet been updated and may break
when used with wide strings.
* module/language/assembly/compile-bytecode.scm (write-bytecode):
use variable width string bytecode format
* module/language/assembly.scm (byte-length): use variable width
bytecode format
* libguile/vm-i-loader.c (load-string, load-symbol):
(load-keyword, define): use variable-width bytecode format
* libguile/vm-engine.h (FETCH_WIDTH): new macro
* libguile/strings.h: new declarations
* libguile/strings.c (make_wide_stringbuf): new function
(widen_stringbuf): new function
(scm_i_make_wide_string): new function
(scm_i_is_narrow_string): new function
(scm_i_string_wide_chars): new function
(scm_i_string_start_writing): new function
(scm_i_string_ref): new function
(scm_i_string_set_x): new function
(scm_i_is_narrow_symbol): new function
(scm_i_symbol_wide_chars, scm_i_symbol_ref): new function
(scm_string_width): new function
(unistring_escapes_to_guile_escapes): new function
(scm_to_stringn): new function
(scm_i_stringbuf_free): modify for wide strings
(scm_i_substring_copy): modify for wide strings
(scm_i_string_chars, scm_string_append): modify for wide strings
(scm_i_make_symbol, scm_to_locale_stringn): modify for wide strings
(scm_string_dump, scm_symbol_dump, scm_to_locale_stringbuf):
(scm_string, scm_i_deprecated_string_chars): modify for wide strings
(scm_from_locale_string, scm_from_locale_stringn): add null test
* libguile/srfi-13.c: add calls for scm_i_string_start_writing for
each call of scm_i_string_stop_writing
(scm_string_for_each): modify for wide strings
* libguile/socket.c: add calls for scm_i_string_start_writing for each
call of scm_i_string_stop_writing
* libguile/rw.c: add calls for scm_i_string_start_writing for each
call of scm_i_string_stop_writing
* libguile/read.c (scm_read_string): allow reading of wide strings
* libguile/print.h: add declaration for scm_charprint
* libguile/print.c (iprin1): print wide strings and add new string
escapes
(scm_charprint): new function
* libguile/ports.h: new declarations for scm_lfwrite_substr and
scm_lfwrite_str
* libguile/ports.c (update_port_lf): new function
(scm_lfwrite): use update_port_lf
(scm_lfwrite_substr): new function
(scm_lfwrite_str): new function
* test-suite/tests/asm-to-bytecode.test ("compiler"): add string
width byte to sting-like asm tests
Andy Wingo [Fri, 7 Aug 2009 17:06:15 +0000 (19:06 +0200)]
lambda, the ultimate goto
* module/language/tree-il/analyze.scm (analyze-lexicals): Rework to
actually determine when a fixed-point procedure may be allocated as a
label.
* module/language/tree-il/compile-glil.scm (emit-bindings): Always emit
a <glil-bind>. Otherwise it's too hard to pair with unbindings.
(flatten-lambda): Consequently, here we only `bind' if there are any
vars to bind. This doesn't make any difference, given that lambdas
don't have trailing unbind instructions, but it does keep the GLIL
output the same for thunks -- no extraneous (bind) instructions. Keeps
tree-il.test happy.
(flatten): Some bugfixes. Yaaay, it works!!!
Andy Wingo [Fri, 7 Aug 2009 15:44:02 +0000 (17:44 +0200)]
implement compilation of label-allocated lambda expressions
* module/language/tree-il/compile-glil.scm (flatten-lambda, flatten):
Implement compilation of label-allocated lambda expressions. Quite
tricky, we'll see if this works when the new analyzer lands.
Andy Wingo [Fri, 7 Aug 2009 13:35:53 +0000 (15:35 +0200)]
add label alist to lambda allocations in tree-il->glil compiler
* module/language/tree-il/analyze.scm: Add some more comments about
something that will land in a future commit: compiling fixpoint
lambdas as labels.
(analyze-lexicals): Reorder a bit, and add a label alist to procedure
allocations. Empty for now.
* module/language/tree-il/compile-glil.scm (flatten): Adapt to the free
variables being in the cddr of the allocation, not the cdr.
Andy Wingo [Thu, 6 Aug 2009 15:46:38 +0000 (17:46 +0200)]
loop detection in the house
* libguile/vm-i-scheme.c (vector-ref, vector-set): Sync registers if we
call out to C.
* module/language/tree-il/compile-glil.scm (flatten-lambda): Add an
extra argument, the self-label, which should be the gensym under which
the procedure is bound in a <fix> expression.
(flatten): If we see a call to a lexical ref to the self-label in a
tail position, rename and goto instead of goto/args, which will tear
down the frame -- or will, in the future. It's a primitive form of
loop detection.
* module/language/tree-il/primitives.scm (zero?): Expand to (= x 0).
Andy Wingo [Thu, 6 Aug 2009 14:01:24 +0000 (16:01 +0200)]
actually implement "fixing letrec"
* module/Makefile.am (SOURCES): Reorganize so GHIL is compiled last,
along with ecmascript.
* module/language/scheme/spec.scm: Remove references to GHIL, as it's
bitrotten and obsolete..
* module/language/tree-il.scm (make-tree-il-folder): Rework so that we
only have down and up procs, and call down and up on each element.
* module/language/tree-il/analyze.scm (analyze-lexicals): Fix a thinko
handling let-values.
* module/language/tree-il/fix-letrec.scm: Actually implement fixing
letrec. The resulting code will perform better, but violations of the
letrec restriction are not detected. This behavior is allowed by the
spec, but it is undesirable. Perhaps that will be fixed later.
* module/language/tree-il/inline.scm (inline!): Fix a case in which
((lambda args foo)) would be erroneously inlined to foo. Remove empty
let, letrec, and fix statements.
* module/language/tree-il/primitives.scm (effect-free-primitive?): New
public predicate.
Andy Wingo [Thu, 6 Aug 2009 09:48:16 +0000 (11:48 +0200)]
actually inline call-with-values to tree-il's <let-values>
* module/srfi/srfi-11.scm (let-values): In the one-clause case, avoid
going through temporary variables.
* module/language/tree-il/inline.scm (inline!): Add another case:
(call-with-values (lambda () ...) (lambda ... ...) -> let-values.
* module/language/tree-il/compile-glil.scm (flatten): Fix a bug
compiling applications in "vals" context.
* module/language/tree-il/analyze.scm (analyze-lexicals): Fix a couple
bugs with let-values and rest arguments.
Andy Wingo [Wed, 5 Aug 2009 19:25:35 +0000 (21:25 +0200)]
let-values in terms of syntax-case, add make-tree-il-folder
* module/language/tree-il.scm (tree-il-fold): Fix for let-values case.
(make-tree-il-folder): New public macro, makes a multi-valued folder
specific to the number of seeds that the user wants.
* module/language/tree-il/optimize.scm (optimize!): Reverse the order of
inline! and fix-letrec!, as the latter might expose opportunities for
the former.
* module/srfi/srfi-11.scm (let-values): Reimplement in terms of
syntax-case, so that its expressions may reference hygienically bound
variables. See the NEWS for the rationale.
(let*-values): An empty let*-values still introduces a local `let'
binding contour.
* module/system/base/syntax.scm (record-case): Yukkkk. Reimplement in
terms of syntax-case. Ug-ly, but see the NEWS again: "Lexical bindings
introduced by hygienic macros may not be referenced by nonhygienic
macros."
Andy Wingo [Wed, 5 Aug 2009 15:51:40 +0000 (17:51 +0200)]
add <fix> tree-il construct, and compile it
* libguile/vm-i-system.c (fix-closure): New instruction, for wiring
together fixpoint procedures.
* module/Makefile.am (TREE_IL_LANG_SOURCES): Add fix-letrec.scm.
* module/language/glil/compile-assembly.scm (glil->assembly): Reindent
the <glil-lexical> case, and handle 'fix for locally-bound vars.
* module/language/tree-il.scm (<fix>): Add the <fix> tree-il type and
accessors, for fixed-point bindings. This IL construct is taken from
the Waddell paper.
(parse-tree-il, unparse-tree-il, tree-il->scheme, tree-il-fold)
(pre-order!, post-order!): Update for <fix>.
* module/language/tree-il/analyze.scm (analyze-lexicals): Update for
<fix>. The difference here is that the bindings may not be assigned,
and are not marked as such. They are not boxed.
(report-unused-variables): Update for <fix>.
* module/language/tree-il/compile-glil.scm (flatten): Compile <fix> to
GLIL.
* module/language/tree-il/fix-letrec.scm: A stub implementation of
fixing letrec -- will flesh out in a separate commit.
* module/language/tree-il/inline.scm: Fix license, it was mistakenly
added with LGPL v2.1+.
* module/language/tree-il/optimize.scm (optimize!): Run the fix-letrec!
pass.
Andy Wingo [Wed, 5 Aug 2009 14:17:20 +0000 (16:17 +0200)]
add a brain-dead inliner
* module/Makefile.am (TREE_IL_LANG_SOURCES):
* module/language/tree-il/inline.scm: Add a brain-dead inliner, to
inline ((lambda () x)) => x.
* module/language/tree-il/optimize.scm (optimize!): Invoke the inliner.
Andy Wingo [Wed, 5 Aug 2009 09:55:42 +0000 (11:55 +0200)]
add1 and sub1 instructions
* libguile/vm-i-scheme.c: Add add1 and sub1 instructions.
* module/language/tree-il/compile-glil.scm: Compile 1+ and 1- to add1
and sub1.
* module/language/tree-il/primitives.scm (define-primitive-expander):
Add support for `if' statements in the consequent.
(+, -): Compile (- x 1), (+ x 1), and (+ 1 x) to 1- or 1+ as
appropriate.
(1-): Remove this one. Seems we forgot 1+ before, but we weren't
compiling it nicely anyway.
* test-suite/tests/tree-il.test ("void"): Fix expected compilation of (+
(void) 1) to allow for add1.
Andy Wingo [Tue, 4 Aug 2009 19:16:32 +0000 (21:16 +0200)]
perform gmp/unistring compile checks with AC_LIB_HAVE_LINKFLAGS
* configure.ac: Rework gmp and unistring checks to use
AC_LIB_HAVE_LINKFLAGS, so that the compilation checks run with the
right -L/-l flags.
* libguile/Makefile.am (libguile_la_LIBADD): Adapt to need to add
$(LIBGMP) and $(LIBUNISTRING) here.
Hopefully this solves
http://article.gmane.org/gmane.lisp.guile.bugs/4288.
Andy Wingo [Tue, 4 Aug 2009 18:46:20 +0000 (20:46 +0200)]
rename configure.in to configure.ac
* configure.ac:
* guile-readline/configure.ac: Rename from configure.in, as recommended
by the autoconf manual.
Andy Wingo [Tue, 4 Aug 2009 18:29:09 +0000 (20:29 +0200)]
fix buffer overrun reading partial numbers: 1.0f, 1.0/, and 1.0+
* libguile/numbers.c (mem2decimal_from_point, mem2ureal, mem2complex):
Fix a number of cases where, for invalid numbers, we could read past
the end of the buffer. This happened in e.g. "1.0+", "1/" and "1.0f".
But I couldn't figure out how to test for these, given that the
behavior depended on the contents of uninitialized memory in the
reader buffer. We'll just have to be happy with this.
Thanks to Kjetil S. Matheussen for the report.
Michael Gran [Sat, 1 Aug 2009 18:21:46 +0000 (11:21 -0700)]
Don't doubly define scm_t_wchar
* libguile/chars.h: don't define scm_t_wchar
* libguile/numbers.h: define scm_t_wchar here
Michael Gran [Sat, 1 Aug 2009 18:04:43 +0000 (11:04 -0700)]
Fix coding style compliance for recent 32-bit char changes
* libguile/print.c (iprin1): extra braces
* libguile/chars.h (SCM_IS_UNICODE_CHAR): coding style
Michael Gran [Sat, 1 Aug 2009 17:15:20 +0000 (10:15 -0700)]
Don't use GNU extensions for SCM_MAKE_CHAR macro
Since the contents of SCM_MAKE_CHAR are evaluated more than once,
don't use it in situations where this could cause side-effects.
* libguile/vm-i-system.c (make-char8): avoid side-effects with
SCM_MAKE_CHAR call
* libguile/chars.h (SCM_MAKE_CHAR): modified
Michael Gran [Sat, 1 Aug 2009 15:12:15 +0000 (08:12 -0700)]
Make charname declarations module-level and GCS
Charname array declarations are corrected for style and
are made module-level. Array list length variables are
replaced with macros.
* libguile/chars.c: variable declaration fixes
Michael Gran [Sat, 1 Aug 2009 15:05:55 +0000 (08:05 -0700)]
Update NEWS for charname changes
* NEWS: updated
Ludovic Courtès [Thu, 30 Jul 2009 22:42:58 +0000 (00:42 +0200)]
Add unused variable analysis in the tree-il->glil compiler.
* module/language/tree-il/analyze.scm (<binding-info>): New record type.
(report-unused-variables): New procedure.
* module/language/tree-il/compile-glil.scm (%warning-passes): New
variable.
(compile-glil): Honor `#:warnings' from OPTS.
* test-suite/tests/tree-il.test (call-with-warnings): New procedure.
(%opts-w-unused): New variable.
("warnings"): New test prefix.
Ludovic Courtès [Thu, 30 Jul 2009 22:06:59 +0000 (00:06 +0200)]
Add `(system base message)', a simple warning framework.
* module/Makefile.am (SOURCES): Add `system/base/message.scm'.
* module/scripts/compile.scm (%options): Add `--warn'.
(parse-args): Update default value for `warnings'.
(show-warning-help): New procedure.
(compile)[compile-opts]: Add `#:warnings'.
Update help message.
* module/system/base/compile.scm (compile): Sanity-check the requested
warnings.
* module/system/base/message.scm: New file.
Ludovic Courtès [Wed, 29 Jul 2009 22:48:04 +0000 (00:48 +0200)]
Add `tree-il-fold', a purely functional iterator on `tree-il'.
* module/language/tree-il.scm (tree-il-fold): New procedure.
* test-suite/tests/tree-il.test ("tree-il-fold"): New test prefix.
Michael Gran [Wed, 29 Jul 2009 13:38:32 +0000 (06:38 -0700)]
Add 32-bit characters
This adds the 32-bit standalone characters. Strings are still
8-bit. Characters larger than 8-bit can only be entered or
displayed in octal format at this point. At this point, the
terminal's display encoding is expected to be Latin-1.
* module/language/assembly/compile-bytecode.scm (write-bytecode):
add 32-bit char
* module/language/assembly.scm (object->assembly): add 32-bit char
(assembly->object): add 32-bit char
* libguile/vm-i-system.c (make-char32): new op
* libguile/print.c (iprin1): print 32-bit char
* libguile/numbers.h: add type scm_t_wchar
* libguile/numbers.c: add type scm_t_wchar
* libguile/chars.h: new type scm_t_wchar
(SCM_CODEPOINT_MAX): new
(SCM_IS_UNICODE_CHAR): new
(SCM_MAKE_CHAR): operate on 32-bit char
* libguile/chars.c: comparison operators now use Unicode
codepoints
(scm_c_upcase): now receives and returns scm_t_wchar
(scm_c_downcase): now receives and returns scm_t_wchar
Michael Gran [Tue, 28 Jul 2009 04:02:23 +0000 (21:02 -0700)]
Replace global charnames variables with accessors
The global variables scm_charnames and scm_charnums are replaced with
the accessor functions scm_i_charname and scm_i_charname_to_num.
Also, the incomplete and broken EBCDIC support is removed.
* libguile/print.c (iprin1): use new func scm_i_charname
* libguile/read.c (scm_read_character): use new func
scm_i_charname_to_num
* libguile/chars.c (scm_i_charname): new function
(scm_i_charname_to_char): new function
(scm_charnames, scm_charnums): removed
* libguile/chars.h: new declarations
Andy Wingo [Sun, 26 Jul 2009 12:01:56 +0000 (14:01 +0200)]
increase range of relative jumps by aligning blocks to 8-byte boundaries
* libguile/objcodes.c (OBJCODE_COOKIE): Bump again, as our jump offsets
are now multiplied by 8.
* libguile/vm-i-system.c (BR): Interpret the 16-bit offset as a relative
jump to the nearest 8-byte-aligned block -- increasing relative jump
range from +/-32K to +/-240K.
(mvra): Do the same for the mvra jump.
* libguile/vm.c (really_make_boot_program): Align the mvra.
* module/language/assembly.scm (align-block): New export, for aligning
blocks.
* module/language/assembly/compile-bytecode.scm (write-bytecode): Emit
jumps to the nearest 8-byte-aligned block. Effectively our range is 18
bits in either direction. I would like to do this differently -- have
long-br and long-br-if, and all the other br instructions go to 8 bits
only. But the assembler doesn't have an appropriate representation to
allow me to do this yet, so for now this is what we have.
* module/language/assembly/decompile-bytecode.scm (decode-load-program):
Decode the 19-bit jumps.
Andy Wingo [Sun, 26 Jul 2009 10:56:11 +0000 (12:56 +0200)]
make sure all programs are 8-byte aligned
* libguile/objcodes.c (OBJCODE_COOKIE): Bump objcode cookie, as we added
to struct scm_objcode.
* libguile/objcodes.h (struct scm_objcode): Add a uint32 after metalen
and before base, so that if the structure has 8-byte alignment, base
will have 8-byte alignment too. (Before, base was 12 bytes from the
start of the structure, now it's 16 bytes.)
* libguile/vm-engine.h (ASSERT_ALIGNED_PROCEDURE): Add a check that can
be turned on with VM_ENABLE_PARANOID_ASSERTIONS.
(CACHE_PROGRAM): Call ASSERT_ALIGNED_PROCEDURE.
* libguile/vm-i-system.c (long-local-ref): Add a missing semicolon.
* libguile/vm.c (really_make_boot_program): Rework to operate directly
on a malloc'd buffer, so that the program will be 8-byte aligned.
* module/language/assembly.scm (*program-header-len*): Add another 4 for
the padding.
(object->assembly): Fix case in which we would return (make-int8 0)
instead of (make-int8:0). This would throw off compile-assembly.scm's
use of addr+.
* module/language/assembly/compile-bytecode.scm (write-bytecode): Write
out the padding int.
* module/language/assembly/decompile-bytecode.scm (decode-load-program):
And pop off the padding int too.
* module/language/glil/compile-assembly.scm (glil->assembly): Don't pack
the assembly, assume that assembly.scm has done it for us. If a
program has a meta, pad out the program so that meta will be aligned.
* test-suite/tests/asm-to-bytecode.test: Adapt to expect programs to
have the extra 4-byte padding int.