def switch(thrd, suspstack):
     # suspstack has a handle to target, i.e. where to switch to
     ll_assert(suspstack != gcrootfinder.oldsuspstack, "stacklet: invalid use")
     gcrootfinder.newsuspstack = suspstack
     thread_handle = thrd._thrd
     h = llop.gc_shadowstackref_context(llmemory.Address, suspstack)
     h = llmemory.cast_adr_to_ptr(h, _c.handle)
     prepare_old_suspstack()
     h = _c.switch(thread_handle, h)
     return get_result_suspstack(h)
예제 #2
0
 def switch(thrd, suspstack):
     # suspstack has a handle to target, i.e. where to switch to
     ll_assert(suspstack != gcrootfinder.oldsuspstack,
               "stacklet: invalid use")
     gcrootfinder.newsuspstack = suspstack
     thread_handle = thrd._thrd
     h = llop.gc_shadowstackref_context(llmemory.Address, suspstack)
     h = llmemory.cast_adr_to_ptr(h, _c.handle)
     prepare_old_suspstack()
     h = _c.switch(thread_handle, h)
     return get_result_suspstack(h)
예제 #3
0
def _switch_callback():
    # Here, we just closed the stack.  Get the stack anchor, store
    # it in the gcrootfinder.suspstack.anchor, and switch to this
    # suspstack with stacklet_switch().  If this call fails, then we
    # are just returning NULL.
    oldanchor = gcrootfinder.suspstack.anchor
    _stack_just_closed()
    h = _consume_suspstack(gcrootfinder.suspstack)
    #
    # gcrootfinder.suspstack.anchor is left with the anchor of the
    # previous place (i.e. before the call to switch()).
    h2 = _c.switch(gcrootfinder.thrd, h)
    #
    if not h2:  # MemoryError: restore
        gcrootfinder.suspstack.anchor = oldanchor
        gcrootfinder.suspstack.handle = h
    return h2
예제 #4
0
def _switch_callback():
    # Here, we just closed the stack.  Get the stack anchor, store
    # it in the gcrootfinder.suspstack.anchor, and switch to this
    # suspstack with stacklet_switch().  If this call fails, then we
    # are just returning NULL.
    oldanchor = gcrootfinder.suspstack.anchor
    _stack_just_closed()
    h = _consume_suspstack(gcrootfinder.suspstack)
    #
    # gcrootfinder.suspstack.anchor is left with the anchor of the
    # previous place (i.e. before the call to switch()).
    h2 = _c.switch(gcrootfinder.thrd, h)
    #
    if not h2:    # MemoryError: restore
        gcrootfinder.suspstack.anchor = oldanchor
        gcrootfinder.suspstack.handle = h
    return h2
예제 #5
0
 def switch(thrd, h):
     h = _c.switch(thrd._thrd, h)
     if not h:
         raise MemoryError
     return h
예제 #6
0
파일: _stacklet_n_a.py 프로젝트: njues/Sypy
 def switch(thrd, h):
     h = _c.switch(thrd._thrd, h)
     if not h:
         raise MemoryError
     return h
예제 #7
0
파일: test_call.py 프로젝트: Debug-Orz/Sypy
 def f():
     switch(rffi.cast(thread_handle, 0), rffi.cast(handle, 0))