Commit c579c976 authored by Kevin Modzelewski's avatar Kevin Modzelewski

Modify NONZERO irgen to allow patchpointing

parent 89c5f52b
......@@ -748,7 +748,7 @@ Value ASTInterpreter::visit_assert(AST_Assert* node) {
#ifndef NDEBUG
// Currently we only generate "assert 0" statements
Value v = visit_expr(node->test);
assert(v.n == 0);
assert(v.o->cls == int_cls && static_cast<BoxedInt*>(v.o)->n == 0);
#endif
assertFail(source_info->parent_module, node->msg ? visit_expr(node->msg).o : 0);
......
......@@ -547,10 +547,9 @@ private:
assert(node->args.size() == 1);
CompilerVariable* obj = evalExpr(node->args[0], unw_info);
ConcreteCompilerVariable* converted_obj = obj->makeConverted(emitter, obj->getBoxType());
obj->decvref(emitter);
llvm::Value* v = emitter.createCall(unw_info, g.funcs.nonzero, { converted_obj->getValue() });
ConcreteCompilerVariable* rtn = obj->nonzero(emitter, getOpInfoForNode(node, unw_info));
assert(rtn->getType() == BOOL);
llvm::Value* v = i1FromBool(emitter, rtn);
assert(v->getType() == g.i1);
return boolFromI1(emitter, v);
......
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