Skip to content

Commit 9e28da4

Browse files
committedMar 20, 2016
Updated JIT for removed CallFrame* passing.
1 parent 154bde3 commit 9e28da4

13 files changed

+589
-728
lines changed
 

Diff for: ‎machine/llvm/inline.cpp

+3-6
Original file line numberDiff line numberDiff line change
@@ -474,20 +474,18 @@ namespace rubinius {
474474
if(!found) {
475475
Signature sig2(ops_.context(), "Object");
476476
sig2 << "State";
477-
sig2 << "CallFrame";
478477
sig2 << "Object";
479478
sig2 << "Object";
480479
sig2 << "Object";
481480

482481
Value* call_args2[] = {
483482
ops_.state(),
484-
ops_.call_frame(),
485483
self,
486484
ops_.constant(acc->name()),
487485
val
488486
};
489487

490-
sig2.call("rbx_set_ivar", call_args2, 5, "ivar",
488+
sig2.call("rbx_set_ivar", call_args2, 4, "ivar",
491489
ops_.b());
492490
}
493491
}
@@ -935,10 +933,9 @@ namespace rubinius {
935933

936934
Signature check(ops_.context(), ops_.NativeIntTy);
937935
check << "State";
938-
check << "CallFrame";
939936

940-
Value* check_args[] = { ops_.state(), ops_.call_frame() };
941-
check.call("rbx_enter_unmanaged", check_args, 2, "unused", ops_.b());
937+
Value* check_args[] = { ops_.state() };
938+
check.call("rbx_enter_unmanaged", check_args, 1, "unused", ops_.b());
942939

943940
Type* return_type = find_type(ops_, nf->ffi_data->ret_info.type);
944941

Diff for: ‎machine/llvm/inline_primitive.cpp

+12-32
Original file line numberDiff line numberDiff line change
@@ -1287,18 +1287,16 @@ namespace rubinius {
12871287

12881288
Signature sig(ops.context(), "Object");
12891289
sig << "State";
1290-
sig << "CallFrame";
12911290
sig << "Object";
12921291

12931292
Function* func = sig.function("rbx_create_instance");
12941293
func->setDoesNotCapture(1);
12951294
func->setDoesNotCapture(2);
1296-
func->setDoesNotCapture(3);
12971295
func->setDoesNotAlias(0);
12981296

1299-
Value* call_args[] = { ops.state(), ops.call_frame(), cls };
1297+
Value* call_args[] = { ops.state(), cls };
13001298

1301-
CallInst* out = sig.call("rbx_create_instance", call_args, 3,
1299+
CallInst* out = sig.call("rbx_create_instance", call_args, 2,
13021300
"instance", ops.b());
13031301
// Even though an allocation actually modifies memory etc, it does
13041302
// not have the semantics that it does. Allocation of this object
@@ -1455,20 +1453,16 @@ namespace rubinius {
14551453

14561454
ops.set_block(set);
14571455

1458-
Value* call_frame = ops.call_frame();
1459-
14601456
Signature sig(ops.context(), ops.ObjType);
14611457
sig << ops.StateTy;
14621458
sig << ops.ObjType;
1463-
sig << "CallFrame";
14641459

14651460
Value* call_args[] = {
14661461
ops.state(),
14671462
matchdata,
1468-
call_frame
14691463
};
14701464

1471-
CallInst* res = sig.call("rbx_regexp_set_last_match", call_args, 3, "set_last_match", ops.b());
1465+
CallInst* res = sig.call("rbx_regexp_set_last_match", call_args, 2, "set_last_match", ops.b());
14721466
res->setDoesNotThrow();
14731467

14741468
i.set_result(res);
@@ -1506,14 +1500,12 @@ namespace rubinius {
15061500

15071501
Signature sig(ops.context(), ops.ObjType);
15081502
sig << "State";
1509-
sig << "CallFrame";
15101503
sig << "Object";
15111504
sig << ops.context()->Int32Ty;
15121505
sig << ops.ObjArrayTy;
15131506

15141507
Value* call_args[] = {
15151508
ops.state(),
1516-
ops.call_frame(),
15171509
i.recv(),
15181510
ops.cint(count),
15191511
ops.stack_objects(count)
@@ -1532,14 +1524,12 @@ namespace rubinius {
15321524

15331525
Signature sig(ops.context(), ops.ObjType);
15341526
sig << "State";
1535-
sig << "CallFrame";
15361527

15371528
Value* call_args[] = {
1538-
ops.state(),
1539-
ops.call_frame()
1529+
ops.state()
15401530
};
15411531

1542-
CallInst* res = sig.call("rbx_variable_scope_of_sender", call_args, 2, "result", ops.b());
1532+
CallInst* res = sig.call("rbx_variable_scope_of_sender", call_args, 1, "result", ops.b());
15431533
res->setDoesNotThrow();
15441534

15451535
i.set_result(res);
@@ -1553,14 +1543,12 @@ namespace rubinius {
15531543

15541544
Signature sig(ops.context(), ops.ObjType);
15551545
sig << "State";
1556-
sig << "CallFrame";
15571546

15581547
Value* call_args[] = {
1559-
ops.state(),
1560-
ops.call_frame()
1548+
ops.state()
15611549
};
15621550

1563-
CallInst* res = sig.call("rbx_compiledcode_of_sender", call_args, 2, "result", ops.b());
1551+
CallInst* res = sig.call("rbx_compiledcode_of_sender", call_args, 1, "result", ops.b());
15641552
res->setDoesNotThrow();
15651553

15661554
i.set_result(res);
@@ -1574,14 +1562,12 @@ namespace rubinius {
15741562

15751563
Signature sig(ops.context(), ops.ObjType);
15761564
sig << "State";
1577-
sig << "CallFrame";
15781565

15791566
Value* call_args[] = {
1580-
ops.state(),
1581-
ops.call_frame()
1567+
ops.state()
15821568
};
15831569

1584-
CallInst* res = sig.call("rbx_constant_scope_of_sender", call_args, 2, "result", ops.b());
1570+
CallInst* res = sig.call("rbx_constant_scope_of_sender", call_args, 1, "result", ops.b());
15851571
res->setDoesNotThrow();
15861572

15871573
i.set_result(res);
@@ -1595,14 +1581,13 @@ namespace rubinius {
15951581

15961582
Signature sig(ops.context(), ops.ObjType);
15971583
sig << "State";
1598-
sig << "CallFrame";
15991584

16001585
Value* call_args[] = {
1601-
ops.state(),
1602-
ops.call_frame()
1586+
ops.state()
16031587
};
16041588

1605-
CallInst* res = sig.call("rbx_location_of_closest_ruby_method", call_args, 2, "result", ops.b());
1589+
CallInst* res = sig.call("rbx_location_of_closest_ruby_method",
1590+
call_args, 1, "result", ops.b());
16061591
res->setDoesNotThrow();
16071592

16081593
i.set_result(res);
@@ -1764,11 +1749,6 @@ namespace rubinius {
17641749
sig << "State";
17651750
call_args.push_back(ops_.state());
17661751

1767-
if(stub_res.pass_callframe()) {
1768-
sig << "CallFrame";
1769-
call_args.push_back(ops_.call_frame());
1770-
}
1771-
17721752
sig << "Object";
17731753
call_args.push_back(recv());
17741754

Diff for: ‎machine/llvm/jit_block.cpp

+5-12
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ namespace jit {
1919
void BlockBuilder::setup() {
2020
std::vector<Type*> ftypes;
2121
ftypes.push_back(ctx_->ptr_type("State"));
22-
ftypes.push_back(ctx_->ptr_type("CallFrame"));
2322
ftypes.push_back(ctx_->ptr_type("BlockEnvironment"));
2423
ftypes.push_back(ctx_->ptr_type("Arguments"));
2524
ftypes.push_back(ctx_->ptr_type("BlockInvocation"));
@@ -39,7 +38,6 @@ namespace jit {
3938

4039
Function::arg_iterator ai = func->arg_begin();
4140
llvm::Value* state = ai++; state->setName("state");
42-
llvm::Value* prev = ai++; prev->setName("previous");
4341
block_env = ai++; block_env->setName("env");
4442
llvm::Value* args = ai++; args->setName("args");
4543
block_inv = ai++; block_inv->setName("invocation");
@@ -51,7 +49,8 @@ namespace jit {
5149

5250
info_.set_state(state);
5351
info_.set_args(args);
54-
info_.set_previous(prev);
52+
// TODO: CallFrame
53+
// info_.set_previous(prev);
5554
info_.set_entry(block);
5655

5756
alloc_frame("block_body");
@@ -266,16 +265,14 @@ namespace jit {
266265

267266
Signature sig(ctx_, ctx_->Int32Ty);
268267
sig << "State";
269-
sig << "CallFrame";
270268
sig << "Arguments";
271269

272270
Value* call_args[] = {
273271
info_.state(),
274-
info_.call_frame(),
275272
info_.args()
276273
};
277274

278-
Value* val = sig.call("rbx_destructure_args", call_args, 3, "", b());
275+
Value* val = sig.call("rbx_destructure_args", call_args, 2, "", b());
279276

280277
Value* is_error = b().CreateICmpEQ(val, cint(-1));
281278

@@ -364,17 +361,15 @@ namespace jit {
364361

365362
Signature sig(ctx_, "Object");
366363
sig << "State";
367-
sig << "CallFrame";
368364
sig << "Object";
369365

370366
Value* call_args[] = {
371367
info_.state(),
372-
info_.previous(),
373368
kw_arg
374369
};
375370

376371
Value* keyword_val = sig.call("rbx_check_keyword",
377-
call_args, 3, "rbx_check_keyword", b());
372+
call_args, 2, "rbx_check_keyword", b());
378373

379374
b().CreateStore(keyword_val, keyword_object_);
380375

@@ -401,18 +396,16 @@ namespace jit {
401396
Signature sig(ctx_, "Object");
402397

403398
sig << "State";
404-
sig << "CallFrame";
405399
sig << "Arguments";
406400
sig << ctx_->Int32Ty;
407401

408402
Value* call_args[] = {
409403
info_.state(),
410-
info_.previous(),
411404
info_.args(),
412405
cint(machine_code_->total_args)
413406
};
414407

415-
Value* val = sig.call("rbx_arg_error", call_args, 4, "rbx_arg_error", b());
408+
Value* val = sig.call("rbx_arg_error", call_args, 3, "rbx_arg_error", b());
416409
info_.add_return_value(val, b().GetInsertBlock());
417410
b().CreateBr(info_.return_pad());
418411

Diff for: ‎machine/llvm/jit_inline_block.cpp

+1-5
Original file line numberDiff line numberDiff line change
@@ -165,20 +165,18 @@ namespace jit {
165165

166166
Signature sig(ctx_, ctx_->Int32Ty);
167167
sig << "State";
168-
sig << "CallFrame";
169168
sig << "Object";
170169
sig << args_array->getType();
171170
sig << ctx_->Int32Ty;
172171

173172
Value* call_args[] = {
174173
info_.state(),
175-
info_.call_frame(),
176174
stack_args.at(0),
177175
args_array,
178176
cint(T)
179177
};
180178

181-
Value* size = sig.call("rbx_destructure_inline_args", call_args, 5, "", b());
179+
Value* size = sig.call("rbx_destructure_inline_args", call_args, 4, "", b());
182180

183181
info_.add_return_value(Constant::getNullValue(obj_type),
184182
b().GetInsertBlock());
@@ -231,12 +229,10 @@ namespace jit {
231229

232230
Signature sig(ctx_, "Object");
233231
sig << "State";
234-
sig << "CallFrame";
235232
sig << "Object";
236233

237234
Value* call_args[] = {
238235
info_.state(),
239-
info_.previous(),
240236
kw_arg
241237
};
242238

Diff for: ‎machine/llvm/jit_inline_method.cpp

+1-3
Original file line numberDiff line numberDiff line change
@@ -224,18 +224,16 @@ namespace jit {
224224
if(SN > M) {
225225
Signature sig(ctx_, "Object");
226226
sig << "State";
227-
sig << "CallFrame";
228227
sig << "Object";
229228

230229
Value* call_args[] = {
231230
info_.state(),
232-
info_.previous(),
233231
b().CreateLoad(
234232
b().CreateGEP(args_array, cint(SN - H - 1)))
235233
};
236234

237235
Value* keyword_val = sig.call("rbx_check_keyword",
238-
call_args, 3, "keyword_val", b());
236+
call_args, 2, "keyword_val", b());
239237

240238
b().CreateStore(keyword_val, keyword_object);
241239
} else {

Diff for: ‎machine/llvm/jit_method.cpp

+4-9
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ namespace jit {
2222
void MethodBuilder::setup() {
2323
std::vector<Type*> ftypes;
2424
ftypes.push_back(ctx_->ptr_type("State"));
25-
ftypes.push_back(ctx_->ptr_type("CallFrame"));
2625
ftypes.push_back(ctx_->ptr_type("Executable"));
2726
ftypes.push_back(ctx_->ptr_type("Module"));
2827
ftypes.push_back(ctx_->ptr_type("Arguments"));
@@ -41,7 +40,6 @@ namespace jit {
4140

4241
Function::arg_iterator ai = func->arg_begin();
4342
llvm::Value* state = ai++; state->setName("state");
44-
llvm::Value* prev = ai++; prev->setName("previous");
4543
exec = ai++; exec->setName("exec");
4644
module = ai++; module->setName("mod");
4745
llvm::Value* args = ai++; args->setName("args");
@@ -53,7 +51,8 @@ namespace jit {
5351

5452
info_.set_state(state);
5553
info_.set_args(args);
56-
info_.set_previous(prev);
54+
// TODO: CallFrame
55+
// info_.set_previous(prev);
5756
info_.set_entry(block);
5857

5958
alloc_frame("method_body");
@@ -144,17 +143,15 @@ namespace jit {
144143

145144
Signature sig(ctx_, "Object");
146145
sig << "State";
147-
sig << "CallFrame";
148146
sig << "Object";
149147

150148
Value* call_args[] = {
151149
info_.state(),
152-
info_.previous(),
153150
kw_arg
154151
};
155152

156153
Value* keyword_val = sig.call("rbx_check_keyword",
157-
call_args, 3, "keyword_val", b());
154+
call_args, 2, "keyword_val", b());
158155

159156
b().CreateStore(keyword_val, keyword_object_);
160157
}
@@ -167,18 +164,16 @@ namespace jit {
167164
Signature sig(ctx_, "Object");
168165

169166
sig << "State";
170-
sig << "CallFrame";
171167
sig << "Arguments";
172168
sig << ctx_->Int32Ty;
173169

174170
Value* call_args[] = {
175171
info_.state(),
176-
info_.previous(),
177172
info_.args(),
178173
cint(machine_code_->total_args)
179174
};
180175

181-
Value* val = sig.call("rbx_arg_error", call_args, 4, "ret", b());
176+
Value* val = sig.call("rbx_arg_error", call_args, 3, "ret", b());
182177
return_value(val);
183178

184179
// Switch to using continuation

Diff for: ‎machine/llvm/jit_operations.hpp

+2-3
Original file line numberDiff line numberDiff line change
@@ -447,12 +447,11 @@ namespace rubinius {
447447
Signature sig(ctx_, "Object");
448448

449449
sig << "State";
450-
sig << "CallFrame";
451450
sig << "Object";
452451

453-
Value* call_args[] = { state_, call_frame_, stack_top() };
452+
Value* call_args[] = { state_, stack_top() };
454453

455-
CallInst* res = sig.call("rbx_check_frozen", call_args, 3, "", b());
454+
CallInst* res = sig.call("rbx_check_frozen", call_args, 2, "check_frozen", b());
456455
res->setOnlyReadsMemory();
457456
res->setDoesNotThrow();
458457

0 commit comments

Comments
 (0)
Please sign in to comment.