forked from MacRuby/MacRuby
-
Notifications
You must be signed in to change notification settings - Fork 0
/
interpreter.h
53 lines (41 loc) · 1.08 KB
/
interpreter.h
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
/*
* MacRuby Interpreter.
*
* This file is covered by the Ruby license. See COPYING for more details.
*
* Copyright (C) 2008-2011, Apple Inc. All rights reserved.
*/
#ifndef __INTERPRETER_H_
#define __INTERPRETER_H_
#if defined(__cplusplus)
#if !defined(MACRUBY_STATIC)
class RoxorInterpreter {
public:
static RoxorInterpreter *shared;
RoxorInterpreter(void);
~RoxorInterpreter(void);
VALUE interpret(Function *func, VALUE self, SEL sel);
bool frame_at_index(unsigned int idx, void *addr, std::string *name,
std::string *path, unsigned int *line);
private:
VALUE self_arg;
SEL sel_arg;
VALUE *stack;
unsigned int stack_p;
#define INTERPRETER_STACK_SIZE 1000
std::map<Instruction *, VALUE> insns;
class Frame {
public:
std::string name;
std::string path;
unsigned int line;
};
std::vector<Frame> frames;
VALUE interpret_basicblock(BasicBlock *bb);
VALUE interpret_instruction(Instruction *insn);
VALUE interpret_value(Value *val);
VALUE interpret_call(CallInst *call);
};
#endif // !MACRUBY_STATIC
#endif // __cplusplus
#endif // __INTERPRETER_H_