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)
Ejemplo n.º 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)
Ejemplo n.º 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
Ejemplo n.º 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
Ejemplo n.º 5
0
 def switch(thrd, h):
     h = _c.switch(thrd._thrd, h)
     if not h:
         raise MemoryError
     return h
Ejemplo n.º 6
0
 def switch(thrd, h):
     h = _c.switch(thrd._thrd, h)
     if not h:
         raise MemoryError
     return h
Ejemplo n.º 7
0
 def f():
     switch(rffi.cast(thread_handle, 0), rffi.cast(handle, 0))