Skip to content

HTTPS clone URL

Subversion checkout URL

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