forked from rubinius/rubinius
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy paththread_state.hpp
64 lines (50 loc) · 1.35 KB
/
thread_state.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#ifndef RBX_THREAD_STATE_HPP
#define RBX_THREAD_STATE_HPP
#include "raise_reason.hpp"
#include "gc/root.hpp"
#include <iostream>
namespace rubinius {
class Object;
class Exception;
class VariableScope;
class VM;
class ThreadState {
TypedRoot<Exception*> current_exception_;
TypedRoot<Object*> raise_value_;
TypedRoot<Object*> throw_dest_;
RaiseReason raise_reason_;
TypedRoot<VariableScope*> destination_scope_;
public:
ThreadState(VM* vm);
Exception* current_exception() {
return current_exception_.get();
}
void set_current_exception(Exception* exc) {
current_exception_.set((Object*)exc);
}
Object* raise_value() {
return raise_value_.get();
}
RaiseReason raise_reason() {
return raise_reason_;
}
VariableScope* destination_scope() {
return destination_scope_.get();
}
Object* throw_dest() {
return throw_dest_.get();
}
void clear_break();
void clear_return();
void clear_raise();
void clear();
Object* state_as_object(STATE);
void set_state(STATE, Object* obj);
void raise_exception(Exception* exc);
void raise_return(Object* value, VariableScope* dest);
void raise_break(Object* value, VariableScope* dest);
void raise_exit(Object* code);
void raise_throw(Symbol* dest, Object* value);
};
};
#endif