Commit e5db59e7 authored by Kevin Modzelewski's avatar Kevin Modzelewski Committed by Kevin Modzelewski

Enable patching of invokes

With the LLVM patch, it seems like this works.
parent 18d68780
......@@ -152,21 +152,14 @@ public:
llvm::CallSite createPatchpoint(const PatchpointSetupInfo* pp, void* func_addr,
const std::vector<llvm::Value*>& args, ExcInfo exc_info) override {
if (exc_info.needsInvoke()) {
std::vector<llvm::Type*> arg_types;
for (auto v : args)
arg_types.push_back(v->getType());
return createCall(
exc_info, embedConstantPtr(func_addr, llvm::FunctionType::get(g.i64, arg_types, false)->getPointerTo()),
args);
}
int64_t pp_id = pp->getPatchpointId();
int pp_size = pp->totalSize();
assert(irstate->getEffortLevel() != EffortLevel::INTERPRETED);
std::vector<llvm::Value*> pp_args;
pp_args.push_back(getConstantInt(pp->getPatchpointId(), g.i64));
pp_args.push_back(getConstantInt(pp->totalSize(), g.i32));
pp_args.push_back(getConstantInt(pp_id, g.i64));
pp_args.push_back(getConstantInt(pp_size, g.i32));
pp_args.push_back(embedConstantPtr(func_addr, g.i8->getPointerTo()));
pp_args.push_back(getConstantInt(args.size(), g.i32));
......
......@@ -39,7 +39,7 @@ extern "C" double PyFloat_AsDouble(PyObject* o) {
template <typename T> static inline void raiseDivZeroExcIfZero(T var) {
if (var == 0) {
raiseExcHelper(ZeroDivisionError, "float divide by zero");
raiseExcHelper(ZeroDivisionError, "float division by zero");
}
}
......
def f2(i):
return 1.0 / (i - 5)
def f1():
# save some locals:
a, b, c, d, e, f, g = range(7)
for i in xrange(10):
try:
print i, f2(i)
except Exception, e:
print e
return a, b, c, d, e, f, g
print f1()
# expected: fail
# - locals not supported
def f():
total = 0
i = 1 or ''
while i < 200:
i = i + 1
j = 2
while j * j <= i:
if i % j == 0:
break
j = j + 1
print locals()
else:
total = total + i
print total
f()
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