[Vm-dev] Access to arguments in the stack vm

Hernan Wilkinson hernan.wilkinson at 10pines.com
Mon Oct 8 18:51:53 UTC 2018


Hi,
 In the implementation of the dynamically typed vm I'm doing (to give it a
name) I need to get the parameters when a method gets activated.
 To do it I implemented a not-inlined method that sends the message
#internalStackValue:
 The problem is that the code for that method is not generated. The method
gets removed from the methods to generate code because it access "localSP"
although not directly but due to inlining #internalStackValue:

 How should I access the arguments then? Why I can not use "localSP"?

 The method source is:
keepArgumentTypes

<inline: false>
| additionalMethodState tempVarsTypes |
additionalMethodState := self additionalMethodStateOf: newMethod.
additionalMethodState = objectMemory nilObject ifTrue: [ ^self ].
tempVarsTypes := objectMemory followObjField: 2 ofObject:
additionalMethodState.
tempVarsTypes = objectMemory nilObject ifTrue: [ ^self ].
0 to: argumentCount-1 do: [ :argIndex |
self keepTypeInformationIn: tempVarsTypes at: argIndex for: (self
internalStackValue: argIndex) ].
 I manage to solve the problem passing localSP as parameter and doing the
following, but I should not be doing that:
keepArgumentTypes: sp

<inline: false>
| additionalMethodState tempVarsTypes |
additionalMethodState := self additionalMethodStateOf: newMethod.
additionalMethodState = objectMemory nilObject ifTrue: [ ^self ].
tempVarsTypes := objectMemory followObjField: 2 ofObject:
additionalMethodState.
tempVarsTypes = objectMemory nilObject ifTrue: [ ^self ].
0 to: argumentCount-1 do: [ :argIndex |
self keepTypeInformationIn: tempVarsTypes at: argIndex for: (stackPages
longAtPointer: sp + (argIndex * objectMemory bytesPerOop)) ].

-- 

*HernĂ¡n WilkinsonAgile Software Development, Teaching & Coaching*
*Phone: +54-011*-4893-2057
*Twitter: @HernanWilkinson*
*site: http://www.10Pines.com <http://www.10pines.com/>*
Address: Alem 896, Floor 6, Buenos Aires, Argentina
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20181008/f8cdc8af/attachment.html>


More information about the Vm-dev mailing list