VM Maker: VMMaker.oscog-eem.154.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.154.mcz

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

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

Name: VMMaker.oscog-eem.154
Author: eem
Time: 3 April 2012, 1:42:00.802 pm
UUID: 5cbb57c7-0a54-4b7e-848c-1f292759f1fa
Ancestors: VMMaker.oscog-eem.153

Fix bad conceptual bug with become on methods.  Unlike full and
incremental GC, the reference from a Cog method to its method
object must not be remapped since they're two halves of the same
object.

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

Item was changed:
  ----- Method: Cogit>>mapObjectReferencesInMachineCodeForBecome (in category 'garbage collection') -----
  mapObjectReferencesInMachineCodeForBecome
  "Update all references to objects in machine code for a become.
+ Unlike incrementalGC or fullGC a method that does not refer to young may
+ refer to young as a result of the become operation.  Unlike incrementalGC
+ or fullGC the reference from a Cog method to its methodObject *must not*
+ change since the two are two halves of the same object."
- Unlike incrementalGC or fullGC a method that does not refer to young
- may refer to young as a result of the become operation."
  | cogMethod hasYoungObj hasYoungObjPtr freedPIC |
  <var: #cogMethod type: #'CogMethod *'>
  hasYoungObj := false.
  hasYoungObjPtr := self cCode: [(self addressOf: hasYoungObj) asInteger]
  inSmalltalk: [CPluggableAccessor new
  setObject: nil;
  atBlock: [:obj :idx| hasYoungObj]
  atPutBlock: [:obj :idx :val| hasYoungObj := val]].
  codeModified := freedPIC := false.
  self mapObjectReferencesInGeneratedRuntime.
  cogMethod := self cCoerceSimple: methodZoneBase to: #'CogMethod *'.
  [cogMethod < methodZone limitZony] whileTrue:
  [self assert: hasYoungObj not.
  cogMethod cmType ~= CMFree ifTrue:
  [self assert: (self cogMethodDoesntLookKosher: cogMethod) = 0.
  cogMethod selector: (objectRepresentation remapOop: cogMethod selector)..
  cogMethod cmType = CMClosedPIC
  ifTrue:
  [((objectMemory isYoung: cogMethod selector)
    or: [self mapObjectReferencesInClosedPIC: cogMethod]) ifTrue:
  [freedPIC := true.
  methodZone freeMethod: cogMethod]]
  ifFalse:
  [(objectMemory isYoung: cogMethod selector) ifTrue:
  [hasYoungObj := true].
  cogMethod cmType = CMMethod ifTrue:
  [self assert: cogMethod objectHeader = objectMemory nullHeaderForMachineCodeMethod.
- cogMethod methodObject: (objectRepresentation remapOop: cogMethod methodObject).
  self assert: ((coInterpreter rawHeaderOf: cogMethod methodObject) = cogMethod asInteger
  or: [(self noAssertMethodClassAssociationOf: cogMethod methodObject)
  = objectMemory nilObject]).
  (objectMemory isYoung: cogMethod methodObject) ifTrue:
  [hasYoungObj := true]].
  self mapFor: cogMethod
  performUntil: (self cppIf: NewspeakVM
  ifTrue: [#remapNSIfObjectRef:pc:hasYoung: asSymbol]
  ifFalse: [#remapIfObjectRef:pc:hasYoung: asSymbol])
  arg: hasYoungObjPtr.
  hasYoungObj
  ifTrue:
  [cogMethod cmRefersToYoung ifFalse:
  [cogMethod cmRefersToYoung: true.
  methodZone addToYoungReferrers: cogMethod].
  hasYoungObj := false]
  ifFalse: [cogMethod cmRefersToYoung: false]]].
  cogMethod := methodZone methodAfter: cogMethod].
  methodZone pruneYoungReferrers.
  freedPIC ifTrue:
  [self unlinkSendsToFree.
  codeModified := true].
  codeModified ifTrue: "After updating oops in inline caches we need to flush the icache."
  [processor flushICacheFrom: codeBase to: methodZone limitZony asInteger]!