#40: Non-constant function-argument initforms ------------------------+--------------------------------------------------- Reporter: ehuelsmann | Owner: ehuelsmann Type: defect | Status: new Priority: major | Milestone: Component: compiler | Version: Keywords: | ------------------------+--------------------------------------------------- The compiler doesn't support non-constant initforms for compiled functions. One way to work around this would be to take advantage of the existing processArgs() functionality in Closure.java. It's used by the interpreter to evaluate non-constant initforms.
In order to re-use the functionality, the compiler would need to create an Environment object and set it up with the variables used in the initforms for the interpreter to access.
This can be done by removing the CompiledClosure wrapper around ClosureTemplateFunction. The ClosureTemplateFunction should support being .execute()-ed directly (instead of through the wrapper). The compiler should then set a context record (array of LispObjects) currently carried around in CompiledClosure directly in ClosureTemplateFunction. The Environment object should be used to set the 'environment' field in ClosureTemplateFunction.
#40: Non-constant function-argument initforms -------------------------+-------------------------------------------------- Reporter: ehuelsmann | Owner: ehuelsmann Type: defect | Status: new Priority: major | Milestone: Component: compiler | Version: Resolution: | Keywords: -------------------------+--------------------------------------------------
Comment(by ehuelsmann):
Current progress is:
- CTF is now used directly instead of being wrapped. - Once a CTF has been loaded/created, it's duplicated using clone() - After cloning, the context record is set to the desired value.
Remain a number of things to do:
- analyse initforms for the variables they use - create the environment object using this information
#40: Non-constant function-argument initforms -------------------------+-------------------------------------------------- Reporter: ehuelsmann | Owner: ehuelsmann Type: defect | Status: closed Priority: major | Milestone: Component: compiler | Version: Resolution: fixed | Keywords: -------------------------+-------------------------------------------------- Changes (by ehuelsmann):
* status: new => closed * resolution: => fixed
Comment:
Fixed by rewriting the lambda list into a series of let* forms, using the SUPPLIED-P argument to determine whether to evaluate the initform or not.
armedbear-ticket@common-lisp.net