Commit f1c12342 authored by Kevin Modzelewski's avatar Kevin Modzelewski

Don't create Register decref-info entries

They might be ok if we allowed allocating callee-save registers, but
since we don't, they mean we are asking the unwinder to restore a
clobbered register.

This was happening in some places where we didn't call setupCall()
before calling a function.  This was previously ok since those cases would
always throw an exception and nothing would want the values of the
then-clobbered registers.
parent 4aaaa6f2
......@@ -1219,7 +1219,8 @@ std::vector<Location> Rewriter::getDecrefLocations() {
assert(indirectFor(l).offset % 8 == 0);
decref_infos.emplace_back(Location::Stack, indirectFor(l).offset / 8);
} else if (l.type == Location::Register) {
decref_infos.emplace_back(l);
// CSRs shouldn't be getting allocated, and we should only be calling this at a callsite:
RELEASE_ASSERT(0, "we shouldn't be trying to decref anything in a register");
} else
RELEASE_ASSERT(0, "not implemented");
}
......@@ -1864,6 +1865,7 @@ void Rewriter::_checkAndThrowCAPIException(RewriterVar* r, int64_t exc_val) {
else
assembler->cmp(var_reg, assembler::Immediate(exc_val));
_setupCall(false, RewriterVar::SmallVector(), RewriterVar::SmallVector());
{
assembler::ForwardJump jnz(*assembler, assembler::COND_NOT_ZERO);
assembler->mov(assembler::Immediate((void*)throwCAPIException), assembler::R11);
......
......@@ -998,6 +998,7 @@ void JitFragmentWriter::_emitGetLocal(RewriterVar* val_var, const char* name) {
assembler::Register var_reg = val_var->getInReg();
assembler->test(var_reg, var_reg);
_setupCall(false, RewriterVar::SmallVector(), RewriterVar::SmallVector());
{
assembler::ForwardJump jnz(*assembler, assembler::COND_NOT_ZERO);
assembler->mov(assembler::Immediate((uint64_t)name), assembler::RDI);
......
......@@ -522,6 +522,12 @@ void executeDecrefs(unw_cursor_t* cursor) {
if (l.type == Location::Stack) {
unw_word_t sp = get_cursor_sp(cursor);
b = ((Box**)sp)[l.stack_offset];
} else if (l.type == Location::Register) {
RELEASE_ASSERT(0, "untested");
// This branch should never get hit since we shouldn't generate Register locations,
// since we don't allow allocating callee-save registers.
// If we did, this code might be right:
// b = (Box*)get_cursor_reg(cursor, l.regnum);
} else {
RELEASE_ASSERT(0, "not implemented");
}
......
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