Hi Craig,
On Fri, Oct 9, 2015 at 3:36 AM, Craig Latta craig@netjam.org wrote:
a) write a scratch primitive called e.g. primitiveFakeAForeignCallback which forks (at a higher priority?, or at least does a yield?), and calls the relevant machinery with faked up callback data (so you can avoid all the stuff in thinkProcess which is written in C)
Which machinery is that? callbackEnter:? I have the simulator and
reader image going.
here's the edited-down guts of thunkEntry, which is what you wasn't to simulate:
long thunkEntry(void *thunkp, long *stackp) { ...
if ((flags = interpreterProxy->ownVM(0)) < 0) { fprintf(stderr,"Warning; callback failed to own the VM\n"); return -1; }
if (!(returnType = setjmp(vmcc.trampoline))) { ... interpreterProxy->sendInvokeCallbackContext(&vmcc); fprintf(stderr,"Warning; callback failed to invoke\n"); ... interpreterProxy->disownVM(flags); return -1; } ... interpreterProxy->disownVM(flags);
switch (returnType) {
case retword: return vmcc.rvs.valword; ...
So I expect you want to do something like
[self ownVM: 0. self sendInvokeCallbackContext: fakeVMCallbackContextAddress] forkAt: Processor activePriority + 1
You could even create a CArray or some such to hold onto the data for the callback (fakeVMCallbackContextAddress above).
BTW, this is /monstrously/ cool of you!
Sure thing!
-C
-- Craig Latta netjam.org +31 6 2757 7177 (SMS ok)
- 1 415 287 3547 (no SMS)
On 09-10-2015, at 9:48 AM, Eliot Miranda eliot.miranda@gmail.com wrote: long thunkEntry(void *thunkp, long *stackp)
Well, there’s your problem. thunkEntry is written in Comic Sans; how could that ever work?
tim -- tim Rowledge; tim@rowledge.org; http://www.rowledge.org/tim Useful Latin Phrases:- Braccae illae virides cum subucula rosea et tunica Caledonia-quam elenganter concinnatur! = Those green pants go so well with that pink shirt and the plaid jacket!
Any advice about how the trace log could be useful here? I notice ownVM etc. write to it.
thanks again,
-C
-- Craig Latta netjam.org +31 6 2757 7177 (SMS ok) + 1 415 287 3547 (no SMS)
On Sat, Oct 10, 2015 at 11:11 AM, Craig Latta craig@netjam.org wrote:
Any advice about how the trace log could be useful here? I notice
ownVM etc. write to it.
For example, you can use it to generate a log of important thread-switching events, to get an idea of what's going on.
_,,,^..^,,,_ best, Eliot
vm-dev@lists.squeakfoundation.org