[Vm-dev] VM Maker: VMMaker.oscog-eem.647.mcz
commits at source.squeak.org
commits at source.squeak.org
Wed Mar 19 02:01:02 UTC 2014
Eliot Miranda uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker.oscog-eem.647.mcz
==================== Summary ====================
Name: VMMaker.oscog-eem.647
Author: eem
Time: 18 March 2014, 6:58:43.647 pm
UUID: 1dc11031-04d6-4682-b2a4-0a3cb99c2a2c
Ancestors: VMMaker.oscog-eem.646
Fix inferring types assigned from the kernel selectors, and hence
correctly evaluate testBecome.
Fix primitiveArrayBecome (the two-way become); it should /not/
specify copyHash. ObjectMemory ignores the copyHash flag when doing a two-way become, hence the wrong sense of the flag had
no effect. Hence correctly evaluate testBecomeIdentityHash.
Avoid remembering bit objects in inPlaceBecome:and:copyHashFlag:.
=============== Diff against VMMaker.oscog-eem.646 ===============
Item was changed:
----- Method: Interpreter>>primitiveArrayBecome (in category 'object access primitives') -----
primitiveArrayBecome
"We must flush the method cache here, to eliminate stale references
to mutated classes and/or selectors."
| arg rcvr |
arg := self stackTop.
rcvr := self stackValue: 1.
+ self success: (self become: rcvr with: arg twoWay: true copyHash: false).
- self success: (self become: rcvr with: arg twoWay: true copyHash: true).
successFlag ifTrue: [ self pop: 1 ].!
Item was changed:
----- Method: InterpreterPrimitives>>primitiveArrayBecome (in category 'object access primitives') -----
primitiveArrayBecome
"We must flush the method cache here, to eliminate stale references
to mutated classes and/or selectors."
| arg rcvr ec |
arg := self stackTop.
rcvr := self stackValue: 1.
+ ec := objectMemory become: rcvr with: arg twoWay: true copyHash: false.
- ec := objectMemory become: rcvr with: arg twoWay: true copyHash: true.
ec = PrimNoErr
ifTrue: [self pop: 1]
ifFalse: [self primitiveFailFor: ec]!
Item was changed:
----- Method: NewspeakInterpreter>>primitiveArrayBecome (in category 'object access primitives') -----
primitiveArrayBecome
"We must flush the method cache here, to eliminate stale references
to mutated classes and/or selectors. This version fails for immutables."
| arg rcvr ec |
arg := self stackTop.
rcvr := self stackValue: 1.
+ ec := self become: rcvr with: arg twoWay: true copyHash: false forceImmutables: false.
- ec := self become: rcvr with: arg twoWay: true copyHash: true forceImmutables: false.
ec = PrimNoErr
ifTrue: [self pop: 1]
ifFalse: [self primitiveFailFor: ec]!
Item was changed:
----- Method: SpurMemoryManager>>inPlaceBecome:and:copyHashFlag: (in category 'become implementation') -----
inPlaceBecome: obj1 and: obj2 copyHashFlag: copyHashFlag
"Do become in place by swapping object contents."
+ | headerTemp temp1 temp2 o1HasYoung o2HasYoung fmt |
- | headerTemp temp1 temp2 o1HasYoung o2HasYoung |
self assert: (self numSlotsOf: obj1) = (self numSlotsOf: obj2).
"swap headers, but swapping headers swaps remembered bits;
these need to be unswapped."
temp1 := self isRemembered: obj1.
temp2 := self isRemembered: obj2.
headerTemp := self longLongAt: obj1.
self longLongAt: obj1 put: (self longLongAt: obj2).
self longLongAt: obj2 put: headerTemp.
self setIsRememberedOf: obj1 to: temp1.
self setIsRememberedOf: obj2 to: temp2.
"swapping headers swaps hash; if !!copyHashFlag undo hash copy"
copyHashFlag ifFalse:
[temp1 := self rawHashBitsOf: obj1.
self setHashBitsOf: obj1 to: (self rawHashBitsOf: obj2).
self setHashBitsOf: obj2 to: temp1].
o1HasYoung := o2HasYoung := false.
0 to: (self numSlotsOf: obj1) - 1 do:
[:i|
temp1 := self fetchPointer: i ofObject: obj1.
temp2 := self fetchPointer: i ofObject: obj2.
self storePointerUnchecked: i
ofObject: obj1
withValue: temp2.
self storePointerUnchecked: i
ofObject: obj2
withValue: temp1.
(self isYoung: temp2) ifTrue:
[o1HasYoung := true].
(self isYoung: temp1) ifTrue:
[o2HasYoung := true]].
(self isOldObject: obj1) ifTrue:
+ [fmt := self formatOf: obj1.
+ (o1HasYoung and: [(self isPureBitsFormat: fmt) not]) ifTrue:
- [o1HasYoung ifTrue:
[self possibleRootStoreInto: obj1]].
(self isOldObject: obj2) ifTrue:
+ [fmt := self formatOf: obj2.
+ (o2HasYoung and: [(self isPureBitsFormat: fmt) not]) ifTrue:
- [o2HasYoung ifTrue:
[self possibleRootStoreInto: obj2]]!
Item was changed:
----- Method: TMethod>>inferTypesForImplicitlyTypedVariablesIn: (in category 'type inference') -----
inferTypesForImplicitlyTypedVariablesIn: aCodeGen
"infer types for untyped variables form assignments and arithmetic uses.
This for debugging:
(self copy inferTypesForImplicitlyTypedVariablesIn: aCodeGen)"
| explicitlyTyped effectiveNodes |
explicitlyTyped := declarations keys asSet.
effectiveNodes := Dictionary new. "this for debugging"
parseTree nodesDo:
+ [:node| | type var |
- [:node| | type var m |
"If there is something of the form i >= 0, then i should be signed, not unsigned."
(node isSend
and: [(locals includes: (var := node receiver variableNameOrNil))
and: [(explicitlyTyped includes: var) not
and: [(#(<= < >= >) includes: node selector)
and: [node args first isConstant
and: [node args first value = 0
and: [(type := self typeFor: var in: aCodeGen) notNil
and: [type first == $u]]]]]]]) ifTrue:
[declarations at: var put: (declarations at: var) allButFirst.
effectiveNodes at: var put: { declarations at: var. node }].
"if an assignment of a known send, set the variable's type to the return type of the send."
(node isAssignment
and: [(locals includes: (var := node variable name))
and: [(declarations includesKey: var) not
and: [node expression isSend
+ and: [(type := aCodeGen returnTypeForSend: node expression) notNil]]]]) ifTrue:
+ [(#(sqInt void) includes: type) ifFalse:
- and: [(m := aCodeGen anyMethodNamed: node expression selector) notNil]]]]) ifTrue:
- [(#(sqInt void nil) includes: m returnType) ifFalse:
["the $: is to map things like unsigned field : 3 to usqInt"
declarations
at: var
+ put: ((type includes: $:) ifTrue: [#usqInt] ifFalse: [type]), ' ', var.
- put: ((m returnType includes: $:) ifTrue: [#usqInt] ifFalse: [m returnType]), ' ', var.
effectiveNodes at: var put: { declarations at: var. node }]]].
^effectiveNodes!
More information about the Vm-dev
mailing list