Forked from
cmucl / cmucl
Source project has a limited visibility.
-
rtoy authored
nreverse) modify constant args and for warning when the result of destructive functions is not used. Detecting modification of constant args is done by adding a new IR1 transformation that checks that a function is not destructively modifying constants or literals. A new IR1 attribute, important-result, is used to determine if the result of a function should be used instead of discarded. (Note: this means some functions are not detected. This should probably be implemented as another transform so the compiler can detect those cases.) code/error.lisp: o Add new condition CONSTANT-MODIFIED. compiler/fndb.lisp: o Note destructive functions that should not modify constant args o Note destructive functions whose results should be used. compiler/ir1opt.lisp: o Add new function CHECK-IMPORTANT-RESULT to check if the result is used. o Update IR1-OPTIMIZE-COMBINATION to check if a function destructively modifies constant args or if the result of a destructive function is not used. compiler/knownfun.lisp: o Add new IR1 attribute, IMPORTANT-RESULT, to indicate that the result of a function should be used. o Add new FUNCTION-INFO slot, DESTROYED-CONSTANT-ARGS. This holds a function for computing the constant or literal arguments which are destructively modified by the function. o Add support functions for DESTROYED-CONSTANT-ARGS functions.
rtoy authorednreverse) modify constant args and for warning when the result of destructive functions is not used. Detecting modification of constant args is done by adding a new IR1 transformation that checks that a function is not destructively modifying constants or literals. A new IR1 attribute, important-result, is used to determine if the result of a function should be used instead of discarded. (Note: this means some functions are not detected. This should probably be implemented as another transform so the compiler can detect those cases.) code/error.lisp: o Add new condition CONSTANT-MODIFIED. compiler/fndb.lisp: o Note destructive functions that should not modify constant args o Note destructive functions whose results should be used. compiler/ir1opt.lisp: o Add new function CHECK-IMPORTANT-RESULT to check if the result is used. o Update IR1-OPTIMIZE-COMBINATION to check if a function destructively modifies constant args or if the result of a destructive function is not used. compiler/knownfun.lisp: o Add new IR1 attribute, IMPORTANT-RESULT, to indicate that the result of a function should be used. o Add new FUNCTION-INFO slot, DESTROYED-CONSTANT-ARGS. This holds a function for computing the constant or literal arguments which are destructively modified by the function. o Add support functions for DESTROYED-CONSTANT-ARGS functions.