Eliot Miranda uploaded a new version of VMMaker to project VM Maker: http://source.squeak.org/VMMaker/VMMaker.oscog-eem.282.mcz
==================== Summary ====================
Name: VMMaker.oscog-eem.282 Author: eem Time: 3 April 2013, 4:14:26.273 pm UUID: 6c2f2048-555b-4d37-a9eb-4d9252acf3b9 Ancestors: VMMaker.oscog-eem.281
Slang: Fix SmartSyntaxPlugin support method affected by the fixes for generating to:by:do: loops in VMMaker.oscog-eem.279.
=============== Diff against VMMaker.oscog-eem.281 ===============
Item was changed: ----- Method: TMethod>>preparePrimitivePrologue (in category 'primitive compilation') ----- preparePrimitivePrologue "Add a prolog and postlog to a primitive method. The prolog copies any instance variables referenced by this primitive method into local variables. The postlog copies values of assigned-to variables back into the instance. The names of the new locals are added to the local variables list.
The declarations dictionary defines the types of any non-integer variables (locals, arguments, or instance variables). In particular, it may specify the types:
int * -- an array of 32-bit values (e.g., a BitMap) short * -- an array of 16-bit values (e.g., a SoundBuffer) char * -- an array of unsigned bytes (e.g., a String) double -- a double precision floating point number (e.g., 3.14159)
Undeclared variables are taken to be integers and will be converted from Smalltalk to C ints."
"Current restrictions: o method must not contain message sends o method must not allocate objects o method must not manipulate raw oops o method cannot access class variables o method can only return an integer"
| prolog postlog instVarsUsed varsAssignedTo instVarList primArgCount varName endsWithReturn aClass | + self assert: selector ~~ #setInterpreter:. - selector == #setInterpreter: ifTrue:[self halt]. aClass := definingClass. prolog := OrderedCollection new. postlog := OrderedCollection new. instVarsUsed := self freeVariableReferences asSet. varsAssignedTo := self variablesAssignedTo asSet. instVarList := aClass allInstVarNames. primArgCount := args size.
"add receiver fetch and arg conversions to prolog" prolog addAll: self fetchRcvrExpr. 1 to: args size do: [:argIndex | varName := args at: argIndex. prolog addAll: (self argConversionExprFor: varName stackIndex: args size - argIndex)].
"add success check to postlog" postlog addAll: self checkSuccessExpr.
"add instance variable fetches to prolog and instance variable stores to postlog" 1 to: instVarList size do: [:varIndex | varName := instVarList at: varIndex. (instVarsUsed includes: varName) ifTrue: [ locals add: varName. prolog addAll: (self instVarGetExprFor: varName offset: varIndex - 1). (varsAssignedTo includes: varName) ifTrue: [ postlog addAll: (self instVarPutExprFor: varName offset: varIndex - 1)]]]. prolog addAll: self checkSuccessExpr.
+ ((locals includes: 'rcvr') or: [(locals intersection: args) notEmpty]) ifTrue: + [self error: 'local name conflicts with instance variable name']. + locals add: 'rcvr'; addAll: args. - locals addAllFirst: args. - locals addFirst: 'rcvr'. args := args class new. - locals asSet size = locals size - ifFalse: [self error: 'local name conflicts with instance variable name']. endsWithReturn := self endsWithReturn. self fixUpReturns: primArgCount postlog: postlog.
endsWithReturn ifTrue: [parseTree setStatements: prolog, parseTree statements] ifFalse: [ postlog addAll: (self popArgsExpr: primArgCount). parseTree setStatements: prolog, parseTree statements, postlog]. !
vm-dev@lists.squeakfoundation.org