diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2018-03-24 20:27:07 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2018-03-24 20:27:07 -0700 |
commit | a76b8a11da5e6bbc8a46466e12d113c2558dd20e (patch) | |
tree | 47564b933dedc68d06d69c87069fb8a6505934f8 | |
parent | 3f8f5ac3be4766ab9947adcce305a6134c88f572 (diff) | |
download | txr-a76b8a11da5e6bbc8a46466e12d113c2558dd20e.tar.gz txr-a76b8a11da5e6bbc8a46466e12d113c2558dd20e.tar.bz2 txr-a76b8a11da5e6bbc8a46466e12d113c2558dd20e.zip |
compiler: specially compile (call ...) forms.
* share/txr/stdlib/compiler.tl (compiler comp-fun-form): Add a
caseq form to handle certain top-level functions specially.
Add a case for the call function, handled by comp-call.
(compiler comp-call): New method.
-rw-r--r-- | share/txr/stdlib/compiler.tl | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/share/txr/stdlib/compiler.tl b/share/txr/stdlib/compiler.tl index d95254bb..798514f7 100644 --- a/share/txr/stdlib/compiler.tl +++ b/share/txr/stdlib/compiler.tl @@ -653,7 +653,19 @@ (((fbind env.(lookup-fun sym))) me.(comp-call-impl oreg env 'call fbind.loc args)) (((fidx me.(get-fidx sym))) - me.(comp-call-impl oreg env 'gcall fidx args)))) + (caseq sym + (call me.(comp-call oreg env args)) + (t me.(comp-call-impl oreg env 'gcall fidx args)))))) + +(defmeth compiler comp-call (me oreg env args) + (tree-bind (fform . fargs) args + (let* ((ffrag me.(compile oreg env fform)) + (cfrag me.(comp-call-impl oreg env 'call ffrag.oreg fargs))) + (new (frag cfrag.oreg + (append ffrag.code + cfrag.code) + (uni ffrag.fvars cfrag.fvars) + (uni ffrag.ffuns cfrag.ffuns)))))) (defmeth compiler comp-call-impl (me oreg env opcode freg args) (let* ((sugg-oregs (mapcar (ret me.(alloc-treg)) args)) |