[Pkg] The Trunk: Tests-eem.408.mcz

commits at source.squeak.org commits at source.squeak.org
Tue Mar 19 16:30:00 UTC 2019


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

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

Name: Tests-eem.408
Author: eem
Time: 19 March 2019, 9:29:58.589612 am
UUID: 98f708d3-76ec-4f02-9db0-8472e0e09a25
Ancestors: Tests-pre.407

Fix a couple of failing Compiler tests.  testPCPreviousTo must be made aware of extensions, for the SistaV1 bytecode set.  testMaxLiteralsWithClassReferenceInClosure must adapt to the much greater number of literals available in the SistaV1 set.

=============== Diff against Tests-pre.407 ===============

Item was changed:
  ----- Method: BytecodeDecodingTests>>testPCPreviousTo (in category 'tests') -----
  testPCPreviousTo
  	"Check that the pcPreviousTo machinery answers the truth for all bytecodes."
  	self systemNavigation allSelect:
+ 		[:m| | ec is prevPC prevBlockCreationPC exclude encoder extensionOffset |
- 		[:m| | ec is prevPC prevBlockCreationPC exclude |
  		m isQuick ifFalse:
  			[ec := m encoderClass.
  			 is:= InstructionStream on: m.
  			 exclude := OrderedCollection new.
  			 m embeddedBlockClosures do:
+ 				[:ebc| | bm followingpc |
+ 				bm := ebc method. "Will differ for FullBlocks/SistaV1 regime"
+ 				followingpc := ebc endPC + (ec bytecodeSize: (bm at: ebc endPC)).
+ 				exclude addLast: ebc startpc; addLast: followingpc.
- 				[:ebc| | followingpc |
- 				followingpc := ebc endPC + (ec bytecodeSize: (m at: ebc endPC)).
- 				exclude addLast: ebc startpc; addLast: followingpc..
  				self assert: nil
+ 					equals: (ec pcPreviousTo: ebc startpc in: bm for: nil).
+ 				bm isCompiledBlock  ifFalse:
+ 					[self assert: (ec pcOfBlockCreationBytecodeForBlockStartingAt: ebc startpc in: m)
+ 						equals: (ec pcPreviousTo: followingpc in: bm for: nil)]].
+ 			encoder := m encoderClass.
+ 			extensionOffset := 0.
+ 			is scanFor:
- 					equals: (ec pcPreviousTo: ebc startpc in: m for: nil).
- 				self assert: (ec pcOfBlockCreationBytecodeForBlockStartingAt: ebc startpc in: m)
- 					equals: (ec pcPreviousTo: followingpc in: m for: nil)].
- 			 is scanFor:
  				[:b|
  				(exclude includes: is pc) ifFalse:
+ 					[self assert: prevPC equals: (ec pcPreviousTo: is pc in: m for: nil)].
+ 				prevPC := is pc - extensionOffset.
+ 				extensionOffset := (encoder isExtension: is nextByte)
+ 										ifTrue: [extensionOffset + 2]
+ 										ifFalse: [0].
- 					[self assert: prevPC
- 						equals: (ec pcPreviousTo: is pc in: m for: nil)].
- 				prevPC := is pc.
  				b = ec createClosureCode ifTrue: [prevBlockCreationPC := prevPC].
+ 				false]].
- 				false].].
  		 false]!

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: [0])
+ 					- 4 "for the implicit stream processing into which the brace construct is compiled: (Array braceStream: size) braceArray".
- 	| maxLiterals stringThatCanBeCompiled stringWithOneTooManyLiterals |
- 	maxLiterals := 245.
  	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.
  !



More information about the Packages mailing list