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

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

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

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

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

Name: VMMaker.oscog-eem.1401
Author: eem
Time: 29 June 2015, 4:40:43.429 pm
UUID: 036f0933-639a-49dd-8a1d-a03bcdcb0a0a
Ancestors: VMMaker.oscog-eem.1400

Provide a limit to the size of old space on Spur.
Access maxOldSpaceSize via vmParameterAt: 67.

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

Item was changed:
  CogClass subclass: #SpurMemoryManager
(excessive size, no diff calculated)

Item was changed:
  ----- Method: SpurMemoryManager class>>declareCVarsIn: (in category 'translation') -----
  declareCVarsIn: aCCodeGenerator
  self declareCAsOop: #( memory freeStart scavengeThreshold newSpaceStart newSpaceLimit pastSpaceStart
  lowSpaceThreshold freeOldSpaceStart oldSpaceStart endOfMemory firstFreeChunk lastFreeChunk)
  in: aCCodeGenerator.
  self declareCAsUSqLong: (self allInstVarNames select: [:ivn| ivn endsWith: 'Usecs'])
  in: aCCodeGenerator.
  aCCodeGenerator
  var: #freeListsMask type: #usqInt;
  var: #freeLists type: #'sqInt *';
  var: #objStackInvalidBecause type: #'char *';
  var: #highestObjects type: #SpurCircularBuffer;
  var: #unscannedEphemerons type: #SpurContiguousObjStack;
  var: #heapGrowthToSizeGCRatio type: #float;
  var: #heapSizeAtPreviousGC type: #usqInt;
+ var: #totalFreeOldSpace type: #usqInt;
+ var: #maxOldSpaceSize type: #'unsigned long'.
- var: #totalFreeOldSpace type: #usqInt.
  aCCodeGenerator
  var: #remapBuffer
  declareC: 'sqInt remapBuffer[RemapBufferSize + 1 /* ', (RemapBufferSize + 1) printString, ' */]'.
  aCCodeGenerator
  var: #extraRoots
  declareC: 'sqInt *extraRoots[ExtraRootsSize + 1 /* ', (ExtraRootsSize + 1) printString, ' */]'!

Item was changed:
  ----- Method: SpurMemoryManager class>>mustBeGlobal: (in category 'translation') -----
  mustBeGlobal: var
  "Answer if a variable must be global and exported.  Used for inst vars that are accessed from VM support code."
 
+ ^#('checkForLeaks' 'maxOldSpaceSize') includes: var!
- ^'checkForLeaks' = var!

Item was changed:
  ----- Method: SpurMemoryManager>>growOldSpaceByAtLeast: (in category 'growing/shrinking memory') -----
  growOldSpaceByAtLeast: minAmmount
  "Attempt to grow memory by at least minAmmount.
  Answer the size of the new segment, or nil if the attempt failed."
+ | ammount headroom total |
- | ammount |
  <var: #segInfo type: #'SpurSegmentInfo *'>
  "statGrowMemory counts attempts, not successes."
+ statGrowMemory := statGrowMemory + 1."we need to include overhead for a new object header plus the segment bridge."
- statGrowMemory := statGrowMemory + 1.
- "we need to include overhead for a new object header plus the segment bridge."
  ammount := minAmmount + (self baseHeaderSize * 2 + self bridgeSize).
  "round up to the nearest power of two."
  ammount := 1 << (ammount - 1) highBit.
  "and grow by at least growHeadroom."
  ammount := ammount max: growHeadroom.
+
+ "Now apply the maxOldSpaceSize limit, if one is in effect."
+ maxOldSpaceSize > 0 ifTrue:
+ [total := segmentManager totalBytesInSegments.
+ total >= maxOldSpaceSize ifTrue:
+ [^nil].
+ headroom := maxOldSpaceSize - total.
+ headroom < ammount ifTrue:
+ [headroom < (minAmmount + (self baseHeaderSize * 2 + self bridgeSize)) ifTrue:
+ [^nil].
+ ammount := headroom]].
+
  ^(segmentManager addSegmentOfSize: ammount) ifNotNil:
  [:segInfo|
  self assimilateNewSegment: segInfo.
  "and add the new free chunk to the free list; done here
   instead of in assimilateNewSegment: for the assert"
  self addFreeChunkWithBytes: segInfo segSize - self bridgeSize at: segInfo segStart.
  self assert: (self addressAfter: (self objectStartingAt: segInfo segStart))
  = (segInfo segLimit - self bridgeSize).
  self checkFreeSpace.
  segmentManager checkSegments.
+ segInfo segSize]
+
+
+ maxOldSpaceSize
+ totalBytesInSegments!
- segInfo segSize]!

Item was changed:
  ----- Method: SpurMemoryManager>>initialize (in category 'initialization') -----
  initialize
  "We can put all initializations that set something to 0 or to false here.
  In C all global variables are initialized to 0, and 0 is false."
  remapBuffer := Array new: RemapBufferSize.
  remapBufferCount := extraRootCount := 0. "see below"
  freeListsMask := totalFreeOldSpace := lowSpaceThreshold := 0.
  checkForLeaks := 0.
  needGCFlag := signalLowSpace := scavengeInProgress := marking := false.
  becomeEffectsFlags := 0.
  statScavenges := statIncrGCs := statFullGCs := 0.
  statScavengeGCUsecs := statIncrGCUsecs := statFullGCUsecs := statGCEndUsecs := 0.
  statSGCDeltaUsecs := statIGCDeltaUsecs := statFGCDeltaUsecs := 0.
  statGrowMemory := statShrinkMemory := statRootTableCount := statSurvivorCount := 0.
  statRootTableOverflows := statMarkCount := statSpecialMarkCount := statCompactPassCount := statCoalesces := 0.
 
  "We can initialize things that are allocated but are lazily initialized."
  unscannedEphemerons := SpurContiguousObjStack new.
 
  "we can initialize things that are virtual in C."
  scavenger := SpurGenerationScavengerSimulator new manager: self; yourself.
  segmentManager := SpurSegmentManager new manager: self; yourself.
 
  "We can also initialize here anything that is only for simulation."
  heapMap := CogCheck32BitHeapMap new.
 
+ "N.B. We *don't* initialize extraRoots because we don't simulate it."
+
+ maxOldSpaceSize := self class initializationOptions at: #maxOldSpaceSize ifAbsent: [0]!
- "N.B. We *don't* initialize extraRoots because we don't simulate it."!

Item was added:
+ ----- Method: SpurMemoryManager>>maxOldSpaceSize (in category 'accessing') -----
+ maxOldSpaceSize
+ <cmacro: '() maxOldSpaceSize'>
+ ^maxOldSpaceSize!

Item was added:
+ ----- Method: SpurMemoryManager>>setMaxOldSpaceSize: (in category 'accessing') -----
+ setMaxOldSpaceSize: limit
+ <var: #limit type: #'unsigned long'>
+ maxOldSpaceSize := limit.
+ ^0!

Item was changed:
  ----- Method: StackInterpreterPrimitives>>primitiveVMParameter (in category 'system control primitives') -----
(excessive size, no diff calculated)