Commit 4e03cb5d authored by Kevin Modzelewski's avatar Kevin Modzelewski

Merge pull request #595 from undingen/generator_gc2

Skip initializing exc fields inside JITed code
parents d17137f9 ba82f050
...@@ -179,16 +179,11 @@ llvm::Value* IRGenState::getFrameInfoVar() { ...@@ -179,16 +179,11 @@ llvm::Value* IRGenState::getFrameInfoVar() {
// The "normal" case // The "normal" case
// frame_info.exc.type = NULL // frame_info.exc.type = NULL
// frame_info.exc.value = NULL
// frame_info.exc.traceback = NULL
llvm::Constant* null_value = getNullPtr(g.llvm_value_type_ptr); llvm::Constant* null_value = getNullPtr(g.llvm_value_type_ptr);
llvm::Value* exc_info = getExcinfoGep(builder, al); llvm::Value* exc_info = getExcinfoGep(builder, al);
builder.CreateStore( builder.CreateStore(
null_value, builder.CreateConstInBoundsGEP2_32(exc_info, 0, offsetof(ExcInfo, type) / sizeof(Box*))); null_value, builder.CreateConstInBoundsGEP2_32(exc_info, 0, offsetof(ExcInfo, type) / sizeof(Box*)));
builder.CreateStore(
null_value, builder.CreateConstInBoundsGEP2_32(exc_info, 0, offsetof(ExcInfo, value) / sizeof(Box*)));
builder.CreateStore(null_value, builder.CreateConstInBoundsGEP2_32(exc_info, 0, offsetof(ExcInfo, traceback)
/ sizeof(Box*)));
// frame_info.boxedLocals = NULL // frame_info.boxedLocals = NULL
llvm::Value* boxed_locals_gep = getBoxedLocalsGep(builder, al); llvm::Value* boxed_locals_gep = getBoxedLocalsGep(builder, al);
builder.CreateStore(getNullPtr(g.llvm_value_type_ptr), boxed_locals_gep); builder.CreateStore(getNullPtr(g.llvm_value_type_ptr), boxed_locals_gep);
......
...@@ -179,6 +179,13 @@ extern "C" Box* deopt(AST_expr* expr, Box* value) { ...@@ -179,6 +179,13 @@ extern "C" Box* deopt(AST_expr* expr, Box* value) {
// Should we only do this selectively? // Should we only do this selectively?
execution_point.cf->speculationFailed(); execution_point.cf->speculationFailed();
// Except of exc.type we skip initializing the exc fields inside the JITed code path (small perf improvement) that's
// why we have todo it now if we didn't set an exception (which sets all fields)
if (frame_state.frame_info->exc.type == NULL) {
frame_state.frame_info->exc.traceback = NULL;
frame_state.frame_info->exc.value = NULL;
}
return astInterpretFrom(execution_point.cf, expr, execution_point.current_stmt, value, frame_state); return astInterpretFrom(execution_point.cf, expr, execution_point.current_stmt, value, frame_state);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment