VM Maker: VMMaker.oscog-eem.2504.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

VM Maker: VMMaker.oscog-eem.2504.mcz

commits-2
 
Eliot Miranda uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker.oscog-eem.2504.mcz

==================== 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]]
  ifNotNil:
  [:type |
  typeSet add: type.
  ^false]].
  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]
  ifFalse:
  [(expr typeOrNilFrom: aCodeGen in: self) ifNotNil:
  [:type | typeSet add: type]]].
  ^false!