static Value *emit_bounds_check(Value *i, Value *len, jl_codectx_t *ctx) { Value *im1 = builder.CreateSub(i, ConstantInt::get(T_size, 1)); Value *ok = builder.CreateICmpULT(im1, len); raise_exception_unless(ok, jlboundserr_var, ctx); return im1; }
static void null_pointer_check(Value *v, jl_codectx_t *ctx) { raise_exception_unless(builder.CreateICmpNE(v,V_null), jlundeferr_var, ctx); }
static void raise_exception_if(Value *cond, Value *exc, jl_codectx_t *ctx) { raise_exception_unless(builder.CreateXor(cond, ConstantInt::get(T_int1,-1)), exc, ctx); }
static void raise_exception_unless(Value *cond, GlobalVariable *exc, jl_codectx_t *ctx) { raise_exception_unless(cond, (Value*)builder.CreateLoad(exc, false), ctx); }
static void null_pointer_check(Value *v, jl_codectx_t *ctx) { raise_exception_unless(builder.CreateICmpNE(v,Constant::getNullValue(v->getType())), jlundeferr_var, ctx); }