1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-30 11:50:28 +02:00
Commit graph

4452 commits

Author SHA1 Message Date
Andy Wingo
cc588f740f fix backtraces, broken since the program-bindings format change
* module/system/vm/frame.scm (frame-bindings): Fix for new binding
  format; actually use the bindings accessors.
  (frame-lookup-binding): Clarify.
2008-10-16 13:56:41 +02:00
Andy Wingo
f580ec0f56 fix use of `binding' data abstraction
* module/system/vm/assemble.scm (make-temp-binding, btemp:name)
  (btemp:extp, btemp:index): Don't abuse program.scm's make-binding to
  make something that actually isn't a binding.
  (codegen): Do use program.scm's make-binding to make something that
  actually is a binding.

* module/system/vm/program.scm (binding:start, binding:end): New
  accessors.
  (make-binding): Expand to have the start and end arguments in the
  constructor.
2008-10-16 13:49:57 +02:00
Andy Wingo
1a38597553 fix mv-call disasm bug
* module/system/vm/disasm.scm (code-annotation): Fix bug with mv-call.
2008-10-15 22:42:51 +02:00
Andy Wingo
8f64368ee5 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.
2008-10-15 22:30:47 +02:00
Andy Wingo
02b1883e56 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.
2008-10-12 22:49:24 +02:00
Andy Wingo
95b6ad34c3 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.
2008-10-11 18:55:44 +02:00
Andy Wingo
2bbe1533e8 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*.
2008-10-11 11:54:12 +02:00
Andy Wingo
0570c3f197 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.
2008-10-09 12:17:51 +02:00
Andy Wingo
1bb6b839ec 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.
2008-10-09 11:10:25 +02:00
Andy Wingo
edb1d1d78d 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.
2008-10-03 15:07:09 +02:00
Andy Wingo
2bd859c81a 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.
2008-09-30 23:41:16 +02:00
Andy Wingo
fd3585753a 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.
2008-09-30 00:31:17 +02:00
Andy Wingo
a1122f8cba 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.
2008-09-29 23:20:10 +02:00
Andy Wingo
48d0006409 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.
2008-09-29 22:52:36 +02:00
Andy Wingo
46d2d6f80e 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.
2008-09-28 23:09:11 +02:00
Andy Wingo
107139eaad 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.
2008-09-26 12:03:36 +02:00
Andy Wingo
7024b58329 compile delay' into make-promise' with a thunk
* module/language/scheme/translate.scm (custom-transformer-table):
  Translate `delay' into `make-promise'.
2008-09-25 16:50:21 +02:00
Andy Wingo
1e6ebf54db 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.
2008-09-25 13:46:09 +02:00
Andy Wingo
76282387ea 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.
2008-09-25 11:07:54 +02:00
Andy Wingo
7bbed5181c 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.
2008-09-24 11:47:25 +02:00
Andy Wingo
d51406fe87 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.
2008-09-18 22:49:55 +02:00
Andy Wingo
d600df9aa9 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.
2008-09-18 20:05:23 +02:00
Andy Wingo
efbd589204 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.
2008-09-16 00:26:22 +02:00
Andy Wingo
ef24c01bff 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.
2008-09-15 00:04:34 +02:00
Andy Wingo
a222b0fa91 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>.
2008-09-14 17:06:52 +02:00
Andy Wingo
7e97ad2dd6 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.
2008-09-14 14:26:29 +02:00
Andy Wingo
f03c31dbad 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.
2008-09-13 19:24:03 +02:00
Andy Wingo
0ba8bb7143 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.
2008-09-13 14:19:30 +02:00
Andy Wingo
e6fea61823 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'.
2008-09-13 14:19:30 +02:00
Andy Wingo
5dcf8f3555 (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.
2008-09-13 14:19:20 +02:00
Andy Wingo
6cdcb824f0 fix confusion in disassemble-bindings
* module/system/vm/disasm.scm (disassemble-bindings): Fix external/local
  confusion when printing args and locals.
2008-09-13 14:19:20 +02:00
Andy Wingo
535ed4d041 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'.
2008-09-13 14:19:20 +02:00
Andy Wingo
709f95afcd correctly disassemble program bindings (arguments, locals, externals)
* module/system/vm/disasm.scm (disassemble-bindings): New function,
  properly disassembles the bindings data. Neat!
2008-09-12 18:01:02 +02:00
Andy Wingo
e91e07811a really newline on eof
* module/system/repl/repl.scm (next-char): Another newline-on-eof case.
2008-09-09 08:33:53 +02:00
Andy Wingo
624e533f4f fix program disassembly for meta-in-a-thunk
* module/system/vm/disasm.scm (disassemble-program): Fix for recent
  meta-in-a-thunk change.
2008-09-09 08:27:49 +02:00
Andy Wingo
6a01fabfd0 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.
2008-09-09 08:23:10 +02:00
Andy Wingo
02ed0d3df2 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.
2008-09-09 07:54:23 +02:00
Andy Wingo
8e3670748f 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.
2008-09-09 07:15:01 +02:00
Andy Wingo
1a1a10d3a5 use #:keywords in module/*.scm, not :keywords
* module/system/base/syntax.scm (keywords): Don't enable :keywords, it
  breaks code that may assume that ':foo is a symbol, like boot-9.

* module/*.scm: Don't use :keywords, use #:keywords. The user can decide
  if she wants #:keywords in their .guile, and :keywords might make us
  compile modules differently.
2008-09-09 06:58:25 +02:00
Andy Wingo
13906f976e lazily load meta info, for less consage
* module/system/vm/assemble.scm (make-meta, codegen): Hide the "meta"
  information -- the names of the bindings, source info, procedure
  properties, etc -- behind a lambda. This way, loading up a program
  conses less, because the metadata stays as mmap'd code until it is
  needed.

* libguile/vm-i-loader.c (load-program): Adjust load-program to expect
  the metadata to be a program.

* module/system/vm/program.scm (program-bindings, program-sources)
  (program-properties): Adjust to new meta format.
2008-09-08 01:03:34 +02:00
Andy Wingo
29a321aef0 take procedure->memoizing-macro off of probation
* module/language/scheme/translate.scm (%forbidden-primitives): Take
  procedure->memoizing-macro off probation; although it's not a good
  idea, there is a fair amount of existing code that uses it that can be
  compiled fine. So allow it in that case.
2008-09-07 22:27:18 +02:00
Andy Wingo
1b79210aa2 better diagnostics on quasiquote errors
* module/system/il/compile.scm (constant?, codegen): Add some diagnostics
  so that we can get decent error reporting if we accidentally unquote an
  unreadable value into the compiled output.
2008-09-07 22:27:18 +02:00
Andy Wingo
2e7e6969bd allow multiple modules in one compilation unit
* module/system/il/ghil.scm (<ghil-env>, <ghil-toplevel-env>): Refactor
  so that all environments point (eventually) at one toplevel
  environment. Instead of having potentially multiple toplevel
  environments, each noting the module against which its bindings are
  resolved, have each binding in the toplevel record what module it
  should be resolved in. Should fix compilation units that define
  multiple modules.
  (ghil-lookup, ghil-define): Reworked to not be destructive. Module
  variables now have the module name as their "env", and are keyed as
  `(MODNAME . SYM)' in the var table.
  (call-with-ghil-environment): Reindented.

* module/system/il/inline.scm (try-inline-with-env): Adapt to
  env/toplevel changes.

* module/system/vm/assemble.scm (dump-object!): A vlink-later now holds
  the module name, not the module itself.

* module/system/il/compile.scm (make-glil-var): The "env" of a "module"
  var is now the module name, not the module.

* module/language/scheme/translate.scm (primitive-syntax-table): Update
  the way we test for toplevel environments. Reindent the lambda
  translator.
  (lookup-transformer, trans): lookup-transformer now has 2 args, not 3.
  (translate): Update the way we make toplevel environments.
2008-09-07 22:27:08 +02:00
Andy Wingo
b5c46470a5 improve backtraces
* module/system/vm/frame.scm (frame-call-representation): Show more of
  lists.
  (program-name): Avoid a traceback if (frame-address link) is #f. Not
  sure when this can happen, but it does, and since this is already in
  the backtrace function, there be badness there.
2008-09-07 22:15:25 +02:00
Andy Wingo
97f1153a86 superstition with no important effect
* module/system/vm/assemble.scm (dump-object!): Some superstition, use
  bit arithmetic instead of int arithmetic. Makes me happier.
2008-09-02 11:00:32 -07:00
Andy Wingo
373d251b4d disable start-stack in compiled code
* module/language/scheme/translate.scm (primitive-syntax-table): Disable
  semantics of start-stack in compiled code. I think start-stack
  semantics aren't bad, but they don't have vm-based implementations at
  this point.
2008-09-02 11:00:27 -07:00
Andy Wingo
049af8259b fix Makefile.am in module/language
* module/language/Makefile.am: Actually recurse into scheme/.
2008-09-02 10:30:39 -07:00
Andy Wingo
5c4926209f ditch the 8-bit compiled form of program parameters
* libguile/vm-i-loader.c (load-program):
* module/system/vm/assemble.scm (dump-object!): There are cases in which
  we use the 16-bit representation for program params (nargs, nexts,
  etc), but the actual 16-bit number actually fits into 8 bits -- which
  is then misinterpreted by the loader as the 8-bit form. So ditch the
  8-bit form entirely (it was never much of an optimization), and just
  use the 16-bit form. Make sure to clear out all your .go files before
  recompiling this one!
2008-09-02 10:30:39 -07:00
Andy Wingo
124c52d8bb fix nested quasiquotes (yeepers)
* module/language/scheme/translate.scm (primitive-syntax-table)
  (trans-quasiquote): Fix handling of nested quasiquotes.

* testsuite/Makefile.am (vm_test_files):
* testsuite/t-quasiquote.scm: Add a quasiquote test case.
2008-09-02 10:30:39 -07:00
Andy Wingo
75a09d5ae6 module compilation fixen, post-integration
Thanks to Dale Smith.

* guilec.mk: Rework to expect the includer to define $(modpath), then
  make $(moddir) from that.

* module/language/Makefile.am:
* module/language/scheme/Makefile.am:
* module/system/base/Makefile.am:
* module/system/il/Makefile.am:
* module/system/repl/Makefile.am:
* module/system/vm/Makefile.am: Define modpath instead.

* src/guilec.in: Don't import (system vm bootstrap), it is no more.
2008-08-25 13:05:16 -07:00