The Trunk: Tests-eem.405.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-eem.405.mcz

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

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

Name: Tests-eem.405
Author: eem
Time: 3 January 2019, 3:07:27.378757 pm
UUID: 17c87dc5-be34-42cc-b043-82315ab82527
Ancestors: Tests-pre.404

Add tests that check that for all methods in a package all pcs in nodes in that method map to valid pcs.

=============== Diff against Tests-pre.404 ===============

Item was added:
+ ----- Method: CompiledMethod class>>noCheckSetPreferredBytecodeSetTo:while: (in category '*Tests-Compiler-support') -----
+ noCheckSetPreferredBytecodeSetTo: encoderClass while: aBlock
+ | savedEncoderClass |
+ encoderClass == PreferredBytecodeSetEncoderClass ifTrue:
+ [^aBlock value].
+ savedEncoderClass := PreferredBytecodeSetEncoderClass.
+ PreferredBytecodeSetEncoderClass := encoderClass.
+ ^aBlock ensure: [PreferredBytecodeSetEncoderClass := savedEncoderClass]!

Item was added:
+ ----- Method: CompilerTest>>runTestAllNodePCsAreForBytecodesInMethod: (in category 'private') -----
+ runTestAllNodePCsAreForBytecodesInMethod: aMethod
+ "Before 1/3/2019 14:10 the bytecode compiler would ascribe the wrong pcs for long conditional branches
+ at the head of ifTrue:ifFalse: et al.  This test checks that all nodes with a pc map to a real bytecode."
+ | class methodAndNode bytecodes |
+ class := aMethod methodClass.
+ methodAndNode := CompiledMethod
+ noCheckSetPreferredBytecodeSetTo: aMethod encoderClass
+ while:
+ [class
+ compile:(class sourceCodeAt: aMethod selector)
+ environment: class environment
+ notifying: nil
+ trailer: aMethod trailer
+ ifFail: [^nil]].
+ bytecodes := self validPCsForMethod: methodAndNode method.
+ bytecodes add: methodAndNode node pc.
+ methodAndNode node nodesDo:
+ [:node|
+ node pc ifNotNil:
+ [:pc|
+ self assert: (bytecodes includes: pc)]]!

Item was added:
+ ----- Method: CompilerTest>>runTestAllNodePCsAreForBytecodesInPackage: (in category 'private') -----
+ runTestAllNodePCsAreForBytecodesInPackage: packageName
+ "Before 1/3/2019 14:10 the bytecode compiler would ascribe the wrong pcs for long conditional branches
+ at the head of ifTrue:ifFalse: et al.  This slow test checks that all nodes with a pc in any method map to a
+ real bytecode."
+ (PackageInfo named: packageName) actualMethodsDo:
+ [:method| self runTestAllNodePCsAreForBytecodesInMethod: method]!

Item was added:
+ ----- Method: CompilerTest>>testAllNodePCsAreForBytecodesInCollections (in category 'debugging') -----
+ testAllNodePCsAreForBytecodesInCollections
+ <timeout: 30> "Approximately 2 seconds on 2018 2.9GHz Core i9 MacBook Pro running 64-bit Squeak Cog VM"
+ self runTestAllNodePCsAreForBytecodesInPackage: #Collections!

Item was added:
+ ----- Method: CompilerTest>>testAllNodePCsAreForBytecodesInKernel (in category 'debugging') -----
+ testAllNodePCsAreForBytecodesInKernel
+ <timeout: 30> "Approximately 3 seconds on 2018 2.9GHz Core i9 MacBook Pro running 64-bit Squeak Cog VM"
+ self runTestAllNodePCsAreForBytecodesInPackage: #Kernel!

Item was added:
+ ----- Method: CompilerTest>>testAllNodePCsAreForBytecodesInMorphic (in category 'debugging') -----
+ testAllNodePCsAreForBytecodesInMorphic
+ <timeout: 30> "Approximately 6 seconds on 2018 2.9GHz Core i9 MacBook Pro running 64-bit Squeak Cog VM"
+ self runTestAllNodePCsAreForBytecodesInPackage: #Morphic!

Item was added:
+ ----- Method: CompilerTest>>validPCsForMethod: (in category 'private') -----
+ validPCsForMethod: aMethod
+ "Answer a set of pcs (either integer pc for the method and embedded blocks,
+ or CompiledBlock -> integer pc for nested full blocks."
+ | validPCs is |
+ validPCs := Set new: aMethod size - aMethod initialPC.
+ (is := InstructionStream on: aMethod) scanFor:
+ [:b| validPCs add: is pc. false].
+ aMethod nestedBlockMethods do:
+ [:bm|
+ (is := InstructionStream on: bm) scanFor:
+ [:b| validPCs add: bm -> is pc. false]].
+ ^validPCs!