Dave Lewis uploaded a new version of VMMaker to project VM Maker: http://www.squeaksource.com/VMMaker/VMMaker-dtl.175.mcz ==================== Summary ==================== Name: VMMaker-dtl.175 Author: dtl Time: 25 May 2010, 8:01:19 am UUID: e948f35c-c90f-44e1-8f83-29db7c31d3b3 Ancestors: VMMaker-dtl.174 VMMaker 4.2.2 Reference Mantis 7473: VM changes for better finalization support Add Igor's VM changes to support better finalization (weak-finalizers-VM.1.cs merged with Alien support updates). Expand special object array with slots needed for Alien as well as for new finalization support. The new entries in ObjectMemory class>>initializeSpecialObjectIndices are: SelectorAttemptToAssign := 50. "PrimErrTableIndex := 51. in Interpreter class>>initializePrimitiveErrorCodes" ClassAlien := 52. InvokeCallbackSelector := 53. ClassUnsafeAlien := 54. ClassWeakFinalizer := 55 =============== Diff against VMMaker-dtl.174 =============== Item was added: + ----- Method: ObjectMemory>>weakFinalizerCheck: (in category 'finalization') ----- + weakFinalizerCheck: oop + "Our oop has at least 2 non-weak fixed slots (this is assured before entering this method, in + #finalizeReference:. + We are assuming that if its first non-weak field is an instance of WeakFinalizer class, + then we should add this oop to that list, by storing it to list's first field and + also, updating the oop's 2nd fixed slot to point to the value which we overridden: + + list := oop instVarAt: 1. + list class == WeakFinalizer ifTrue: [ + first := list instVarAt: 1. + oop instVarAt: 2 put: first. + list instVarAt: 1 put: oop ] " + + | listOop listItemOop | + self inline: true. + + listOop := self fetchPointer: 0 ofObject: oop. + (self fetchClassOf: listOop) == (self splObj: ClassWeakFinalizer) ifTrue: [ + listItemOop := self fetchPointer: 0 ofObject: listOop. + self storePointer: 1 ofObject: oop withValue: listItemOop. + self storePointer: 0 ofObject: listOop withValue: oop. + ]. + ! Item was changed: (excessive method size, no diff calculated) Item was changed: ----- Method: ObjectMemory>>finalizeReference: (in category 'finalization') ----- finalizeReference: oop "During sweep phase we have encountered a weak reference. Check if its object has gone away (or is about to) and if so, signal a semaphore. " "Do *not* inline this in sweepPhase - it is quite an unlikely case to run into a weak reference" + | weakOop oopGone chunk firstField lastField nonWeakCnt | - | weakOop oopGone chunk firstField lastField | self inline: false. self var: #oop type: 'usqInt'. self var: #weakOop type: 'usqInt'. + nonWeakCnt := self nonWeakFieldsOf: oop. + firstField := self baseHeaderSize + (nonWeakCnt << self shiftForWord). - firstField := self baseHeaderSize + ((self nonWeakFieldsOf: oop) << self shiftForWord). lastField := self lastPointerOf: oop. firstField to: lastField by: self bytesPerWord do: [:i | weakOop := self longAt: oop + i. "ar 1/18/2005: Added oop < youngStart test to make sure we're not testing objects in non-GCable region. This could lead to a forward reference in old space with the oop pointed to not being marked and thus treated as free." (weakOop == nilObj or: [(self isIntegerObject: weakOop) or:[weakOop < youngStart]]) ifFalse: ["Check if the object is being collected. If the weak reference points * backward: check if the weakOops chunk is free * forward: check if the weakOoop has been marked by GC" weakOop < oop ifTrue: [chunk := self chunkFromOop: weakOop. oopGone := ((self longAt: chunk) bitAnd: TypeMask) = HeaderTypeFree] ifFalse: [oopGone := ((self baseHeader: weakOop) bitAnd: self markBit) = 0]. oopGone ifTrue: ["Store nil in the pointer and signal the interpreter " self longAt: oop + i put: nilObj. + nonWeakCnt >= 2 ifTrue: [ self weakFinalizerCheck: oop ]. self signalFinalization: oop]]]! Item was changed: ----- Method: ObjectMemory class>>initializeSpecialObjectIndices (in category 'initialization') ----- initializeSpecialObjectIndices "Initialize indices into specialObjects array." NilObject := 0. FalseObject := 1. TrueObject := 2. SchedulerAssociation := 3. ClassBitmap := 4. ClassInteger := 5. ClassString := 6. ClassArray := 7. "SmalltalkDictionary := 8." "Do not delete!!" ClassFloat := 9. ClassMethodContext := 10. ClassBlockContext := 11. ClassPoint := 12. ClassLargePositiveInteger := 13. TheDisplay := 14. ClassMessage := 15. ClassCompiledMethod := 16. TheLowSpaceSemaphore := 17. ClassSemaphore := 18. ClassCharacter := 19. SelectorDoesNotUnderstand := 20. SelectorCannotReturn := 21. ProcessSignalingLowSpace := 22. "was TheInputSemaphore" SpecialSelectors := 23. CharacterTable := 24. SelectorMustBeBoolean := 25. ClassByteArray := 26. ClassProcess := 27. CompactClasses := 28. TheTimerSemaphore := 29. TheInterruptSemaphore := 30. SelectorCannotInterpret := 34. "Was MethodContextProto := 35." ClassBlockClosure := 36. "Was BlockContextProto := 37." ExternalObjectsArray := 38. ClassPseudoContext := 39. ClassTranslatedMethod := 40. TheFinalizationSemaphore := 41. ClassLargeNegativeInteger := 42. ClassExternalAddress := 43. ClassExternalStructure := 44. ClassExternalData := 45. ClassExternalFunction := 46. ClassExternalLibrary := 47. SelectorAboutToReturn := 48. SelectorRunWithIn := 49. + SelectorAttemptToAssign := 50. + + "PrimErrTableIndex := 51. in Interpreter class>>initializePrimitiveErrorCodes" + + ClassAlien := 52. + InvokeCallbackSelector := 53. + ClassUnsafeAlien := 54. + + ClassWeakFinalizer := 55 ! Item was changed: ----- Method: VMMaker class>>versionString (in category 'version testing') ----- versionString "VMMaker versionString" + ^'4.2.2'! - ^'4.2.1'! |
Free forum by Nabble | Edit this page |