diff options
author | Andy Wingo <wingo@pobox.com> | 2009-01-30 14:12:57 +0100 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2009-01-30 14:12:57 +0100 |
commit | d7236899f5752fab1ad1e8d3e5b51cfe18abe5c7 (patch) | |
tree | f91d833a7d8a048d81b8cd5e62d9b40a77958a53 /module/language/objcode/spec.scm | |
parent | 7b107cceb9adcc966b639fd2c217f4708b53a2aa (diff) | |
download | guile-d7236899f5752fab1ad1e8d3e5b51cfe18abe5c7.tar.gz |
add disassembler that fits in with old compiler tower
* 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.
Diffstat (limited to 'module/language/objcode/spec.scm')
-rw-r--r-- | module/language/objcode/spec.scm | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/module/language/objcode/spec.scm b/module/language/objcode/spec.scm index ce67dcff5..d4212be48 100644 --- a/module/language/objcode/spec.scm +++ b/module/language/objcode/spec.scm @@ -46,8 +46,25 @@ (define (decompile-value x env opts) (cond ((program? x) - (values (program-objcode x) - (cons (program-objects x) (program-externals x)))) + (let ((objs (program-objects x)) + (meta (program-meta x)) + (exts (program-external x)) + (binds (program-bindings x)) + (srcs (program-sources x)) + (nargs (arity:nargs (program-arity x)))) + (let ((blocs (and binds + (append (list-head binds nargs) + (filter (lambda (x) (not (binding:extp x))) + (list-tail binds nargs))))) + (bexts (and binds + (filter binding:extp binds)))) + (values (program-objcode x) + `((objects . ,objs) + (meta . ,(and meta (meta))) + (exts . ,exts) + (blocs . ,blocs) + (bexts . ,bexts) + (sources . ,srcs)))))) ((objcode? x) (values x #f)) (else |