diff --git a/core/src/main/java/org/teavm/backend/c/intrinsic/ShadowStackIntrinsic.java b/core/src/main/java/org/teavm/backend/c/intrinsic/ShadowStackIntrinsic.java index 61c0bdab3..b9eddddb6 100644 --- a/core/src/main/java/org/teavm/backend/c/intrinsic/ShadowStackIntrinsic.java +++ b/core/src/main/java/org/teavm/backend/c/intrinsic/ShadowStackIntrinsic.java @@ -34,6 +34,8 @@ public class ShadowStackIntrinsic implements Intrinsic { case "registerCallSite": case "getExceptionHandlerId": case "setExceptionHandlerId": + case "setExceptionHandlerSkip": + case "setExceptionHandlerRestore": case "getStackTop": case "getNextStackFrame": case "getStackRootCount": @@ -69,6 +71,12 @@ public class ShadowStackIntrinsic implements Intrinsic { case "setExceptionHandlerId": context.writer().print("TEAVM_SET_EXCEPTION_HANDLER"); break; + case "setExceptionHandlerSkip": + context.writer().print("TEAVM_SET_EXCEPTION_HANDLER_SKIP"); + break; + case "setExceptionHandlerRestore": + context.writer().print("TEAVM_SET_EXCEPTION_HANDLER_RESTO"); + break; case "getStackTop": context.writer().print("teavm_stackTop"); return; diff --git a/core/src/main/resources/org/teavm/backend/c/stack.h b/core/src/main/resources/org/teavm/backend/c/stack.h index 21af0f24b..08f9c67b0 100644 --- a/core/src/main/resources/org/teavm/backend/c/stack.h +++ b/core/src/main/resources/org/teavm/backend/c/stack.h @@ -95,6 +95,8 @@ typedef struct TeaVM_StackFrame { #define TEAVM_WITH_CALL_SITE_ID(id, expr) (TEAVM_CALL_SITE(id), (expr)) #define TEAVM_EXCEPTION_HANDLER (teavm_shadowStack.header.callSiteId) #define TEAVM_SET_EXCEPTION_HANDLER(frame, id) (((TeaVM_StackFrame*) (frame))->callSiteId = (id)) +#define TEAVM_SET_EXCEPTION_HANDLER_SKIP(frame) (((TeaVM_StackFrame*) (frame))->callSiteId++) +#define TEAVM_SET_EXCEPTION_HANDLER_RESTORE(frame) (((TeaVM_StackFrame*) (frame))->callSiteId--) #define TEAVM_GET_NEXT_FRAME(frame) (((TeaVM_StackFrame*) (frame))->next) #define TEAVM_GET_CALL_SITE_ID(frame) (((TeaVM_StackFrame*) (frame))->callSiteId)