[Vm-dev] VM Maker: VMMaker.oscog-eem.922.mcz
commits at source.squeak.org
commits at source.squeak.org
Tue Nov 4 22:32:15 UTC 2014
Eliot Miranda uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker.oscog-eem.922.mcz
==================== Summary ====================
Name: VMMaker.oscog-eem.922
Author: eem
Time: 4 November 2014, 2:29:50.312 pm
UUID: 52f1b50e-005d-4035-ad57-953a3790260e
Ancestors: VMMaker.oscog-eem.921
Fix a transcription slip in the new
implicitReceiverFor:mixin:implementing:. Use
followObjField: in
findApplicationOfTargetMixin:startingAtBehavior:.
Fix the assert in addFreeSubTree: similarly to that in
addToFreeTree:bytes:.
=============== Diff against VMMaker.oscog-eem.921 ===============
Item was changed:
----- Method: SpurMemoryManager>>addFreeSubTree: (in category 'free space') -----
addFreeSubTree: freeTree
"Add a freeChunk sub tree back into the large free chunk tree.
This is for allocateOldSpaceChunkOf[Exactly]Bytes:[suchThat:]."
| bytesInArg treeNode bytesInNode subNode |
"N.B. *can't* use numSlotsOfAny: because of rounding up of odd slots
and/or step in size at 1032 bytes in 32-bits or 2048 bytes in 64-bits."
self assert: (self isFreeObject: freeTree).
bytesInArg := self bytesInObject: freeTree.
self assert: bytesInArg >= (self numFreeLists * self allocationUnit).
treeNode := freeLists at: 0.
self assert: treeNode ~= 0.
[bytesInNode := self bytesInObject: treeNode.
+ "check for overlap; could write this as self oop: (self objectAfter: freeChunk) isLessThanOrEqualTo: child...
+ but that relies on headers being correct, etc. So keep it clumsy..."
+ self assert: ((self oop: freeTree + bytesInArg - self baseHeaderSize isLessThanOrEqualTo: treeNode)
+ or: [self oop: freeTree isGreaterThanOrEqualTo: treeNode + bytesInNode - self baseHeaderSize]).
- self assert: ((self oop: freeTree + bytesInArg isLessThanOrEqualTo: treeNode)
- or: [self oop: freeTree isGreaterThanOrEqualTo: treeNode + bytesInNode]).
self assert: bytesInNode >= (self numFreeLists * self allocationUnit).
self assert: bytesInArg ~= bytesInNode.
bytesInNode > bytesInArg
ifTrue:
[subNode := self fetchPointer: self freeChunkSmallerIndex ofFreeChunk: treeNode.
subNode = 0 ifTrue:
[self storePointer: self freeChunkSmallerIndex ofFreeChunk: treeNode withValue: freeTree.
self storePointer: self freeChunkParentIndex ofFreeChunk: freeTree withValue: treeNode.
^self]]
ifFalse:
[subNode := self fetchPointer: self freeChunkLargerIndex ofFreeChunk: treeNode.
subNode = 0 ifTrue:
[self storePointer: self freeChunkLargerIndex ofFreeChunk: treeNode withValue: freeTree.
self storePointer: self freeChunkParentIndex ofFreeChunk: freeTree withValue: treeNode.
^self]].
treeNode := subNode] repeat!
Item was changed:
----- Method: StackInterpreter>>findApplicationOfTargetMixin:startingAtBehavior: (in category 'newspeak bytecode support') -----
findApplicationOfTargetMixin: targetMixin startingAtBehavior: aBehavior
"This is used to implement implicit receiver and enclosing object lookup
+ for Newspeak. Find the mixin application of which aClass is a subclass that
- for Newspeak. Find the mixin applcation of which aClass is a subclass that
is an application of targetMixin. This is an implementation derived from
<ContextPart> findApplicationOf: targetMixin startingAt: aBehavior
"
| mixinApplication mixin |
mixinApplication := aBehavior.
[mixinApplication = objectMemory nilObject
or: [mixinApplication = targetMixin
+ or: [(mixin := objectMemory followObjField: MixinIndex ofObject: mixinApplication) = targetMixin]]] whileFalse:
+ [mixinApplication := objectMemory followObjField: SuperclassIndex ofObject: mixinApplication].
- or: [(mixin := objectMemory fetchPointer: MixinIndex ofObject: mixinApplication) = targetMixin]]] whileFalse:
- [mixinApplication := objectMemory fetchPointer: SuperclassIndex ofObject: mixinApplication].
^mixinApplication!
Item was changed:
----- Method: StackInterpreter>>implicitReceiverFor:mixin:implementing: (in category 'newspeak bytecode support') -----
implicitReceiverFor: methodReceiver mixin: methodMixin implementing: selector
"This is used to implement implicit receiver sends in Newspeak. Find the nearest
lexically-enclosing implementation of selector by searching up the static chain of the
method's receiver, starting at mixin's application. This implementation is derived from
<ContextPart> implicitReceiverFor: methodReceiver <Object>
in: methodMixin <Mixin>
implementing: selector <Symbol> ^<Object>"
<api>
<option: #NewspeakVM>
| candidateReceiver candidateMixin candidateMixinApplication dictionary found |
self deny: (objectMemory isOopForwarded: methodReceiver).
self deny: (objectMemory isForwarded: methodMixin).
"messageSelector is an implicit parameter of lookupMethodInDictionary:"
messageSelector := objectMemory followMaybeForwarded: selector.
candidateReceiver := methodReceiver.
candidateMixin := methodMixin.
[candidateMixinApplication := self
+ findApplicationOfTargetMixin: candidateMixin
+ startingAtBehavior: (objectMemory fetchClassOf: candidateReceiver).
+ candidateMixinApplication = objectMemory nilObject ifTrue:
+ [^methodReceiver].
- findApplicationOfTargetMixin: candidateMixin
- startingAtBehavior: (objectMemory fetchClassOf: candidateReceiver).
- self deny: (candidateMixinApplication = objectMemory nilObject).
dictionary := objectMemory followObjField: MethodDictionaryIndex ofObject: candidateMixinApplication.
found := self lookupMethodInDictionary: dictionary.
found ifTrue: [^candidateReceiver].
candidateMixin := objectMemory followObjField: EnclosingMixinIndex ofObject: candidateMixin.
candidateMixin = objectMemory nilObject]
whileFalse:
[candidateReceiver := objectMemory followObjField: EnclosingObjectIndex ofObject: candidateMixinApplication].
^methodReceiver!
More information about the Vm-dev
mailing list