[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-smalltalk] ParseTreeRewriter tests & behavior
From: |
Paolo Bonzini |
Subject: |
Re: [Help-smalltalk] ParseTreeRewriter tests & behavior |
Date: |
Thu, 11 Jan 2007 09:52:05 +0100 |
User-agent: |
Thunderbird 1.5.0.9 (Macintosh/20061207) |
Stephen Compall wrote:
http://scompall.nocandysw.com/gst/ptrtests.st
This is a file of SUnit tests for "PTR" (ParseTreeRewriter). (It's been
updated since I last mentioned it.) File it in (fix up
RBSmallDictionary first, as described in list thread "copying
RBSmallDictionary") to load and execute the tests.
Ok, I agree with you that both changes are desirable. I've posted to
c.l.s for help.
I'll include ptrtests.st in 2.4 (possibly backporting it later to
2.3.1). The full fix for RBSmallDictionary, which passes ptrtests.st,
is this:
--- 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
@@ -299,7 +311,7 @@ new
^self new: 2!
new: anInteger
- ^(self basicNew: anInteger) initialize: anInteger! !
+ ^(self primNew: anInteger) initialize: anInteger! !
RBProgramNodeVisitor subclass: #ParseTreeSearcher
- Re: [Help-smalltalk] ParseTreeRewriter refactoring, (continued)
- Re: [Help-smalltalk] ParseTreeRewriter refactoring, Stephen Compall, 2007/01/11
- Re: [Help-smalltalk] ParseTreeRewriter refactoring, Paolo Bonzini, 2007/01/11
- Re: [Help-smalltalk] ParseTreeRewriter refactoring, Stephen Compall, 2007/01/11
- Re: [Help-smalltalk] ParseTreeRewriter refactoring, Paolo Bonzini, 2007/01/11
- Re: [Help-smalltalk] ParseTreeRewriter refactoring, Stephen Compall, 2007/01/11
- Re: [Help-smalltalk] ParseTreeRewriter refactoring, Paolo Bonzini, 2007/01/12
- Re: [Help-smalltalk] ParseTreeRewriter refactoring, Stephen Compall, 2007/01/12
- Re: [Help-smalltalk] ParseTreeRewriter refactoring, Paolo Bonzini, 2007/01/12
- Re: [Help-smalltalk] ParseTreeRewriter refactoring, Stephen Compall, 2007/01/12
- Re: [Help-smalltalk] ParseTreeRewriter refactoring, Paolo Bonzini, 2007/01/13
Re: [Help-smalltalk] ParseTreeRewriter tests & behavior,
Paolo Bonzini <=