[squeak-dev] The Trunk: Tests-eem.327.mcz

commits at source.squeak.org commits at source.squeak.org
Tue Aug 25 23:21:40 UTC 2015


Eliot Miranda uploaded a new version of Tests to project The Trunk:
http://source.squeak.org/trunk/Tests-eem.327.mcz

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

Name: Tests-eem.327
Author: eem
Time: 25 August 2015, 4:21:25.745 pm
UUID: 40649464-54c2-4aab-b4a4-9df95952958d
Ancestors: Tests-ul.326

Revise the maxLiterals test given the bytecode set specific facilities in Encoder and CompiledMethod.

=============== Diff against Tests-ul.326 ===============

Item was changed:
  ----- Method: CompilerTest>>testMaxLiterals (in category 'limits') -----
  testMaxLiterals
  	"Document the maximum number of literals in a compiled method"
  
  	| maxLiterals stringThatCanBeCompiled stringWithOneTooManyLiterals |
+ 	"Why 6?  It's rather implementation dependent.  But the {... construct is compiled as
+ 		(Array braceStream: size)
+ 			nextPut: expr;
+ 			...;
+ 			braceArray
+ 	 where nextPut: is a special selector.  So one each for Array binding, #braceStream, #braceArray and the size,
+ 	 one for the selector and one for the methodClass makes 6."
+ 	maxLiterals := thisContext method encoderClass new maxNumLiterals - 6.
- 	maxLiterals := 250.
  	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 assert: ((1 to: maxLiterals) collect: #printString) equals: (Compiler evaluate: stringThatCanBeCompiled).
  	
  	"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] raise: Error.
  !



More information about the Squeak-dev mailing list