Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 415 lines (372 sloc) 13.23 kb
cfd7b4d added licensing information on the new files
Laurent Sansonetti authored
1 /*
2 * MacRuby compiler.
3 *
4 * This file is covered by the Ruby license. See COPYING for more details.
5 *
6 * Copyright (C) 2008-2009, Apple Inc. All rights reserved.
7 */
8
cb65416 the great schism, part I
Laurent Sansonetti authored
9 #ifndef __COMPILER_H_
10 #define __COMPILER_H_
11
12 #if defined(__cplusplus)
13
14 // For the dispatcher.
9590d40 fixing and adding several missing ruby method features
Laurent Sansonetti authored
15 #define DISPATCH_VCALL 1 // no receiver, no argument
16 #define DISPATCH_FCALL 2 // no receiver, one or more arguments
17 #define DISPATCH_SUPER 3 // super call
18 #define DISPATCH_SELF_ATTRASGN 4 // self attribute assignment
19 #define SPLAT_ARG_FOLLOWS 0xdeadbeef
cb65416 the great schism, part I
Laurent Sansonetti authored
20
21 // For defined?
22 #define DEFINED_IVAR 1
23 #define DEFINED_GVAR 2
24 #define DEFINED_CVAR 3
25 #define DEFINED_CONST 4
26 #define DEFINED_LCONST 5
27 #define DEFINED_SUPER 6
28 #define DEFINED_METHOD 7
29
bb0b28c moving to LLVM r82747
Laurent Sansonetti authored
30 class RoxorScope {
2541db3 added preliminary support for backtracing/symbolication
Laurent Sansonetti authored
31 public:
32 std::string path;
33 std::vector<unsigned int> dispatch_lines;
34
bb0b28c moving to LLVM r82747
Laurent Sansonetti authored
35 RoxorScope(const char *fname) : path(fname) {}
2541db3 added preliminary support for backtracing/symbolication
Laurent Sansonetti authored
36 };
37
cb65416 the great schism, part I
Laurent Sansonetti authored
38 class RoxorCompiler {
39 public:
40 static llvm::Module *module;
41 static RoxorCompiler *shared;
42
3432fd1 a better exception-based implementation for return-from-block
Laurent Sansonetti authored
43 RoxorCompiler(void);
cb65416 the great schism, part I
Laurent Sansonetti authored
44 virtual ~RoxorCompiler(void) { }
45
3432fd1 a better exception-based implementation for return-from-block
Laurent Sansonetti authored
46 void set_fname(const char *_fname) {
47 fname = _fname;
48 }
49
cb65416 the great schism, part I
Laurent Sansonetti authored
50 Value *compile_node(NODE *node);
51
52 virtual Function *compile_main_function(NODE *node);
53 Function *compile_read_attr(ID name);
54 Function *compile_write_attr(ID name);
55 Function *compile_stub(const char *types, int argc, bool is_objc);
56 Function *compile_bs_struct_new(rb_vm_bs_boxed_t *bs_boxed);
57 Function *compile_bs_struct_writer(rb_vm_bs_boxed_t *bs_boxed,
58 int field);
59 Function *compile_ffi_function(void *stub, void *imp, int argc);
60 Function *compile_to_rval_convertor(const char *type);
61 Function *compile_to_ocval_convertor(const char *type);
c1c347f AOT compiler: now supporting objc stubs and super dispatch
Laurent Sansonetti authored
62 Function *compile_objc_stub(Function *ruby_func, IMP ruby_imp,
63 const rb_vm_arity_t &arity, const char *types);
208a965 a quick implementation for #define_method (not yet 100% complete)
Laurent Sansonetti authored
64 Function *compile_block_caller(rb_vm_block_t *block);
cb65416 the great schism, part I
Laurent Sansonetti authored
65
66 const Type *convert_type(const char *type);
67
c219e86 don't slow ivars used inside an eval string
Laurent Sansonetti authored
68 bool is_inside_eval(void) { return inside_eval; }
69 void set_inside_eval(bool flag) { inside_eval = flag; }
12a1d67 fixing bugs in instance_eval & friends + fixed some specs so that they p...
Laurent Sansonetti authored
70 bool is_dynamic_class(void) { return dynamic_class; }
71 void set_dynamic_class(bool flag) { dynamic_class = flag; }
c219e86 don't slow ivars used inside an eval string
Laurent Sansonetti authored
72
bb0b28c moving to LLVM r82747
Laurent Sansonetti authored
73 RoxorScope *scope_for_function(Function *f) {
74 std::map<Function *, RoxorScope *>::iterator i = scopes.find(f);
75 return i == scopes.end() ? NULL : i->second;
76 }
77
78 void clear_scopes(void) {
79 scopes.clear();
80 }
81
cb65416 the great schism, part I
Laurent Sansonetti authored
82 protected:
83 const char *fname;
c219e86 don't slow ivars used inside an eval string
Laurent Sansonetti authored
84 bool inside_eval;
cb65416 the great schism, part I
Laurent Sansonetti authored
85
86 std::map<ID, Value *> lvars;
87 std::vector<ID> dvars;
85b7cc2 AOT compiler: ivar slots support
Laurent Sansonetti authored
88 std::map<ID, Instruction *> ivar_slots_cache;
cb65416 the great schism, part I
Laurent Sansonetti authored
89 std::map<std::string, GlobalVariable *> static_strings;
e379686 some work on unicode support (still in progress)
Laurent Sansonetti authored
90 std::map<CFHashCode, GlobalVariable *> static_ustrings;
bb0b28c moving to LLVM r82747
Laurent Sansonetti authored
91 std::map<Function *, RoxorScope *> scopes;
cb65416 the great schism, part I
Laurent Sansonetti authored
92
93 #if ROXOR_COMPILER_DEBUG
94 int level;
95 # define DEBUG_LEVEL_INC() (level++)
96 # define DEBUG_LEVEL_DEC() (level--)
97 #else
98 # define DEBUG_LEVEL_INC()
99 # define DEBUG_LEVEL_DEC()
100 #endif
101
2541db3 added preliminary support for backtracing/symbolication
Laurent Sansonetti authored
102 unsigned int current_line;
cb65416 the great schism, part I
Laurent Sansonetti authored
103 BasicBlock *bb;
104 BasicBlock *entry_bb;
105 ID current_mid;
164ca93 fixed super within a method that has a splat argument
Laurent Sansonetti authored
106 rb_vm_arity_t current_arity;
cb65416 the great schism, part I
Laurent Sansonetti authored
107 bool current_instance_method;
108 ID self_id;
109 Value *current_self;
110 bool current_block;
1961daa better fix than last one
Laurent Sansonetti authored
111 bool current_block_chain;
cb65416 the great schism, part I
Laurent Sansonetti authored
112 Value *current_var_uses;
113 Value *running_block;
114 BasicBlock *begin_bb;
63c77f8 @vincentisambart now rescues in rescues should work properly in most cases
vincentisambart authored
115 // block used in an invoke when an exception occurs
116 BasicBlock *rescue_invoke_bb;
117 // block to return to in a rescue if an exception is not handled
118 BasicBlock *rescue_rethrow_bb;
cb65416 the great schism, part I
Laurent Sansonetti authored
119 BasicBlock *ensure_bb;
120 bool current_rescue;
121 NODE *current_block_node;
122 Function *current_block_func;
123 GlobalVariable *current_opened_class;
12a1d67 fixing bugs in instance_eval & friends + fixed some specs so that they p...
Laurent Sansonetti authored
124 bool dynamic_class;
cb65416 the great schism, part I
Laurent Sansonetti authored
125 bool current_module;
126 BasicBlock *current_loop_begin_bb;
127 BasicBlock *current_loop_body_bb;
128 BasicBlock *current_loop_end_bb;
513ee74 @vincentisambart Fixed the return value of while/until loops
vincentisambart authored
129 PHINode *current_loop_exit_val;
3432fd1 a better exception-based implementation for return-from-block
Laurent Sansonetti authored
130 int return_from_block;
131 int return_from_block_ids;
5d7a33f @vincentisambart when there are multiple returns in an ensure,
vincentisambart authored
132 PHINode *ensure_pn;
bb0b28c moving to LLVM r82747
Laurent Sansonetti authored
133 RoxorScope *current_scope;
cb65416 the great schism, part I
Laurent Sansonetti authored
134
135 Function *dispatcherFunc;
38456a4 most fast ops in place
Laurent Sansonetti authored
136 Function *fastPlusFunc;
137 Function *fastMinusFunc;
138 Function *fastMultFunc;
139 Function *fastDivFunc;
140 Function *fastLtFunc;
141 Function *fastLeFunc;
142 Function *fastGtFunc;
143 Function *fastGeFunc;
944d624 optimize #== and #!= for non fixnum/float types
Laurent Sansonetti authored
144 Function *fastEqFunc;
145 Function *fastNeqFunc;
cb65416 the great schism, part I
Laurent Sansonetti authored
146 Function *fastEqqFunc;
147 Function *whenSplatFunc;
148 Function *prepareBlockFunc;
149 Function *pushBindingFunc;
150 Function *getBlockFunc;
151 Function *currentBlockObjectFunc;
152 Function *getConstFunc;
153 Function *setConstFunc;
154 Function *prepareMethodFunc;
155 Function *singletonClassFunc;
156 Function *defineClassFunc;
157 Function *prepareIvarSlotFunc;
158 Function *getIvarFunc;
159 Function *setIvarFunc;
160 Function *definedFunc;
161 Function *undefFunc;
162 Function *aliasFunc;
163 Function *valiasFunc;
164 Function *newHashFunc;
165 Function *toAFunc;
166 Function *toAryFunc;
167 Function *catArrayFunc;
168 Function *dupArrayFunc;
169 Function *newArrayFunc;
170 Function *newStructFunc;
171 Function *newOpaqueFunc;
ff75d60 added support for overwriting an ObjC method that accepts a pointer
Laurent Sansonetti authored
172 Function *newPointerFunc;
cb65416 the great schism, part I
Laurent Sansonetti authored
173 Function *getStructFieldsFunc;
174 Function *getOpaqueDataFunc;
175 Function *getPointerPtrFunc;
176 Function *checkArityFunc;
177 Function *setStructFunc;
178 Function *newRangeFunc;
179 Function *newRegexpFunc;
180 Function *strInternFunc;
181 Function *keepVarsFunc;
182 Function *masgnGetElemBeforeSplatFunc;
183 Function *masgnGetElemAfterSplatFunc;
184 Function *masgnGetSplatFunc;
185 Function *newStringFunc;
913687b fixed a bug in the way we compile literal strings
Laurent Sansonetti authored
186 Function *newString2Func;
187 Function *newString3Func;
cb65416 the great schism, part I
Laurent Sansonetti authored
188 Function *yieldFunc;
7da28cb make sure break makes yield return from its scope
Laurent Sansonetti authored
189 Function *getBrokenFunc;
208a965 a quick implementation for #define_method (not yet 100% complete)
Laurent Sansonetti authored
190 Function *blockEvalFunc;
cb65416 the great schism, part I
Laurent Sansonetti authored
191 Function *gvarSetFunc;
192 Function *gvarGetFunc;
193 Function *cvarSetFunc;
194 Function *cvarGetFunc;
195 Function *currentExceptionFunc;
196 Function *popExceptionFunc;
197 Function *getSpecialFunc;
198 Function *breakFunc;
6c5b476 a new implementation for return-from-block which uses an exception inste...
Laurent Sansonetti authored
199 Function *returnFromBlockFunc;
3432fd1 a better exception-based implementation for return-from-block
Laurent Sansonetti authored
200 Function *checkReturnFromBlockFunc;
cb65416 the great schism, part I
Laurent Sansonetti authored
201 Function *longjmpFunc;
202 Function *setjmpFunc;
9590d40 fixing and adding several missing ruby method features
Laurent Sansonetti authored
203 Function *setScopeFunc;
204 Function *setCurrentClassFunc;
77f9768 implemented super from a block
Laurent Sansonetti authored
205 Function *getCacheFunc;
cb65416 the great schism, part I
Laurent Sansonetti authored
206
207 Constant *zeroVal;
208 Constant *oneVal;
209 Constant *twoVal;
01528a7 floating point arithmetic optimization: Float objects are now immediate ...
Laurent Sansonetti authored
210 Constant *threeVal;
cb65416 the great schism, part I
Laurent Sansonetti authored
211 Constant *nilVal;
212 Constant *trueVal;
213 Constant *falseVal;
214 Constant *undefVal;
215 Constant *splatArgFollowsVal;
9590d40 fixing and adding several missing ruby method features
Laurent Sansonetti authored
216 Constant *defaultScope;
217 Constant *publicScope;
bb0b28c moving to LLVM r82747
Laurent Sansonetti authored
218
219 const Type *VoidTy;
220 const Type *Int1Ty;
221 const Type *Int8Ty;
222 const Type *Int16Ty;
223 const Type *Int32Ty;
224 const Type *Int64Ty;
225 const Type *FloatTy;
226 const Type *DoubleTy;
cb65416 the great schism, part I
Laurent Sansonetti authored
227 const Type *RubyObjTy;
228 const Type *RubyObjPtrTy;
229 const Type *RubyObjPtrPtrTy;
230 const Type *PtrTy;
231 const Type *PtrPtrTy;
232 const Type *IntTy;
85b7cc2 AOT compiler: ivar slots support
Laurent Sansonetti authored
233 const Type *Int32PtrTy;
cb65416 the great schism, part I
Laurent Sansonetti authored
234
235 void compile_node_error(const char *msg, NODE *node);
236
237 virtual Instruction *
85b7cc2 AOT compiler: ivar slots support
Laurent Sansonetti authored
238 compile_const_pointer(void *ptr, const Type *type=NULL,
239 bool insert_to_bb=true) {
cb65416 the great schism, part I
Laurent Sansonetti authored
240 Value *ptrint = ConstantInt::get(IntTy, (long)ptr);
85b7cc2 AOT compiler: ivar slots support
Laurent Sansonetti authored
241 if (type == NULL) {
242 type = PtrTy;
243 }
cb65416 the great schism, part I
Laurent Sansonetti authored
244 return insert_to_bb
85b7cc2 AOT compiler: ivar slots support
Laurent Sansonetti authored
245 ? new IntToPtrInst(ptrint, type, "", bb)
246 : new IntToPtrInst(ptrint, type, "");
cb65416 the great schism, part I
Laurent Sansonetti authored
247 }
248
249 Instruction *
250 compile_const_pointer_to_pointer(void *ptr, bool insert_to_bb=true) {
85b7cc2 AOT compiler: ivar slots support
Laurent Sansonetti authored
251 return compile_const_pointer(ptr, PtrPtrTy, insert_to_bb);
cb65416 the great schism, part I
Laurent Sansonetti authored
252 }
253
95f3b23 added support for AOT compilation of literal ranges
Laurent Sansonetti authored
254 Instruction *compile_protected_call(Function *func,
cb65416 the great schism, part I
Laurent Sansonetti authored
255 std::vector<Value *> &params);
256 void compile_dispatch_arguments(NODE *args,
257 std::vector<Value *> &arguments, int *pargc);
258 Function::ArgumentListType::iterator compile_optional_arguments(
259 Function::ArgumentListType::iterator iter, NODE *node);
260 void compile_boolean_test(Value *condVal, BasicBlock *ifTrueBB,
261 BasicBlock *ifFalseBB);
262 void compile_when_arguments(NODE *args, Value *comparedToVal,
263 BasicBlock *thenBB);
264 void compile_single_when_argument(NODE *arg, Value *comparedToVal,
265 BasicBlock *thenBB);
12a1d67 fixing bugs in instance_eval & friends + fixed some specs so that they p...
Laurent Sansonetti authored
266 virtual void compile_prepare_method(Value *classVal, Value *sel,
267 bool singleton, Function *new_function, rb_vm_arity_t &arity,
9590d40 fixing and adding several missing ruby method features
Laurent Sansonetti authored
268 NODE *body);
cb65416 the great schism, part I
Laurent Sansonetti authored
269 Value *compile_dispatch_call(std::vector<Value *> &params);
270 Value *compile_when_splat(Value *comparedToVal, Value *splatVal);
944d624 optimize #== and #!= for non fixnum/float types
Laurent Sansonetti authored
271 Value *compile_fast_op_call(SEL sel, Value *selfVal, Value *comparedToVal);
cb65416 the great schism, part I
Laurent Sansonetti authored
272 Value *compile_attribute_assign(NODE *node, Value *extra_val);
2c54dbd AOT compiler: added support for blocks
Laurent Sansonetti authored
273 virtual Value *compile_prepare_block_args(Function *func, int *flags);
274 Value *compile_block_create(NODE *node);
cb65416 the great schism, part I
Laurent Sansonetti authored
275 Value *compile_binding(void);
276 Value *compile_optimized_dispatch_call(SEL sel, int argc,
277 std::vector<Value *> &params);
278 Value *compile_ivar_read(ID vid);
279 Value *compile_ivar_assignment(ID vid, Value *val);
280 Value *compile_cvar_assignment(ID vid, Value *val);
eeb7a10 added support for @@foo||=42, a lot of changes for a very stupid functio...
Laurent Sansonetti authored
281 Value *compile_cvar_get(ID vid, bool check);
42e4a2a AOT compiler: added support for global variables
Laurent Sansonetti authored
282 Value *compile_gvar_assignment(NODE *node, Value *val);
cb65416 the great schism, part I
Laurent Sansonetti authored
283 Value *compile_constant_declaration(NODE *node, Value *val);
284 Value *compile_multiple_assignment(NODE *node, Value *val);
285 void compile_multiple_assignment_element(NODE *node, Value *val);
286 Value *compile_current_class(void);
57d8085 AOT compiler: added support for NSObject and ID compilation
Laurent Sansonetti authored
287 virtual Value *compile_nsobject(void);
78b1e93 added support for AOT compilation of the rb_eStandardError constant
Laurent Sansonetti authored
288 virtual Value *compile_standarderror(void);
aca37ff fixed const lookup inside a module defined under an explicit (using ::) ...
Laurent Sansonetti authored
289 Value *compile_class_path(NODE *node, bool *outer);
cb65416 the great schism, part I
Laurent Sansonetti authored
290 Value *compile_const(ID id, Value *outer);
291 Value *compile_singleton_class(Value *obj);
292 Value *compile_defined_expression(NODE *node);
293 Value *compile_dstr(NODE *node);
294 Value *compile_dvar_slot(ID name);
295 void compile_break_val(Value *val);
e8d79c7 @vincentisambart a return in an ensure should now work properly
vincentisambart authored
296 void compile_simple_return(Value *val);
3432fd1 a better exception-based implementation for return-from-block
Laurent Sansonetti authored
297 void compile_return_from_block(Value *val, int id);
298 void compile_return_from_block_handler(int id);
cb65416 the great schism, part I
Laurent Sansonetti authored
299 Value *compile_jump(NODE *node);
300 virtual Value *compile_mcache(SEL sel, bool super);
77f9768 implemented super from a block
Laurent Sansonetti authored
301 Value *compile_get_mcache(Value *sel, bool super);
cb65416 the great schism, part I
Laurent Sansonetti authored
302 virtual Value *compile_ccache(ID id);
303 virtual Instruction *compile_sel(SEL sel, bool add_to_bb=true) {
85b7cc2 AOT compiler: ivar slots support
Laurent Sansonetti authored
304 return compile_const_pointer(sel, PtrTy, add_to_bb);
cb65416 the great schism, part I
Laurent Sansonetti authored
305 }
57d8085 AOT compiler: added support for NSObject and ID compilation
Laurent Sansonetti authored
306 virtual Value *compile_id(ID id);
913687b fixed a bug in the way we compile literal strings
Laurent Sansonetti authored
307 GlobalVariable *compile_const_global_string(const char *str,
308 const size_t str_len);
309 GlobalVariable *compile_const_global_string(const char *str) {
310 return compile_const_global_string(str, strlen(str));
311 }
e379686 some work on unicode support (still in progress)
Laurent Sansonetti authored
312 GlobalVariable *compile_const_global_ustring(const UniChar *str,
313 const size_t str_len, CFHashCode hash);
314
2c54dbd AOT compiler: added support for blocks
Laurent Sansonetti authored
315 Value *compile_arity(rb_vm_arity_t &arity);
95f3b23 added support for AOT compilation of literal ranges
Laurent Sansonetti authored
316 Instruction *compile_range(Value *beg, Value *end, bool exclude_end,
14423f1 fixed AOT compilation of literal ranges (objects should be retained)
Laurent Sansonetti authored
317 bool retain=false, bool add_to_bb=true);
913687b fixed a bug in the way we compile literal strings
Laurent Sansonetti authored
318 Value *compile_literal(VALUE val);
907bd81 AOT compiler: added support for some immutable literals
Laurent Sansonetti authored
319 virtual Value *compile_immutable_literal(VALUE val);
42e4a2a AOT compiler: added support for global variables
Laurent Sansonetti authored
320 virtual Value *compile_global_entry(NODE *node);
cb65416 the great schism, part I
Laurent Sansonetti authored
321
9590d40 fixing and adding several missing ruby method features
Laurent Sansonetti authored
322 void compile_set_current_scope(Value *klass, Value *scope);
323 Value *compile_set_current_class(Value *klass);
324
3432fd1 a better exception-based implementation for return-from-block
Laurent Sansonetti authored
325 Value *compile_landing_pad_header(void);
326 Value *compile_landing_pad_header(const std::type_info &eh_type);
6c5b476 a new implementation for return-from-block which uses an exception inste...
Laurent Sansonetti authored
327 void compile_landing_pad_footer(bool pop_exception=true);
cb65416 the great schism, part I
Laurent Sansonetti authored
328 void compile_rethrow_exception(void);
329 void compile_pop_exception(void);
330 Value *compile_lvar_slot(ID name);
331 bool compile_lvars(ID *tbl);
332 Value *compile_new_struct(Value *klass, std::vector<Value *> &fields);
333 Value *compile_new_opaque(Value *klass, Value *val);
ff75d60 added support for overwriting an ObjC method that accepts a pointer
Laurent Sansonetti authored
334 Value *compile_new_pointer(const char *type, Value *val);
cb65416 the great schism, part I
Laurent Sansonetti authored
335 void compile_get_struct_fields(Value *val, Value *buf,
336 rb_vm_bs_boxed_t *bs_boxed);
337 Value *compile_get_opaque_data(Value *val, rb_vm_bs_boxed_t *bs_boxed,
338 Value *slot);
339 Value *compile_get_cptr(Value *val, const char *type, Value *slot);
340 void compile_check_arity(Value *given, Value *requested);
341 void compile_set_struct(Value *rcv, int field, Value *val);
342
343 Value *compile_conversion_to_c(const char *type, Value *val,
344 Value *slot);
345 Value *compile_conversion_to_ruby(const char *type,
346 const Type *llvm_type, Value *val);
347
85b7cc2 AOT compiler: ivar slots support
Laurent Sansonetti authored
348 Instruction *compile_slot_cache(ID id);
349 virtual Instruction *gen_slot_cache(ID id);
cb65416 the great schism, part I
Laurent Sansonetti authored
350 ICmpInst *is_value_a_fixnum(Value *val);
351 void compile_ivar_slots(Value *klass, BasicBlock::InstListType &list,
352 BasicBlock::InstListType::iterator iter);
353 bool unbox_ruby_constant(Value *val, VALUE *rval);
01528a7 floating point arithmetic optimization: Float objects are now immediate ...
Laurent Sansonetti authored
354 Value *optimized_immediate_op(SEL sel, Value *leftVal, Value *rightVal,
355 bool float_op, bool *is_predicate);
356 Value *compile_double_coercion(Value *val, Value *mask,
357 BasicBlock *fallback_bb, Function *f);
2a1240c @vincentisambart some refactoring
vincentisambart authored
358 void compile_keep_vars(BasicBlock *startBB, BasicBlock *mergeBB);
01528a7 floating point arithmetic optimization: Float objects are now immediate ...
Laurent Sansonetti authored
359
cb65416 the great schism, part I
Laurent Sansonetti authored
360 SEL mid_to_sel(ID mid, int arity);
361 };
362
bb0b28c moving to LLVM r82747
Laurent Sansonetti authored
363 #define context (RoxorCompiler::module->getContext())
364
cb65416 the great schism, part I
Laurent Sansonetti authored
365 class RoxorAOTCompiler : public RoxorCompiler {
366 public:
3432fd1 a better exception-based implementation for return-from-block
Laurent Sansonetti authored
367 RoxorAOTCompiler(void);
cb65416 the great schism, part I
Laurent Sansonetti authored
368
369 Function *compile_main_function(NODE *node);
370
371 private:
372 std::map<SEL, GlobalVariable *> mcaches;
373 std::map<ID, GlobalVariable *> ccaches;
374 std::map<SEL, GlobalVariable *> sels;
57d8085 AOT compiler: added support for NSObject and ID compilation
Laurent Sansonetti authored
375 std::map<ID, GlobalVariable *> ids;
42e4a2a AOT compiler: added support for global variables
Laurent Sansonetti authored
376 std::map<ID, GlobalVariable *> global_entries;
85b7cc2 AOT compiler: ivar slots support
Laurent Sansonetti authored
377 std::vector<GlobalVariable *> ivar_slots;
907bd81 AOT compiler: added support for some immutable literals
Laurent Sansonetti authored
378 std::map<VALUE, GlobalVariable *> literals;
379
57d8085 AOT compiler: added support for NSObject and ID compilation
Laurent Sansonetti authored
380 GlobalVariable *cObject_gvar;
78b1e93 added support for AOT compilation of the rb_eStandardError constant
Laurent Sansonetti authored
381 GlobalVariable *cStandardError_gvar;
382 std::vector<GlobalVariable *> class_gvars;
cb65416 the great schism, part I
Laurent Sansonetti authored
383
384 Value *compile_mcache(SEL sel, bool super);
385 Value *compile_ccache(ID id);
386 Instruction *compile_sel(SEL sel, bool add_to_bb=true);
12a1d67 fixing bugs in instance_eval & friends + fixed some specs so that they p...
Laurent Sansonetti authored
387 void compile_prepare_method(Value *classVal, Value *sel,
388 bool singleton, Function *new_function, rb_vm_arity_t &arity,
9590d40 fixing and adding several missing ruby method features
Laurent Sansonetti authored
389 NODE *body);
2c54dbd AOT compiler: added support for blocks
Laurent Sansonetti authored
390 Value *compile_prepare_block_args(Function *func, int *flags);
57d8085 AOT compiler: added support for NSObject and ID compilation
Laurent Sansonetti authored
391 Value *compile_nsobject(void);
78b1e93 added support for AOT compilation of the rb_eStandardError constant
Laurent Sansonetti authored
392 Value *compile_standarderror(void);
57d8085 AOT compiler: added support for NSObject and ID compilation
Laurent Sansonetti authored
393 Value *compile_id(ID id);
907bd81 AOT compiler: added support for some immutable literals
Laurent Sansonetti authored
394 Value *compile_immutable_literal(VALUE val);
42e4a2a AOT compiler: added support for global variables
Laurent Sansonetti authored
395 Value *compile_global_entry(NODE *node);
cb65416 the great schism, part I
Laurent Sansonetti authored
396
85b7cc2 AOT compiler: ivar slots support
Laurent Sansonetti authored
397 Instruction *gen_slot_cache(ID id);
398
cb65416 the great schism, part I
Laurent Sansonetti authored
399 Instruction *
85b7cc2 AOT compiler: ivar slots support
Laurent Sansonetti authored
400 compile_const_pointer(void *ptr, const Type *type=NULL,
401 bool insert_to_bb=true) {
cb65416 the great schism, part I
Laurent Sansonetti authored
402 if (ptr == NULL) {
85b7cc2 AOT compiler: ivar slots support
Laurent Sansonetti authored
403 return RoxorCompiler::compile_const_pointer(ptr, type,
404 insert_to_bb);
cb65416 the great schism, part I
Laurent Sansonetti authored
405 }
406 printf("compile_const_pointer() called with a non-NULL pointer " \
407 "on the AOT compiler - leaving the ship!\n");
408 abort();
409 }
410 };
411
412 #endif /* __cplusplus */
413
414 #endif /* __COMPILER_H_ */
Something went wrong with that request. Please try again.