Fwd: Problem running iSqueak with callbacks

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

Fwd: Problem running iSqueak with callbacks

johnmci

Ok, this one is

wakeHighestPriority()   does exit(42) because "scheduler could not find a runnable process"

Note the guard clause check for "primitiveIndex"
The objective-c code is also attached, note the "interpreterProxy->methodPrimitiveIndex() != 0"

The execution path seems to be via checkForInterrupts via longUnconditionalJump in the interpreter loop.
In this case the method seems to have the methodPrimitiveIndex set to non-zero.

I'm wonder here if the "idleProcess" is triggering the callback and we want to switch to another process. However from
the process dump there isn't anything runnable....

Thoughts are welcome.


 callbackEnter: callbackID
        "Re-enter the interpreter for executing a callback"
        | result activeProc |
        self export: true.
        self var: #callbackID declareC: 'sqInt *callbackID'.

        "For now, do not allow a callback unless we're in a primitiveResponse"
        primitiveIndex = 0 ifTrue:[^false].

        "Check if we've exceeded the callback depth"
        jmpDepth >= jmpMax ifTrue:[^false].
        jmpDepth := jmpDepth + 1.

        "Suspend the currently active process"
        activeProc := self fetchPointer: ActiveProcessIndex
                                                 ofObject: self schedulerPointer.
        suspendedCallbacks at: jmpDepth put: activeProc.
        "We need to preserve newMethod explicitly since it is not activated yet
        and therefore no context has been created for it. If the caller primitive
        for any reason decides to fail we need to make sure we execute the correct
        method and not the one 'last used' in the call back"
        suspendedMethods at: jmpDepth put: newMethod.
        self transferTo: self wakeHighestPriority.

        "Typically, invoking the callback means that some semaphore has been
        signaled to indicate the callback. Force an interrupt check right away."
        self forceInterruptCheck.



Begin forwarded message:

> From: Esteban Lorenzano <[hidden email]>
> Date: February 17, 2010 3:37:02 PM PST
> To: [hidden email]
> Subject: Re: Problem running iSqueak with callbacks
>
> Hi again :)
> Well, I placed a breakpoint and take this information data:
>
> Cheers,
> Esteban
>
>
> (gdb) bt
> #0  callbackEnter (callbackID=0x48311cc) at /Users/MAC/Desktop/Dev/iSqueak/iRPGNames/src/vm/interp.c:24669
> #1  0x000bc91e in -[SqueakProxy forwardInvocation:] (self=0x48311b0, _cmd=0x97cec0c0, anInvocation=0x4815870) at /Users/MAC/Desktop/Dev/iSqueak/iRPGNames/platforms/Mac OSObjC/plugins/SqueakObjectiveC/squeakProxy.m:107
> #2  0x020006f4 in ___forwarding___ ()
> #3  0x01fdc6c2 in __forwarding_prep_0___ ()
> #4  0x0091bfb9 in -[UIPickerView _sendSelectionChangedForComponent:] ()
> #5  0x00a99133 in -[UIScroller _scrollAnimationEnded] ()
> #6  0x0099c2d8 in -[UIAnimator stopAnimation:] ()
> #7  0x0099c100 in -[UIAnimator(Static) _advance:] ()
> #8  0x02a855a1 in HeartbeatTimerCallback ()
> #9  0x01fd7ac0 in CFRunLoopRunSpecific ()
> #10 0x01fd6c48 in CFRunLoopRunInMode ()
> #11 0x003e6cf5 in -[NSRunLoop(NSRunLoop) runMode:beforeDate:] ()
> #12 0x0043bc7d in -[NSRunLoop(NSRunLoop) runUntilDate:] ()
> #13 0x000aa0d6 in ioProcessEvents () at /Users/MAC/Desktop/Dev/iSqueak/iRPGNames/platforms/Mac OSObjC/vm/Common/Classes/sqSqueakEventsAPI.m:70
> #14 0x00090171 in checkForInterrupts () at /Users/MAC/Desktop/Dev/iSqueak/iRPGNames/src/vm/interp.c:3240
> #15 0x000a2456 in interpret () at /Users/MAC/Desktop/Dev/iSqueak/iRPGNames/src/vm/interp.c:8971
> #16 0x000a9ba7 in -[sqSqueakMainApplication runSqueak] (self=0x4815f70, _cmd=0xc7850) at /Users/MAC/Desktop/Dev/iSqueak/iRPGNames/platforms/Mac OSObjC/vm/Common/Classes/sqSqueakMainApplication.m:169
> #17 0x00409e6a in __NSFirePerformTimer ()
> #18 0x01fd8252 in __CFRunLoopDoObservers ()
> #19 0x01fd6f5d in CFRunLoopRunSpecific ()
> #20 0x01fd6c48 in CFRunLoopRunInMode ()
> #21 0x02a82615 in GSEventRunModal ()
> #22 0x02a826da in GSEventRun ()
> #23 0x0092efaf in UIApplicationMain ()
> #24 0x00002686 in main (argc=1, argv=0xbffff05c) at /Users/MAC/Desktop/Dev/iSqueak/iRPGNames/platforms/Mac OSObjC/vm/Common/main.m:52
>
> (gdb) call (int) printAllStacks()
> Process
> 543613324 >idleProcess
> 543613232 >startUp
> 543555748 BlockClosure>newProcess
>
>
> Process
> 543600440 >finalizationProcess
> 543600348 >restartFinalizationProcess
> 543600584 BlockClosure>newProcess
>
>
>
>
>
>
>
>
>
>
> Process
> 543677144 >handleTimerEvent
> 526099932 >?
> 526099796 BlockClosure>?
> 526099704 >?
> 526099612 >?
> 526100044 BlockClosure>?
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> Process
> 543669116 Delay>wait
> 543669024 BlockClosure>ifCurtailed:
> 543668124 Delay>wait
> 543668032 InputEventPollingFetcher>waitForInput
> 543546484 InputEventFetcher>eventLoop
> 543546392 InputEventFetcher>installEventLoop
> 543546576 BlockClosure>newProcess
>
> Process
> 543555352 SystemDictionary>lowSpaceWatcher
> 543555260 SystemDictionary>installLowSpaceWatcher
> 543555476 BlockClosure>newProcess
>
>
>
>
> Process
> 543603372 ObjectiveCSqueakProxy>wait
> 543603280 DEProxy>runUntilTerminateConditionBlock:
> 543603188 BlockClosure>repeat
> 543603064 DEProxy>runUntilTerminateConditionBlock:
> 543602956 DEProxy>run
> 543602864 BlockClosure>on:do:
> 543602740 DEProxy>run
> 543602524 BlockClosure>newProcess
>
> Process
> 543613520 ObjectiveCSqueakProxy>wait
> 543613428 DEProxy>runUntilTerminateConditionBlock:
> 543604652 BlockClosure>repeat
> 543604528 DEProxy>runUntilTerminateConditionBlock:
> 543604420 DEProxy>run
> 543604328 BlockClosure>on:do:
> 543604204 DEProxy>run
> 543603780 BlockClosure>newProcess
>
> Process
> 543607024 ObjectiveCSqueakProxy>wait
> 543606932 DEProxy>runUntilTerminateConditionBlock:
> 543606840 BlockClosure>repeat
> 543606716 DEProxy>runUntilTerminateConditionBlock:
> 543606576 DEProxy>run
> 543606484 BlockClosure>on:do:
> 543606392 DEProxy>run
> 543604972 BlockClosure>newProcess
> Process
> 543607748 ObjectiveCSqueakProxy>wait
> 543607656 DEProxy>runUntilTerminateConditionBlock:
> 543607564 BlockClosure>repeat
> 543607440 DEProxy>runUntilTerminateConditionBlock:
> 543607332 DEProxy>run
> 543607240 BlockClosure>on:do:
> 543607116 DEProxy>run
> 543605316 BlockClosure>newProcess
>
> Process
> 543608472 ObjectiveCSqueakProxy>wait
> 543608380 DEProxy>runUntilTerminateConditionBlock:
> 543608288 BlockClosure>repeat
> 543608164 DEProxy>runUntilTerminateConditionBlock:
> 543608056 DEProxy>run
> 543607964 BlockClosure>on:do:
> 543607840 DEProxy>run
> 543605884 BlockClosure>newProcess
> Process
> 543609196 ObjectiveCSqueakProxy>wait
> 543609104 DEProxy>runUntilTerminateConditionBlock:
> 543609012 BlockClosure>repeat
> 543608888 DEProxy>runUntilTerminateConditionBlock:
> 543608780 DEProxy>run
> 543608688 BlockClosure>on:do:
> 543608564 DEProxy>run
> 543606228 BlockClosure>newProcess
>
>
>
> Process
> 543612184 DelayWaitTimeout>wait
> 543612060 BlockClosure>ensure:
> 543611884 DelayWaitTimeout>wait
> 543611792 Semaphore>waitTimeoutMSecs:
> 543611700 Socket>waitForConnectionFor:ifTimedOut:
> 543611608 Socket>waitForAcceptFor:
> 543611380 RFBServer>runLoop
> 543611288 BlockClosure>ifCurtailed:
> 543611196 RFBServer>runLoop
> 543611060 RFBServer>start:
> 543611472 BlockClosure>newProcess
>
>
>
>
>
>
>
>
>
> Process
> 543677420 Delay>wait
> 543677328 BlockClosure>ifCurtailed:
> 543676364 Delay>wait
> 543675868 WorldState>interCyclePause:
> 543675776 WorldState>doOneCycleFor:
> 543675684 PasteUpMorph>doOneCycle
> 538773448 >spawnNewProcess
> 538773320 BlockClosure>newProcess
> $1 = 2
> (gdb)




sqInt ioProcessEvents(void) {
        //API Documented
       
        aioPoll(0);
       
        /* This the carbon logic model
         described by http://developer.apple.com/qa/qa2001/qa1061.html
         but fails on device, bug tracking number  5971848 */
       
/* extern struct VirtualMachine* interpreterProxy; */
        if (interpreterProxy->methodPrimitiveIndex() != 0) {
                // limitDateForMode:
               
                //BOOL processedEvent;
                // NSDate *now = [[NSDate alloc] init];
                NSDate *now = [[NSDate alloc] initWithTimeIntervalSinceNow: 0.0001 ];
                //processedEvent = [[NSRunLoop mainRunLoop] runMode: NSDefaultRunLoopMode  beforeDate: now];
               
                //[now release];
                [[NSRunLoop mainRunLoop] runUntilDate: now];
                [now release];
        }
       
       
        if (gQuitNowRightNow) {
                ioExit();  //This might not return, might call exittoshell
        }
       
        return 0;
}
--
===========================================================================
John M. McIntosh <[hidden email]>   Twitter:  squeaker68882
Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com
===========================================================================