Skip to content
This repository
Newer
Older
100644 432 lines (389 sloc) 13.901 kb
cfd7b4d8 » Laurent Sansonetti
2009-05-23 added licensing information on the new files
1 /*
2 * MacRuby compiler.
3 *
4 * This file is covered by the Ruby license. See COPYING for more details.
5 *
4aca1014 » drernie
2010-01-20 Added 2010 Copyrights
6 * Copyright (C) 2008-2010, Apple Inc. All rights reserved.
cfd7b4d8 » Laurent Sansonetti
2009-05-23 added licensing information on the new files
7 */
8
cb654164 » Laurent Sansonetti
2009-05-23 the great schism, part I
9 #ifndef __COMPILER_H_
10 #define __COMPILER_H_
11
12 #if defined(__cplusplus)
13
14 // For the dispatcher.
9590d405 » Laurent Sansonetti
2009-08-22 fixing and adding several missing ruby method features
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
cb654164 » Laurent Sansonetti
2009-05-23 the great schism, part I
20
370e3852 » Laurent Sansonetti
2010-02-08 get rid of bad allocas, disable frame pointer elimination, simplified…
21 // For const lookup.
22 #define CONST_LOOKUP_LEXICAL 1
23 #define CONST_LOOKUP_DYNAMIC_CLASS 2
24
cb654164 » Laurent Sansonetti
2009-05-23 the great schism, part I
25 // For defined?
26 #define DEFINED_IVAR 1
27 #define DEFINED_GVAR 2
28 #define DEFINED_CVAR 3
29 #define DEFINED_CONST 4
30 #define DEFINED_LCONST 5
31 #define DEFINED_SUPER 6
32 #define DEFINED_METHOD 7
33
34 class RoxorCompiler {
35 public:
36 static llvm::Module *module;
37 static RoxorCompiler *shared;
38
cf73725a » Laurent Sansonetti
2010-01-17 experimental debugger
39 RoxorCompiler(bool debug_mode);
cb654164 » Laurent Sansonetti
2009-05-23 the great schism, part I
40 virtual ~RoxorCompiler(void) { }
41
0f14388c » Laurent Sansonetti
2009-12-15 emit dwarf metadata at compilation time and use it to establish backt…
42 void set_fname(const char *_fname);
3432fd19 » Laurent Sansonetti
2009-07-10 a better exception-based implementation for return-from-block
43
cb654164 » Laurent Sansonetti
2009-05-23 the great schism, part I
44 Value *compile_node(NODE *node);
45
46 virtual Function *compile_main_function(NODE *node);
47 Function *compile_read_attr(ID name);
48 Function *compile_write_attr(ID name);
9fab1acf » Laurent Sansonetti
2009-10-01 fixed variadic functions/methods calls
49 Function *compile_stub(const char *types, bool variadic, int min_argc,
50 bool is_objc);
485e4353 » Thibault Martin-Lagardette
2010-02-26 Allow methods/blocks with 12+ arguments
51 Function *compile_long_arity_stub(int argc, bool is_block);
cb654164 » Laurent Sansonetti
2009-05-23 the great schism, part I
52 Function *compile_bs_struct_new(rb_vm_bs_boxed_t *bs_boxed);
53 Function *compile_bs_struct_writer(rb_vm_bs_boxed_t *bs_boxed,
54 int field);
55 Function *compile_ffi_function(void *stub, void *imp, int argc);
56 Function *compile_to_rval_convertor(const char *type);
57 Function *compile_to_ocval_convertor(const char *type);
c1c347fc » Laurent Sansonetti
2009-07-12 AOT compiler: now supporting objc stubs and super dispatch
58 Function *compile_objc_stub(Function *ruby_func, IMP ruby_imp,
59 const rb_vm_arity_t &arity, const char *types);
208a965e » Laurent Sansonetti
2009-06-15 a quick implementation for #define_method (not yet 100% complete)
60 Function *compile_block_caller(rb_vm_block_t *block);
4b7c757e » Laurent Sansonetti
2010-02-10 cleaning a bit public headers, added support for methods defined for …
61 Function *compile_mri_stub(void *imp, const int arity);
cb654164 » Laurent Sansonetti
2009-05-23 the great schism, part I
62
63 const Type *convert_type(const char *type);
64
c219e864 » Laurent Sansonetti
2009-06-19 don't slow ivars used inside an eval string
65 bool is_inside_eval(void) { return inside_eval; }
66 void set_inside_eval(bool flag) { inside_eval = flag; }
12a1d67f » Laurent Sansonetti
2009-08-25 fixing bugs in instance_eval & friends + fixed some specs so that the…
67 bool is_dynamic_class(void) { return dynamic_class; }
68 void set_dynamic_class(bool flag) { dynamic_class = flag; }
c219e864 » Laurent Sansonetti
2009-06-19 don't slow ivars used inside an eval string
69
cb654164 » Laurent Sansonetti
2009-05-23 the great schism, part I
70 protected:
0f14388c » Laurent Sansonetti
2009-12-15 emit dwarf metadata at compilation time and use it to establish backt…
71 DIFactory *debug_info;
72 DICompileUnit debug_compile_unit;
73 DISubprogram debug_subprogram;
74
cf73725a » Laurent Sansonetti
2010-01-17 experimental debugger
75 bool debug_mode;
cb654164 » Laurent Sansonetti
2009-05-23 the great schism, part I
76 const char *fname;
c219e864 » Laurent Sansonetti
2009-06-19 don't slow ivars used inside an eval string
77 bool inside_eval;
cb654164 » Laurent Sansonetti
2009-05-23 the great schism, part I
78
79 std::map<ID, Value *> lvars;
80 std::vector<ID> dvars;
f61f2c7d » vincentisambart
2009-09-28 const pointers should be real constants
81 std::map<ID, Value *> ivar_slots_cache;
cb654164 » Laurent Sansonetti
2009-05-23 the great schism, part I
82 std::map<std::string, GlobalVariable *> static_strings;
e3796866 » Laurent Sansonetti
2009-07-20 some work on unicode support (still in progress)
83 std::map<CFHashCode, GlobalVariable *> static_ustrings;
cb654164 » Laurent Sansonetti
2009-05-23 the great schism, part I
84
85 #if ROXOR_COMPILER_DEBUG
86 int level;
87 # define DEBUG_LEVEL_INC() (level++)
88 # define DEBUG_LEVEL_DEC() (level--)
89 #else
90 # define DEBUG_LEVEL_INC()
91 # define DEBUG_LEVEL_DEC()
92 #endif
93
2541db33 » Laurent Sansonetti
2009-09-18 added preliminary support for backtracing/symbolication
94 unsigned int current_line;
cb654164 » Laurent Sansonetti
2009-05-23 the great schism, part I
95 BasicBlock *bb;
96 BasicBlock *entry_bb;
97 ID current_mid;
164ca93c » Laurent Sansonetti
2009-08-04 fixed super within a method that has a splat argument
98 rb_vm_arity_t current_arity;
cb654164 » Laurent Sansonetti
2009-05-23 the great schism, part I
99 bool current_instance_method;
100 ID self_id;
101 Value *current_self;
102 bool current_block;
1961daae » Laurent Sansonetti
2009-07-29 better fix than last one
103 bool current_block_chain;
cb654164 » Laurent Sansonetti
2009-05-23 the great schism, part I
104 Value *current_var_uses;
105 Value *running_block;
cc6f8a94 » Laurent Sansonetti
2009-11-14 fixed a bug in super without argument, it should pass the method's &b…
106 Value *current_block_arg;
cb654164 » Laurent Sansonetti
2009-05-23 the great schism, part I
107 BasicBlock *begin_bb;
63c77f81 » vincentisambart
2009-09-20 now rescues in rescues should work properly in most cases
108 // block used in an invoke when an exception occurs
109 BasicBlock *rescue_invoke_bb;
110 // block to return to in a rescue if an exception is not handled
111 BasicBlock *rescue_rethrow_bb;
cb654164 » Laurent Sansonetti
2009-05-23 the great schism, part I
112 BasicBlock *ensure_bb;
113 bool current_rescue;
114 NODE *current_block_node;
115 Function *current_block_func;
1e86229b » Laurent Sansonetti
2010-04-04 fixed ZSUPER compilation inside blocks
116 Function *current_non_block_func;
cb654164 » Laurent Sansonetti
2009-05-23 the great schism, part I
117 GlobalVariable *current_opened_class;
12a1d67f » Laurent Sansonetti
2009-08-25 fixing bugs in instance_eval & friends + fixed some specs so that the…
118 bool dynamic_class;
cb654164 » Laurent Sansonetti
2009-05-23 the great schism, part I
119 bool current_module;
120 BasicBlock *current_loop_begin_bb;
121 BasicBlock *current_loop_body_bb;
122 BasicBlock *current_loop_end_bb;
513ee741 » vincentisambart
2009-09-23 Fixed the return value of while/until loops
123 PHINode *current_loop_exit_val;
3432fd19 » Laurent Sansonetti
2009-07-10 a better exception-based implementation for return-from-block
124 int return_from_block;
125 int return_from_block_ids;
5d7a33f5 » vincentisambart
2009-08-15 when there are multiple returns in an ensure,
126 PHINode *ensure_pn;
13f5368a » Laurent Sansonetti
2010-01-07 fixed a bunch of super-dispatch bugs
127 bool block_declaration;
cb654164 » Laurent Sansonetti
2009-05-23 the great schism, part I
128
129 Function *dispatcherFunc;
38456a4c » Laurent Sansonetti
2009-08-12 most fast ops in place
130 Function *fastPlusFunc;
131 Function *fastMinusFunc;
132 Function *fastMultFunc;
133 Function *fastDivFunc;
134 Function *fastLtFunc;
135 Function *fastLeFunc;
136 Function *fastGtFunc;
137 Function *fastGeFunc;
944d624b » Laurent Sansonetti
2009-08-07 optimize #== and #!= for non fixnum/float types
138 Function *fastEqFunc;
139 Function *fastNeqFunc;
cb654164 » Laurent Sansonetti
2009-05-23 the great schism, part I
140 Function *fastEqqFunc;
141 Function *whenSplatFunc;
142 Function *prepareBlockFunc;
143 Function *pushBindingFunc;
144 Function *getBlockFunc;
145 Function *currentBlockObjectFunc;
146 Function *getConstFunc;
147 Function *setConstFunc;
148 Function *prepareMethodFunc;
149 Function *singletonClassFunc;
150 Function *defineClassFunc;
151 Function *prepareIvarSlotFunc;
152 Function *getIvarFunc;
153 Function *setIvarFunc;
0583c824 » alloy
2010-04-07 Once any framework is loaded, send KVO notifications from attr writers.
154 Function *setKVOIvarFunc;
cb654164 » Laurent Sansonetti
2009-05-23 the great schism, part I
155 Function *definedFunc;
156 Function *undefFunc;
157 Function *aliasFunc;
158 Function *valiasFunc;
159 Function *newHashFunc;
160 Function *toAFunc;
161 Function *toAryFunc;
162 Function *catArrayFunc;
163 Function *dupArrayFunc;
164 Function *newArrayFunc;
165 Function *newStructFunc;
166 Function *newOpaqueFunc;
ff75d601 » Laurent Sansonetti
2009-06-12 added support for overwriting an ObjC method that accepts a pointer
167 Function *newPointerFunc;
cb654164 » Laurent Sansonetti
2009-05-23 the great schism, part I
168 Function *getStructFieldsFunc;
169 Function *getOpaqueDataFunc;
170 Function *getPointerPtrFunc;
d1bb30d6 » Laurent Sansonetti
2010-04-29 added simple compiler support for bit fields and C-style arrays, impr…
171 Function *xmallocFunc;
cb654164 » Laurent Sansonetti
2009-05-23 the great schism, part I
172 Function *checkArityFunc;
173 Function *setStructFunc;
174 Function *newRangeFunc;
175 Function *newRegexpFunc;
176 Function *strInternFunc;
177 Function *keepVarsFunc;
178 Function *masgnGetElemBeforeSplatFunc;
179 Function *masgnGetElemAfterSplatFunc;
180 Function *masgnGetSplatFunc;
181 Function *newStringFunc;
913687b8 » Laurent Sansonetti
2009-07-02 fixed a bug in the way we compile literal strings
182 Function *newString2Func;
183 Function *newString3Func;
cb654164 » Laurent Sansonetti
2009-05-23 the great schism, part I
184 Function *yieldFunc;
7da28cbe » Laurent Sansonetti
2009-09-07 make sure break makes yield return from its scope
185 Function *getBrokenFunc;
208a965e » Laurent Sansonetti
2009-06-15 a quick implementation for #define_method (not yet 100% complete)
186 Function *blockEvalFunc;
cb654164 » Laurent Sansonetti
2009-05-23 the great schism, part I
187 Function *gvarSetFunc;
188 Function *gvarGetFunc;
189 Function *cvarSetFunc;
190 Function *cvarGetFunc;
191 Function *currentExceptionFunc;
192 Function *popExceptionFunc;
193 Function *getSpecialFunc;
194 Function *breakFunc;
6c5b476f » Laurent Sansonetti
2009-07-10 a new implementation for return-from-block which uses an exception in…
195 Function *returnFromBlockFunc;
208c475a » Laurent Sansonetti
2009-11-04 optimized returns from non-ensure-scoped and non-Proc blocks
196 Function *returnedFromBlockFunc;
3432fd19 » Laurent Sansonetti
2009-07-10 a better exception-based implementation for return-from-block
197 Function *checkReturnFromBlockFunc;
208c475a » Laurent Sansonetti
2009-11-04 optimized returns from non-ensure-scoped and non-Proc blocks
198 Function *setHasEnsureFunc;
cb654164 » Laurent Sansonetti
2009-05-23 the great schism, part I
199 Function *longjmpFunc;
200 Function *setjmpFunc;
9590d405 » Laurent Sansonetti
2009-08-22 fixing and adding several missing ruby method features
201 Function *setScopeFunc;
202 Function *setCurrentClassFunc;
77f9768b » Laurent Sansonetti
2009-09-10 implemented super from a block
203 Function *getCacheFunc;
cf73725a » Laurent Sansonetti
2010-01-17 experimental debugger
204 Function *debugTrapFunc;
c437b620 » Thibault Martin-Lagardette
2010-02-03 - Adds the flip-flop operator (fixes #548)
205 Function *getFFStateFunc;
206 Function *setFFStateFunc;
ad56c99f » Laurent Sansonetti
2010-02-09 when doing an assignment from thread X to thread Y's stack, defeat th…
207 Function *takeOwnershipFunc;
cb654164 » Laurent Sansonetti
2009-05-23 the great schism, part I
208
209 Constant *zeroVal;
210 Constant *oneVal;
211 Constant *twoVal;
01528a72 » Laurent Sansonetti
2009-06-18 floating point arithmetic optimization: Float objects are now immedia…
212 Constant *threeVal;
cb654164 » Laurent Sansonetti
2009-05-23 the great schism, part I
213 Constant *nilVal;
214 Constant *trueVal;
215 Constant *falseVal;
216 Constant *undefVal;
217 Constant *splatArgFollowsVal;
9590d405 » Laurent Sansonetti
2009-08-22 fixing and adding several missing ruby method features
218 Constant *defaultScope;
219 Constant *publicScope;
bb0b28cb » Laurent Sansonetti
2009-09-25 moving to LLVM r82747
220
221 const Type *VoidTy;
222 const Type *Int1Ty;
223 const Type *Int8Ty;
224 const Type *Int16Ty;
225 const Type *Int32Ty;
226 const Type *Int64Ty;
227 const Type *FloatTy;
228 const Type *DoubleTy;
cb654164 » Laurent Sansonetti
2009-05-23 the great schism, part I
229 const Type *RubyObjTy;
f61f2c7d » vincentisambart
2009-09-28 const pointers should be real constants
230 const PointerType *RubyObjPtrTy;
231 const PointerType *RubyObjPtrPtrTy;
232 const PointerType *PtrTy;
233 const PointerType *PtrPtrTy;
cb654164 » Laurent Sansonetti
2009-05-23 the great schism, part I
234 const Type *IntTy;
f61f2c7d » vincentisambart
2009-09-28 const pointers should be real constants
235 const PointerType *Int32PtrTy;
d1bb30d6 » Laurent Sansonetti
2010-04-29 added simple compiler support for bit fields and C-style arrays, impr…
236 const Type *BitTy;
cb654164 » Laurent Sansonetti
2009-05-23 the great schism, part I
237
fa571624 » Laurent Sansonetti
2010-02-02 follow LLVM ToT
238 unsigned dbg_mdkind;
239
cb654164 » Laurent Sansonetti
2009-05-23 the great schism, part I
240 void compile_node_error(const char *msg, NODE *node);
241
f61f2c7d » vincentisambart
2009-09-28 const pointers should be real constants
242 virtual Constant *
243 compile_const_pointer(void *ptr, const PointerType *type=NULL) {
85b7cc25 » Laurent Sansonetti
2009-07-02 AOT compiler: ivar slots support
244 if (type == NULL) {
245 type = PtrTy;
246 }
f61f2c7d » vincentisambart
2009-09-28 const pointers should be real constants
247 if (ptr == NULL) {
248 return ConstantPointerNull::get(type);
249 }
250 else {
251 Constant *ptrint = ConstantInt::get(IntTy, (long)ptr);
252 return ConstantExpr::getIntToPtr(ptrint, type);
253 }
cb654164 » Laurent Sansonetti
2009-05-23 the great schism, part I
254 }
255
f61f2c7d » vincentisambart
2009-09-28 const pointers should be real constants
256 Constant *
257 compile_const_pointer_to_pointer(void *ptr) {
258 return compile_const_pointer(ptr, PtrPtrTy);
cb654164 » Laurent Sansonetti
2009-05-23 the great schism, part I
259 }
260
1e86229b » Laurent Sansonetti
2010-04-04 fixed ZSUPER compilation inside blocks
261 Function *compile_scope(NODE *node);
c80c60a5 » Laurent Sansonetti
2009-10-07 in the objc->ruby 32-bit stub convert ruby exceptions to objc
262 Instruction *compile_protected_call(Value *imp,
cb654164 » Laurent Sansonetti
2009-05-23 the great schism, part I
263 std::vector<Value *> &params);
264 void compile_dispatch_arguments(NODE *args,
265 std::vector<Value *> &arguments, int *pargc);
266 Function::ArgumentListType::iterator compile_optional_arguments(
267 Function::ArgumentListType::iterator iter, NODE *node);
268 void compile_boolean_test(Value *condVal, BasicBlock *ifTrueBB,
269 BasicBlock *ifFalseBB);
270 void compile_when_arguments(NODE *args, Value *comparedToVal,
271 BasicBlock *thenBB);
272 void compile_single_when_argument(NODE *arg, Value *comparedToVal,
273 BasicBlock *thenBB);
12a1d67f » Laurent Sansonetti
2009-08-25 fixing bugs in instance_eval & friends + fixed some specs so that the…
274 virtual void compile_prepare_method(Value *classVal, Value *sel,
275 bool singleton, Function *new_function, rb_vm_arity_t &arity,
9590d405 » Laurent Sansonetti
2009-08-22 fixing and adding several missing ruby method features
276 NODE *body);
cb654164 » Laurent Sansonetti
2009-05-23 the great schism, part I
277 Value *compile_dispatch_call(std::vector<Value *> &params);
278 Value *compile_when_splat(Value *comparedToVal, Value *splatVal);
944d624b » Laurent Sansonetti
2009-08-07 optimize #== and #!= for non fixnum/float types
279 Value *compile_fast_op_call(SEL sel, Value *selfVal, Value *comparedToVal);
cb654164 » Laurent Sansonetti
2009-05-23 the great schism, part I
280 Value *compile_attribute_assign(NODE *node, Value *extra_val);
2c54dbd2 » Laurent Sansonetti
2009-07-01 AOT compiler: added support for blocks
281 virtual Value *compile_prepare_block_args(Function *func, int *flags);
cc6f8a94 » Laurent Sansonetti
2009-11-14 fixed a bug in super without argument, it should pass the method's &b…
282 Value *compile_block_create(void);
283 Value *compile_block_get(Value *block_object);
cb654164 » Laurent Sansonetti
2009-05-23 the great schism, part I
284 Value *compile_binding(void);
285 Value *compile_optimized_dispatch_call(SEL sel, int argc,
286 std::vector<Value *> &params);
287 Value *compile_ivar_read(ID vid);
288 Value *compile_ivar_assignment(ID vid, Value *val);
289 Value *compile_cvar_assignment(ID vid, Value *val);
eeb7a106 » Laurent Sansonetti
2009-08-03 added support for @@foo||=42, a lot of changes for a very stupid func…
290 Value *compile_cvar_get(ID vid, bool check);
42e4a2a2 » Laurent Sansonetti
2009-07-03 AOT compiler: added support for global variables
291 Value *compile_gvar_assignment(NODE *node, Value *val);
cb654164 » Laurent Sansonetti
2009-05-23 the great schism, part I
292 Value *compile_constant_declaration(NODE *node, Value *val);
293 Value *compile_multiple_assignment(NODE *node, Value *val);
294 void compile_multiple_assignment_element(NODE *node, Value *val);
295 Value *compile_current_class(void);
57d80850 » Laurent Sansonetti
2009-06-30 AOT compiler: added support for NSObject and ID compilation
296 virtual Value *compile_nsobject(void);
78b1e930 » Laurent Sansonetti
2009-09-22 added support for AOT compilation of the rb_eStandardError constant
297 virtual Value *compile_standarderror(void);
e037cf28 » Laurent Sansonetti
2010-01-22 fix a const lookup bug inside Foo::Bar modules
298 Value *compile_class_path(NODE *node, int *flags);
cb654164 » Laurent Sansonetti
2009-05-23 the great schism, part I
299 Value *compile_const(ID id, Value *outer);
300 Value *compile_singleton_class(Value *obj);
301 Value *compile_defined_expression(NODE *node);
302 Value *compile_dstr(NODE *node);
303 Value *compile_dvar_slot(ID name);
304 void compile_break_val(Value *val);
e8d79c75 » vincentisambart
2009-08-16 a return in an ensure should now work properly
305 void compile_simple_return(Value *val);
208c475a » Laurent Sansonetti
2009-11-04 optimized returns from non-ensure-scoped and non-Proc blocks
306 Value *compile_set_has_ensure(Value *val);
3432fd19 » Laurent Sansonetti
2009-07-10 a better exception-based implementation for return-from-block
307 void compile_return_from_block(Value *val, int id);
308 void compile_return_from_block_handler(int id);
cb654164 » Laurent Sansonetti
2009-05-23 the great schism, part I
309 Value *compile_jump(NODE *node);
310 virtual Value *compile_mcache(SEL sel, bool super);
77f9768b » Laurent Sansonetti
2009-09-10 implemented super from a block
311 Value *compile_get_mcache(Value *sel, bool super);
cb654164 » Laurent Sansonetti
2009-05-23 the great schism, part I
312 virtual Value *compile_ccache(ID id);
f61f2c7d » vincentisambart
2009-09-28 const pointers should be real constants
313 virtual Value *compile_sel(SEL sel, bool add_to_bb=true) {
314 return compile_const_pointer(sel, PtrTy);
cb654164 » Laurent Sansonetti
2009-05-23 the great schism, part I
315 }
57d80850 » Laurent Sansonetti
2009-06-30 AOT compiler: added support for NSObject and ID compilation
316 virtual Value *compile_id(ID id);
913687b8 » Laurent Sansonetti
2009-07-02 fixed a bug in the way we compile literal strings
317 GlobalVariable *compile_const_global_string(const char *str,
318 const size_t str_len);
319 GlobalVariable *compile_const_global_string(const char *str) {
320 return compile_const_global_string(str, strlen(str));
321 }
e3796866 » Laurent Sansonetti
2009-07-20 some work on unicode support (still in progress)
322 GlobalVariable *compile_const_global_ustring(const UniChar *str,
f045214f » Laurent Sansonetti
2010-02-25 regexps are now AOT compilable
323 const size_t str_len);
e3796866 » Laurent Sansonetti
2009-07-20 some work on unicode support (still in progress)
324
2c54dbd2 » Laurent Sansonetti
2009-07-01 AOT compiler: added support for blocks
325 Value *compile_arity(rb_vm_arity_t &arity);
95f3b233 » Laurent Sansonetti
2009-08-28 added support for AOT compilation of literal ranges
326 Instruction *compile_range(Value *beg, Value *end, bool exclude_end,
14423f11 » Laurent Sansonetti
2009-09-25 fixed AOT compilation of literal ranges (objects should be retained)
327 bool retain=false, bool add_to_bb=true);
913687b8 » Laurent Sansonetti
2009-07-02 fixed a bug in the way we compile literal strings
328 Value *compile_literal(VALUE val);
907bd816 » Laurent Sansonetti
2009-07-04 AOT compiler: added support for some immutable literals
329 virtual Value *compile_immutable_literal(VALUE val);
42e4a2a2 » Laurent Sansonetti
2009-07-03 AOT compiler: added support for global variables
330 virtual Value *compile_global_entry(NODE *node);
cb654164 » Laurent Sansonetti
2009-05-23 the great schism, part I
331
9590d405 » Laurent Sansonetti
2009-08-22 fixing and adding several missing ruby method features
332 void compile_set_current_scope(Value *klass, Value *scope);
333 Value *compile_set_current_class(Value *klass);
334
3432fd19 » Laurent Sansonetti
2009-07-10 a better exception-based implementation for return-from-block
335 Value *compile_landing_pad_header(void);
336 Value *compile_landing_pad_header(const std::type_info &eh_type);
6c5b476f » Laurent Sansonetti
2009-07-10 a new implementation for return-from-block which uses an exception in…
337 void compile_landing_pad_footer(bool pop_exception=true);
c80c60a5 » Laurent Sansonetti
2009-10-07 in the objc->ruby 32-bit stub convert ruby exceptions to objc
338 Value *compile_current_exception(void);
cb654164 » Laurent Sansonetti
2009-05-23 the great schism, part I
339 void compile_rethrow_exception(void);
23ef57ef » Laurent Sansonetti
2010-01-30 now properly popping exceptions from the VM stack when we unwind from…
340 void compile_pop_exception(int pos=0);
cb654164 » Laurent Sansonetti
2009-05-23 the great schism, part I
341 Value *compile_lvar_slot(ID name);
342 bool compile_lvars(ID *tbl);
343 Value *compile_new_struct(Value *klass, std::vector<Value *> &fields);
344 Value *compile_new_opaque(Value *klass, Value *val);
ff75d601 » Laurent Sansonetti
2009-06-12 added support for overwriting an ObjC method that accepts a pointer
345 Value *compile_new_pointer(const char *type, Value *val);
cb654164 » Laurent Sansonetti
2009-05-23 the great schism, part I
346 void compile_get_struct_fields(Value *val, Value *buf,
347 rb_vm_bs_boxed_t *bs_boxed);
348 Value *compile_get_opaque_data(Value *val, rb_vm_bs_boxed_t *bs_boxed,
349 Value *slot);
350 Value *compile_get_cptr(Value *val, const char *type, Value *slot);
351 void compile_check_arity(Value *given, Value *requested);
352 void compile_set_struct(Value *rcv, int field, Value *val);
d1bb30d6 » Laurent Sansonetti
2010-04-29 added simple compiler support for bit fields and C-style arrays, impr…
353 Value *compile_xmalloc(size_t len);
cb654164 » Laurent Sansonetti
2009-05-23 the great schism, part I
354
355 Value *compile_conversion_to_c(const char *type, Value *val,
356 Value *slot);
357 Value *compile_conversion_to_ruby(const char *type,
358 const Type *llvm_type, Value *val);
cf73725a » Laurent Sansonetti
2010-01-17 experimental debugger
359 void compile_debug_trap(void);
cb654164 » Laurent Sansonetti
2009-05-23 the great schism, part I
360
f61f2c7d » vincentisambart
2009-09-28 const pointers should be real constants
361 Value *compile_slot_cache(ID id);
362 virtual Value *gen_slot_cache(ID id);
cb654164 » Laurent Sansonetti
2009-05-23 the great schism, part I
363 ICmpInst *is_value_a_fixnum(Value *val);
364 void compile_ivar_slots(Value *klass, BasicBlock::InstListType &list,
365 BasicBlock::InstListType::iterator iter);
366 bool unbox_ruby_constant(Value *val, VALUE *rval);
01528a72 » Laurent Sansonetti
2009-06-18 floating point arithmetic optimization: Float objects are now immedia…
367 Value *optimized_immediate_op(SEL sel, Value *leftVal, Value *rightVal,
368 bool float_op, bool *is_predicate);
369 Value *compile_double_coercion(Value *val, Value *mask,
370 BasicBlock *fallback_bb, Function *f);
2a1240c8 » vincentisambart
2009-08-12 some refactoring
371 void compile_keep_vars(BasicBlock *startBB, BasicBlock *mergeBB);
01528a72 » Laurent Sansonetti
2009-06-18 floating point arithmetic optimization: Float objects are now immedia…
372
cb654164 » Laurent Sansonetti
2009-05-23 the great schism, part I
373 SEL mid_to_sel(ID mid, int arity);
4e1a3bae » Laurent Sansonetti
2010-02-02 let's attach more metadata
374
c437b620 » Thibault Martin-Lagardette
2010-02-03 - Adds the flip-flop operator (fixes #548)
375 Value *compile_get_ffstate(GlobalVariable *ffstate);
376 Value *compile_set_ffstate(Value *val, Value *expected, GlobalVariable *ffstate, BasicBlock *mergeBB, Function *f);
377 Value *compile_ff2(NODE *current_node);
378 Value *compile_ff3(NODE *current_node);
379
4e1a3bae » Laurent Sansonetti
2010-02-02 let's attach more metadata
380 void attach_current_line_metadata(Instruction *insn);
cb654164 » Laurent Sansonetti
2009-05-23 the great schism, part I
381 };
382
bb0b28cb » Laurent Sansonetti
2009-09-25 moving to LLVM r82747
383 #define context (RoxorCompiler::module->getContext())
384
cb654164 » Laurent Sansonetti
2009-05-23 the great schism, part I
385 class RoxorAOTCompiler : public RoxorCompiler {
386 public:
3432fd19 » Laurent Sansonetti
2009-07-10 a better exception-based implementation for return-from-block
387 RoxorAOTCompiler(void);
cb654164 » Laurent Sansonetti
2009-05-23 the great schism, part I
388
389 Function *compile_main_function(NODE *node);
390
391 private:
392 std::map<SEL, GlobalVariable *> mcaches;
393 std::map<ID, GlobalVariable *> ccaches;
394 std::map<SEL, GlobalVariable *> sels;
57d80850 » Laurent Sansonetti
2009-06-30 AOT compiler: added support for NSObject and ID compilation
395 std::map<ID, GlobalVariable *> ids;
42e4a2a2 » Laurent Sansonetti
2009-07-03 AOT compiler: added support for global variables
396 std::map<ID, GlobalVariable *> global_entries;
85b7cc25 » Laurent Sansonetti
2009-07-02 AOT compiler: ivar slots support
397 std::vector<GlobalVariable *> ivar_slots;
907bd816 » Laurent Sansonetti
2009-07-04 AOT compiler: added support for some immutable literals
398 std::map<VALUE, GlobalVariable *> literals;
399
57d80850 » Laurent Sansonetti
2009-06-30 AOT compiler: added support for NSObject and ID compilation
400 GlobalVariable *cObject_gvar;
78b1e930 » Laurent Sansonetti
2009-09-22 added support for AOT compilation of the rb_eStandardError constant
401 GlobalVariable *cStandardError_gvar;
402 std::vector<GlobalVariable *> class_gvars;
cb654164 » Laurent Sansonetti
2009-05-23 the great schism, part I
403
404 Value *compile_mcache(SEL sel, bool super);
405 Value *compile_ccache(ID id);
f61f2c7d » vincentisambart
2009-09-28 const pointers should be real constants
406 Value *compile_sel(SEL sel, bool add_to_bb=true);
12a1d67f » Laurent Sansonetti
2009-08-25 fixing bugs in instance_eval & friends + fixed some specs so that the…
407 void compile_prepare_method(Value *classVal, Value *sel,
408 bool singleton, Function *new_function, rb_vm_arity_t &arity,
9590d405 » Laurent Sansonetti
2009-08-22 fixing and adding several missing ruby method features
409 NODE *body);
2c54dbd2 » Laurent Sansonetti
2009-07-01 AOT compiler: added support for blocks
410 Value *compile_prepare_block_args(Function *func, int *flags);
57d80850 » Laurent Sansonetti
2009-06-30 AOT compiler: added support for NSObject and ID compilation
411 Value *compile_nsobject(void);
78b1e930 » Laurent Sansonetti
2009-09-22 added support for AOT compilation of the rb_eStandardError constant
412 Value *compile_standarderror(void);
57d80850 » Laurent Sansonetti
2009-06-30 AOT compiler: added support for NSObject and ID compilation
413 Value *compile_id(ID id);
907bd816 » Laurent Sansonetti
2009-07-04 AOT compiler: added support for some immutable literals
414 Value *compile_immutable_literal(VALUE val);
42e4a2a2 » Laurent Sansonetti
2009-07-03 AOT compiler: added support for global variables
415 Value *compile_global_entry(NODE *node);
cb654164 » Laurent Sansonetti
2009-05-23 the great schism, part I
416
f61f2c7d » vincentisambart
2009-09-28 const pointers should be real constants
417 Value *gen_slot_cache(ID id);
85b7cc25 » Laurent Sansonetti
2009-07-02 AOT compiler: ivar slots support
418
f61f2c7d » vincentisambart
2009-09-28 const pointers should be real constants
419 Constant *
420 compile_const_pointer(void *ptr, const PointerType *type=NULL) {
cb654164 » Laurent Sansonetti
2009-05-23 the great schism, part I
421 if (ptr == NULL) {
f61f2c7d » vincentisambart
2009-09-28 const pointers should be real constants
422 return RoxorCompiler::compile_const_pointer(ptr, type);
cb654164 » Laurent Sansonetti
2009-05-23 the great schism, part I
423 }
424 printf("compile_const_pointer() called with a non-NULL pointer " \
425 "on the AOT compiler - leaving the ship!\n");
426 abort();
427 }
428 };
429
430 #endif /* __cplusplus */
431
432 #endif /* __COMPILER_H_ */
Something went wrong with that request. Please try again.