Eliot Miranda uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker.oscog-eem.2503.mcz==================== Summary ====================
Name: VMMaker.oscog-eem.2503
Author: eem
Time: 29 December 2018, 5:39:12.429171 pm
UUID: ba90817f-4122-4ed1-9cce-68164b5f81d3
Ancestors: VMMaker.oscog-eem.2502
Fix a bug in type inferrence that resulted in the inferred return type of findMapLocationForMcpc:inMethod: to flip between usqInt (correct) and sqInt (incorrect). addTypesFor:to:in: needed to answer if it was inferring a return type from an untyped variable, as well as an untyped method.
=============== Diff against VMMaker.oscog-eem.2502 ===============
Item was changed:
----- Method: TMethod>>addTypesFor:to:in: (in category 'type inference') -----
addTypesFor: node to: typeSet in: aCodeGen
"Add the value types for the node to typeSet.
+ Answer if any type was derived from an as-yet-untyped method or variable, which allows us to abort
+ inferReturnTypeFromReturnsIn: if the return type depends on a yet-to-be-typed method or variable."
- Answer if any type was derived from an as-yet-untyped method, which allows us to abort
- inferReturnTypeFromReturnsIn: if the return type depends on a yet-to-be-typed method."
| expr |
expr := node.
[expr isAssignment or: [expr isStmtList]] whileTrue:
[expr isAssignment ifTrue:
[expr := expr variable].
expr isStmtList ifTrue:
[expr := expr statements last]].
expr isSend ifTrue:
[(#(ifTrue: ifFalse: ifTrue:ifFalse: ifFalse:ifTrue:) includes: expr selector) ifTrue:
[^expr args
inject: false
into: [:asYetUntyped :block|
asYetUntyped | (self addTypesFor: block to: typeSet in: aCodeGen)]].
(aCodeGen returnTypeForSend: expr in: self ifNil: nil)
ifNil: [^(aCodeGen methodNamed: expr selector) notNil and: [expr selector ~~ selector]]
ifNotNil:
[:type |
typeSet add: type.
+ ^false]].
- ^false].].
expr isVariable ifTrue:
[(aCodeGen typeOfVariable: expr name)
ifNotNil: [:type| typeSet add: type]
ifNil: [typeSet add: (expr name = 'self'
ifTrue: [#void]
+ ifFalse: [#sqInt]).
+ ^true]].
- ifFalse: [#sqInt])]].
expr isConstant ifTrue:
[(expr value isInteger and: [expr value >= 0]) "cannot determine if signed or unsigned yet..."
ifTrue: [typeSet add: expr value]
ifFalse:
[(expr typeOrNilFrom: aCodeGen in: self) ifNotNil:
[:type | typeSet add: type]]].
^false!