bpt/guile.git
15 years agoensure that lists pushed onto the stack are proper
Andy Wingo [Thu, 16 Oct 2008 11:24:39 +0000 (13:24 +0200)]
ensure that lists pushed onto the stack are proper

I saw this problem when running elisp.test -- it tries to apply a
function to an arglist ending in nil, which obviously is not null.

* libguile/vm-engine.h (PUSH_LIST): New helper macro, pushes the elements
  of a list onto the stack. Checks to make sure that the list is proper.

* libguile/vm-i-system.c (list-break, mv-call, apply, goto/apply)
  (goto/cc): Use LIST_BREAK.

* libguile/vm-engine.c (vm_error_improper_list): New error case.

15 years agofix asyncs running in the vm; re-enable popen.scm compilation
Andy Wingo [Thu, 16 Oct 2008 10:55:27 +0000 (12:55 +0200)]
fix asyncs running in the vm; re-enable popen.scm compilation

* libguile/vm-i-system.c (goto/args): Sync the registers before doing the
  SCM_TICK. We probably need a different SCM_TICK that saves the regs
  only if necessary. This fixes GC problems with a compiled popen.scm.

* ice-9/Makefile.am: Re-enable popen.scm compilation.

15 years agofix `(help)'
Andy Wingo [Wed, 15 Oct 2008 20:44:37 +0000 (22:44 +0200)]
fix `(help)'

* ice-9/session.scm (help): Return valid scheme forms in the no-arg and
  no-regex cases.

15 years agofix mv-call disasm bug
Andy Wingo [Wed, 15 Oct 2008 20:42:51 +0000 (22:42 +0200)]
fix mv-call disasm bug

* module/system/vm/disasm.scm (code-annotation): Fix bug with mv-call.

15 years agofix disasm bugs, add some more instruction annotations
Andy Wingo [Wed, 15 Oct 2008 20:30:47 +0000 (22:30 +0200)]
fix disasm bugs, add some more instruction annotations

* module/system/vm/disasm.scm (disassemble-program): Fix misunderstanding
  of nlocs: the *actual* number of locals is nlocs + nargs, even if the
  arg is heap-allocated -- because our calling convention always puts the
  initial val on the stack. Also: don't disassemble the objects, they are
  now woven into the text.
  (code-annotation): Fix external-{ref,set} handling to allow for
  referencing externals from enclosed stack frames. Really this should be
  statically determined, though. Add late-variable-{ref,set} handling.

15 years agomake disassembly better -- a more woven text.
Andy Wingo [Sun, 12 Oct 2008 20:49:24 +0000 (22:49 +0200)]
make disassembly better -- a more woven text.

* module/system/vm/assemble.scm (pop): Define a pop here too.
  (codegen): Rework how bindings are represented in a program's
  meta-info, so they declare their range in the binding list instead of
  you having to figure out when they end.

* module/system/vm/conv.scm (make-byte-decoder): Return the end-address
  as well; requires a change to callers.

* module/system/vm/disasm.scm (disassemble-objcode, disassemble-program)
  (disassemble-bytecode, disassemble-objects, disassemble-externals)
  (disassemble-meta, source->string, make-int16, code-annotation)
  (print-info): Rework to display my domination of `format', and, more
  seriously, start to integrate the "subsections" of the disassembly into
  the main disassembly text.

* module/system/vm/program.scm (program-bindings-as-lambda-list): Update
  for new bindings format; should be more correct.

15 years agosimplify disassembly annotations a bit
Andy Wingo [Sat, 11 Oct 2008 16:55:44 +0000 (18:55 +0200)]
simplify disassembly annotations a bit

* module/system/vm/disasm.scm (original-value): Simplify a bit to
  normally dispatch on the instruction, only trying code->object at the
  end.

15 years agomake each invocation of `while' throw to different keys
Andy Wingo [Sat, 11 Oct 2008 13:03:00 +0000 (15:03 +0200)]
make each invocation of `while' throw to different keys

* ice-9/boot-9.scm (while): Further fixes to while, brought out by the
  test suite. Also updated documentary comments.

15 years agorelax an assertion -- the test suite completes without aborting, whee
Andy Wingo [Sat, 11 Oct 2008 10:01:25 +0000 (12:01 +0200)]
relax an assertion -- the test suite completes without aborting, whee

* libguile/vm-i-system.c (call/cc, goto/cc): Don't assert that ip matches
  vp->ip, because vp->ip is not restored by vm_reset_stack, and indeed
  it's re-set to 0 by `halt'. But still, perhaps reset_stack and halt
  should indeed reset vp->ip.

15 years agotruly thread-local vms; don't compile popen.scm
Andy Wingo [Sat, 11 Oct 2008 09:54:12 +0000 (11:54 +0200)]
truly thread-local vms; don't compile popen.scm

* ice-9/Makefile.am: Don't compile popen.scm, its behaviour at runtime
  is not consistent -- seems to miss some GC references? I suspect a bug
  in the compiler. In any case without popen.scm being compiled,
  continuations.test, r4rs.tes, and r5rs_pitfall.test do pass.

* libguile/threads.h (scm_i_thread):
* libguile/threads.c (thread_mark, guilify_self_2): Add a field for the
  thread's vm. Previously I had this as a fluid, but it seems that newly
  created threads share their fluid values from the creator thread; as
  expected, I guess. In any case one VM should not be active in two
  threads.

* libguile/vm.c (scm_the_vm): Change to access the thread-local vm,
  instead of accessing a fluid.
  (scm_the_vm_fluid): Removed.

* module/system/vm/vm.scm: Removed *the-vm*.

15 years agoNULLSTACK fixes for nonlocal exits in reentrant pre-wind handlers
Andy Wingo [Thu, 9 Oct 2008 12:44:43 +0000 (14:44 +0200)]
NULLSTACK fixes for nonlocal exits in reentrant pre-wind handlers

* libguile/vm-i-system.c (goto/cc): Add some asserts here.

* libguile/vm.c (capture_vm_cont): Add some asserts here too.
  (reinstate_vm_cont): Null the correct number of bytes. Add a FIXME.
  (vm_reset_stack): Make the code a bit clearer. Null the correct number
  of bytes.

* libguile/vm-engine.h (NULLSTACK_FOR_NONLOCAL_EXIT): New macro, handles
  a very tricky case that took me days to find! Amply commented. Expands
  to nothing in the normal case.

* libguile/vm-i-system.c (call, goto/args, mv-call): Call
  NULLSTACK_FOR_NONLOCAL_EXIT in the right places. Fixes
  continuations.test.

15 years agosundries: side effects in interpreted repl, wrong-num-args in vm, self-checks
Andy Wingo [Thu, 9 Oct 2008 10:17:51 +0000 (12:17 +0200)]
sundries: side effects in interpreted repl, wrong-num-args in vm, self-checks

* libguile/vm-engine.c (vm_error_wrong_num_args): Sync the registers
  before calling scm_wrong_num_args. (The other cases are handled more
  uniformly.)

* libguile/vm.c (vm_heapify_frames_1): Add a FIXME: I don't think we
  should be modifying the stack.
  (scm_vm_save_stack): If stack nulling is enabled, verify the stack here
  before reifying it.

* module/language/scheme/spec.scm (scheme): Use primitive-eval here
  instead of eval, because at the repl we do want to allow evaluations to
  have side effects like setting the current module.

15 years agohandle throws to unknown keys in the repl
Andy Wingo [Thu, 9 Oct 2008 09:10:25 +0000 (11:10 +0200)]
handle throws to unknown keys in the repl

* module/system/repl/repl.scm (default-catch-handler): Don't rethrow if
  we don't know the key, just print an error.

15 years agofix dynwind + nonlocal entrance/exit + programs bug
Andy Wingo [Thu, 9 Oct 2008 09:09:43 +0000 (11:09 +0200)]
fix dynwind + nonlocal entrance/exit + programs bug

* libguile/dynwind.c (scm_i_dowinds): Invoke guard procedures when
  entering and exiting nonlocally. Previously this procedure was
  program-racist.

15 years agoprecise stack marking, fix some missed references, still imperfect
Andy Wingo [Fri, 3 Oct 2008 14:00:30 +0000 (16:00 +0200)]
precise stack marking, fix some missed references, still imperfect

* libguile/vm-engine.h (CHECK_STACK_LEAK, NULLSTACK): Add a new mode,
  VM_ENABLE_STACK_NULLING, that tries to ensure that all stack data past
  the top of the stack is NULL. This helps to verify the VM's
  consistency. If VM_ENABLE_STACK_NULLING is not defined, there is no
  overhead.
  (DROP, DROPN): Hook into NULLSTACK.
  (POP_LIST): Hoo, fix a good bug: if CONS triggered a GC, the elements
  of the list that had not yet been consed would not be marked, because
  the sp was already below them.
  (NEXT): Hook into CHECK_STACK_LEAK.
  (INIT_ARGS): Add a note that consing the rest arg can cause GC.
  (NEW_FRAME): Cons up the external data after initializing the frame, so
  that if GC is triggered, the precise marker sees a well-formed frame.

* libguile/vm-i-loader.c (load-program): In the four-integers case, use
  the POP macro so that we can hook into NULLSTACK (if necessary).

* libguile/vm-i-scheme.c (ARGS2, ARGS3): Hook into NULLSTACK.

* libguile/vm-i-system.c (halt): Null the nvalues. Rework some asserts
  into using ASSERT, and null the stack when we free the frame.
  (variable-set): Use DROPN instead of sp -= 2.
  (BR): Hook into NULLSTACK.
  (goto/args): Hook into NULLSTACK. In the non-self case, delay updating
  the frame until after INIT_ARGS so that GC sees a well-formed frame.
  Delay consing the externals until after the frame is set up, as in
  NEW_FRAME.
  (call/cc): Add some asserts.
  (return): Rework some asserts into ASSERT, and hook into NULLSTACK.
  (return/values): Hook into NULLSTACK, and use ASSERT.
  (return/values*) Use ASSERT.

* libguile/vm.c (VM_ENABLE_ASSERTIONS, VM_ENABLE_STACK_NULLING): These
  are the variables that control assertions and nulling. Perhaps we can
  do these per-engine when we start compiling the debug engine separate
  from a speedy engine.
  (vm_mark_stack): Add a precise stack marker. Yay!
  (vm_cont_mark): Mark the continuation stack precisely.
  (capture_vm_cont): Record the difference from the vp's stack_base too,
  so that we can translate the dynamic links when marking the
  continuation stack. Memset the stack to NULL if we are doing nulling.
  (reinstate_vm_cont): If we are nulling, null out the relevant part
  of the stack.
  (vm_reset_stack): When resetting sp due to a nonlocal exit, null out
  the stack too.
  (vm_mark): If we are nulling, assert that there are no extra values on
  the stack. Mark the stack precisely.

15 years agoremove repl.scm's start-stack definition
Andy Wingo [Fri, 3 Oct 2008 13:07:09 +0000 (15:07 +0200)]
remove repl.scm's start-stack definition

* module/system/repl/repl.scm: Now that we actually compile start-stack,
  no need to provide our own definition here.

15 years agoadd gdb-pre-inst-guile
Andy Wingo [Fri, 3 Oct 2008 13:06:03 +0000 (15:06 +0200)]
add gdb-pre-inst-guile

* configure.in:
* gdb-pre-inst-guile.in: Add gdb-pre-inst-guile, because I'm tired of
  typos. You can run it just like Guile. For compiling, you might try
  GUILE=./gdb-pre-inst-guile scripts/compile foo.scm.

15 years agobe more like the interpreter in signalling wrong-num-args
Andy Wingo [Thu, 2 Oct 2008 09:00:55 +0000 (11:00 +0200)]
be more like the interpreter in signalling wrong-num-args

* libguile/vm-engine.c: Call scm_wrong_num_args in the wrong-num-args
  case, to be more like the interpreter.

* libguile/vm-engine.h (ASSERT): New macro.

* libguile/vm-i-system.c (apply, goto/apply): Assert that nargs >= 2,
  because the compiler should always feed us correct instructions.
  (call/cc): If no values are returned to the continuation, signal
  no_values instead of wrong_num_args.

15 years agoload the i18n extension when compiling i18n.scm
Andy Wingo [Tue, 30 Sep 2008 21:57:13 +0000 (23:57 +0200)]
load the i18n extension when compiling i18n.scm

* ice-9/i18n.scm: Load the i18n extension when compiling too, so that the
  macros that depend on (provided? 'nl-langinfo) actually have
  nl-langinfo. Fixes the i18n test.

15 years agofix compilation of quasiquote with splicing and improper lists
Andy Wingo [Tue, 30 Sep 2008 21:41:16 +0000 (23:41 +0200)]
fix compilation of quasiquote with splicing and improper lists

* libguile/vm-engine.h (POP_CONS_MARK): New macro, analagous to
  POP_LIST_MARK; used in quasiquote on improper lists.

* libguile/vm-i-system.c (cons-mark): New instruction. You know the
  drill, remove all your .go files please.

* module/system/il/compile.scm (codegen): Compile quasiquoted improper
  lists with splices correctly. Additionally check that we don't have
  slices in the CDR of an improper list.

* testsuite/t-quasiquote.scm: Add a test for unquote-splicing in improper
  lists.

15 years agofix some missed references when calling C functions
Andy Wingo [Tue, 30 Sep 2008 20:50:48 +0000 (22:50 +0200)]
fix some missed references when calling C functions

* gdbinit: Update to be a bit more useful.

* libguile/vm-i-system.c: Make sure that arguments to C procedures are
  visible on the stack so they get marked. Could be a source for the
  missed references.

15 years agoMerge commit 'origin/master' into vm
Andy Wingo [Tue, 30 Sep 2008 19:12:16 +0000 (21:12 +0200)]
Merge commit 'origin/master' into vm

Conflicts:

doc/Makefile.am
ice-9/Makefile.am
libguile/gc.c

15 years ago(oop goops) works again, after (the-environment) removal
Andy Wingo [Tue, 30 Sep 2008 18:29:35 +0000 (20:29 +0200)]
(oop goops) works again, after (the-environment) removal

* oop/goops.scm: Update so as not to use (the-environment), which no
  longer exists. I think that the speed characteristics are the same,
  broadly speaking.

15 years agoobject-documentation knows about programs
Andy Wingo [Tue, 30 Sep 2008 18:18:57 +0000 (20:18 +0200)]
object-documentation knows about programs

* ice-9/documentation.scm (object-documentation): Add hooks for getting
  documentation for compiled procedures, too. (Goops would be helpful
  here.)

15 years agodon't require users of users of optargs to have used optargs
Andy Wingo [Mon, 29 Sep 2008 22:40:36 +0000 (00:40 +0200)]
don't require users of users of optargs to have used optargs

* ice-9/optargs.scm: Do the compile-friendly equivalent of unquoting in a
  value into the macro: use @@.

15 years agocompile @ and @@
Andy Wingo [Mon, 29 Sep 2008 22:31:17 +0000 (00:31 +0200)]
compile @ and @@

* libguile/vm-engine.c (vm_run): Add new error case for resolving @ or @@
  references, but there is no such module. Possible if
  module-public-interface returns #f.

* libguile/vm-i-loader.c (link-now): Allow the stack arg to be a sym, as
  before, or a list, indicating an absolute reference. Could be two
  separate instructions, but I'm lazy.

* libguile/vm-i-system.c (late-variable-ref, late-variable-set): As in
  link-now, allow the lazy reference to be a list, for @ and @@.

* module/language/scheme/translate.scm (custom-transformer-table):
  Compile @ and @@, and set! forms for both of them. This will ease the
  non-hygienic pain for exported macros.

* module/system/il/compile.scm (make-glil-var): Translate public and
  private module variable references into glil-module variables.

* module/system/il/ghil.scm (ghil-var-at-module!): New function, resolves
  a variable for @ or @@.

* module/system/il/glil.scm (<glil-module>): Revival of <glil-module>,
  this time with the semantics that it really links to a particular
  module.

* module/system/vm/assemble.scm (<vlink-now>, <vlink-later>): Redefine as
  taking a "key" as the argument, which may be a sym or a list; see the
  notes on link-now for more details.
  (codegen): Compile <glil-module> appropriately. Some duplication here,
  probably could use some cleanup later.

15 years agocall toplevel variables "toplevel", not "module"
Andy Wingo [Mon, 29 Sep 2008 21:20:10 +0000 (23:20 +0200)]
call toplevel variables "toplevel", not "module"

* module/system/il/ghil.scm (ghil-var-for-set!, ghil-var-for-ref!)
  (ghil-var-define!): ghil-var-kind of a toplevel var is now 'toplevel.

* module/system/il/glil.scm: Renamve <glil-module> to <glil-toplevel>.
  Remove the unused `module' field. Remove the unused <glil-late-bound>
  type.

* module/system/il/compile.scm (make-glil-var): s/toplevel/module/

* module/system/vm/assemble.scm (<vlink-later>, <vdefine>): Remove the
  unused `module' parameters from these two types.
  (codegen, dump-object!): Adapt to module/toplevel name changes.

15 years agoremove `type' and `value' fields from <ghil-var>
Andy Wingo [Mon, 29 Sep 2008 20:52:36 +0000 (22:52 +0200)]
remove `type' and `value' fields from <ghil-var>

* module/system/il/ghil.scm (<ghil-var>): Remove `type' and `value'
  fields, as they were not used.

15 years agomove module-public-interface to C, and expose it as C API
Andy Wingo [Mon, 29 Sep 2008 19:36:25 +0000 (21:36 +0200)]
move module-public-interface to C, and expose it as C API

* libguile/modules.h:
* libguile/modules.c:
* ice-9/boot-9.scm (module-public-interface): Move definition of
  module-public-interface to C, where it is now available as
  scm_module_public_interface ().

15 years agoRemove GH and its traces.
Han-Wen Nienhuys [Sat, 13 Sep 2008 03:19:23 +0000 (00:19 -0300)]
Remove GH and its traces.

15 years agoallocate variables that are set! on the heap
Andy Wingo [Sun, 28 Sep 2008 21:09:11 +0000 (23:09 +0200)]
allocate variables that are set! on the heap

* module/system/il/ghil.scm (ghil-lookup): So, it turns out this function
  needed to be split into three:
  (ghil-var-is-bound?, ghil-var-for-ref!, ghil-var-for-set!): The
  different facets of ghil-lookup. Amply commented in the source. The
  difference being that we now allocate variables that are set! on the
  heap, so that other continuations see their possibly-modified values.
  (force-heap-allocation!): New helper.

* testsuite/Makefile.am:
* testsuite/t-call-cc.scm: New test, that variables that are set! are
  allocated on the heap, so that subsequent modifications are still
  seen by the continuation. The test was distilled from test 7.3 in
  r5rs_pitfall.test.

15 years agorevert part of 7ff017002ddc980 that caused missed references
Andy Wingo [Sun, 28 Sep 2008 21:08:14 +0000 (23:08 +0200)]
revert part of 7ff017002ddc980 that caused missed references

* libguile/programs.c (scm_c_make_closure): If the program is actually
  not a program, abort. This can happen if GC misses a reference, as
  currently seems to happen.

* libguile/vm.c (vm_mark): Revert part of
  7ff017002ddc980f684120653549a10c6c7cde5c, which changed the call to
  scm_mark_locations. I'm 99% *sure* this is wrong, but it seems to
  prevent missed references when recompiling the .go files in guile
  itself. Needs revisiting soon, but for the time being we can go back to
  where we were a couple of days ago.

* libguile/vm-i-system.c (halt, vector, vector-mark): Sync the registers
  before calling into C, as it may GC.

15 years agodon't compile psyntax.scm
Andy Wingo [Sun, 28 Sep 2008 16:24:20 +0000 (18:24 +0200)]
don't compile psyntax.scm

* ice-9/Makefile.am: Don't try to compile psyntax.scm

15 years agorename psyntax.ss to psyntax.scm to hack around makefile foo
Andy Wingo [Fri, 26 Sep 2008 15:35:37 +0000 (17:35 +0200)]
rename psyntax.ss to psyntax.scm to hack around makefile foo

* ice-9/Makefile.am (SOURCES):
* ice-9/syncase.scm:
* ice-9/psyntax.scm: Renamve psyntax.ss to psyntax.scm. This way the
  guilec rules won't delete it on a make clean. Doh!

15 years agoFix continuation marking, and some tests.
Andy Wingo [Fri, 26 Sep 2008 11:42:09 +0000 (13:42 +0200)]
Fix continuation marking, and some tests.

* libguile/continuations.c (continuation_mark): Mark the vm
  continuations.

* libguile/vm.c (vm_cont_mark): Fix the marking function.
  (vm_mark): Fix this one too -- the size is a number of STACKITEMS,
  which we foolishly assume are the same size as SCM.

* test-suite/tests/ftw.test: Make our stat hacks verifyable without
  assuming that they are interpreted.

* test-suite/tests/r5rs_pitfall.test: Re-indent.

15 years agoactually compile start-stack to something useful
Andy Wingo [Fri, 26 Sep 2008 10:03:36 +0000 (12:03 +0200)]
actually compile start-stack to something useful

* ice-9/boot-9.scm (start-stack): Define as a defmacro instead of an acro
  in C. We have a way to delay evaluation of the exp, after all: putting
  it in a thunk is sufficient.

* libguile/debug.h:
* libguile/debug.c (scm_sys_start_stack): Renamed from scm_start_stack,
  and exposed to the user. Takes a thunk instead of an expression +
  environment.
  (scm_m_start_stack): Remove this acro.

* module/language/scheme/translate.scm (custom-transformer-table): Remove
  the start-stack special case.

15 years agoEnclose `regexp.test' in a module.
Ludovic Courtès [Thu, 25 Sep 2008 19:36:14 +0000 (21:36 +0200)]
Enclose `regexp.test' in a module.

* test-suite/tests/regexp.test: Add `define-module' clause.

15 years agoFix handling of the FLAGS argument in `fold-matches'.
Ludovic Courtès [Thu, 25 Sep 2008 19:07:06 +0000 (21:07 +0200)]
Fix handling of the FLAGS argument in `fold-matches'.

* ice-9/regex.scm (fold-matches): If FLAGS is non-null, use
  `(car flags)', not `flags'.

* test-suite/tests/regexp.test ("fold-matches"): New test prefix.

* NEWS: Update.

15 years agofurther compilation fixes -- all files compile fine now
Andy Wingo [Thu, 25 Sep 2008 15:17:02 +0000 (17:17 +0200)]
further compilation fixes -- all files compile fine now

* ice-9/runq.scm (strip-sequence): Remove use of obtuse guile `define'
  extension.

* ice-9/boot-9.scm (while): Redefine so as not to unquote in a procedure.
  Less hygienic. Perhaps we should switch to syncase at some point.

* ice-9/session.scm (help): Redefine as a normal macro, so that it can be
  compiled. Not very useful though -- further effort should go into
  (system repl ...).
  (system-module): Removed, it didn't work, and is not useful as far as I
  can tell.

* ice-9/string-fun.scm (string-prefix-predicate): Remove guile define
  extension usage. Compilation also fixed by `while' compilation fix.

* ice-9/threads.scm (par-mapper): Remove guile define extension usage.

15 years agocompile `delay' into `make-promise' with a thunk
Andy Wingo [Thu, 25 Sep 2008 14:50:21 +0000 (16:50 +0200)]
compile `delay' into `make-promise' with a thunk

* module/language/scheme/translate.scm (custom-transformer-table):
  Translate `delay' into `make-promise'.

15 years agoexport `make-promise' to scheme
Andy Wingo [Thu, 25 Sep 2008 14:16:35 +0000 (16:16 +0200)]
export `make-promise' to scheme

* libguile/eval.h:
* libguile/eval.c (scm_make_promise): Rename from `scm_makprom', and
  export as the scheme procedure, `make-promise'.

* libguile/eval.i.c (CEVAL): s/makprom/make_promise/.

15 years agoenable compilation of more modules
Andy Wingo [Thu, 25 Sep 2008 11:54:54 +0000 (13:54 +0200)]
enable compilation of more modules

* ice-9/Makefile.am: Compile most modules. There are still a couple that
  fail to compile.

15 years agoa number of small compilation fixes
Andy Wingo [Thu, 25 Sep 2008 11:46:09 +0000 (13:46 +0200)]
a number of small compilation fixes

* ice-9/boot-9.scm: Allow a compiled load of posix, networking, and
  deprecated files.

* module/language/scheme/translate.scm (lookup-transformer): Lookup the
  sc-macro by value, not by name. Works around the fact that compiled
  macros don't have names, which is probably a bug.

* module/system/base/compile.scm (syntax-error)
  (call-with-compile-error-catch): Throw and catch a key that's not used
  by anyone else. Write error messages to the error port.

* module/system/repl/repl.scm (default-catch-handler): Call display-error
  with the correct number of arguments.

* module/system/vm/frame.scm (frame-program-name): Guard against unbound
  variables.

* ice-9/optargs.scm (let-keywords-template): Don't unquote in a helper
  procedure. A bit irritating. I suppose we should fix the modules +
  syncase situation at some point, and then switch to syncase.

15 years agocompile psyntax-pp
Andy Wingo [Thu, 25 Sep 2008 11:40:13 +0000 (13:40 +0200)]
compile psyntax-pp

* ice-9/Makefile.am: Compile psyntax-pp.scm, which is the new name of
  psyntax.pp.

* ice-9/syncase.scm: Load the pre-processed source as psyntax-pp so that
  we load up a .go file if available.

15 years agofix handling of multiple values from c functions
Andy Wingo [Thu, 25 Sep 2008 10:08:54 +0000 (12:08 +0200)]
fix handling of multiple values from c functions

* libguile/vm-i-system.c (mv-call, goto/cc): Fix handling of values
  returns from C or interpreted functions.

15 years agoadd gdbinit for debugging the vm
Andy Wingo [Thu, 25 Sep 2008 10:07:52 +0000 (12:07 +0200)]
add gdbinit for debugging the vm

* gdbinit: Add my gdbinit. The most useful commands are gwrite and
  vmstack.

15 years agocompile call/cc, yee ha
Andy Wingo [Thu, 25 Sep 2008 09:07:54 +0000 (11:07 +0200)]
compile call/cc, yee ha

* libguile/vm-i-system.c (call, goto/args): Add a FIXME for handling the
  case in which a call to the interpreter returns a values object.
  (call/cc, goto/cc): Flesh out, and handle full continuations (with the
  C stack also).

* module/language/scheme/translate.scm (custom-transformer-table):
  Compile call-with-current-continuation. This is necessary so that the
  called procedure is called in tail position.

* module/system/il/compile.scm (codegen): Translate apply to goto/apply,
  call/cc to goto/cc, etc when in tail position.

15 years agofix bug introduced in the fluid commit
Andy Wingo [Thu, 25 Sep 2008 09:04:35 +0000 (11:04 +0200)]
fix bug introduced in the fluid commit

* libguile/vm.c (the-vm): If the dynamic binding of *the-vm* is false,
  make a new vm. Fixes multiple threads with the vm since the *the-vm*
  fluid changes.

15 years agomake call/cc capture and restore the vm stacks
Andy Wingo [Wed, 24 Sep 2008 15:04:14 +0000 (17:04 +0200)]
make call/cc capture and restore the vm stacks

* libguile/continuations.c (scm_make_continuation): Capture VM
  continuations as well, as their stack is outside the C stack.
  (copy_stack): Reinstate VM stacks with the C stack.

* libguile/continuations.h (scm_t_contregs): Add a pointer for VM stacks.
  A binary-incompatible change -- hopefully not too many people were
  messing around with this struct, though.

* libguile/vm-engine.c (vm_run): Add a note about possibly maintaining a
  stack of vms.

* libguile/vm.c (struct scm_vm_cont): New struct, distinct from scm_vm.
  (vm_cont_mark, vm_cont_free, capture_vm_cont, reinstate_vm_cont):
  Reorder some code, and fix some bad assumptions about what part of the
  stack to copy; obviously this code was never used.

* libguile/vm.h:
* libguile/vm.c (scm_vm_capture_continuations)
  (scm_vm_reinstate_continuations): New public functions, used by
  continuations.c.

15 years agothe vm is a fluid
Andy Wingo [Wed, 24 Sep 2008 09:47:25 +0000 (11:47 +0200)]
the vm is a fluid

* module/system/vm/vm.scm:
* libguile/vm.h:
* libguile/vm.c: Make the `the-vm' procedure access a fluid, `*the-vm*'.
  Export that fluid from vm.h and vm.scm.

15 years agoMake literal strings (i.e., returned by `read') read-only.
Ludovic Courtès [Mon, 22 Sep 2008 21:03:20 +0000 (23:03 +0200)]
Make literal strings (i.e., returned by `read') read-only.

* libguile/read.c (scm_read_string): Use `scm_i_make_read_only_string ()' to
  return a read-only string, as mandated by R5RS.  Reported by Bill
  Schottstaedt <bil@ccrma.Stanford.EDU>.

* libguile/strings.c (scm_i_make_read_only_string): New function.
  (scm_i_shared_substring_read_only): Special-case the empty string
  so that the read-only and read-write empty strings are `eq?'.  This
  optimization is relied on by the `substring/shared' `empty string'
  test case in `srfi-13.test'.

* libguile/strings.h (scm_i_make_read_only_string): New declaration.

* test-suite/tests/strings.test ("string-set!")["literal string"]: New test.

* NEWS: Update.

15 years agoMake `symbol->string' return a read-only string.
Ludovic Courtès [Mon, 22 Sep 2008 20:51:36 +0000 (22:51 +0200)]
Make `symbol->string' return a read-only string.

* libguile/strings.c (scm_i_symbol_substring): Return a read-only string
  since R5RS requires `symbol->string' to return a read-only string.
  Reported by Bill Schottstaedt <bil@ccrma.Stanford.EDU>.

* test-suite/tests/symbols.test: Add `define-module' clause.
  (exception:immutable-string): Adjust to current exception.
  ("symbol->string")["result is an immutable string"]: Use
  `pass-if-exception' instead of `expect-fail-exception'.

* NEWS: Update.

15 years agoFix for incorrect (gcd -2) => -2; should give 2.
Neil Jerram [Wed, 17 Sep 2008 20:46:40 +0000 (21:46 +0100)]
Fix for incorrect (gcd -2) => -2; should give 2.

(reported by Bill Schottstaedt)

* libguile/numbers.c (scm_gcd): When only one arg given, use scm_abs
  to ensure that result is non-negative.

* test-suite/tests/numbers.test ("gcd"): New test, (gcd -2).

15 years agoFix `strftime' documentation wrt. `%Z'.
Ludovic Courtès [Thu, 18 Sep 2008 21:13:42 +0000 (23:13 +0200)]
Fix `strftime' documentation wrt. `%Z'.

* doc/ref/posix.texi (Time)[strftime]: Remove erroneous note saying
  that `%Z' ignores `tm:zone'.  Reported by Neil Jerram.

15 years agodon't poke installed scm, go, etc files when running pre-inst-guile
Andy Wingo [Thu, 18 Sep 2008 21:04:58 +0000 (23:04 +0200)]
don't poke installed scm, go, etc files when running pre-inst-guile

* libguile/load.c (scm_init_load_path): If GUILE_SYSTEM_PATH is set, use
  that instead of the compiled-in suffix to the load path. And, as a
  special case, GUILE_SYSTEM_PATH= is interpreted as '(). A bit nasty.

* pre-inst-guile-env.in (top_builddir): Set GUILE_SYSTEM_PATH to the
  empty string, if it is not set.

15 years agolambda-lifting for (lambda () ...) as consumer of call-with-values
Andy Wingo [Thu, 18 Sep 2008 20:49:55 +0000 (22:49 +0200)]
lambda-lifting for (lambda () ...) as consumer of call-with-values

* libguile/vm-engine.c (vm_run): Add new error case,
  vm_error_not_enough_values.

* libguile/vm-i-system.c (goto/nargs, call/nargs): So, in these cases, if
  we get too many values, we don't truncate the values like we do in the
  single-value continuation case, or in the mvbind case. What to do? I
  guess we either truncate them here, or only allow the correct number of
  values. Dunno. Mark the code as a fixme.
  (truncate-values): New instruction, for mv-bind: checks that the number
  of values on the stack is compatible with the number of bindings we
  have arranged for them, truncating if necessary.

* module/language/scheme/translate.scm (custom-transformer-table):
  Compile receive as a primary form -- not so much because it is a
  primary form, but more to test the mv-bind machinery. Also it's more
  efficient, I think.

* module/system/il/compile.scm (lift-variables!): New helper, factored
  out of `optimize'.
  (optimize): Add a few more cases. Adapt `lambda' optimization, which
  isn't much. I'm not happy with ghil as a mungeable language.
  Add a case for call-with-values with the second argument is
  a lambda: lift the lambda. Untested.
  (codegen): Refactor the push-bindings! code. Compile mv-bind.

* module/system/il/ghil.scm (<ghil-mv-bind>): Add mv-bind construct,
  along with its procedures.

* module/system/il/glil.scm (<glil-mv-bind>): Add mv-bind construct,
  different from the high-level one. It makes sense in the source, I
  think.

* module/system/vm/assemble.scm (codegen): Assemble glil-mv-bind by
  pushing onto the bindings list, and actually push some code to truncate
  the values.

15 years agoFix first-time compilation
Ludovic Courtès [Tue, 16 Sep 2008 21:16:00 +0000 (23:16 +0200)]
Fix first-time compilation

Hello!

The attached patch fixes first-time compilation, by ensuring SRFI
modules are built before "guile-tools compile" is ever run.

Thanks,
Ludo'.

From 691a111c440a26c021f52b4027b0d9772f8e04cc Mon Sep 17 00:00:00 2001
From: =?utf-8?q?Ludovic=20Court=C3=A8s?= <ludo@gnu.org>
Date: Tue, 16 Sep 2008 23:13:38 +0200
Subject: [PATCH] Fix compilation order of the sub-directories.

* Makefile.am (SUBDIRS): Move `ice-9' past `srfi' and friends, so that
  the SRFI modules needed by the compiler are built before "guile-tools
  compile" is used.

15 years agofix case in which we can fail to exit the repl cleanly
Andy Wingo [Thu, 18 Sep 2008 18:05:23 +0000 (20:05 +0200)]
fix case in which we can fail to exit the repl cleanly

* module/system/repl/repl.scm (next-char): Don't throw if we get an EOF,
  just return the EOF object. Fixes a case in which we fail to exit
  cleanly.

15 years agocompile call-with-values, woot!
Andy Wingo [Mon, 15 Sep 2008 22:26:22 +0000 (00:26 +0200)]
compile call-with-values, woot!

* libguile/vm-engine.c (vm_run): Add another byte onto the bootstrap
  program, as the offset passed to mv-call now takes two bytes.

* module/system/vm/frame.scm (bootstrap-frame?): Update for the new
  bootstrap length. Really we should just check for 'halt though.

* libguile/vm-i-system.c (FETCH_OFFSET): New helper, used in BR().
  (goto/nargs, call/nargs): Versions of goto/args and call, respectively,
  that take the number of arguments from a value on the top of the stack.
  (mv-call): Call FETCH_OFFSET to get the offset.

* module/language/scheme/translate.scm (custom-transformer-table):
  Compile call-with-values to <ghil-mv-call>. There is some trickery
  because of the r4rs.scm call-with-values trampolines.

* module/system/il/ghil.scm: Add <ghil-mv-call> and accessors.

* module/system/il/compile.scm (codegen): Compile <ghil-mv-call>.

* module/system/il/glil.scm: Add <glil-mv-call>, which needs some special
  assembly because of the label. Fix some typos.

* module/system/vm/assemble.scm (byte-length): New helper, factored out
  and made more general.
  (codegen): Assemble mv-call, including the label.
  (check-length): New helper, makes sure that the addressing is
  consistent within the produced object code.
  (stack->bytes): Rewrite to be more generic -- now `br' instructions
  aren't the only ones jumping around in the instruction stream.

* module/system/vm/conv.scm (make-byte-decoder): Return two values in the
  #f case.

* module/system/vm/disasm.scm (disassemble-bytecode): Rewrite, because
  the previous implementation depended on a guile interpreter quirk:
  namely, that multiple values could be represented within one value, and
  destructured later.

15 years agoMake multi-byte reads on unbuffered ports more efficient.
Neil Jerram [Sun, 14 Sep 2008 23:25:25 +0000 (00:25 +0100)]
Make multi-byte reads on unbuffered ports more efficient.

Idea and original patch were by Ludovic Courtès, this is Neil Jerram's
reworking of it.

* libguile/srfi-4.c (scm_uniform_vector_read_x): Use scm_c_read,
instead of equivalent code here.

* libguile/ports.c (scm_fill_input): Add assertion that read
buffer is empty when called.
(port_and_swap_buffer, swap_buffer): New, for...
(scm_c_read): Use caller's buffer for reading, to avoid making N
1-byte low-level read calls, in the case where the port is
unbuffered (or has a very small buffer).

15 years agoAdd `uniform-vector-read!' benchmark.
Ludovic Courtès [Sun, 1 Jun 2008 17:31:36 +0000 (19:31 +0200)]
Add `uniform-vector-read!' benchmark.

15 years agoadd special case for (apply values ...)
Andy Wingo [Sun, 14 Sep 2008 22:04:34 +0000 (00:04 +0200)]
add special case for (apply values ...)

* libguile/vm-engine.c (vm_run): Move nvalues to the top level, to avoid
  (spurious, it seems) gcc warnings about it being used uninitialized.

* libguile/vm-i-system.c (halt, return/values): Adapt to gcc silliness.
  Deindent some of return/values.
  (return/values*): New instruction, does what (apply values . args)
  would do.

* module/language/scheme/translate.scm (custom-transformer-table): Move
  the apply and @apply cases here from inline.scm, because we need some
  more cleverness when dealing with cases like (apply values . args).
  (lookup-apply-transformer): Define an eval transformer for `values',
  turning it into ghil-values*.

* module/system/il/compile.scm (codegen): Compile <ghil-values*> into
  return/values*.

* module/system/il/ghil.scm: Add <ghil-values*> and accessors.
  (ghil-lookup): Add optional argument, define?, which if false tells us
  not to actually cache the binding if it is not found in the toplevel.

* module/system/il/inline.scm: Remove apply clauses.

* module/system/vm/frame.scm (bootstrap-frame?): Update heuristic for
  bootstrap-frame?, as the bootstrap frame is now 5 bytes since it
  accepts multiple values.

15 years agoadd multiple values support to the vm
Andy Wingo [Sun, 14 Sep 2008 15:06:52 +0000 (17:06 +0200)]
add multiple values support to the vm

* libguile/vm-engine.c (vm_run): The bootstrap program now uses mv_call,
  so as to allow multiple values out of the VM. (It did before, because
  multiple values were represented internally as single scm_values
  objects, but now that values go on the stack, we need to note the boot
  frame as accepting multiple values.)
  (vm_error_no_values): New error, happens if you pass no values into a
  single-value continuation. Passing more than one is OK though, it just
  takes the first one.

* libguile/vm-i-system.c (halt): Assume that someone has pushed the
  number of values onto the stack, and package up that number of values
  as a scm_values() object, for communication with the interpreter.
  (mv-call): New instruction, calls a procedure with a multiple-value
  continuation, even handling calls out to the interpreter.
  (return/values): New instruction, returns multiple values to the
  continuation. If the continuation is single-valued, takes the first
  value or errors if there are no values. Otherwise it returns to the
  multiple-value return address, pushing the number of values on top of
  the values.

* module/system/il/compile.scm (codegen): Compile <ghil-values> forms.

* module/system/il/ghil.scm (<ghil-values>) Add new GHIL data structure
  and associated procedures.

* module/language/scheme/translate.scm (custom-transformer-table):
  Compile (values .. ) forms into <ghil-values>.

15 years agolook up scheme translators by value, not by name
Andy Wingo [Sun, 14 Sep 2008 12:26:29 +0000 (14:26 +0200)]
look up scheme translators by value, not by name

* module/language/scheme/translate.scm (custom-transformer-table): Rename
  from `primitive-syntax-table', because now it will handle procedural
  values as well.
  (lookup-transformer): Update for renaming. Look up custom transformers
  by value, not name.
  (make-pmatch-transformers): Key the transformer table by value, not
  name.

15 years agoInclude <config.h> in standalone tests.
Ludovic Courtès [Sat, 13 Sep 2008 18:09:08 +0000 (20:09 +0200)]
Include <config.h> in standalone tests.

* test-suite/standalone/Makefile.am (test_cflags): Add `-I$(top_builddir)' so
  that <config.h> can be found.
  (snarfcppopts): Likewise.

* test-suite/standalone/*.c: Include <config.h>.

15 years agorename tail-call to goto/args, add some more tail instructions
Andy Wingo [Sat, 13 Sep 2008 17:19:10 +0000 (19:19 +0200)]
rename tail-call to goto/args, add some more tail instructions

* libguile/vm-i-system.c (call): Rename continuation invocation from
  `vm_call_cc' to `vm_call_continuation', because that's what it really
  does. Add a note that it doesn't handle multiple values at the moment.
  (goto/arg): Renamed from tail-call, in deference to the progenitors, on
  Dale Smith's suggestion.
  (goto/apply): New instruction, for `apply' in a tail context. Not yet
  used, or vetted for that matter.
  (call/cc): No need to pop the program, I don't think; although this
  isn't tested either.
  (goto/cc): New instruction, for call/cc in a tail context.

* module/language/scheme/translate.scm (*forbidden-primitives*): Rename
  from %forbidden-primitives.

* module/system/il/compile.scm (codegen): Adapt to goto/args instead of
  tail-call.

* module/system/il/inline.scm: Start inlining some macros used in
  r4rs.scm -- not yet fully tested.

* ice-9/boot-9.scm: Allow load of a compiled r4rs file.

15 years agoadd a multiple values return address to stack frames
Andy Wingo [Sat, 13 Sep 2008 17:15:20 +0000 (19:15 +0200)]
add a multiple values return address to stack frames

* libguile/frames.c (frame-mv-return-address): New accessor.

* libguile/frames.h: Update frame diagram.
  (SCM_FRAME_UPPER_ADDRESS): Update for data area
  growing by one pointer.
  (SCM_FRAME_MV_RETURN_ADDRESS): New macro.

* libguile/vm-engine.h (NEW_FRAME): Update for frame getting bigger by a
  pointer. In a normal NEW_FRAME, set the MV return address to NULL, to
  indicate that this continuation does not accept multiple values.

* libguile/vm-i-system.c (tail-call): Update frame replacement code to
  understand the MV return address.
  (return): Make room for the MVRA.

15 years agoinline frame replacement in tail-call
Andy Wingo [Sat, 13 Sep 2008 13:41:43 +0000 (15:41 +0200)]
inline frame replacement in tail-call

* libguile/programs.c (program_print): Only try to lookup write-program
  if the module system is booted.

* libguile/vm-engine.h (FREE_FRAME): Remove, it's now inlined everywhere.

* libguile/vm-i-system.c (tail-call): Inline FREE_FRAME, and implement
  the calling bits here. Will make things more hackable.

15 years agoInclude <config.h> in all C files; use `#ifdef HAVE_CONFIG_H' rather than `#if'.
Ludovic Courtès [Sat, 13 Sep 2008 13:35:27 +0000 (15:35 +0200)]
Include <config.h> in all C files; use `#ifdef HAVE_CONFIG_H' rather than `#if'.

15 years agoinline FREE_FRAME in halt
Andy Wingo [Sat, 13 Sep 2008 12:40:27 +0000 (14:40 +0200)]
inline FREE_FRAME in halt

* libguile/vm-i-system.c (halt): Inline FREE_FRAME, specialized for the
  halt case.

15 years agoinline FREE_FRAME in return, sync stack_base in CACHE_REGISTER
Andy Wingo [Sat, 13 Sep 2008 12:30:57 +0000 (14:30 +0200)]
inline FREE_FRAME in return, sync stack_base in CACHE_REGISTER

* libguile/vm-engine.h (CACHE_REGISTER): Sync stack_base too.

* libguile/vm-i-system.c (return): Inline FREE_FRAME here,
  micro-optimizing a wee bit. Sounds silly, but it's to enable some
  refactoring.

15 years agoclean up NEW_FRAME macro
Andy Wingo [Thu, 11 Sep 2008 17:30:15 +0000 (19:30 +0200)]
clean up NEW_FRAME macro

* libguile/vm-engine.h (NEW_FRAME): Clean up this macro.

15 years agoreadability improvement in vm-i-scheme
Andy Wingo [Sat, 13 Sep 2008 12:14:20 +0000 (14:14 +0200)]
readability improvement in vm-i-scheme

* libguile/vm-engine.h:
* libguile/vm-i-scheme.c: Move some helper macros closer to their use
  sites.

15 years agotweaks for printing programs
Andy Wingo [Sat, 13 Sep 2008 11:14:45 +0000 (13:14 +0200)]
tweaks for printing programs

* module/system/vm/program.scm (program-bindings-as-lambda-list): Handle
  the bindings-is-null case too -- not sure how it comes about, though. A
  thunk with no let, perhaps.
  (write-program): Another default for the name: the source location at
  which it was defined.

* libguile/programs.c (program_print): Add some "logic" to stop doing
  detailed prints if one print had a nonlocal exit -- preventing
  exceptions in backtraces.

15 years agoprograms can now get at their names, and print nicely
Andy Wingo [Fri, 12 Sep 2008 21:14:46 +0000 (23:14 +0200)]
programs can now get at their names, and print nicely

* module/system/vm/frame.scm (frame-call-representation)
  (frame-program-name): Rename program-name to frame-program-name, and
  use the program-name if it is available.

* module/system/vm/program.scm (program-bindings): Return #f if there are
  no bindings.
  (program-name): New public procedure.
  (program-bindings-as-lambda-list, write-program): A more useful writer
  for programs.

* libguile/programs.c (scm_bootstrap_programs, program_print): Add a smob
  printer for programs, which dispatches to `write-program'.

15 years ago(define (foo ...) ...) actually gives the lambda a name
Andy Wingo [Fri, 12 Sep 2008 21:11:09 +0000 (23:11 +0200)]
(define (foo ...) ...) actually gives the lambda a name

* module/language/scheme/translate.scm (primitive-syntax-table): In forms
  like (define x y) where y is a lambda, and the lambda has no name yet,
  set the lambda's name in its metadata.

15 years agofix confusion in disassemble-bindings
Andy Wingo [Fri, 12 Sep 2008 21:09:45 +0000 (23:09 +0200)]
fix confusion in disassemble-bindings

* module/system/vm/disasm.scm (disassemble-bindings): Fix external/local
  confusion when printing args and locals.

15 years agofix *another* bug in compiling `or'. incredible.
Andy Wingo [Sat, 13 Sep 2008 12:13:13 +0000 (14:13 +0200)]
fix *another* bug in compiling `or'. incredible.

* module/system/il/compile.scm (codegen): Fix *another* bug in compiling
  `or' -- in the case in which the value was being discarded, as in `or'
  used as a control structure, we were sometimes leaving a value on the
  stack.

* testsuite/t-or.scm: Add another test case for `or'.

15 years agoAdd `ChangeLog-2008' files to the distribution.
Ludovic Courtès [Fri, 12 Sep 2008 19:46:32 +0000 (21:46 +0200)]
Add `ChangeLog-2008' files to the distribution.

15 years agoRename `ChangeLog' files to `ChangeLog-2008'.
Ludovic Courtès [Fri, 12 Sep 2008 19:48:04 +0000 (21:48 +0200)]
Rename `ChangeLog' files to `ChangeLog-2008'.

15 years agountabify process-define-module
Andy Wingo [Fri, 12 Sep 2008 15:59:59 +0000 (17:59 +0200)]
untabify process-define-module

* ice-9/boot-9.scm (process-define-module): Untabify.

15 years agocorrectly disassemble program bindings (arguments, locals, externals)
Andy Wingo [Fri, 12 Sep 2008 15:55:33 +0000 (17:55 +0200)]
correctly disassemble program bindings (arguments, locals, externals)

* module/system/vm/disasm.scm (disassemble-bindings): New function,
  properly disassembles the bindings data. Neat!

15 years agodoc: Correct the default value of `%load-path'.
Ludovic Courtès [Fri, 12 Sep 2008 09:30:04 +0000 (11:30 +0200)]
doc: Correct the default value of `%load-path'.

* doc/ref/api-options.texi (Build Config): Remove "." from the default value
  of `%load-path'.  Reported by David Séverin <david@altosw.be>.

15 years agoInclude <config.h> in `discouraged.c'.
Ludovic Courtès [Fri, 12 Sep 2008 07:41:54 +0000 (09:41 +0200)]
Include <config.h> in `discouraged.c'.

* libguile/discouraged.c: Include <config.h> first so that files that
  rely on `config.h' macros (such as Gnulib-provided headers) work as
  expected.

15 years agoRemove `.cvsignore' files.
Ludovic Courtès [Thu, 11 Sep 2008 19:28:21 +0000 (21:28 +0200)]
Remove `.cvsignore' files.

15 years agoUse Gnulib's `autobuild' module.
Ludovic Courtès [Thu, 11 Sep 2008 19:16:47 +0000 (21:16 +0200)]
Use Gnulib's `autobuild' module.

* m4/gnulib-cache.m4 (gl_MODULES): Add `autobuild'.

* Makefile.am (EXTRA_DIST): Add `m4/autobuild.m4'.

15 years agoRevise GC asserts.
Han-Wen Nienhuys [Wed, 10 Sep 2008 03:11:02 +0000 (00:11 -0300)]
Revise GC asserts.

* libguile/gc.c (scm_i_gc): Change assert into printed warning.

* libguile/private-gc.h (nil): introduce scm_i_last_marked_cell_count,
  as a private mechanism for maintaining cell counts.  Remove variable
  scm_cells_allocated.

15 years ago* HACKING: update to current practice
Han-Wen Nienhuys [Wed, 3 Sep 2008 04:35:18 +0000 (01:35 -0300)]
* HACKING: update to current practice

  * Drop CVS references.

  * Ask for Git based patches.

  * Drop outdated info (EGCS, SCM_P)

15 years agoFix compilation of `libguile-i18n' on MinGW.
Ludovic Courtès [Wed, 10 Sep 2008 09:38:23 +0000 (11:38 +0200)]
Fix compilation of `libguile-i18n' on MinGW.

* libguile/locale-categories.h (MESSAGES): Enclose in `#ifdef LC_MESSAGES' as
  it's not available on MinGW.  Reported by Han-Wen.

15 years agoCleanup mark-during-GC debug checks.
Han-Wen Nienhuys [Wed, 10 Sep 2008 02:08:16 +0000 (23:08 -0300)]
Cleanup mark-during-GC debug checks.

* libguile/__scm.h (SCM_DEBUG): add SCM_DEBUG_MARKING_API

* libguile/gc.h (SCM_SET_GC_MARK): depending on
SCM_DEBUG_MARKING_API crash if someone is touching markbits
outside regular hours.

Rename ensure_marking() to scm_i_ensure_marking().

* libguile/inline.h (scm_double_cell, scm_cell): only set mark bits
for debugging if SCM_DEBUG_MARKING_API is unset

* libguile/gc-mark.c: Issue deprecation warning if we are marking
outside of the GC mark phase.

15 years agoUse Gnulib's `count-one-bits' as a replacement for `scm_i_uint_bit_count ()'.
Ludovic Courtès [Tue, 9 Sep 2008 20:46:04 +0000 (22:46 +0200)]
Use Gnulib's `count-one-bits' as a replacement for `scm_i_uint_bit_count ()'.

* libguile/gc-card.c: Include <config.h> and <count-one-bits.h>.
  (scm_i_uint_bit_count): Remove.
  (scm_i_card_marked_count): Use `count_one_bits_l ()' instead
  of `scm_i_uint_bit_count ()'.

* libguile/gc-segment.c: Include <config.h> and <count-one-bits.h>.
  (scm_i_heap_segment_marked_count): Use `count_one_bits_l ()' instead
  of `scm_i_uint_bit_count ()'.

* libguile/private-gc.h (scm_i_uint_bit_count): Remove.

15 years agoUse Gnulib's `count-one-bits' module.
Ludovic Courtès [Tue, 9 Sep 2008 20:37:43 +0000 (22:37 +0200)]
Use Gnulib's `count-one-bits' module.

* m4/gnulib-cache.m4 (gl_MODULES): Add `count-one-bits'.

15 years agoMerge branch 'master' into strftime-gnulib
Ludovic Courtès [Tue, 9 Sep 2008 20:03:42 +0000 (22:03 +0200)]
Merge branch 'master' into strftime-gnulib

Conflicts:
libguile/ChangeLog
srfi/ChangeLog
test-suite/ChangeLog

15 years agoGet rid of Automake's "maintainer mode".
Ludovic Courtès [Tue, 9 Sep 2008 16:06:37 +0000 (18:06 +0200)]
Get rid of Automake's "maintainer mode".

* NEWS: Update.
* configure.in: Remove `AM_MAINTAINER_MODE' invocation.
* doc/Makefile.am, ice-9/Makefile.am: Ignore `MAINTAINER_MODE'
  conditional.

15 years agoreally newline on eof
Andy Wingo [Tue, 9 Sep 2008 06:33:53 +0000 (08:33 +0200)]
really newline on eof

* module/system/repl/repl.scm (next-char): Another newline-on-eof case.

15 years agofix program disassembly for meta-in-a-thunk
Andy Wingo [Tue, 9 Sep 2008 06:27:49 +0000 (08:27 +0200)]
fix program disassembly for meta-in-a-thunk

* module/system/vm/disasm.scm (disassemble-program): Fix for recent
  meta-in-a-thunk change.

15 years agorun the vm repl instead of the scm-style-repl
Andy Wingo [Tue, 9 Sep 2008 06:23:10 +0000 (08:23 +0200)]
run the vm repl instead of the scm-style-repl

* ice-9/boot-9.scm (@, @@): Note that these don't work with the compiler.
  Damn.
  (top-repl): Run the VM repl. Whooo!

* module/system/repl/repl.scm (start-repl): Catch 'quit, as the
  scm-style-repl does. Newline after input EOF's, so that we don't leave
  the user's shell messed up.

15 years agoadd repl option to interpret rather than compile
Andy Wingo [Tue, 9 Sep 2008 05:54:23 +0000 (07:54 +0200)]
add repl option to interpret rather than compile

* module/language/scheme/spec.scm (scheme): Specify an evaluator, `eval'.

* module/system/repl/common.scm (repl-default-options): Add option,
  `interp', specifying that, if possible, the repl should interpret its
  expressions rather than compile them. Defaults to #f.

15 years agorework late binding resolution to be simpler and more efficient
Andy Wingo [Tue, 9 Sep 2008 05:15:01 +0000 (07:15 +0200)]
rework late binding resolution to be simpler and more efficient

* libguile/programs.h (struct scm_program):
* libguile/programs.c (scm_c_make_program): Record the current module
  when making a program. This replaces the per-late binding recorded
  module in the generated code, which should be more efficient, both in
  terms of garbage, and in not calling resolve-module.
  (program-module): New accessor.

* module/system/vm/program.scm: Add program-module to exports.

* libguile/vm-i-loader.c (link-later): Remove this instruction, since now
  the entry in the object table is just a symbol, and can be loaded with
  load-symbol.

* libguile/vm-i-system.c (late-variable-ref, late-variable-set): Rework
  so as to look up in the module of the current program. The logic could
  be condensed quite a bit if scm_module_lookup () knew what to do with
  mod==#f.

* module/system/vm/assemble.scm (dump-object!): Dump <vlink-later> just
  as load-symbol, as mentioned in the note on link-later.

* module/system/il/ghil.scm: Update comment to reflect the new reality.

15 years agofinal de-:prefixification
Andy Wingo [Tue, 9 Sep 2008 05:13:14 +0000 (07:13 +0200)]
final de-:prefixification

* scripts/compile: Don't (read-set! keywords 'prefix) here either.