[Vm-dev] VM Maker: VMMaker.oscog-eem.2504.mcz

commits at source.squeak.org commits at source.squeak.org
Sun Dec 30 01:52:41 UTC 2018

Eliot Miranda uploaded a new version of VMMaker to project VM Maker:

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

Name: VMMaker.oscog-eem.2504
Author: eem
Time: 29 December 2018, 5:52:25.481882 pm
UUID: a00b0fad-c04c-47a6-8a11-5dbff110ac11
Ancestors: VMMaker.oscog-eem.2503

Make the fix more precise.  ^self does map to a return type of #void, so only answer in the positive for variables other than self.

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

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."
  	| 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]]
  				[:type |
  				typeSet add: type.
  	expr isVariable ifTrue:
  		[(aCodeGen typeOfVariable: expr name)
  			ifNotNil: [:type| typeSet add: type]
+ 			ifNil: [(typeSet add: (expr name = 'self'
- 			ifNil: [typeSet add: (expr name = 'self'
  										ifTrue: [#void]
+ 										ifFalse: [#sqInt])) == #sqInt ifTrue:
+ 					[^true]]].
- 										ifFalse: [#sqInt]).
- 				^true]].
  	expr isConstant ifTrue:
  		[(expr value isInteger and: [expr value >= 0]) "cannot determine if signed or unsigned yet..."
  			ifTrue: [typeSet add: expr value]
  				[(expr typeOrNilFrom: aCodeGen in: self) ifNotNil:
  					[:type | typeSet add: type]]].

More information about the Vm-dev mailing list