/moarvm.diff Secret
Created
September 15, 2017 11:57
Star
You must be signed in to star a gist
more precise error for getstaticcode (and others)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/src/core/interp.c b/src/core/interp.c | |
| index e019a53..c31691c 100644 | |
| --- a/src/core/interp.c | |
| +++ b/src/core/interp.c | |
| @@ -2900,7 +2900,7 @@ void MVM_interp_run(MVMThreadContext *tc, void (*initial_invoke)(MVMThreadContex | |
| MVMObject * const cr = GET_REG(cur_op, 2).o; | |
| MVMCode *ncr; | |
| if (REPR(cr)->ID != MVM_REPR_ID_MVMCode) | |
| - MVM_exception_throw_adhoc(tc, "freshcoderef requires a coderef"); | |
| + MVM_exception_throw_adhoc(tc, "freshcoderef requires a static coderef but got %s (%s)", REPR(cr)->name, STABLE(cr)->debug_name); | |
| ncr = (MVMCode *)(GET_REG(cur_op, 0).o = MVM_repr_clone(tc, cr)); | |
| MVMROOT(tc, ncr, { | |
| MVMStaticFrame *nsf; | |
| @@ -2917,7 +2917,7 @@ void MVM_interp_run(MVMThreadContext *tc, void (*initial_invoke)(MVMThreadContex | |
| OP(markcodestatic): { | |
| MVMObject * const cr = GET_REG(cur_op, 0).o; | |
| if (REPR(cr)->ID != MVM_REPR_ID_MVMCode) | |
| - MVM_exception_throw_adhoc(tc, "markcodestatic requires a coderef"); | |
| + MVM_exception_throw_adhoc(tc, "markcodestatic requires a static coderef but got %s (%s)", REPR(cr)->name, STABLE(cr)->debug_name); | |
| ((MVMCode *)cr)->body.is_static = 1; | |
| cur_op += 2; | |
| goto NEXT; | |
| @@ -2925,7 +2925,7 @@ void MVM_interp_run(MVMThreadContext *tc, void (*initial_invoke)(MVMThreadContex | |
| OP(markcodestub): { | |
| MVMObject * const cr = GET_REG(cur_op, 0).o; | |
| if (REPR(cr)->ID != MVM_REPR_ID_MVMCode) | |
| - MVM_exception_throw_adhoc(tc, "markcodestub requires a coderef"); | |
| + MVM_exception_throw_adhoc(tc, "markcodestub requires a static coderef but got %s (%s)", REPR(cr)->name, STABLE(cr)->debug_name); | |
| ((MVMCode *)cr)->body.is_compiler_stub = 1; | |
| cur_op += 2; | |
| goto NEXT; | |
| @@ -2933,7 +2933,7 @@ void MVM_interp_run(MVMThreadContext *tc, void (*initial_invoke)(MVMThreadContex | |
| OP(getstaticcode): { | |
| MVMObject * const cr = GET_REG(cur_op, 2).o; | |
| if (REPR(cr)->ID != MVM_REPR_ID_MVMCode) | |
| - MVM_exception_throw_adhoc(tc, "getstaticcode requires a static coderef"); | |
| + MVM_exception_throw_adhoc(tc, "getstaticcode requires a static coderef but got %s (%s)", REPR(cr)->name, STABLE(cr)->debug_name); | |
| GET_REG(cur_op, 0).o = (MVMObject *)((MVMCode *)cr)->body.sf->body.static_code; | |
| cur_op += 4; | |
| goto NEXT; | |
| @@ -2941,7 +2941,7 @@ void MVM_interp_run(MVMThreadContext *tc, void (*initial_invoke)(MVMThreadContex | |
| OP(getcodecuid): { | |
| MVMObject * const cr = GET_REG(cur_op, 2).o; | |
| if (REPR(cr)->ID != MVM_REPR_ID_MVMCode || !IS_CONCRETE(cr)) | |
| - MVM_exception_throw_adhoc(tc, "getcodecuid requires a static coderef"); | |
| + MVM_exception_throw_adhoc(tc, "getcodecuid requires a static coderef but got %s (%s)", REPR(cr)->name, STABLE(cr)->debug_name); | |
| GET_REG(cur_op, 0).s = ((MVMCode *)cr)->body.sf->body.cuuid; | |
| cur_op += 4; | |
| goto NEXT; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment