The Trunk: Tests-mt.412.mcz

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

The Trunk: Tests-mt.412.mcz

commits-2
Marcel Taeumel uploaded a new version of Tests to project The Trunk:
http://source.squeak.org/trunk/Tests-mt.412.mcz

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

Name: Tests-mt.412
Author: mt
Time: 5 July 2019, 4:19:48.095927 pm
UUID: 2c15b9f3-d33e-42b6-b9f5-bab98e2f6d03
Ancestors: Tests-pre.411

Fixes max-literals test for EncoderV3* (i.e., pre-SistaV1).

=============== Diff against Tests-pre.411 ===============

Item was changed:
  ----- 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."
 
  | bytecodeSetEncoder maxLiterals stringThatCanBeCompiled stringWithOneTooManyLiterals |
  bytecodeSetEncoder := CompiledMethod preferredBytecodeSetEncoderClass new.
  maxLiterals := bytecodeSetEncoder maxNumLiterals
  - 2 "for selector & methodClass"
+ - (bytecodeSetEncoder supportsFullBlocks ifTrue: [1] ifFalse: [5 "For this example. See below"])
- - (bytecodeSetEncoder supportsFullBlocks ifTrue: [1] ifFalse: [0])
  - 4 "for the implicit stream processing into which the brace construct is compiled: (Array braceStream: size) braceArray".
  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 assert: maxLiterals equals: (Compiler evaluate: stringThatCanBeCompiled) size.
 
  "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.
  !