Skip to content
Newer
Older
100644 530 lines (476 sloc) 15.9 KB
cfd7b4d added licensing information on the new files
Laurent Sansonetti authored
1 /*
e29c2ec now interpreting potential cold paths (work in progress)
Laurent Sansonetti authored
2 * MacRuby Compiler.
cfd7b4d added licensing information on the new files
Laurent Sansonetti authored
3 *
4 * This file is covered by the Ruby license. See COPYING for more details.
5 *
9595725 update copyrights to 2011
Laurent Sansonetti authored
6 * Copyright (C) 2008-2011, Apple Inc. All rights reserved.
cfd7b4d added licensing information on the new files
Laurent Sansonetti authored
7 */
8
cb65416 the great schism, part I
Laurent Sansonetti authored
9 #ifndef __COMPILER_H_
10 #define __COMPILER_H_
11
12 // For the dispatcher.
8e4c2c7 moving the dispatcher bits into the kernel + misc fixes/cleanup
Laurent Sansonetti authored
13 #define DISPATCH_VCALL 0x1 // no receiver, no argument
14 #define DISPATCH_FCALL 0x2 // no receiver, one or more arguments
15 #define DISPATCH_SUPER 0x4 // super call
16 #define DISPATCH_SPLAT 0x8 // has splat
9590d40 fixing and adding several missing ruby method features
Laurent Sansonetti authored
17 #define SPLAT_ARG_FOLLOWS 0xdeadbeef
cb65416 the great schism, part I
Laurent Sansonetti authored
18
370e385 get rid of bad allocas, disable frame pointer elimination, simplified…
Laurent Sansonetti authored
19 // For const lookup.
20 #define CONST_LOOKUP_LEXICAL 1
21 #define CONST_LOOKUP_DYNAMIC_CLASS 2
6b101bd @takaokouji supported lexical const lookup. (fixes #619, #626, #1167, #1192) (ref…
takaokouji authored
22 #define CONST_LOOKUP_INSIDE_EVAL 4
370e385 get rid of bad allocas, disable frame pointer elimination, simplified…
Laurent Sansonetti authored
23
cb65416 the great schism, part I
Laurent Sansonetti authored
24 // For defined?
25 #define DEFINED_IVAR 1
26 #define DEFINED_GVAR 2
27 #define DEFINED_CVAR 3
28 #define DEFINED_CONST 4
29 #define DEFINED_LCONST 5
30 #define DEFINED_SUPER 6
31 #define DEFINED_METHOD 7
32
002ed5d now compile some of the VM primitives into bitcode that will be added…
Laurent Sansonetti authored
33 #if defined(__cplusplus)
34
a6a5d3e started to trim out the static library
Laurent Sansonetti authored
35 #if !defined(MACRUBY_STATIC)
36
e29c2ec now interpreting potential cold paths (work in progress)
Laurent Sansonetti authored
37 class RoxorInterpreter;
38
cb65416 the great schism, part I
Laurent Sansonetti authored
39 class RoxorCompiler {
e29c2ec now interpreting potential cold paths (work in progress)
Laurent Sansonetti authored
40 friend class RoxorInterpreter;
41
cb65416 the great schism, part I
Laurent Sansonetti authored
42 public:
43 static llvm::Module *module;
44 static RoxorCompiler *shared;
45
cf73725 experimental debugger
Laurent Sansonetti authored
46 RoxorCompiler(bool debug_mode);
cb65416 the great schism, part I
Laurent Sansonetti authored
47 virtual ~RoxorCompiler(void) { }
48
0f14388 emit dwarf metadata at compilation time and use it to establish backt…
Laurent Sansonetti authored
49 void set_fname(const char *_fname);
3432fd1 a better exception-based implementation for return-from-block
Laurent Sansonetti authored
50
cb65416 the great schism, part I
Laurent Sansonetti authored
51 Value *compile_node(NODE *node);
52
e29c2ec now interpreting potential cold paths (work in progress)
Laurent Sansonetti authored
53 virtual Function *compile_main_function(NODE *node,
54 bool *can_be_interpreted);
cb65416 the great schism, part I
Laurent Sansonetti authored
55 Function *compile_read_attr(ID name);
56 Function *compile_write_attr(ID name);
9fab1ac fixed variadic functions/methods calls
Laurent Sansonetti authored
57 Function *compile_stub(const char *types, bool variadic, int min_argc,
58 bool is_objc);
485e435 Allow methods/blocks with 12+ arguments
Thibault Martin-Lagardette authored
59 Function *compile_long_arity_stub(int argc, bool is_block);
cb65416 the great schism, part I
Laurent Sansonetti authored
60 Function *compile_bs_struct_new(rb_vm_bs_boxed_t *bs_boxed);
61 Function *compile_bs_struct_writer(rb_vm_bs_boxed_t *bs_boxed,
62 int field);
63 Function *compile_ffi_function(void *stub, void *imp, int argc);
64 Function *compile_to_rval_convertor(const char *type);
65 Function *compile_to_ocval_convertor(const char *type);
c1c347f AOT compiler: now supporting objc stubs and super dispatch
Laurent Sansonetti authored
66 Function *compile_objc_stub(Function *ruby_func, IMP ruby_imp,
67 const rb_vm_arity_t &arity, const char *types);
208a965 a quick implementation for #define_method (not yet 100% complete)
Laurent Sansonetti authored
68 Function *compile_block_caller(rb_vm_block_t *block);
4b7c757 cleaning a bit public headers, added support for methods defined for …
Laurent Sansonetti authored
69 Function *compile_mri_stub(void *imp, const int arity);
cb65416 the great schism, part I
Laurent Sansonetti authored
70
002ed5d now compile some of the VM primitives into bitcode that will be added…
Laurent Sansonetti authored
71 void inline_function_calls(Function *f);
72
cb65416 the great schism, part I
Laurent Sansonetti authored
73 const Type *convert_type(const char *type);
74
c219e86 don't slow ivars used inside an eval string
Laurent Sansonetti authored
75 bool is_inside_eval(void) { return inside_eval; }
76 void set_inside_eval(bool flag) { inside_eval = flag; }
12a1d67 fixing bugs in instance_eval & friends + fixed some specs so that the…
Laurent Sansonetti authored
77 bool is_dynamic_class(void) { return dynamic_class; }
78 void set_dynamic_class(bool flag) { dynamic_class = flag; }
c219e86 don't slow ivars used inside an eval string
Laurent Sansonetti authored
79
9b5bce3 when calculating a backtrace path from a -e script, omit the current …
Laurent Sansonetti authored
80 void generate_location_path(std::string &path, DILocation loc);
81
cb65416 the great schism, part I
Laurent Sansonetti authored
82 protected:
9be9a37 now depend on revision 127367 of branch LLVM 2.9
Laurent Sansonetti authored
83 #if !defined(LLVM_TOT)
c3fac48 add support for llvm 2.9, test it by passing CFLAGS=-D__SUPPORT_LLVM_…
Laurent Sansonetti authored
84 DIBuilder *debug_info;
85 #else
0f14388 emit dwarf metadata at compilation time and use it to establish backt…
Laurent Sansonetti authored
86 DIFactory *debug_info;
c3fac48 add support for llvm 2.9, test it by passing CFLAGS=-D__SUPPORT_LLVM_…
Laurent Sansonetti authored
87 #endif
0f14388 emit dwarf metadata at compilation time and use it to establish backt…
Laurent Sansonetti authored
88 DICompileUnit debug_compile_unit;
89 DISubprogram debug_subprogram;
90
cf73725 experimental debugger
Laurent Sansonetti authored
91 bool debug_mode;
cb65416 the great schism, part I
Laurent Sansonetti authored
92 const char *fname;
c219e86 don't slow ivars used inside an eval string
Laurent Sansonetti authored
93 bool inside_eval;
e29c2ec now interpreting potential cold paths (work in progress)
Laurent Sansonetti authored
94 bool should_interpret;
95 bool can_interpret;
cb65416 the great schism, part I
Laurent Sansonetti authored
96
97 std::map<ID, Value *> lvars;
98 std::vector<ID> dvars;
8c55086 better ivar slot system for RubyObject + misc fixes/cleanup
Laurent Sansonetti authored
99 std::map<ID, void *> ivars_slots_cache;
cb65416 the great schism, part I
Laurent Sansonetti authored
100 std::map<std::string, GlobalVariable *> static_strings;
e379686 some work on unicode support (still in progress)
Laurent Sansonetti authored
101 std::map<CFHashCode, GlobalVariable *> static_ustrings;
cb65416 the great schism, part I
Laurent Sansonetti authored
102
0ff5064 optimizing symetric masgns
Laurent Sansonetti authored
103 class MAsgnValue {
104 public:
105 CallInst *ary;
106 };
107 std::vector<MAsgnValue> masgn_values;
108
cb65416 the great schism, part I
Laurent Sansonetti authored
109 #if ROXOR_COMPILER_DEBUG
110 int level;
111 # define DEBUG_LEVEL_INC() (level++)
112 # define DEBUG_LEVEL_DEC() (level--)
113 #else
114 # define DEBUG_LEVEL_INC()
115 # define DEBUG_LEVEL_DEC()
116 #endif
117
2541db3 added preliminary support for backtracing/symbolication
Laurent Sansonetti authored
118 unsigned int current_line;
cb65416 the great schism, part I
Laurent Sansonetti authored
119 BasicBlock *bb;
120 BasicBlock *entry_bb;
121 ID current_mid;
164ca93 fixed super within a method that has a splat argument
Laurent Sansonetti authored
122 rb_vm_arity_t current_arity;
cb65416 the great schism, part I
Laurent Sansonetti authored
123 ID self_id;
124 Value *current_self;
125 bool current_block;
1961daa better fix than last one
Laurent Sansonetti authored
126 bool current_block_chain;
cb65416 the great schism, part I
Laurent Sansonetti authored
127 Value *current_var_uses;
128 Value *running_block;
cc6f8a9 fixed a bug in super without argument, it should pass the method's &b…
Laurent Sansonetti authored
129 Value *current_block_arg;
cb65416 the great schism, part I
Laurent Sansonetti authored
130 BasicBlock *begin_bb;
63c77f8 @vincentisambart now rescues in rescues should work properly in most cases
vincentisambart authored
131 BasicBlock *rescue_invoke_bb;
132 BasicBlock *rescue_rethrow_bb;
cb65416 the great schism, part I
Laurent Sansonetti authored
133 BasicBlock *ensure_bb;
18f25be fix a bug in the compilation of the 'next' expression which would not…
Laurent Sansonetti authored
134 PHINode *ensure_pn;
135 NODE *ensure_node;
cb65416 the great schism, part I
Laurent Sansonetti authored
136 bool current_rescue;
137 NODE *current_block_node;
138 Function *current_block_func;
1e86229 fixed ZSUPER compilation inside blocks
Laurent Sansonetti authored
139 Function *current_non_block_func;
cb65416 the great schism, part I
Laurent Sansonetti authored
140 GlobalVariable *current_opened_class;
12a1d67 fixing bugs in instance_eval & friends + fixed some specs so that the…
Laurent Sansonetti authored
141 bool dynamic_class;
cb65416 the great schism, part I
Laurent Sansonetti authored
142 BasicBlock *current_loop_begin_bb;
143 BasicBlock *current_loop_body_bb;
144 BasicBlock *current_loop_end_bb;
513ee74 @vincentisambart Fixed the return value of while/until loops
vincentisambart authored
145 PHINode *current_loop_exit_val;
3432fd1 a better exception-based implementation for return-from-block
Laurent Sansonetti authored
146 int return_from_block;
147 int return_from_block_ids;
13f5368 fixed a bunch of super-dispatch bugs
Laurent Sansonetti authored
148 bool block_declaration;
be15a06 atomic compilation of arrays, to make JIT compilation faster
Laurent Sansonetti authored
149 AllocaInst *argv_buffer;
cb65416 the great schism, part I
Laurent Sansonetti authored
150
5bcbc93 issue write barriers when storing objects into Binding slots (this sh…
Laurent Sansonetti authored
151 Function *writeBarrierFunc;
8e4c2c7 moving the dispatcher bits into the kernel + misc fixes/cleanup
Laurent Sansonetti authored
152 Function *dispatchFunc;
38456a4 most fast ops in place
Laurent Sansonetti authored
153 Function *fastPlusFunc;
154 Function *fastMinusFunc;
155 Function *fastMultFunc;
156 Function *fastDivFunc;
157 Function *fastLtFunc;
158 Function *fastLeFunc;
159 Function *fastGtFunc;
160 Function *fastGeFunc;
944d624 optimize #== and #!= for non fixnum/float types
Laurent Sansonetti authored
161 Function *fastEqFunc;
162 Function *fastNeqFunc;
cb65416 the great schism, part I
Laurent Sansonetti authored
163 Function *fastEqqFunc;
002ed5d now compile some of the VM primitives into bitcode that will be added…
Laurent Sansonetti authored
164 Function *fastArefFunc;
165 Function *fastAsetFunc;
166 Function *fastShiftFunc;
cb65416 the great schism, part I
Laurent Sansonetti authored
167 Function *whenSplatFunc;
168 Function *prepareBlockFunc;
169 Function *pushBindingFunc;
170 Function *getBlockFunc;
5f62cf0 when compiling super without argument (ZSUPER), make sure to pass the…
Laurent Sansonetti authored
171 Function *currentBlockFunc;
cb65416 the great schism, part I
Laurent Sansonetti authored
172 Function *currentBlockObjectFunc;
173 Function *getConstFunc;
174 Function *setConstFunc;
175 Function *prepareMethodFunc;
176 Function *singletonClassFunc;
177 Function *defineClassFunc;
178 Function *prepareIvarSlotFunc;
179 Function *getIvarFunc;
180 Function *setIvarFunc;
002ed5d now compile some of the VM primitives into bitcode that will be added…
Laurent Sansonetti authored
181 Function *willChangeValueFunc;
182 Function *didChangeValueFunc;
cb65416 the great schism, part I
Laurent Sansonetti authored
183 Function *definedFunc;
184 Function *undefFunc;
185 Function *aliasFunc;
186 Function *valiasFunc;
187 Function *newHashFunc;
002ed5d now compile some of the VM primitives into bitcode that will be added…
Laurent Sansonetti authored
188 Function *storeHashFunc;
cb65416 the great schism, part I
Laurent Sansonetti authored
189 Function *toAFunc;
190 Function *toAryFunc;
191 Function *catArrayFunc;
192 Function *dupArrayFunc;
193 Function *newArrayFunc;
424e623 add support for C-style arrays (from/to Ruby)
Laurent Sansonetti authored
194 Function *entryArrayFunc;
195 Function *checkArrayFunc;
4856e8a fix a bug where calling a method defined with #define_method with a b…
Laurent Sansonetti authored
196 Function *lengthArrayFunc;
197 Function *ptrArrayFunc;
cb65416 the great schism, part I
Laurent Sansonetti authored
198 Function *newStructFunc;
199 Function *newOpaqueFunc;
ff75d60 added support for overwriting an ObjC method that accepts a pointer
Laurent Sansonetti authored
200 Function *newPointerFunc;
cb65416 the great schism, part I
Laurent Sansonetti authored
201 Function *getStructFieldsFunc;
202 Function *getOpaqueDataFunc;
203 Function *getPointerPtrFunc;
d1bb30d added simple compiler support for bit fields and C-style arrays, impr…
Laurent Sansonetti authored
204 Function *xmallocFunc;
cb65416 the great schism, part I
Laurent Sansonetti authored
205 Function *checkArityFunc;
206 Function *setStructFunc;
207 Function *newRangeFunc;
208 Function *newRegexpFunc;
209 Function *strInternFunc;
00b147f add basic support for __method__ and __callee__
Laurent Sansonetti authored
210 Function *selToSymFunc;
cb65416 the great schism, part I
Laurent Sansonetti authored
211 Function *keepVarsFunc;
212 Function *masgnGetElemBeforeSplatFunc;
213 Function *masgnGetElemAfterSplatFunc;
214 Function *masgnGetSplatFunc;
215 Function *newStringFunc;
913687b fixed a bug in the way we compile literal strings
Laurent Sansonetti authored
216 Function *newString2Func;
217 Function *newString3Func;
cb65416 the great schism, part I
Laurent Sansonetti authored
218 Function *yieldFunc;
7da28cb make sure break makes yield return from its scope
Laurent Sansonetti authored
219 Function *getBrokenFunc;
208a965 a quick implementation for #define_method (not yet 100% complete)
Laurent Sansonetti authored
220 Function *blockEvalFunc;
cb65416 the great schism, part I
Laurent Sansonetti authored
221 Function *gvarSetFunc;
222 Function *gvarGetFunc;
223 Function *cvarSetFunc;
224 Function *cvarGetFunc;
225 Function *currentExceptionFunc;
226 Function *popExceptionFunc;
f2d8a2b fix a bug when retrieving the special <dollar-sign>38 variable would …
Laurent Sansonetti authored
227 Function *getBackrefNth;
228 Function *getBackrefSpecial;
cb65416 the great schism, part I
Laurent Sansonetti authored
229 Function *breakFunc;
6c5b476 a new implementation for return-from-block which uses an exception in…
Laurent Sansonetti authored
230 Function *returnFromBlockFunc;
208c475 optimized returns from non-ensure-scoped and non-Proc blocks
Laurent Sansonetti authored
231 Function *returnedFromBlockFunc;
3432fd1 a better exception-based implementation for return-from-block
Laurent Sansonetti authored
232 Function *checkReturnFromBlockFunc;
208c475 optimized returns from non-ensure-scoped and non-Proc blocks
Laurent Sansonetti authored
233 Function *setHasEnsureFunc;
9590d40 fixing and adding several missing ruby method features
Laurent Sansonetti authored
234 Function *setScopeFunc;
235 Function *setCurrentClassFunc;
6b101bd @takaokouji supported lexical const lookup. (fixes #619, #626, #1167, #1192) (ref…
takaokouji authored
236 Function *pushOuterFunc;
237 Function *popOuterFunc;
cf73725 experimental debugger
Laurent Sansonetti authored
238 Function *debugTrapFunc;
c437b62 - Adds the flip-flop operator (fixes #548)
Thibault Martin-Lagardette authored
239 Function *getFFStateFunc;
240 Function *setFFStateFunc;
945dba1 moving more primitives to the kernel
Laurent Sansonetti authored
241 Function *releaseOwnershipFunc;
002ed5d now compile some of the VM primitives into bitcode that will be added…
Laurent Sansonetti authored
242 Function *ocvalToRvalFunc;
243 Function *charToRvalFunc;
244 Function *ucharToRvalFunc;
245 Function *shortToRvalFunc;
246 Function *ushortToRvalFunc;
247 Function *intToRvalFunc;
248 Function *uintToRvalFunc;
249 Function *longToRvalFunc;
250 Function *ulongToRvalFunc;
251 Function *longLongToRvalFunc;
252 Function *ulongLongToRvalFunc;
253 Function *floatToRvalFunc;
254 Function *doubleToRvalFunc;
255 Function *selToRvalFunc;
256 Function *charPtrToRvalFunc;
257 Function *rvalToOcvalFunc;
258 Function *rvalToBoolFunc;
259 Function *rvalToCharFunc;
260 Function *rvalToUcharFunc;
261 Function *rvalToShortFunc;
262 Function *rvalToUshortFunc;
263 Function *rvalToIntFunc;
264 Function *rvalToUintFunc;
265 Function *rvalToLongFunc;
266 Function *rvalToUlongFunc;
267 Function *rvalToLongLongFunc;
268 Function *rvalToUlongLongFunc;
269 Function *rvalToFloatFunc;
270 Function *rvalToDoubleFunc;
271 Function *rvalToSelFunc;
272 Function *rvalToCharPtrFunc;
112362a support for C-level blocks (note: this requires a not-yet-released Br…
Laurent Sansonetti authored
273 Function *initBlockFunc;
807d2d2 fix the compilation of C blocks closures to not use a global variable…
Laurent Sansonetti authored
274 Function *blockProcFunc;
fa6ceeb add implementation of MRI rb_call_super() method (note: untested)
Laurent Sansonetti authored
275 Function *setCurrentMRIMethodContext;
cb65416 the great schism, part I
Laurent Sansonetti authored
276
277 Constant *zeroVal;
278 Constant *oneVal;
279 Constant *twoVal;
01528a7 floating point arithmetic optimization: Float objects are now immedia…
Laurent Sansonetti authored
280 Constant *threeVal;
cb65416 the great schism, part I
Laurent Sansonetti authored
281 Constant *nilVal;
282 Constant *trueVal;
283 Constant *falseVal;
284 Constant *undefVal;
285 Constant *splatArgFollowsVal;
9590d40 fixing and adding several missing ruby method features
Laurent Sansonetti authored
286 Constant *defaultScope;
287 Constant *publicScope;
bb0b28c moving to LLVM r82747
Laurent Sansonetti authored
288
289 const Type *VoidTy;
290 const Type *Int1Ty;
291 const Type *Int8Ty;
292 const Type *Int16Ty;
293 const Type *Int32Ty;
294 const Type *Int64Ty;
295 const Type *FloatTy;
296 const Type *DoubleTy;
cb65416 the great schism, part I
Laurent Sansonetti authored
297 const Type *RubyObjTy;
f61f2c7 @vincentisambart const pointers should be real constants
vincentisambart authored
298 const PointerType *RubyObjPtrTy;
299 const PointerType *RubyObjPtrPtrTy;
300 const PointerType *PtrTy;
301 const PointerType *PtrPtrTy;
cb65416 the great schism, part I
Laurent Sansonetti authored
302 const Type *IntTy;
f61f2c7 @vincentisambart const pointers should be real constants
vincentisambart authored
303 const PointerType *Int32PtrTy;
d1bb30d added simple compiler support for bit fields and C-style arrays, impr…
Laurent Sansonetti authored
304 const Type *BitTy;
112362a support for C-level blocks (note: this requires a not-yet-released Br…
Laurent Sansonetti authored
305 const Type *BlockLiteralTy;
cb65416 the great schism, part I
Laurent Sansonetti authored
306
fa57162 follow LLVM ToT
Laurent Sansonetti authored
307 unsigned dbg_mdkind;
308
cb65416 the great schism, part I
Laurent Sansonetti authored
309 void compile_node_error(const char *msg, NODE *node);
310
002ed5d now compile some of the VM primitives into bitcode that will be added…
Laurent Sansonetti authored
311 Function *
312 get_function(const char *name) {
313 Function *f = module->getFunction(name);
314 if (f == NULL) {
315 printf("function %s cannot be found!\n", name);
316 abort();
317 }
318 return f;
319 }
320
f61f2c7 @vincentisambart const pointers should be real constants
vincentisambart authored
321 virtual Constant *
322 compile_const_pointer(void *ptr, const PointerType *type=NULL) {
85b7cc2 AOT compiler: ivar slots support
Laurent Sansonetti authored
323 if (type == NULL) {
324 type = PtrTy;
325 }
f61f2c7 @vincentisambart const pointers should be real constants
vincentisambart authored
326 if (ptr == NULL) {
327 return ConstantPointerNull::get(type);
328 }
329 else {
330 Constant *ptrint = ConstantInt::get(IntTy, (long)ptr);
331 return ConstantExpr::getIntToPtr(ptrint, type);
332 }
cb65416 the great schism, part I
Laurent Sansonetti authored
333 }
334
f61f2c7 @vincentisambart const pointers should be real constants
vincentisambart authored
335 Constant *
336 compile_const_pointer_to_pointer(void *ptr) {
337 return compile_const_pointer(ptr, PtrPtrTy);
cb65416 the great schism, part I
Laurent Sansonetti authored
338 }
339
002ed5d now compile some of the VM primitives into bitcode that will be added…
Laurent Sansonetti authored
340 bool should_inline_function(Function *f);
341
e29c2ec now interpreting potential cold paths (work in progress)
Laurent Sansonetti authored
342 Value *compile_node0(NODE *node);
1e86229 fixed ZSUPER compilation inside blocks
Laurent Sansonetti authored
343 Function *compile_scope(NODE *node);
da50a49 better tco disable check
Laurent Sansonetti authored
344 Value *compile_call(NODE *node, bool use_tco=true);
8e4c2c7 moving the dispatcher bits into the kernel + misc fixes/cleanup
Laurent Sansonetti authored
345 Value *compile_yield(NODE *node);
fb086cf reduce usage of std::vector
Laurent Sansonetti authored
346 Instruction *compile_protected_call(Value *imp, Value **args_begin,
347 Value **args_end);
8e4c2c7 moving the dispatcher bits into the kernel + misc fixes/cleanup
Laurent Sansonetti authored
348 Instruction *compile_protected_call(Value *imp, std::vector<Value *>
349 &params);
be15a06 atomic compilation of arrays, to make JIT compilation faster
Laurent Sansonetti authored
350 Value *compile_argv_buffer(const long argc);
8e4c2c7 moving the dispatcher bits into the kernel + misc fixes/cleanup
Laurent Sansonetti authored
351 Value *recompile_dispatch_argv(std::vector<Value *> &params, int idx);
cb65416 the great schism, part I
Laurent Sansonetti authored
352 void compile_dispatch_arguments(NODE *args,
353 std::vector<Value *> &arguments, int *pargc);
354 Function::ArgumentListType::iterator compile_optional_arguments(
355 Function::ArgumentListType::iterator iter, NODE *node);
356 void compile_boolean_test(Value *condVal, BasicBlock *ifTrueBB,
357 BasicBlock *ifFalseBB);
358 void compile_when_arguments(NODE *args, Value *comparedToVal,
359 BasicBlock *thenBB);
360 void compile_single_when_argument(NODE *arg, Value *comparedToVal,
361 BasicBlock *thenBB);
e29c2ec now interpreting potential cold paths (work in progress)
Laurent Sansonetti authored
362 void compile_method_definition(NODE *node);
12a1d67 fixing bugs in instance_eval & friends + fixed some specs so that the…
Laurent Sansonetti authored
363 virtual void compile_prepare_method(Value *classVal, Value *sel,
364 bool singleton, Function *new_function, rb_vm_arity_t &arity,
9590d40 fixing and adding several missing ruby method features
Laurent Sansonetti authored
365 NODE *body);
cb65416 the great schism, part I
Laurent Sansonetti authored
366 Value *compile_dispatch_call(std::vector<Value *> &params);
367 Value *compile_when_splat(Value *comparedToVal, Value *splatVal);
368 Value *compile_attribute_assign(NODE *node, Value *extra_val);
2c54dbd AOT compiler: added support for blocks
Laurent Sansonetti authored
369 virtual Value *compile_prepare_block_args(Function *func, int *flags);
945dba1 moving more primitives to the kernel
Laurent Sansonetti authored
370 Value *compile_prepare_block(void);
371 Value *compile_block(NODE *node);
cc6f8a9 fixed a bug in super without argument, it should pass the method's &b…
Laurent Sansonetti authored
372 Value *compile_block_get(Value *block_object);
cb65416 the great schism, part I
Laurent Sansonetti authored
373 Value *compile_binding(void);
374 Value *compile_optimized_dispatch_call(SEL sel, int argc,
375 std::vector<Value *> &params);
e29c2ec now interpreting potential cold paths (work in progress)
Laurent Sansonetti authored
376 Value *compile_lvar_assignment(ID vid, Value *val);
377 Value *compile_dvar_assignment(ID vid, Value *val);
378 Value *compile_lvar_get(ID vid);
cb65416 the great schism, part I
Laurent Sansonetti authored
379 Value *compile_ivar_assignment(ID vid, Value *val);
e29c2ec now interpreting potential cold paths (work in progress)
Laurent Sansonetti authored
380 Value *compile_ivar_get(ID vid);
cb65416 the great schism, part I
Laurent Sansonetti authored
381 Value *compile_cvar_assignment(ID vid, Value *val);
eeb7a10 added support for @@foo||=42, a lot of changes for a very stupid func…
Laurent Sansonetti authored
382 Value *compile_cvar_get(ID vid, bool check);
42e4a2a AOT compiler: added support for global variables
Laurent Sansonetti authored
383 Value *compile_gvar_assignment(NODE *node, Value *val);
e29c2ec now interpreting potential cold paths (work in progress)
Laurent Sansonetti authored
384 Value *compile_gvar_get(NODE *node);
cb65416 the great schism, part I
Laurent Sansonetti authored
385 Value *compile_constant_declaration(NODE *node, Value *val);
0ff5064 optimizing symetric masgns
Laurent Sansonetti authored
386 Value *compile_multiple_assignment(NODE *node);
cb65416 the great schism, part I
Laurent Sansonetti authored
387 Value *compile_multiple_assignment(NODE *node, Value *val);
388 void compile_multiple_assignment_element(NODE *node, Value *val);
389 Value *compile_current_class(void);
57d8085 AOT compiler: added support for NSObject and ID compilation
Laurent Sansonetti authored
390 virtual Value *compile_nsobject(void);
78b1e93 added support for AOT compilation of the rb_eStandardError constant
Laurent Sansonetti authored
391 virtual Value *compile_standarderror(void);
68ac3fc @takaokouji fixed RoxorVM::pop_outer() leaks memory. (fixes #1267)
takaokouji authored
392 Value *compile_class_path(NODE *node, int *flags);
cb65416 the great schism, part I
Laurent Sansonetti authored
393 Value *compile_const(ID id, Value *outer);
394 Value *compile_singleton_class(Value *obj);
395 Value *compile_defined_expression(NODE *node);
396 Value *compile_dstr(NODE *node);
397 Value *compile_dvar_slot(ID name);
398 void compile_break_val(Value *val);
dcd258b @takaokouji fixed break, next and redo with ensure block, fixed codes below.
takaokouji authored
399 void compile_break_within_loop(Value *val);
400 void compile_break_within_block(Value *val);
e8d79c7 @vincentisambart a return in an ensure should now work properly
vincentisambart authored
401 void compile_simple_return(Value *val);
208c475 optimized returns from non-ensure-scoped and non-Proc blocks
Laurent Sansonetti authored
402 Value *compile_set_has_ensure(Value *val);
3432fd1 a better exception-based implementation for return-from-block
Laurent Sansonetti authored
403 void compile_return_from_block(Value *val, int id);
404 void compile_return_from_block_handler(int id);
cb65416 the great schism, part I
Laurent Sansonetti authored
405 Value *compile_jump(NODE *node);
406 virtual Value *compile_ccache(ID id);
f61f2c7 @vincentisambart const pointers should be real constants
vincentisambart authored
407 virtual Value *compile_sel(SEL sel, bool add_to_bb=true) {
408 return compile_const_pointer(sel, PtrTy);
cb65416 the great schism, part I
Laurent Sansonetti authored
409 }
57d8085 AOT compiler: added support for NSObject and ID compilation
Laurent Sansonetti authored
410 virtual Value *compile_id(ID id);
9d1b612 aot: precompiling BridgeSupport metadata (work in progress)
Laurent Sansonetti authored
411 Instruction *compile_const_global_string(const char *str,
913687b fixed a bug in the way we compile literal strings
Laurent Sansonetti authored
412 const size_t str_len);
9d1b612 aot: precompiling BridgeSupport metadata (work in progress)
Laurent Sansonetti authored
413 Instruction *compile_const_global_string(const char *str) {
913687b fixed a bug in the way we compile literal strings
Laurent Sansonetti authored
414 return compile_const_global_string(str, strlen(str));
415 }
9d1b612 aot: precompiling BridgeSupport metadata (work in progress)
Laurent Sansonetti authored
416 Instruction *compile_const_global_ustring(const UniChar *str,
f045214 regexps are now AOT compilable
Laurent Sansonetti authored
417 const size_t str_len);
e379686 some work on unicode support (still in progress)
Laurent Sansonetti authored
418
2c54dbd AOT compiler: added support for blocks
Laurent Sansonetti authored
419 Value *compile_arity(rb_vm_arity_t &arity);
95f3b23 added support for AOT compilation of literal ranges
Laurent Sansonetti authored
420 Instruction *compile_range(Value *beg, Value *end, bool exclude_end,
9d1b612 aot: precompiling BridgeSupport metadata (work in progress)
Laurent Sansonetti authored
421 bool retain=false);
913687b fixed a bug in the way we compile literal strings
Laurent Sansonetti authored
422 Value *compile_literal(VALUE val);
907bd81 AOT compiler: added support for some immutable literals
Laurent Sansonetti authored
423 virtual Value *compile_immutable_literal(VALUE val);
42e4a2a AOT compiler: added support for global variables
Laurent Sansonetti authored
424 virtual Value *compile_global_entry(NODE *node);
cb65416 the great schism, part I
Laurent Sansonetti authored
425
9590d40 fixing and adding several missing ruby method features
Laurent Sansonetti authored
426 void compile_set_current_scope(Value *klass, Value *scope);
427 Value *compile_set_current_class(Value *klass);
6b101bd @takaokouji supported lexical const lookup. (fixes #619, #626, #1167, #1192) (ref…
takaokouji authored
428 Value *compile_push_outer(Value *klass);
429 Value *compile_pop_outer(void);
9590d40 fixing and adding several missing ruby method features
Laurent Sansonetti authored
430
3432fd1 a better exception-based implementation for return-from-block
Laurent Sansonetti authored
431 Value *compile_landing_pad_header(void);
6c5b476 a new implementation for return-from-block which uses an exception in…
Laurent Sansonetti authored
432 void compile_landing_pad_footer(bool pop_exception=true);
c80c60a in the objc->ruby 32-bit stub convert ruby exceptions to objc
Laurent Sansonetti authored
433 Value *compile_current_exception(void);
cb65416 the great schism, part I
Laurent Sansonetti authored
434 void compile_rethrow_exception(void);
23ef57e now properly popping exceptions from the VM stack when we unwind from…
Laurent Sansonetti authored
435 void compile_pop_exception(int pos=0);
cb65416 the great schism, part I
Laurent Sansonetti authored
436 Value *compile_lvar_slot(ID name);
5bcbc93 issue write barriers when storing objects into Binding slots (this sh…
Laurent Sansonetti authored
437 Value *compile_lvar_slot(ID name, bool *need_wb);
cb65416 the great schism, part I
Laurent Sansonetti authored
438 bool compile_lvars(ID *tbl);
439 Value *compile_new_struct(Value *klass, std::vector<Value *> &fields);
440 Value *compile_new_opaque(Value *klass, Value *val);
ff75d60 added support for overwriting an ObjC method that accepts a pointer
Laurent Sansonetti authored
441 Value *compile_new_pointer(const char *type, Value *val);
cb65416 the great schism, part I
Laurent Sansonetti authored
442 void compile_get_struct_fields(Value *val, Value *buf,
443 rb_vm_bs_boxed_t *bs_boxed);
444 Value *compile_get_opaque_data(Value *val, rb_vm_bs_boxed_t *bs_boxed,
445 Value *slot);
446 Value *compile_get_cptr(Value *val, const char *type, Value *slot);
447 void compile_check_arity(Value *given, Value *requested);
448 void compile_set_struct(Value *rcv, int field, Value *val);
d1bb30d added simple compiler support for bit fields and C-style arrays, impr…
Laurent Sansonetti authored
449 Value *compile_xmalloc(size_t len);
cb65416 the great schism, part I
Laurent Sansonetti authored
450
112362a support for C-level blocks (note: this requires a not-yet-released Br…
Laurent Sansonetti authored
451 Value *compile_lambda_to_funcptr(const char *type, Value *val,
452 Value *slot, bool is_block);
cb65416 the great schism, part I
Laurent Sansonetti authored
453 Value *compile_conversion_to_c(const char *type, Value *val,
002ed5d now compile some of the VM primitives into bitcode that will be added…
Laurent Sansonetti authored
454 Value *slot);
cb65416 the great schism, part I
Laurent Sansonetti authored
455 Value *compile_conversion_to_ruby(const char *type,
002ed5d now compile some of the VM primitives into bitcode that will be added…
Laurent Sansonetti authored
456 const Type *llvm_type, Value *val);
cf73725 experimental debugger
Laurent Sansonetti authored
457 void compile_debug_trap(void);
cb65416 the great schism, part I
Laurent Sansonetti authored
458
8c55086 better ivar slot system for RubyObject + misc fixes/cleanup
Laurent Sansonetti authored
459 virtual Value *compile_slot_cache(ID id);
2a1240c @vincentisambart some refactoring
vincentisambart authored
460 void compile_keep_vars(BasicBlock *startBB, BasicBlock *mergeBB);
01528a7 floating point arithmetic optimization: Float objects are now immedia…
Laurent Sansonetti authored
461
cb65416 the great schism, part I
Laurent Sansonetti authored
462 SEL mid_to_sel(ID mid, int arity);
4e1a3ba let's attach more metadata
Laurent Sansonetti authored
463
c437b62 - Adds the flip-flop operator (fixes #548)
Thibault Martin-Lagardette authored
464 Value *compile_get_ffstate(GlobalVariable *ffstate);
002ed5d now compile some of the VM primitives into bitcode that will be added…
Laurent Sansonetti authored
465 Value *compile_set_ffstate(Value *val, Value *expected,
466 GlobalVariable *ffstate, BasicBlock *mergeBB, Function *f);
c437b62 - Adds the flip-flop operator (fixes #548)
Thibault Martin-Lagardette authored
467 Value *compile_ff2(NODE *current_node);
468 Value *compile_ff3(NODE *current_node);
469
4e1a3ba let's attach more metadata
Laurent Sansonetti authored
470 void attach_current_line_metadata(Instruction *insn);
cb65416 the great schism, part I
Laurent Sansonetti authored
471 };
472
bb0b28c moving to LLVM r82747
Laurent Sansonetti authored
473 #define context (RoxorCompiler::module->getContext())
474
cb65416 the great schism, part I
Laurent Sansonetti authored
475 class RoxorAOTCompiler : public RoxorCompiler {
476 public:
3432fd1 a better exception-based implementation for return-from-block
Laurent Sansonetti authored
477 RoxorAOTCompiler(void);
cb65416 the great schism, part I
Laurent Sansonetti authored
478
e29c2ec now interpreting potential cold paths (work in progress)
Laurent Sansonetti authored
479 Function *compile_main_function(NODE *node, bool *can_be_interpreted);
cb65416 the great schism, part I
Laurent Sansonetti authored
480
9d1b612 aot: precompiling BridgeSupport metadata (work in progress)
Laurent Sansonetti authored
481 // BridgeSupport metadata needed for AOT compilation.
482 std::map<SEL, std::vector<std::string> *> bs_c_stubs_types,
483 bs_objc_stubs_types;
484
485 void load_bs_full_file(const char *path);
486
cb65416 the great schism, part I
Laurent Sansonetti authored
487 private:
488 std::map<ID, GlobalVariable *> ccaches;
489 std::map<SEL, GlobalVariable *> sels;
57d8085 AOT compiler: added support for NSObject and ID compilation
Laurent Sansonetti authored
490 std::map<ID, GlobalVariable *> ids;
42e4a2a AOT compiler: added support for global variables
Laurent Sansonetti authored
491 std::map<ID, GlobalVariable *> global_entries;
85b7cc2 AOT compiler: ivar slots support
Laurent Sansonetti authored
492 std::vector<GlobalVariable *> ivar_slots;
907bd81 AOT compiler: added support for some immutable literals
Laurent Sansonetti authored
493 std::map<VALUE, GlobalVariable *> literals;
9d1b612 aot: precompiling BridgeSupport metadata (work in progress)
Laurent Sansonetti authored
494 std::vector<std::string> c_stubs, objc_stubs;
907bd81 AOT compiler: added support for some immutable literals
Laurent Sansonetti authored
495
57d8085 AOT compiler: added support for NSObject and ID compilation
Laurent Sansonetti authored
496 GlobalVariable *cObject_gvar;
78b1e93 added support for AOT compilation of the rb_eStandardError constant
Laurent Sansonetti authored
497 GlobalVariable *cStandardError_gvar;
498 std::vector<GlobalVariable *> class_gvars;
cb65416 the great schism, part I
Laurent Sansonetti authored
499
9d1b612 aot: precompiling BridgeSupport metadata (work in progress)
Laurent Sansonetti authored
500 Function *compile_init_function(void);
cb65416 the great schism, part I
Laurent Sansonetti authored
501 Value *compile_ccache(ID id);
f61f2c7 @vincentisambart const pointers should be real constants
vincentisambart authored
502 Value *compile_sel(SEL sel, bool add_to_bb=true);
12a1d67 fixing bugs in instance_eval & friends + fixed some specs so that the…
Laurent Sansonetti authored
503 void compile_prepare_method(Value *classVal, Value *sel,
504 bool singleton, Function *new_function, rb_vm_arity_t &arity,
9590d40 fixing and adding several missing ruby method features
Laurent Sansonetti authored
505 NODE *body);
2c54dbd AOT compiler: added support for blocks
Laurent Sansonetti authored
506 Value *compile_prepare_block_args(Function *func, int *flags);
57d8085 AOT compiler: added support for NSObject and ID compilation
Laurent Sansonetti authored
507 Value *compile_nsobject(void);
78b1e93 added support for AOT compilation of the rb_eStandardError constant
Laurent Sansonetti authored
508 Value *compile_standarderror(void);
57d8085 AOT compiler: added support for NSObject and ID compilation
Laurent Sansonetti authored
509 Value *compile_id(ID id);
907bd81 AOT compiler: added support for some immutable literals
Laurent Sansonetti authored
510 Value *compile_immutable_literal(VALUE val);
42e4a2a AOT compiler: added support for global variables
Laurent Sansonetti authored
511 Value *compile_global_entry(NODE *node);
8c55086 better ivar slot system for RubyObject + misc fixes/cleanup
Laurent Sansonetti authored
512 Value *compile_slot_cache(ID id);
85b7cc2 AOT compiler: ivar slots support
Laurent Sansonetti authored
513
f61f2c7 @vincentisambart const pointers should be real constants
vincentisambart authored
514 Constant *
515 compile_const_pointer(void *ptr, const PointerType *type=NULL) {
cb65416 the great schism, part I
Laurent Sansonetti authored
516 if (ptr == NULL) {
f61f2c7 @vincentisambart const pointers should be real constants
vincentisambart authored
517 return RoxorCompiler::compile_const_pointer(ptr, type);
cb65416 the great schism, part I
Laurent Sansonetti authored
518 }
519 printf("compile_const_pointer() called with a non-NULL pointer " \
520 "on the AOT compiler - leaving the ship!\n");
521 abort();
522 }
523 };
524
a6a5d3e started to trim out the static library
Laurent Sansonetti authored
525 #endif // !MACRUBY_STATIC
526
cb65416 the great schism, part I
Laurent Sansonetti authored
527 #endif /* __cplusplus */
528
529 #endif /* __COMPILER_H_ */
Something went wrong with that request. Please try again.