Commit 49eccf88 authored by Marius Wachtler's avatar Marius Wachtler

bjit: fix problems when setting bjit thresholds to 1

- we hit an assert when we ran out of scratch space
- 'classobjSetattr' returned void but all runtime funcs must return a Box* object.
- sneak in a change which removes a unused arg from '_setupCall'
parent ded39f2a
......@@ -819,7 +819,7 @@ RewriterVar* Rewriter::call(bool has_side_effects, void* func_addr, const Rewrit
return result;
}
void Rewriter::_setupCall(RewriterVar* result, bool has_side_effects, const RewriterVar::SmallVector& args,
void Rewriter::_setupCall(bool has_side_effects, const RewriterVar::SmallVector& args,
const RewriterVar::SmallVector& args_xmm) {
if (has_side_effects)
assert(done_guarding);
......@@ -972,7 +972,7 @@ void Rewriter::_call(RewriterVar* result, bool has_side_effects, void* func_addr
// RewriterVarUsage scratch = createNewVar(Location::any());
assembler::Register r = allocReg(assembler::R11);
_setupCall(result, has_side_effects, args, args_xmm);
_setupCall(has_side_effects, args, args_xmm);
for (RewriterVar* arg : args) {
arg->bumpUse();
......
......@@ -422,7 +422,7 @@ protected:
void _trap();
void _loadConst(RewriterVar* result, int64_t val);
void _setupCall(RewriterVar* result, bool has_side_effects, const RewriterVar::SmallVector& args,
void _setupCall(bool has_side_effects, const RewriterVar::SmallVector& args,
const RewriterVar::SmallVector& args_xmm);
void _call(RewriterVar* result, bool has_side_effects, void* func_addr, const RewriterVar::SmallVector& args,
const RewriterVar::SmallVector& args_xmm);
......
......@@ -803,9 +803,12 @@ void JitFragmentWriter::_emitPPCall(RewriterVar* result, void* func_addr, const
}
RewriterVar::SmallVector reg_args(args.begin(), args.begin() + 6);
assert(reg_args.size() == 6);
_setupCall(result, false, reg_args, RewriterVar::SmallVector());
_setupCall(false, reg_args, RewriterVar::SmallVector());
} else
_setupCall(result, false, args, RewriterVar::SmallVector());
_setupCall(false, args, RewriterVar::SmallVector());
if (failed)
return;
// make sure setupCall doesn't use R11
assert(vars_by_location.count(assembler::R11) == 0);
......
......@@ -203,7 +203,7 @@ static const char* set_bases(PyClassObject* c, PyObject* v) {
return "";
}
static void classobjSetattr(Box* _cls, Box* _attr, Box* _value) {
static Box* classobjSetattr(Box* _cls, Box* _attr, Box* _value) {
RELEASE_ASSERT(_cls->cls == classobj_cls, "");
BoxedClassobj* cls = static_cast<BoxedClassobj*>(_cls);
......@@ -216,10 +216,11 @@ static void classobjSetattr(Box* _cls, Box* _attr, Box* _value) {
raiseExcHelper(TypeError, "%s", error_str);
static BoxedString* bases_str = internStringImmortal("__bases__");
cls->setattr(bases_str, _value, NULL);
return;
return None;
}
PyObject_GenericSetAttr(cls, _attr, _value);
checkAndThrowCAPIException();
return None;
}
static int classobj_setattro(Box* cls, Box* attr, Box* value) noexcept {
......
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