Hi, is this possible somehow to: - load compiled code in the image? like loading a compiled method instead of loading source then compiling it? - dynamically change a method that is on the stack?
If so, how? :) Steven. |
On Sat, Feb 24, 2018 at 11:23 AM, Steven Costiou
<[hidden email]> wrote: > Hi, > > is this possible somehow to: > > - load compiled code in the image? like loading a compiled method instead of > loading source then compiling it? why is this a problem? you could try to serialise a method with fuel and load it. > - dynamically change a method that is on the stack? have a look at on:fork: to see how igor cut some stack elements > > > > If so, how? :) > > Steven. |
Le 2018-02-25 08:37, Stephane Ducasse a écrit :
That is not necessarily a problem, I want to add new or modified methods in remote iot applications, while Pharo is running. I'm experimenting different ways to find which one suits me best. It works with TelePharo for example, but the method has to be recompiled on the iot application side. I was just wondering if Pharo provided a way to upload an already compiled method.
I will try fuel. But is fuel part of "standard" Pharo distribution?
Thanks.
Steven.
|
On Sun, Feb 25, 2018 at 12:59 PM, Steven Costiou <[hidden email]> wrote:
I'm really tempted to tell you to download Pharo and check it for yourself ^^
Also, send an email to Pablo, he's the DSU expert :)
|
In reply to this post by Steven Costiou-2
Hi Steven,
1. You can use Hermes through a socket or a file. The only pre-requisite is that both images run similar compatible compilers (usually you can use it from and to Pharo 6.1 and 7) 2. You can change the method, but if there is an activation context in the stack everything can be wrong. If you change a method you should update the program counter of the stack, and also any other thing can change (for example, temporaries or literals). Can you describe more the scenario where you want to change the method? Cheers, On Sat, Feb 24, 2018 at 11:23 AM, Steven Costiou <[hidden email]> wrote:
Pablo Tesone.
[hidden email] |
Hi Pablo, thanks :) I will try Hermes. Basic scenario is adding/removing metalinks to a lot of a methods in an iot app: 1- If the add/remove occurs a lot of time, then there is a slowdown due to recompilation of methods. As this is a remote app, i want to try recompiling all methods locally then upload them. I will also try with Hermes.
2- If metalinks are put inside a loop that is running, for now i understand i cannot update the method unless i replace it on the stack. Experimenting that is somewhere in my todolist, but i'm taking any advice ;) Maybe that is not really possible.
Steven. Le 2018-02-26 10:36, [hidden email] a écrit :
|
On 26 Feb 2018, at 22:59 , Steven Costiou <[hidden email]> wrote: My suggestion would be not to try updating methods that are on the stack, but to update the methods that are executed in response to messages sent by what is on the stack. So, for example, instead of longRunningLoopThatHandlesEvents [ terminationCondition ] whileFalse: [ big loop body inline here ] write: longRunningLoopThatHandlesEvents [ terminationCondition ] whileFalse: [ self doOneIteration ] doOneIteration big loop body here Then you can upload a new version of doOneIteration, and next time around the even loop, that’s what will be executed. This is much cleaner; you don’t have to worry about changing code in the midst of its execution and somehow preserving the values of temporaries while you do so. You can see the same thing in Pharo if you are examining an execution in the debugger, and edit and recompile one of the executing methods. The method on the stack won’t change, but after the execution context has popped off the stack, you will see the new version execute in response to subsequent message sends. Andrew |
Free forum by Nabble | Edit this page |