Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 55 lines (41 sloc) 0.985 kb
b1f0998 Add a VM level bytecode verifier
Evan Phoenix authored
1 #ifndef RBX_BYTECODE_VERIFICATION
2 #define RBX_BYTECODE_VERIFICATION
3
4 #include <stdint.h>
5 #include <list>
6
7 namespace rubinius {
35dbaf5 @dbussink Rename CompiledMethod to CompiledCode
dbussink authored
8 class CompiledCode;
35a49f3 @evanphx Introduce State class as STATE
evanphx authored
9 class State;
b1f0998 Add a VM level bytecode verifier
Evan Phoenix authored
10 class VM;
11 class Tuple;
12
13 class BytecodeVerification {
35dbaf5 @dbussink Rename CompiledMethod to CompiledCode
dbussink authored
14 CompiledCode* method_;
b1f0998 Add a VM level bytecode verifier
Evan Phoenix authored
15
16 Tuple* ops_;
17 native_int total_;
18
19 int max_stack_allowed_;
20 int max_stack_seen_;
21 int32_t* stack_;
22
23 native_int locals_;
24 int max_stack_local_;
25
26 const char* fail_reason_;
27 int fail_ip_;
28
29 void fail(const char* reason, int ip) {
30 fail_reason_ = reason;
31 fail_ip_ = ip;
32 }
33
34 struct Section {
35 int sp;
36 int ip;
37
38 Section(int sp, int ip)
39 : sp(sp), ip(ip)
40 {}
41 };
42
43 public:
149a364 @brixen Cleaned up debris from CompiledMethod rename.
brixen authored
44 BytecodeVerification(CompiledCode* code);
b1f0998 Add a VM level bytecode verifier
Evan Phoenix authored
45 ~BytecodeVerification();
46
35a49f3 @evanphx Introduce State class as STATE
evanphx authored
47 bool verify(STATE);
48 bool verify_from(STATE, int sp, int ip, std::list<Section>& ips);
b1f0998 Add a VM level bytecode verifier
Evan Phoenix authored
49
50 const char* failure_reason() { return fail_reason_; }
51 int failure_ip() { return fail_ip_; }
52 };
53 }
54 #endif
Something went wrong with that request. Please try again.