David T. Lewis uploaded a new version of Tests to project The Trunk: http://source.squeak.org/trunk/Tests-dtl.194.mcz
==================== Summary ====================
Name: Tests-dtl.194 Author: dtl Time: 29 March 2013, 10:13:41.368 am UUID: ba96f5b8-f215-4045-a16f-473c8dde8760 Ancestors: Tests-eem.193
Merge Tests-dtl.193
Background: http://lists.squeakfoundation.org/pipermail/squeak-dev/2013-March/169911.htm...
Two tests that illustrate the limit to number of literals in a compiled method. Both tests pass on Squeak 4.4. One of the tests fails in the most recent Squeak trunk.
CompilerTest>>testMaxLiteralsWithClassReferenceInClosure passes in the image at http://build.squeak.org/job/SqueakTrunk/212/ and fails in later updates to trunk.
=============== Diff against Tests-eem.193 ===============
Item was added: + ----- Method: CompilerTest>>testMaxLiterals (in category 'limits') ----- + testMaxLiterals + "Document the maximum number of literals in a compiled method" + + | maxLiterals stringThatCanBeCompiled stringWithOneTooManyLiterals | + maxLiterals := 249. + stringThatCanBeCompiled := '{ ', (String streamContents: [:strm | + 1 to: maxLiterals do: [:e | strm nextPutAll: '''', e asString, '''', ' . ']]), '}'. + stringWithOneTooManyLiterals := '{ ', (String streamContents: [:strm | + 1 to: maxLiterals + 1 do: [:e | strm nextPutAll: '''', e asString, '''', ' . ']]), '}'. + self shouldnt: [Compiler evaluate: stringThatCanBeCompiled logged: false] raise: Error. + self should: (Compiler evaluate: stringThatCanBeCompiled logged: false) size = maxLiterals. + + "If the following test fails, it means that the limit has been raised or eliminated, + and this test should be updated to reflect the improvement." + self should: [Compiler evaluate: stringWithOneTooManyLiterals logged: false] raise: Error. + !
Item was added: + ----- Method: CompilerTest>>testMaxLiteralsWithClassReferenceInClosure (in category 'limits') ----- + testMaxLiteralsWithClassReferenceInClosure + "Document the maximum number of literals in a compiled method. A class + reference in a closure reduces the maximum literals." + + | maxLiterals stringThatCanBeCompiled stringWithOneTooManyLiterals | + maxLiterals := 244. + stringThatCanBeCompiled := '[ DateAndTime now. Date today. Time ]. { ', + (String streamContents: [:strm | + 1 to: maxLiterals do: [:e | strm nextPutAll: '''', e asString, '''', ' . ']]), '}'. + stringWithOneTooManyLiterals := '[ DateAndTime now. Date today. Time ]. { ', + (String streamContents: [:strm | + 1 to: maxLiterals + 1 do: [:e | strm nextPutAll: '''', e asString, '''', ' . ']]), '}'. + self shouldnt: [Compiler evaluate: stringThatCanBeCompiled logged: false] raise: Error. + self should: (Compiler evaluate: stringThatCanBeCompiled logged: false) size = maxLiterals. + + "If the following test fails, it means that the limit has been raised or eliminated, + and this test should be updated to reflect the improvement." + self should: [Compiler evaluate: stringWithOneTooManyLiterals logged: false] raise: Error. + !
packages@lists.squeakfoundation.org