Parent Directory | Revision Log
|Links to HEAD:||(view) (annotate)|
|Links to snapshot-2011-01:||(view) (annotate)|
Remove _N"" reader macro from docstrings when possible.
Merge intl-branch 2010-03-18 to HEAD. To build, you need to use boot-2010-02-1 as the bootstrap file. You should probably also use the new -P option for build.sh to generate and update the po files while building.
Fix Trac #25. Don't set continuation-dest to continuation-next in FLUSH-DEAD-CODE when safety is 3. Just don't do anything. The generated code remains but doesn't deliver the result anywhere, but that's ok in SAFE mode.
From Helmut Eller, cmucl-imp, 2007/11/29: the following example gets miscompiled: (defun foo () (let ((<= (symbol-function 'list))) (lambda (x y) (funcall <= x y)))) (assert (equal (funcall (foo) 'a 'b) '(a b))) It seems to me that the compiler inappropriately applies a source transformation because the local variable happens to have a function type. (This happens also for symbols other than <=, e.g. char= .) The following patch fixes that. It seems to me, that we can use the secondary return of VALIDATE-CALL-TYPE (info) to decide whether we deal with a global variable, because VALIDATE-CALL-TYPE indirectly calls RECOGNIZE-KNOWN-CALL which does the proper checks for a global variable.
Change how the important-result stuff is implemented. We no longer use an IR1 attribute but allow arbitrary functions to determine if the result is used or not. This allows us to handle SORT and ADJUST-ARRAY depending on the args. Use 19c/boot-2005-11-1.lisp to bootstrap this change. compiler/knownfun.lisp: o Remove IMPORTANT-RESULT attribute. o Add new slot to function-info the hold the function to indicate if the result is not used. o Adjust %defknown with a new keyword arg :result-not-used for the new slot. o Add functions for the result-not-used arg for o SORT-RESULT-NOT-USED-P: non-NIL if the sequence might be a list. o ADJUST-ARRAY-RESULT-NOT-USED-P: non-NIL if the array is not known to be adjustable. o FUNCTION-RESULT-NOT-USED-P: non-NIL if function result must be used (for functions like nreverse). compiler/ir1opt.lisp: o Remove now unused function CHECK-IMPORTANT-RESULT o Add check in IR1-OPTIMIZE-COMBINATION to see if function result should be used. compiler/fndb.lisp: o Remove IMPORTANT-RESULT attribute and replace with :result-not-used.
Port SBCL'S support for detecting when destructive functions (such as 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.
Apply patch from Jan Rychter that implements return-from-frame (debug-return). No bootstrap file or cross-compile needed. Return-from-frame only works when debug = 3.
* src/compiler/eval-comp.lisp (compile-for-eval): Delete unreachable blocks, similar to ir1-optimize, which we don't call. This simplifies things by reducing the differences between "normal" compilation and compiling for interpretation. * src/compiler/ir1util.lisp (block-unreachable-p): New function. (delete-lambda): Mark return blocks for deletion again. * src/compiler/ir1opt.lisp (ir1-optimize): Use block-unreachable-p. Delete unreachable blocks after the loop.
(compile nil '(lambda (a c) (if nil (unwind-protect (max 521739 (unwind-protect c))) (logandc2 3942 a)))) => nil is not of type ref * src/compiler/ir1opt.lisp (find-result-type): Ignore uses whose home lambda or block is deleted. From SBCL.
ANSI test misc.14 => case failure in continuation-proven-type * src/compiler/ir1opt.lisp (continuation-proven-type): Return *empty-type* for unused continuations.
FIXME: Dead code elimination sometimes leaves spurious references to unused lambda-vars. Unused vars are not packed, and so have a tn but a null tn-offset. Some of these cases have been fixed, but not all of them, and since it's not sure if/when all of them will be fixed, add a hack for these cases. * src/compiler/debug-dump.lisp (dump-1-variable): If the tn-offset of a tn is null, set the tn to nil. (compile nil '(lambda (a b) (declare (optimize (speed 3) (debug 1))) (let ((v7 (let ((v2 (block b5 (return-from b5 (if t b -4))))) a))) -65667836))) => error nil is not integer, in dump-1-variable. This is caused by an exit from the return-from being deleted, while leaving the exit's value untouched, which leads to a remaining reference to lambda-var b, which is unused and therefore not being packed. * src/compiler/ir1opt.lisp (maybe-delete-exit): When no node receives the value of the exit, flush the dest of the exit's value.
(compile nil '(lambda (a b c) (declare (notinline logandc2 not)) (declare (optimize (safety 3))) (declare (optimize (speed 0))) (declare (optimize (debug 0))) (let ((v10 (let ((v5 (if (not nil) -4 (logandc2 68392 c)))) c))) a))) => assertion failure, (not (block-delete-p block)) * src/compiler/ir1opt.lisp (recognize-known-call): Treat :inline and :maybe-inline like :notinline if byte-compiling or converting for interpreter. Reported by Paul Dietz.
Fix for various ANSI test cases that fail when compiled because argument type checks are constant-folded away. * src/compiler/ir1opt.lisp (constant-fold-call): In safe code, don't constant-fold a call if one of its arguments requires a type check. * src/compiler/checkgen.lisp (probable-type-check-p): Return true for :error type-checks if safety = 3. Fix ENDP.* test failures when running tests compiled. From SBCL, basically. * src/compiler/ir1opt.lisp (ir1-optimize, ir1-optimize-if): Don't eliminate if-tests requiring type checks. * src/compiler/checkgen.lisp (continuation-check-types): Add parameter force-hairy. (generate-type-checks): Call continuation-check-types with force-hairy true for :error continuations in safe code.
Fix for compiled test cases of the form (PROGN (FBOUNDP 42) T), which don't signal an error in safe code because such calls are flushed when the called function is FLUSHABLE and the value of the call is not used. * src/compiler/ir1opt.lisp (flush-dead-code): Suppress flushing of flushable known functions if safety = 3.
ANSI test fixes, interpreted code. * src/compiler/ir1opt.lisp (recognize-known-call): Don't inline if *converting-for-interpreter*. This suppresses inlining when generating IR1 for interpretation because no type-checking IR1 is generated in this case, and the interpreter, internal-apply-loop for instance, doesn't do type checks is some other way either.
Change most PROCLAIMs to DECLAIMs.
o After propagate-let-args, delete the let when none of the variables are referenced, rather than also checking that none are set. Problems related to lambda-vars without a home may have been resolved now.
Add the ability to delay IR1 transforms, giving type and constraint propagation a chance before transforming to less amiable forms. A transform may now choose to be delayed by calling delay-transform giving a reason. The two supported reasons are :optimize to delay until IR1 optimization has completed, and :constraint to delay until after constraint propagation.
Flush unnecessary function proclaim's some of which had incorrect return values, and replace them with function argument declarations which the compiler move carefully checks.
Reworking of the values-type system to overcome a number of inconsistencies causing problems: o Redefine coerce-to-values to convert a single value type into (values type), rather than the former definition (values type &rest t). A single value type such as fixnum is now equivalent to (values fixnum). Values-type-union and values-type-intersection will canonicalise values types with a single value such as (values fixnum) back to a single value type such as fixnum. o Now when the compiler makes assertions for the first value of continuations that may be generating multiple values it asserts the type as (values type &rest t), or as (value &optional type &rest t) if it is not sure that the continuation does generate a value. o Enhance the type check generation to better handle the now common values types with optional and rest arguments. Add the new function Values-types-asserted which converts asserted optional and rest arguments to required arguments that have been proven to be delivered, Thus an assertion such as (values &optional fixnum &rest t) will generate a fixnum type check if the proven type if (values t). o The compiler is now far more likely to pickup attempts to use an assertion to select a subset of values. For example (the (values fixnum) (values x y)) will generated a compiler warning. o Update single values type assertions where appropriate to clarify that the received values may be optional or that multiple values may be received. For example, a macro argument which had been asserted to be a list via (the list ,...) would now be asserted to be (the (values &optional list &rest t)) etc. o Have the IR1 translator for THE convert single value types into (values &optional type &rest t) so that code such as (the fixnum (values x y)) will still work acceptably. This does not restrict the possible type assertions as the values types may be used and are not modified.
Enhance ir1-optimize-mv-bind to propagate the type of optional or rest value types, using the new support function values-types-defaulted.
o Skip substitute-single-use-continuation if CONT's assertion is incompatbile with the proven type of ARG, such as when ARG returns multiple values and CONT has a single value assertion. o After propagate-let-args, only delete the let when none of the variables are set, otherwise an unreferenced variable that is set can end up without a home which would be unexpected by later stages of the compiler. o Correct and enhance the values deftransform to adjust the node continuation asserted type which may otherwise be inconsistent with the new single value type, and set the node derived type to the received single-value-type.
This set of changes removes nearly all references to the dylan language. It is a benign revision as no structures are redefined. At some later point the definitions in compiler/objdef could be removed, perhaps in sync with some other type change.
When constant-folding succeeds alway transform the call so that even non-flushable functions are flushed. For single value calls it had been just unlinking the result and inserting the constant but this failed to flush the call if it didn't have a flushable attribute, for example numeric constant coercions were not being flush when successful leading to rather inefficient code.
Fix headed boilerplate.
In propagate-local-call-args, don't do anything if there is an optional-dispatch specified. The last fixed entry point won't be referenced by the XEP, so we can't count on that providing a T type input.
In PROPAGATE-LOCAL-CALL-ARGS, be prepared the possibility that other refs to the function have no dest (and are going to be deleted.)
Don'e use info function info for dylan-function-var, instead get the info from the dylan-function-var-function-info slot.
In inline expansion, *byte-compiling* => (byte-compiling)
When byte-compiling, don't do any inline expansion, and only do ir1 transforms explicitly annotated as relevant.
Fixed call to CONTINUATION-DERIVED-TYPE to be CONTINUATION-TYPE so that we don't choke on values types in the functional position.
Fixed a bug in type inference which seems to have generally prevented anything from being inferred about function result types.
Fixed VALIDATE-CALL-TYPE to correctly handle calls where there is no function type guarding the call (for example, calls to lambdas). In this case, we still want to call RECOGNIZE-KNOWN-CALL, since it will figure out what leaf we are referencing, and might also do something else interesting: inline expansion, etc.
Fixed FIND-RESULT-TYPE to correctly handle assignment conversion.
Added a hack to IF-IF optimization to hopefully prevent some spurious unreachable code notes.
In IR1-OPTIMIZE-MV-COMBINATION, only call MAYBE-LET-CONVERT if we suceed in local call converting.
Pass inline-ok argument to IR1-CONVERT-LAMBDA-FOR-DEFUN.
Make propagate-from-sets an entry point.
Make PROPAGATE-TO-REFS an entry point.
Added block compilation declarations. Moved some stuff around to get better locality. Substantially revamped known call reoptimization so that more core is sharable with ir1-conversion. Formerly some stuff (like inline expansion) only happend at ir1-conversion time.
Don't try to reconvert calls to SETF functions with inline expansions in RECOGNIZE-KNOWN-CALL, because it won't work. For now, SETF functions are never inline expanded.
In RECOGNIZE-KNOWN-CALL, reconvert the form if it has an inline expansion or source transform, even if there is no function-info.
Do not SUBSTITUTE-SINGLE-USE-CONTINUATION when *BYTE-COMPILING*.
Moved tail-set merging out of IR1-OPTIMIZE-RETURN into LTN. Changed MAYBE-DELETE-EXIT to call MERGE-TAIL-SETS.
Set COMPONENT-REANALYZE in MAYBE-TERMINATE-BLOCK if we do terminate.
Don't substitute out LET variables when the initial value is a reference to a :NOTINLINE functional. The inlinep information must be retained, since we count on :NOTLININE calls never being local call converted.
Changed SUBSTITUTE-SINGLE-USE-CONTINUATION to not substitute if the continuation type assertions conflict.
Added optimization which deletes MV-BINDS when all variables have been deleted.
Flame out when speed>=brevity if the transform is important.
Don't look at the LAMBDA-TAIL-SET of deleted functions to find out the result type, because there isn't any.
In FIND-RESULT-TYPE, don't call MAYBE-CONVERT-TAIL-LOCAL-CALL on MV-combinations.
Do inconsistent derived type warning only when *CHECK-CONSISTENCY* is T. It seems that we do derive inconsistent types in dead code.
Only call maybe-emit-make-load-forms when we are (producing-fasl-file).
Make constant-fold-call call maybe-emit-make-load-forms on the resultant constant so that it gets dumped correctly.
Give a warning in DERIVE-NODE-TYPE when we prove inconsistent types. This is probably always a bug, but I don't want to use ASSERT until all the problems are fixed. Changed RETURN optimization to call MAYBE-CONVERT-TAIL-CALL. Updated for new tail-set semantics. Changed VALUES IR1 transform and SUBSTITUTE-SINGLE-USE-CONTINUATION to clear out the old NODE-DERIVED-TYPE so that the type doesn't spuriously go to NIL.
Fixed the VALUES IR1 transform (which discards unused values forms) to work when there are no values forms.
In MAYBE-TERMINATE-BLOCK, don't try it if either the block is DELETE-P or has already been terminated. In IR1-OPTIMIZE-MV-COMBINATION, don't do MV-LET optimizations on local MV-CALLs that aren't MV-LETs yet.
Made MAYBE-TERMINATE-BLOCK more cautious about using continuation type information, since both the derived and asserted types can independently spuriously be NIL during IR1 conversion. Also, deleted some unnecessary (and wrong) checking of CONTINUATION-REOPTIMIZE in IR1-OPTIMIZE-MV-COMBINATION.
When optimizing combinations, don't do the "efficiency hack" of checking whether any args have reoptimize set. Most calls to IR1-OPTIMIZE-COMBINATION that this inhibits are actually desirable. Deleted assertion in JOIN-SUCCESSOR-IF-POSSIBLE. This really can happen, and DELETE-CONTINUATION should do the right thing. Changed MAYBE-TERMINATE-BLOCK to take an explicit IR1-P flag. Fixed it not to consider deleted continuations to have type NIL. Use DELETE-CONTINUATION on the old continuation if it has no references and we aren't in IR1 conversion.
Added MAYBE-TERMINATE-BLOCK, which looks at a combination node to see if the result type is NIL. If so, it stops the block and links it to the component tail. Changed IR1-OPTIMIZE-BLOCK to call MAYBE-TERMINATE-BLOCK. Changed REOPTIMIZE-CONTINUATION to quietly do nothing when called on an unused continuation.
Changed IR1 transform stuff to use TRANSFORM structures instead of conses so that we can keep track of the transform note.
Inhibit continuation substitution when the let and ref have different policies, so that we don't blow away type checks.
Fixed let var substitution to not attempt to substitute references in different components. This can happen when we close over top-level variables.
Added an assertion in single-use continuation variable substitution.
New file header with RCS stuff.
Weakened assertion in IR1-CONVERT-MV-CALL.
Fixed IR1-OPTIMIZE-MV-CALL not to convert calls with more than one arg, and to convert the call immediately and check if it wins.
Added IR1-OPTIMIZE-MV-COMBINATION, which dispatches to various MV-combination optimizers depending on the kind of call. We convert newly discovered MV-BINDs local :MV-LET calls, and convert MV-CALLs to MV-BINDs if the argument count is known. Also added a VALUES-LIST IR1 optimizer that converts (values-list (list ...)) into (values ...). These changes make inline expansion of functions that have &rest args and do APPLY convert to FUNCALL.
Fixed VALUES IR1 optimizer to do the REOPTIMIZE-CONTINUATION before PROPAGATE-TO-ARGS so that we know that the first arg won't be deleted yet.
Mucho enhancements. If we discover a known call, and that call has a source transform or is a conditional, then we replace the function with a lambda that just calls the function again. This gives IR1 conversion another chance to permute the call. Changed IR1 transforms to test the function type with :STRICT-RESULT T since this is almost always what you want when writing a transform. In constant folding, if the call returns multiple values, change the function to a call to VALUES, rather than just blowing off constant folding. Added DELETE-LET which deletes the bind node for a let when all its variables are deleted. This cleans up the IR1 a great deal, enabling some optimizations. Added an IR1 optimizer for VALUES that converts MV-BIND/VALUES into a LET (as long as the VALUES is the only use of the values continuation.) This helps optimization of the results of IR1 transforms for multiple value functions. Added a IR1 transform for VALUES that discards all but the first value when the context is not a multiple-value receiver.
Fixed REOPTIMIZE-CONTINUATION to set BLOCK-TEST-MODIFIED if the continuation goes to an IF.
Made CONSTANT-REFERENCE-P be an interface in the comment.
Inhibit substitution of let variables whenever the arg variable type is not a subtype of the asserted type, not just when the arg *value* is nota subtype. This is necessary to prevent representation selection from being defeated.
Changed the failed optimization stuff to record one note for each failed transform, instead of just one per call. Also, when a transform quietly gives up, blow away any old note for that transform.
Fixed the proclaim of continuation-type to return a ctype, not a type.
Merged MIPS branch with the trunk.
In PROPAGATE-LET-ARGS, propagate the arg type to the refs before substituting rather than after, since after substituting, there are no refs to propagate to.
Lexenv changes, mostly usage of new block-flags block attributes instead of separate boolean flags.
Added CONSTANT-CONTINUATION-P assertion to CONTINUATION-VALUE so that we don't lose again from people doing it on non-constant continuations.
In SUBSTITUTE-SINGLE-USE-CONTINUATION, we also punt if either continuation has some weird TYPE-CHECK annotation. This prevents us from trashing type check generation.
Fixed JOIN-BLOCKS to combine many optimization flags it was ignoring. Fixed continuation substitution stuff to look at the let's home lambda so that we will sometimes do something.
Enhanced let optimization: Now we substitute for global function variables when the reference isn't :notinline. Also, single-reference let variables can be squeezed out by replacing the ref's value continuation with the argument continuation. The biggest advantage of this is that it allows output type assertions on the reference to be seen by the argument, which helps INCF, PSETQ, etc.
Merged in MV-BIND type inference from the mips branch, and fixed to handle set variables correctly.
Rolled back to 1.2, since there seem to be serious problems with the deleted-contiuation merging.
Fixed JOIN-SUCCESSOR-IF-POSSIBLE a bit in the new case of the first block ending in a deleted continuation.
Changed JOIN-BLOCKS-IF-POSSIBLE to join when the first block's last-cont is deleted.
Fixed TRANSFORM-CALL to return T or NIL to indicate whether to attempt other transforms, and changed IR1-OPTIMIZE-COMBINATION to respect this.
This form allows you to request diffs between any two revisions of this file. For each of the two "sides" of the diff, select a symbolic revision name using the selection box, or choose 'Use Text Field' and enter a numeric revision.
|Powered by ViewVC 1.1.5|