Can anyone tell me why this happens:
st> PackageLoader fileInPackage: 'Parser'! ... st> STInST.RBSmallDictionary new at: 1 put: 2; copy! Object: RBSmallDictionary new: 1 "<-0x4c6f1798>" error: Invalid index 2: index out of range SystemExceptions.IndexOutOfRange(Smalltalk.Exception)>>#signal SystemExceptions.IndexOutOfRange class>>#signalOn:withIndex: STInST.RBSmallDictionary(Smalltalk.Object)>>#checkIndexableBounds:put: STInST.RBSmallDictionary(Smalltalk.Object)>>#basicAt:put: STInST.RBSmallDictionary(Smalltalk.LookupTable)>>#valueAt:put: STInST.RBSmallDictionary(Smalltalk.LookupTable)>>#whileGrowingAt:put: STInST.RBSmallDictionary(Smalltalk.LookupTable)>>#copyAllFrom: STInST.RBSmallDictionary(Smalltalk.HashedCollection)>>#shallowCopy STInST.RBSmallDictionary(Smalltalk.Object)>>#copy Smalltalk.UndefinedObject>>#executeStatements Seems to happen for any RBSmallDictionary (defined in compiler/ParseTreeSearcher.st) but an empty one. I'll take a look later to see what's going on, but any help would be welcome. In case you are curious about context, I have been testing ParseTreeRewriter using this: http://scompall.nocandysw.com/gst/ptrtests.st I have a refactoring of ParseTreeRewriter (some of which should be pushed up to RBProgramNodeVisitor), which I'll present when I add a few tests for multiple tree rules and get matching, non-failing test behavior between the original and new versions. -- Stephen Compall http://scompall.nocandysw.com/blog ##smalltalk,#gnu-smalltalk on Freenode IRC _______________________________________________ help-smalltalk mailing list [hidden email] http://lists.gnu.org/mailman/listinfo/help-smalltalk signature.asc (196 bytes) Download Attachment |
Stephen Compall wrote:
> Can anyone tell me why this happens: > > st> PackageLoader fileInPackage: 'Parser'! > ... > st> STInST.RBSmallDictionary new at: 1 put: 2; copy! > Object: RBSmallDictionary new: 1 "<-0x4c6f1798>" error: Invalid index 2: index out of range > SystemExceptions.IndexOutOfRange(Smalltalk.Exception)>>#signal > SystemExceptions.IndexOutOfRange class>>#signalOn:withIndex: > STInST.RBSmallDictionary(Smalltalk.Object)>>#checkIndexableBounds:put: > STInST.RBSmallDictionary(Smalltalk.Object)>>#basicAt:put: > STInST.RBSmallDictionary(Smalltalk.LookupTable)>>#valueAt:put: > STInST.RBSmallDictionary(Smalltalk.LookupTable)>>#whileGrowingAt:put: > STInST.RBSmallDictionary(Smalltalk.LookupTable)>>#copyAllFrom: > STInST.RBSmallDictionary(Smalltalk.HashedCollection)>>#shallowCopy > STInST.RBSmallDictionary(Smalltalk.Object)>>#copy > Smalltalk.UndefinedObject>>#executeStatements This happens because RBSmallDictionary>>#findIndex: is wrong for LookupTable, which expects a valid index. I fixed this by removing RBSmallDictionary class>>#new: outright. I think this could also be fixed with more faith to the original by using primNew: instead of basicNew: in that method, but it doesn't bother me that much. -- Stephen Compall http://scompall.nocandysw.com/blog _______________________________________________ help-smalltalk mailing list [hidden email] http://lists.gnu.org/mailman/listinfo/help-smalltalk |
> This happens because RBSmallDictionary>>#findIndex: is wrong for > LookupTable, which expects a valid index. I fixed this by removing > RBSmallDictionary class>>#new: outright. I think this could also be > fixed with more faith to the original by using primNew: instead of > basicNew: in that method, but it doesn't bother me that much. Try this. (The incrementTally change is only for efficiency). --- orig/compiler/ParseTreeSearcher.st +++ mod/compiler/ParseTreeSearcher.st @@ -277,6 +277,17 @@ LookupTable variableSubclass: #RBSmallDi !RBSmallDictionary methodsFor: 'private'! +whileGrowingAt: key put: value + tally := tally + 1. + self primAt: self size put: key. + self valueAt: self size put: value! + +incrementTally + tally := tally + 1. + ^tally > self primSize + ifTrue: [ self grow ]; + yourself! + findIndex: anObject "Tries to see if anObject exists as an indexed variable. As soon as nil or anObject is found, the index of that slot is answered" @@ -288,6 +299,7 @@ findIndex: anObject (element isNil or: [ element = anObject ]) ifTrue: [ ^i ] ]. + tally = self primSize ifTrue: [ self grow ]. ^self size + 1! ! RBSmallDictionary class Paolo _______________________________________________ help-smalltalk mailing list [hidden email] http://lists.gnu.org/mailman/listinfo/help-smalltalk |
On Wed, 2007-01-10 at 08:28 +0100, Paolo Bonzini wrote:
> Try this. (The incrementTally change is only for efficiency). This unfortunately also broke in at:ifAbsent: and copy in ptrtests.st. I removed new: as a stopgap mentioned earlier so I could post a patch in thread "ParseTreeRewriter tests & behavior". It's part of that patch. -- Stephen Compall http://scompall.nocandysw.com/blog _______________________________________________ help-smalltalk mailing list [hidden email] http://lists.gnu.org/mailman/listinfo/help-smalltalk signature.asc (196 bytes) Download Attachment |
Free forum by Nabble | Edit this page |