1.1 --- a/sourcepawn/jit/interpreter.cpp Sat May 10 22:21:42 2014 -0400
1.2 +++ b/sourcepawn/jit/interpreter.cpp Sun May 11 14:36:32 2014 -0700
1.3 @@ -167,6 +167,29 @@
1.4 return result;
1.5 }
1.6
1.7 +cell_t
1.8 +BoundNativeCallback(sp_context_t *ctx, SPVM_NATIVE_FUNC pfn, cell_t *params)
1.9 +{
1.10 + cell_t save_sp = ctx->sp;
1.11 + cell_t save_hp = ctx->hp;
1.12 +
1.13 + cell_t result = pfn(ctx->basecx, params);
1.14 +
1.15 + if (ctx->n_err != SP_ERROR_NONE)
1.16 + return result;
1.17 +
1.18 + if (save_sp != ctx->sp) {
1.19 + ctx->n_err = SP_ERROR_STACKLEAK;
1.20 + return result;
1.21 + }
1.22 + if (save_hp != ctx->hp) {
1.23 + ctx->n_err = SP_ERROR_HEAPLEAK;
1.24 + return result;
1.25 + }
1.26 +
1.27 + return result;
1.28 +}
1.29 +
1.30 static inline bool
1.31 GenerateArray(BaseRuntime *rt, sp_context_t *ctx, cell_t dims, cell_t *stk, bool autozero)
1.32 {