summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2018-04-24 20:23:05 -0700
committerKaz Kylheku <kaz@kylheku.com>2018-04-24 20:23:05 -0700
commit74012ba82c2bcbbf4a3cde3da05e497719e41008 (patch)
tree78af3d72a21c6053cf7a0f76ced6a6db66a56fba
parentef1234d530a0caa244778f62f3ec3d9cc295628e (diff)
downloadtxr-74012ba82c2bcbbf4a3cde3da05e497719e41008.tar.gz
txr-74012ba82c2bcbbf4a3cde3da05e497719e41008.tar.bz2
txr-74012ba82c2bcbbf4a3cde3da05e497719e41008.zip
compiler: called function must be listed as free.
When compiling a plain (f x) function call, the resulting frag must list f as a free function. * share/txr/stdlib/compiler.tl (comp-fun-form): Compile the call with comp-call-impl; then pushnew the symbol into the frag's ffuns set list.
-rw-r--r--share/txr/stdlib/compiler.tl10
1 files changed, 6 insertions, 4 deletions
diff --git a/share/txr/stdlib/compiler.tl b/share/txr/stdlib/compiler.tl
index 34dc3128..9dbb1572 100644
--- a/share/txr/stdlib/compiler.tl
+++ b/share/txr/stdlib/compiler.tl
@@ -936,10 +936,12 @@
(arg me.(comp-call oreg env
(if (eq sym 'usr:apply) 'apply sym) args)))))
(ift me.(comp-ift oreg env form))
- (t (let ((fbind env.(lookup-fun sym)))
- me.(comp-call-impl oreg env (if fbind 'call 'gcall)
- (if fbind fbind.loc me.(get-fidx sym))
- args))))))
+ (t (let* ((fbind env.(lookup-fun sym))
+ (cfrag me.(comp-call-impl oreg env (if fbind 'call 'gcall)
+ (if fbind fbind.loc me.(get-fidx sym))
+ args)))
+ (pushnew sym cfrag.ffuns)
+ cfrag)))))
(defmeth compiler comp-call (me oreg env opcode args)
(tree-bind (fform . fargs) args