Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
dart::LongJumpScope Class Reference

#include <longjump.h>

Inheritance diagram for dart::LongJumpScope:
dart::StackResource

Public Member Functions

 LongJumpScope (ThreadState *thread=ThreadState::Current())
 
 ~LongJumpScope ()
 
jmp_buf * Set ()
 
DART_NORETURN void Jump (int value, const Error &error)
 
DART_NORETURN void Jump (int value)
 
- Public Member Functions inherited from dart::StackResource
 StackResource (ThreadState *thread)
 
virtual ~StackResource ()
 
ThreadStatethread () const
 

Additional Inherited Members

- Static Public Member Functions inherited from dart::StackResource
static void Unwind (ThreadState *thread)
 
static void UnwindAbove (ThreadState *thread, StackResource *new_top)
 

Detailed Description

Definition at line 17 of file longjump.h.

Constructor & Destructor Documentation

◆ LongJumpScope()

dart::LongJumpScope::LongJumpScope ( ThreadState thread = ThreadState::Current())
inlineexplicit

Definition at line 19 of file longjump.h.

20 : StackResource(thread), top_(nullptr), base_(thread->long_jump_base()) {
22 }
ThreadState * thread() const
Definition: allocation.h:33
StackResource(ThreadState *thread)
Definition: allocation.h:25
void set_long_jump_base(LongJumpScope *value)
Definition: thread_state.h:48
LongJumpScope * long_jump_base() const
Definition: thread_state.h:47

◆ ~LongJumpScope()

dart::LongJumpScope::~LongJumpScope ( )
inline

Definition at line 24 of file longjump.h.

24 {
26 thread()->set_long_jump_base(base_);
27 }
static ThreadState * Current()
Definition: thread_state.h:27
#define ASSERT(E)

Member Function Documentation

◆ Jump() [1/2]

void dart::LongJumpScope::Jump ( int  value)

Definition at line 31 of file longjump.cc.

31 {
32 // A zero is the default return value from setting up a LongJumpScope
33 // using Set.
34 ASSERT(value != 0);
35
36 Thread* thread = Thread::Current();
37 DEBUG_ASSERT(thread->TopErrorHandlerIsSetJump());
38
39 // Destruct all the active StackResource objects.
41 longjmp(environment_, value);
43}
#define UNREACHABLE()
Definition: assert.h:248
#define DEBUG_ASSERT(cond)
Definition: assert.h:321
static void UnwindAbove(ThreadState *thread, StackResource *new_top)
Definition: allocation.cc:56
static Thread * Current()
Definition: thread.h:362
uint8_t value

◆ Jump() [2/2]

void dart::LongJumpScope::Jump ( int  value,
const Error error 
)

Definition at line 22 of file longjump.cc.

22 {
23 ASSERT(!error.IsNull());
24
25 // Remember the error in the sticky error of this isolate.
27
28 Jump(value);
29}
DART_NORETURN void Jump(int value, const Error &error)
Definition: longjump.cc:22
void set_sticky_error(const Error &value)
Definition: thread.cc:236
const uint8_t uint32_t uint32_t GError ** error

◆ Set()

jmp_buf * dart::LongJumpScope::Set ( )

Definition at line 16 of file longjump.cc.

16 {
17 ASSERT(top_ == nullptr);
18 top_ = Thread::Current()->top_resource();
19 return &environment_;
20}
StackResource * top_resource() const
Definition: thread_state.h:41

The documentation for this class was generated from the following files: