Release 1.4.1 of CL-Forth
Optimization
CL-Forth now includes an experimental optimizer which tries to simplify the code generated by CL-Forth by eliminating as much use of the data stack as possible. There are additional optimizations applied to eliminate unnecessary validity checks when those checks can be shown to be redundant. (E.g, checking that the character count given to TYPE
is not negative.)
The optimizer is controlled by a boolean flag whose address is stored in the OPTIMIZER
variable. You change the value of this flag using the words ON
and OFF
.
To turn the optimizer on, execute OPTIMIZER ON
and to turn it off, execute OPTIMIZER OFF
.
Under SBCL, the Forth test suite runs approximately 33% faster and generates approximately 25% less object code.
By default, the optimizer is off.
Other Changes
- When using the
:forth-source-file
ASDF module type, if a Forth exception occurs while loading a Forth source file, display the exception phrase, Forth backtrace, data stack, and the source line that generated the error. (asdf:test-system '#:cl-forth)
now runs the Forth test suite twice, first with the optimizer off and then with the optimizer on. If an error occurs during the test suite, CL-Forth displays the Forth backtrace and data stack.- Increase the maximum number of locals in a definition from 16 to 32.
- Add
SETINLINEABLE
to enable or disable the inlining of an existing word. (E.g.,FALSE SETINLINEABLE U.
) - Add
P.
to display the top of the stack as a pointer (i.e., 16 hex digits). - Inline foreign function calls
- Inline references to variables defined by
VALUE
,2VALUE
, andFVALUE
. - Save the state of backtrace-on-error (
SHOW-BACKTRACES
) and the optimizer (OPTIMIZER
) in templates.