The Inbox: Tests-dtl.193.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Inbox: Tests-dtl.193.mcz

commits-2
David T. Lewis uploaded a new version of Tests to project The Inbox:
http://source.squeak.org/inbox/Tests-dtl.193.mcz

==================== Summary ====================

Name: Tests-dtl.193
Author: dtl
Time: 17 March 2013, 7:59:50.668 pm
UUID: 039ad8da-1f24-4f87-aca5-9fb9f8dfb7d1
Ancestors: Tests-fbs.192

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-fbs.192 ===============

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.
+ !