VM Maker: VMMaker.oscog-eem.2080.mcz

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

VM Maker: VMMaker.oscog-eem.2080.mcz

commits-2
 
Eliot Miranda uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker.oscog-eem.2080.mcz

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

Name: VMMaker.oscog-eem.2080
Author: eem
Time: 10 January 2017, 1:09:38.430454 pm
UUID: de2bea31-7530-47e7-b308-598c8e29a740
Ancestors: VMMaker.oscog-eem.2079

SpurPlanningCompactor:
Add a test framework for the compactor based around loading a Pharo bootstrap image and extending it.  For now include one test that shortens the heap to the minimum and checks that the heap is found to be incompressible.  Add a test class that tests that the cloneSimulation and image (re)loading functions work (upon which the SpurPlanningCompactorTests relies).

Don't use a macro for setDesiredCogCodeSize: (not needed) and implement it in the StackInterpreter for the convenience of these tests as well as potential image-build Smalltalk code running on the StackInterpreter.
Requires Cog-eem.335

=============== Diff against VMMaker.oscog-eem.2079 ===============

Item was changed:
  ----- Method: CoInterpreter>>setDesiredCogCodeSize: (in category 'internal interpreter access') -----
  setDesiredCogCodeSize: dccs
+ <inline: true>
- <cmacro: '(dccs) (desiredCogCodeSize = (dccs))'>
  desiredCogCodeSize := dccs!

Item was added:
+ ----- Method: SpurMemoryManager>>abandonEmptySegmentForTests (in category 'simulation tests support') -----
+ abandonEmptySegmentForTests
+ "Assume a freshly-loaded image. Eliminate the last segment."
+ <doNotGenerate>
+ | freeChunk emptySeg |
+ freeChunk := self findLargestFreeChunk.
+ self assert: totalFreeOldSpace = (self bytesInObject: freeChunk).
+ self assert: endOfMemory = (self addressAfter: freeChunk).
+ self unlinkSolitaryFreeTreeNode: freeChunk.
+ segmentManager numSegments > 1
+ ifTrue:
+ [emptySeg := segmentManager findEmptySegNearestInSizeTo: (self bytesInObject: freeChunk).
+ segmentManager removeSegment: emptySeg]
+ ifFalse:
+ [(segmentManager segments at: 0)
+ segSize: (segmentManager segments at: 0) segSize - (self bytesInObject: freeChunk).
+ self setLastSegment: (segmentManager segments at: 0);
+ initSegmentBridgeWithBytes: self bridgeSize at: (self startOfObject: freeChunk)]!

Item was added:
+ TestCase subclass: #SpurPlanningCompactorTests
+ instanceVariableNames: 'emptyVM'
+ classVariableNames: ''
+ poolDictionaries: ''
+ category: 'VMMaker-Tests'!

Item was added:
+ ----- Method: SpurPlanningCompactorTests class>>imageNameForTests (in category 'accessing') -----
+ imageNameForTests
+ "self imageNameForTests"
+ | baseImageName |
+ baseImageName := 'core32-preen.image'.
+ #('.' 'oscogvm/image' '../oscogvm/image') do:
+ [:dirName|
+ ((FileDirectory default directoryExists: dirName)
+  and: [(FileDirectory on: dirName) fileExists: baseImageName]) ifTrue:
+ [^dirName, '/', baseImageName]].
+ self error: 'cannot find ', baseImageName!

Item was added:
+ ----- Method: SpurPlanningCompactorTests class>>preenImage (in category 'utilities') -----
+ preenImage
+ "Assume there's a Pharo bootstrap core32.image in ../oscogvm/image/core32.image.
+ We should find out where the image directory is and write a download script to get it.
+ But for now assume it's there."
+ "[SpurPlanningCompactorTests preenImage] timeToRun"
+ Spur32BitPreen new
+ writeDefaultHeader: true;
+ savedWindowSize: 640@480;
+ preenImage: '../oscogvm/image/core32'!

Item was added:
+ ----- Method: SpurPlanningCompactorTests>>initialize (in category 'initialize-release') -----
+ initialize
+ emptyVM := StackInterpreterSimulator newWithOptions: #(ObjectMemory Spur32BitMemoryManager
+ compactorClass SpurPlanningCompactor)!

Item was added:
+ ----- Method: SpurPlanningCompactorTests>>initializedVM (in category 'private') -----
+ initializedVM
+ ^emptyVM cloneSimulation
+ openOn: self class imageNameForTests extraMemory: 0;
+ initStackPages;
+ yourself!

Item was added:
+ ----- Method: SpurPlanningCompactorTests>>testIncompactibleHeap (in category 'tests') -----
+ testIncompactibleHeap
+ | errored |
+ errored := false.
+ [self initializedVM objectMemory
+ initializeMarkStack; "The Pharo bootstrap has no mark or weakling stacks :-)"
+ initializeWeaklingStack;
+ abandonEmptySegmentForTests;
+ fullGC]
+ on: Error
+ do: [:ex|
+ errored := true.
+ self assert: ex messageText = 'uncompactable heap; no unmarked objects found'].
+ self assert: errored!

Item was changed:
  ----- Method: StackInterpreter>>setDesiredCogCodeSize: (in category 'internal interpreter access') -----
+ setDesiredCogCodeSize: dccs
+ <inline: true>
+ "This should perhaps be a no-op in the StackVM, but we implement it for the convenience of bootstrap scripts etc."
+ theUnknownShort := dccs!
- setDesiredCogCodeSize: iCouldCareLess
- "This is a no-op in the StackVM"!

Item was added:
+ TestCase subclass: #StackInterpreterSimulatorTests
+ instanceVariableNames: ''
+ classVariableNames: ''
+ poolDictionaries: ''
+ category: 'VMMaker-Tests'!

Item was added:
+ ----- Method: StackInterpreterSimulatorTests class>>imageNameForTests (in category 'accessing') -----
+ imageNameForTests
+ "self imageNameForTests"
+ | baseImageName |
+ baseImageName := 'core32-preen.image'.
+ #('.' 'oscogvm/image' '../oscogvm/image') do:
+ [:dirName|
+ ((FileDirectory default directoryExists: dirName)
+  and: [(FileDirectory on: dirName) fileExists: baseImageName]) ifTrue:
+ [^dirName, '/', baseImageName]].
+ self error: 'cannot find ', baseImageName!

Item was added:
+ ----- Method: StackInterpreterSimulatorTests>>testEmptySimulatorCanCloneSimulation (in category 'tests') -----
+ testEmptySimulatorCanCloneSimulation
+ self shouldnt:
+ [(StackInterpreterSimulator newWithOptions: #(ObjectMemory Spur32BitMemoryManager))
+ cloneSimulation cloneSimulation]
+ raise: Error!

Item was added:
+ ----- Method: StackInterpreterSimulatorTests>>testEmptySimulatorCloneCanLoadImage (in category 'tests') -----
+ testEmptySimulatorCloneCanLoadImage
+ self shouldnt:
+ [(StackInterpreterSimulator newWithOptions: #(ObjectMemory Spur32BitMemoryManager))
+ cloneSimulation
+ openOn: self class imageNameForTests extraMemory: 0]
+ raise: Error!

Item was added:
+ ----- Method: StackInterpreterSimulatorTests>>testSimulatorCanReloadImage (in category 'tests') -----
+ testSimulatorCanReloadImage
+ self shouldnt:
+ [(StackInterpreterSimulator newWithOptions: #(ObjectMemory Spur32BitMemoryManager))
+ openOn: self class imageNameForTests extraMemory: 0;
+ openOn: self class imageNameForTests extraMemory: 0]
+ raise: Error!

Loading...