Commit 5de266c3 authored by Kevin Modzelewski's avatar Kevin Modzelewski

Merge pull request #854 from undingen/spec

Fix and reenable type speculations
parents 0fc53b70 401ff2ff
......@@ -113,9 +113,6 @@ private:
assert(old_type);
assert(speculation != TypeAnalysis::NONE);
// TODO: reenable this
return old_type;
if (speculated_cls != NULL && speculated_cls->is_constant) {
ConcreteCompilerType* speculated_type = unboxedType(typeFromClass(speculated_cls));
if (VERBOSITY() >= 2) {
......
......@@ -1819,9 +1819,10 @@ Box* astInterpretFunctionEval(CLFunction* clfunc, Box* globals, Box* boxedLocals
return v ? v : None;
}
Box* astInterpretDeopt(CLFunction* clfunc, AST_expr* after_expr, AST_stmt* enclosing_stmt, Box* expr_val,
static Box* astInterpretDeoptInner(CLFunction* clfunc, AST_expr* after_expr, AST_stmt* enclosing_stmt, Box* expr_val,
FrameStackState frame_state) __attribute__((noinline));
static Box* astInterpretDeoptInner(CLFunction* clfunc, AST_expr* after_expr, AST_stmt* enclosing_stmt, Box* expr_val,
FrameStackState frame_state) {
RELEASE_ASSERT(0, "didn't check if this still works");
assert(clfunc);
assert(enclosing_stmt);
assert(frame_state.locals);
......@@ -1911,6 +1912,11 @@ Box* astInterpretDeopt(CLFunction* clfunc, AST_expr* after_expr, AST_stmt* enclo
return v ? v : None;
}
Box* astInterpretDeopt(CLFunction* clfunc, AST_expr* after_expr, AST_stmt* enclosing_stmt, Box* expr_val,
FrameStackState frame_state) {
return astInterpretDeoptInner(clfunc, after_expr, enclosing_stmt, expr_val, frame_state);
}
extern "C" void printExprHelper(Box* obj) {
Box* displayhook = PySys_GetObject("displayhook");
if (!displayhook)
......
......@@ -69,7 +69,7 @@ struct GlobalState {
llvm::Type* llvm_value_type, *llvm_value_type_ptr, *llvm_value_type_ptr_ptr;
llvm::Type* llvm_class_type, *llvm_class_type_ptr;
llvm::Type* llvm_opaque_type;
llvm::Type* llvm_boxedstring_type_ptr, *llvm_dict_type_ptr, *llvm_aststmt_type_ptr;
llvm::Type* llvm_boxedstring_type_ptr, *llvm_dict_type_ptr, *llvm_aststmt_type_ptr, *llvm_astexpr_type_ptr;
llvm::Type* llvm_frame_info_type;
llvm::Type* llvm_clfunction_type_ptr, *llvm_closure_type_ptr, *llvm_generator_type_ptr;
llvm::Type* llvm_module_type_ptr, *llvm_bool_type_ptr;
......
......@@ -604,7 +604,7 @@ private:
curblock = deopt_bb;
emitter.getBuilder()->SetInsertPoint(curblock);
llvm::Value* v = emitter.createCall2(UnwindInfo(current_statement, NULL), g.funcs.deopt,
embedRelocatablePtr(node, g.llvm_aststmt_type_ptr), node_value);
embedRelocatablePtr(node, g.llvm_astexpr_type_ptr), node_value);
emitter.getBuilder()->CreateRet(v);
curblock = success_bb;
......
......@@ -148,6 +148,10 @@ void initGlobalFuncs(GlobalState& g) {
assert(g.llvm_aststmt_type_ptr);
g.llvm_aststmt_type_ptr = g.llvm_aststmt_type_ptr->getPointerTo();
g.llvm_astexpr_type_ptr = g.stdlib_module->getTypeByName("class.pyston::AST_expr");
assert(g.llvm_astexpr_type_ptr);
g.llvm_astexpr_type_ptr = g.llvm_astexpr_type_ptr->getPointerTo();
// The LLVM vector type for the arguments that we pass to runtimeCall and related functions.
// It will be a pointer to a type named something like class.std::vector or
// class.std::vector.##. We can figure out exactly what it is by looking at the last
......
# skip-if: '-O' in EXTRA_JIT_ARGS
# expected: statfail
# skip-if: '-O' in EXTRA_JIT_ARGS or '-n' in EXTRA_JIT_ARGS
# statcheck: 4 <= noninit_count('num_deopt') < 50
# statcheck: 1 <= stats["num_osr_exits"] <= 2
......
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