summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2009-01-30add disassembler that fits in with old compiler towerAndy Wingo4-7/+201
* module/language/assembly/Makefile.am: * module/language/assembly/disassemble.scm: Add a disassembler, based on the old one but fitting in with the decompiler tower. * module/language/objcode/spec.scm (decompile-value): When decompiling programs, shove all the metadata that we know about into the "env". * module/system/base/compile.scm (decompile-fold, decompile): Return the env from `decompile' as a second value. Not sure if `compile' should do this too.
2009-01-30add decompilers that can take us back to assemblyAndy Wingo7-17/+145
* module/language/assembly/Makefile.am: * module/language/assembly/spec.scm: * module/language/assembly/decompile-bytecode.scm: Add a bytecode decompiler. Neat! * module/language/bytecode/spec.scm (decompile-objcode): * module/language/objcode/spec.scm (decompile-value): Add some "decompilers" here too. * module/system/base/compile.scm (current-language): Since we can refer to languages by name, do so here -- removes the previous anti-circularity hack. (compile-file, compile): Refer to target languages by name. (decompile): New public function. Neat! * module/system/base/language.scm (lookup-decompilation-order): Fix so we look for decompilers with the high-level language definition.
2009-01-30allow specification of languages by name; add decompilers to languagesAndy Wingo8-34/+43
* module/system/base/language.scm (lookup-decompilation-order): New function, like its compiling cousin, but backwards. (compute-translation-order): Rework so that languages can be specified either by name or by identity. Return a list of language - procedure pairs, without the "to" language in the list, instead of a list of languages. (invalidate-compilation-cache!): Invalidate the decompilation cache too. (<language>): Add a decompiler field. * module/system/base/compile.scm (compile-passes): Much simpler now that lookup-compilation-order gives us the procedures directly. * module/language/*/spec.scm: Specify compilers by name, so that we can avoid unnecessary module loads, and so that when we specify decompilers, we can avoid cycles.
2009-01-30remove glil->objcode path in favor of passing through assembly; refactorings.Andy Wingo6-449/+34
* module/language/assembly.scm: Refactor a bit; remove the name "code" from the API, as it's too generic, and replace with "assembly". * module/language/assembly/compile-bytecode.scm: Get byte lengths via, well, byte-length. * module/language/glil/Makefile.am: * module/language/glil/spec.scm: * module/language/glil/compile-objcode.scm: Remove compile-objcode, as we just go through bytecode now. * module/language/glil/compile-assembly.scm (glil->assembly) (dump-object): s/object->code/object->assembly/.
2009-01-30add new language between assembly and objcode: bytecodeAndy Wingo8-20/+56
* module/language/bytecode/Makefile.am: * module/language/bytecode/spec.scm: Add another language to the stack, bytecode. Bytecode is the u8vector form of object code.. * configure.in: * module/language/Makefile.am: * module/language/assembly/Makefile.am: * test-suite/tests/asm-to-bytecode.test: * module/language/assembly/spec.scm: * module/language/assembly/compile-bytecode.scm: Update to include the new pass.
2009-01-29remove GPKG.def filesAndy Wingo2-20/+0
* module/language/ghil/GPKG.def: * module/language/r5rs/GPKG.def: Reove these, they aren't used any more.
2009-01-29static opcodes; refactor program/objcode division; use new assembly pipelineAndy Wingo35-683/+953
* gdbinit: Untested attempts to get the stack fondling macros to deal with the new program representation. * libguile/frames.c (scm_vm_frame_arguments, scm_vm_frame_source) (scm_vm_frame_local_ref, scm_vm_frame_local_set_x): SCM_PROGRAM_DATA is a struct scm_objcode*. * libguile/instructions.h: * libguile/instructions.c: Hide the instruction table and the struct scm_instruction structure; all access to instructions now goes through procedures. This is because instructions are no longer in a packed array indexed by opcode. Also, declare a mask that all instructions should fit in. * libguile/objcodes.h: * libguile/objcodes.c: Rewrite so that object code directly maps its arity and length from its bytecode. This makes it unnecessary to keep this information in programs, allowing programs to be simple conses between the code (objcodes) and data (the object table and the closure variables). * libguile/programs.c (scm_make_program): Rework so that make-program takes objcode, an object table, and externals as arguments. It's much clearer this way, and we avoid malloc(). * libguile/stacks.c (is_vm_bootstrap_frame): Update for program/objcode changes. * libguile/vm-engine.c (vm_run): Initialize the jump table on the first run, with the opcodes declared in the instruction sources, and with bad instructions raising an error instead of wandering off into the Unknown. * libguile/vm-engine.h (FETCH_LENGTH): Always represent lengths as 3 bytes. The old code was too error-prone. (NEXT_JUMP): Mask the instruction with SCM_VM_INSTRUCTION_MASK. (NEW_FRAME): Update for program/objcode changes. * libguile/vm-expand.h (VM_DEFINE_FUNCTION, VM_DEFINE_INSTRUCTION) (VM_DEFINE_LOADER): Update so that we explicitly specify opcodes, so that we have a stable bytecode API. * libguile/vm-i-loader.c: Update license to LGPLv2+. Explicitly declare opcodes. (load-integer): Use an int instead of a long as the accumulator; still need to revisit this code at some point, I think. (load-program): Simplify, thankfully!! Just creates the objcode slice and rolls with it. * libguile/vm-i-scheme.c: Number the opcodes explicitly. * libguile/vm-i-system.c: Update license to LGPLv2+. Explicitly declare opcodes. (make-closure): Update for new program API. * libguile/vm.c (vm_make_boot_program): Update for new program/objcode API. Still a bit ugly. (scm_load_compiled_with_vm): Update for new program/objcode API. * module/language/assembly.scm (byte-length): Fix byte-length calculation for loaders, and load-program. (code-pack, code-unpack): Start to move things from (system vm conv) here. (object->code, code->object): More things from conv.scm. * module/language/glil.scm (<glil-program>): Add a new field, closure-level. (make-glil-program, compute-closure-level): Calculate the "closure level" when making a glil program. This is the maximum depth of external binding refs in this closure. (unparse-glil): Fix label serialization. * module/language/glil/compile-assembly.scm (make-meta): Prepend #f for the meta's object table, though maybe in the future we can avoid creating assembly in the first place. (assoc-ref-or-acons, object-index-and-alist): GRRR! Caught again by the different sets of arguments to assoc and assoc-ref! (glil->assembly): Attempt to make the <glil-program> case more readable, and fix the bugs. Sorry I don't know how to comment this change any more than this. (glil->assembly): For <glil-module> serialize the whole key, not just the name. (dump-object): subprogram-code is already a list. Serialize integers as strings, not u8vectors. Fix the order of lists and vectors. * module/language/glil/spec.scm (glil): Switch orders, so we prefer glil -> assembly -> objcode. Actually glil->objcode doesn't work any more, needs to be removed I think. * module/language/objcode/spec.scm (objcode->value): s/objcode->program/make-program/. * module/language/scheme/inline.scm: Add acons inline. * module/system/vm/conv.scm (make-byte-decoder): Skip the first 8 bytes, they are header. Handle subprograms properly. Still needs help though. (decode-length): Lengths are always 3 bytes now. * module/system/vm/disasm.scm: Superficial changes to keep things working. I'd like to fix this better in the future. * module/system/vm/frame.scm (bootstrap-frame?): Fixes for program-bytecode. * module/system/vm/program.scm: Export make-program. It's program-objcode now, no more program-bytecode. * module/system/vm/vm.scm (vm-load): Use make-program. * test-suite/tests/asm-to-bytecode.test: New test, very minimal. * module/system/vm/objcode.scm: Export word-size, byte-order, and write-objcode.
2009-01-19add assembly intermediate languageAndy Wingo7-3/+444
* configure.in: * module/language/Makefile.am: * module/language/assembly/Makefile.am: Automakery. * module/language/assembly.scm: * module/language/assembly/spec.scm: Add a new language, which is oddly even lower than GLIL. I got tired of GLIL's terrible compile-objcode.scm, and wanted a cleaner intermediate format. * module/language/glil/compile-assembly.scm: A purely-functional assembler, that produces "assembly". Will document later. * module/language/glil/spec.scm: Declare the compiler to assembly.
2009-01-17move module and meta inside programs' object tablesAndy Wingo9-61/+64
* libguile/programs.h (struct scm_program): Remove the module and meta fields. * libguile/programs.c (scm_c_make_program): Add a new argument, `objs'. If it's a vector, we'll look for the module and the metadata in there, instead of having them in the scm_program structure. (scm_c_make_closure, program_mark, scm_program_meta) (scm_c_program_source, scm_program_module): Adapt to the new program representation. * libguile/objcodes.c (scm_objcode_to_program): Pass #f as the object table when making the program. * libguile/vm-engine.h (CACHE_PROGRAM): * libguile/vm-engine.c (vm_run): Rework to use the simple vector API for getting the current object table. Call the helper, vm_make_boot_program, to make the boot program. * libguile/vm-i-loader.c (load-program): Set the current module and the meta in the object vector, which we pass to scm_c_make_program. * libguile/vm-i-system.c (toplevel-ref, toplevel-set): Adapt to the new program representation. * module/language/glil/compile-objcode.scm (codegen): Clarify.
2009-01-17placeholder for meta and module in a program's object tableAndy Wingo1-22/+22
* module/language/glil/compile-objcode.scm (codegen): If the generated objcode will have a meta or it has objects, prepend two cells to the object table: one for the meta, and one for the module. This is a placeholder for future work.
2009-01-15fold in ludovic's suggestions for new manual sectionsAndy Wingo3-97/+45
* INSTALL: Update from newest merge * doc/ref/compiler.texi: * doc/ref/vm.texi: Fold in Ludovic's suggestions
2009-01-15Merge commit 'origin/master' into vmAndy Wingo31-965/+2948
Conflicts: INSTALL
2009-01-15Invoke gnulib-tool with --no-vc-files option, andNeil Jerram10-926/+3
remove files that should not have been committed to the repository.
2009-01-15Revert lib/.gitignore and m4/.gitignore to how they should beNeil Jerram2-0/+2
(before my confused Gnulib commits...)
2009-01-15Revert unintended change to INSTALL made by commit ↵Neil Jerram1-20/+77
4a462e35440fdc3f10b0f88b3fb737fa76ed146d
2009-01-15Add more missing Gnulib filesNeil Jerram16-17/+2303
2009-01-14Add more missing Gnulib filesNeil Jerram4-3/+552
2009-01-14Add missing Gnulib file (m4/localcharset.m4)Neil Jerram2-1/+16
2009-01-13fix marking empty VM continuationsAndy Wingo4-11/+15
* libguile/vm.h (struct scm_vm_cont): * libguile/vm.c (capture_vm_cont, reinstate_vm_cont): Change so we just store the registers as they are, with the reloc. (vm_cont_mark): Only mark the stack if it has elements on it, otherwise we get a bogus fp. * libguile/stacks.c (scm_make_stack): Update for change to vm continuations.
2009-01-12Merge branch 'master' into vmAndy Wingo51-1108/+92141
2009-01-12Fixlet for `run-benchmark.scm'.Ludovic Courtès1-1/+2
* gc-benchmarks/run-benchmark.scm (%default-options): Default to the empty list for `input'.
2009-01-12gc-benchmarks: Adapt `gcold.scm' so that if conforms to the framework.Ludovic Courtès1-3/+5
* gc-benchmarks/larceny/gcold.scm (main): Rename to `gcold-benchmark'. (GCOld): Fix the order of the predicate and run-maker.
2009-01-12gc-benchmarks: Add `gcold.scm', by Clinger, Hansen et al.Ludovic Courtès1-0/+384
See http://www.ccs.neu.edu/home/will/Twobit/benchmarksAbout.html for details.
2009-01-12gc-benchmarks: Add `run-benchmark.scm'.Ludovic Courtès1-0/+268
2009-01-12gc-profile: Show the result of `(version)'.Ludovic Courtès1-1/+1
* gc-benchmarks/gc-profile.scm (main): Show `(version)'.
2009-01-12gc-benchmarks: Allow the iteration count to be passed to `gc-profile.scm'.Ludovic Courtès2-60/+54
* gc-benchmarks/gc-profile.scm (*iteration-count*): New parameter. (run-benchmark): Moved from `twobit-compat.scm'. Honor `*iteration-count*'. (%options): Add `--iterations'. (show-help): Document it. (main): Parameterize `*iteration-count*'.
2009-01-12Import GC benchmarks from Larceny, by Hansen, Clinger, et al.Ludovic Courtès21-0/+89532
These GPLv2+-licensed GC benchmarks are available from http://www.ccs.neu.edu/home/will/GC/sourcecode.html .
2009-01-12gc-benchmarks: Add a Larceny/Twobit benchmark compatibility layer.Ludovic Courtès2-12/+144
* gc-benchmarks/gc-profile.scm: Load "twobit-compat.scm". (save-directory-excursion, load-larceny-benchmark): New procedures. (%options): New variable. (show-help, parse-args): New procedures. (main): Use `parse-args' and `load-larceny-benchmark'.
2009-01-12Add GC benchmarks.Ludovic Courtès5-0/+402
2009-01-12Make sure that we have a real on-the-stack alloca()Neil Jerram23-1108/+1426
Because of how Guile saves and restores continuations (by copying the stack), and how it uses alloca to create space for debug information on the stack, we must have an alloca() that really does use the stack, and not one that uses the heap. To do this, we use the Gnulib "alloca-opt" module instead of "alloca". This commit also updates the Gnulib sources from the current Gnulib Git repository.
2009-01-12remove a paranoid define; fix bitrot in measure.scm.Andy Wingo2-5/+3
* benchmark/measure.scm (measure): Fix bitrot. * libguile/vm.c (VM_ENABLE_STACK_NULLING): Undefine this, as it hasn't caught any errors in quite a while.
2009-01-12fix mismerge on srfi-19.scmAndy Wingo1-2/+2
* module/srfi/srfi-19.scm (priv:locale-abbr-weekday->index): Whoops, fix broken manual merge on srfi-19.scm.
2009-01-12fix typo when compiling receive formsAndy Wingo1-1/+1
* module/language/glil/compile-objcode.scm (codegen): Fix an embarassing typo, introduced in c2c82b62f40242a4212528c3d3e882038b48f0a2
2009-01-12Merge commit 'origin/master' into vmAndy Wingo89-4369/+2412
Conflicts: .gitignore guile-tools.in srfi/srfi-19.scm
2009-01-11fold in neil's feedback to history.texiAndy Wingo1-5/+6
* doc/ref/history.texi: Fold in Neil's feedback
2009-01-11word tweaksAndy Wingo2-8/+22
* doc/ref/guile.texi: Finish some wording. * doc/ref/compiler.texi: Fix some goofiness.
2009-01-11tweaks to compiler.texiAndy Wingo1-5/+3
* doc/ref/compiler.texi: Minor tweaks.
2009-01-11finish compiler.texi, wooAndy Wingo4-92/+153
* libguile/objcodes.c (do-pair): Removed unused debuging hack. * module/language/glil/spec.scm (glil): Simplify a bit. * module/system/repl/repl.scm (default-catch-handler): Don't catch vm-error, as vm-backtrace doesn't exist any more. * doc/ref/compiler.texi: Finish documenting GLIL and object code.
2009-01-11rename <glil-asm> to <glil-program>Andy Wingo4-79/+290
* module/language/glil.scm (<glil-program>): Rename from <glil-asm>. * module/language/ghil/compile-glil.scm (codegen): * module/language/glil.scm (parse-glil, unparse-glil): * module/language/glil/compile-objcode.scm (preprocess, codegen): Adapt to naming change.
2009-01-11remove useless <glil-vars> helper type, serialize GHIL more strictlyAndy Wingo5-68/+58
* module/language/ghil.scm (parse-ghil, unparse-ghil): Rework to make the parse format correspond more closely with the object representation, so that I only have to document it once in the manual. The salient change is that no expression is self-quoting, and that variable references should go through `(ref FOO)'. Rename `set!' to `set'. * module/language/ghil/compile-glil.scm: Add a couple of compilers for unquote and unquote-splicing, that just raise an error. This way I can document unquote and unquote-splicing as normal ghil expressions, except that it's the compiler that catches them if they're outside a quasiquote. (codegen): Adapt to change in <glil-asm>. * module/language/ghil/spec.scm (parse): Fix parser typo bug. * module/language/glil.scm (<glil-asm>): Remove useless <glil-vars> structure, which also had a confusing name. Just put the nargs, nrest, nlocs, and nexts in the <glil-asm> directly. (parse-glil, unparse-glil): Serialize `asm' more straightforwardly. * module/language/glil/compile-objcode.scm (<bytespec>): Remove <glil-vars>, as with <glil-asm>. (preprocess, make-meta, codegen, dump-object!): Adapt to change in <glil-asm>.
2009-01-09rename translate.scm to compile-ghil.scm, and more work on compiler.texiAndy Wingo10-47/+208
* doc/ref/api-evaluation.texi: Fix some typos and xrefs. * doc/ref/compiler.texi (The Scheme Compiler): Document the scheme compiler, and start documenting the GHIL language. * doc/ref/guile.texi (Guile Implementation): Whoops, put autoconf after the implementation foo. Unless we want it before? * doc/ref/history.texi (The Emacs Thesis): Fix typo. * doc/ref/vm.texi (Environment Control Instructions): Rename offset to index. * module/language/ghil.scm (parse-ghil): Fix what I think was a bug -- the consumer in a mv-call shouldn't be a rest arg. * module/language/scheme/Makefile.am (SOURCES): * module/language/scheme/compile-ghil.scm: Rename this file from translate.scm. * module/oop/goops.scm: * module/language/scheme/spec.scm: Deal with renaming.
2009-01-09fix some xrefs, flesh out compiler.texi a bit moreAndy Wingo3-65/+160
* doc/ref/api-debug.texi: * doc/ref/vm.texi: Fix some cross-references. * doc/ref/compiler.texi: Hack some more, finishing the section on the compiler tower.
2009-01-09finish api-procedures.texiAndy Wingo1-22/+86
* doc/ref/api-procedures.texi: Finish documenting bits on compiled procedures.
2009-01-08more work on api-procedures.texiAndy Wingo2-29/+80
* doc/ref/api-procedures.texi (Compiled Procedures): Stub out these docs some more, taking some commented-out docs from vm.texi. * doc/ref/vm.texi: Move docs ^.
2009-01-08start at documenting the compilerAndy Wingo5-8/+247
* doc/ref/api-evaluation.texi: Add documentation for the standard compilation interface, and some notes about compiled files. * doc/ref/api-procedures.texi (Compiled Procedures): A stub at documenting compiled procedures. * doc/ref/compiler.texi (Compiling to the Virtual Machine): Flesh out with some structure, though much of the text remains to be written. This stuff is hard to write!
2009-01-08(language ghil def) becomes (language ghil)Andy Wingo12-15/+18
* module/language/Makefile.am: * module/language/ghil/Makefile.am: * module/language/ghil.scm: * module/language/ghil/compile-glil.scm: * module/language/ghil/spec.scm: * module/language/glil/Makefile.am: * module/language/glil.scm: * module/language/glil/compile-objcode.scm: * module/language/glil/spec.scm: * module/language/scheme/inline.scm: * module/language/scheme/translate.scm: * module/oop/goops.scm: Rename (language ghil def) and (language glil def) to not have the "def". They're nicer names.
2009-01-08move lang-specific modules, e.g. (system il compile) to (language ghil ↵Andy Wingo16-36/+33
compile-glil) * configure.in: Remove module/system/il directory. * module/language/ghil/Makefile.am (SOURCES): * module/language/ghil/compile-glil.scm (system): * module/language/ghil/def.scm (language): * module/language/ghil/spec.scm (language, ghil): * module/language/glil/Makefile.am (SOURCES): * module/language/glil/compile-objcode.scm (language): * module/language/glil/def.scm (language): * module/language/glil/spec.scm (language, compile): * module/language/scheme/Makefile.am (SOURCES): * module/language/scheme/inline.scm (system, define-inline): * module/language/scheme/translate.scm (language): Move files, renaming the modules. * module/oop/goops.scm (load-toplevel): Unfortunately the GHIL name leaked here. Patch it up. * module/system/vm/Makefile.am (SOURCES): Remove assemble.scm.
2009-01-06react to comments by ludovic on history.texiAndy Wingo1-11/+12
* doc/ref/history.texi: Adjust to some of Ludovic's comments.
2009-01-06finish vm.texi except referencesAndy Wingo1-236/+368
* doc/ref/vm.texi: Finish writing the VM reference, all correct except for the missing references.
2009-01-04NEWS entry for %fast-slot-ref/set! fixNeil Jerram1-0/+6