From: Nikodemus S. <nik...@ra...> - 2015-03-21 10:39:55
|
On 21 March 2015 at 11:18, Nikodemus Siivola <nik...@ra...> wrote: > ...while this *is* allowed, I'm pretty sure this is a regression as well. Hah. Amusingly it looks like this is my handiwork. How time flies. commit 12836ca105af62252aa0974c3f6992e60ce0ebf4 Author: Nikodemus Siivola <nik...@ra...> Date: Thu Oct 14 16:32:51 2010 +0000 1.0.43.57: better handling of derived function types Fixes bug 657499, and improves the earlier fix of 655126. * Sort out TYPE vs. DEFINED-TYPE in FIND-GLOBAL-FUN: ** TYPE is the declarared type, OR the derived type iff *derive-function-types* is true, no ftype has been declared, we're not explicitly late-binding, and the function is not NOTINLINE. ** DEFINED-TYPE is the derived type, or FUNCTION if the function has been declared NOTINLINE or we're late-binding. Previously TYPE (which is what the rest of the system trusts implcitly) was the derived type for functions in the same file not declared NOTINLINE. * ASSERT-CALL-TYPE can now be used in "untrusted" cases as well: argument types are asserted as before, but instead of using DERIVE-NODE-TYPE to annotate the function LVAR with its type, we instead assert the return-type when appropriate. * VALIDATE-CALL-TYPE is now called with DEFINED-TYPE from IR1-OPTIMIZE-COMBINATION, not IR1-CONVERT-COMBINATION-CHECKING-TYPE: the DEFINED-TYPE may be used there in an untrusted call to ASSERT-CALL-TYPE. Also keep track of the leaves whose DEFINED-TYPE we have asserted, so that we won't do duplicate work. New slot in COMBINATION: TYPE-VALIDATED-FOR-LEAF is utilized for this. * LEAF-WHERE-FROM can now also be :DEFINED-HERE, meaning the definition originates in the file being compiled -- this information is used by VALIDATE-CALL-TYPE, and filled in by FIND-FREE-FUN and FIND-GLOBAL-FUN. * Adjust the tests for 655126 to account for full warnings in case *derive-function-types* and self-calls. I didn't test if this is the commit that actually causes this to happen, or if this is a later interaction with the above change -- but this does look like a likely culprit. I'd (I'll?) need to check that and think this more completely through (including checking the bugs referenced above) before venturing a further opinion. ...but on quick reflection I suspect my memory is just shot and this is legit -- but at the same time from where I stand today, I would turn down the default type propagation here a bit, and make stuff like this require SPEED 2 or something, or maybe apply some selective type-widening here: asserting something to be a singleton type without an inlining or anything seems a bit rich. ...and we since we should be able to know that some other function in the same compilation unit relies on the return type and this is an incompatible redefinition, we should probably signal a full WARNING at least for the redefinition. (Yeah, hair there in getting things right.) Cheers, -- nikodemus |