Example #1
0
 def f(n):
     if n <= 0:
         return 42
     try:
         return f(n + 1)
     except StackOverflow:
         if glob.caught:
             print 'Oups! already caught!'
         glob.caught = True
         _stack_criticalcode_start()
         critical(100)  # recurse another 100 times here
         _stack_criticalcode_stop()
         return 789
Example #2
0
 def f(n):
     if n <= 0:
         return 42
     try:
         return f(n+1)
     except StackOverflow:
         if glob.caught:
             print 'Oups! already caught!'
         glob.caught = True
         _stack_criticalcode_start()
         critical(100)   # recurse another 100 times here
         _stack_criticalcode_stop()
         return 789
Example #3
0
    def force_now(cpu, token):
        # Called during a residual call from the assembler, if the code
        # actually needs to force one of the virtualrefs or the virtualizable.
        # Implemented by forcing *all* virtualrefs and the virtualizable.

        # don't interrupt me! If the stack runs out in force_from_resumedata()
        # then we have seen cpu.force() but not self.save_data(), leaving in
        # an inconsistent state
        rstack._stack_criticalcode_start()
        try:
            deadframe = cpu.force(token)
            # this should set descr to ResumeGuardForceDescr, if it
            # was not that already
            faildescr = cpu.get_latest_descr(deadframe)
            assert isinstance(faildescr, ResumeGuardForcedDescr)
            faildescr.handle_async_forcing(deadframe)
        finally:
            rstack._stack_criticalcode_stop()
Example #4
0
    def force_now(cpu, token):
        # Called during a residual call from the assembler, if the code
        # actually needs to force one of the virtualrefs or the virtualizable.
        # Implemented by forcing *all* virtualrefs and the virtualizable.

        # don't interrupt me! If the stack runs out in force_from_resumedata()
        # then we have seen cpu.force() but not self.save_data(), leaving in
        # an inconsistent state
        rstack._stack_criticalcode_start()
        try:
            deadframe = cpu.force(token)
            # this should set descr to ResumeGuardForcedDescr, if it
            # was not that already
            faildescr = cpu.get_latest_descr(deadframe)
            assert isinstance(faildescr, ResumeGuardForcedDescr)
            faildescr.handle_async_forcing(deadframe)
        finally:
            rstack._stack_criticalcode_stop()