mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 16:14:10 -08:00
C: fix exception handling semantics with longjmp
This commit is contained in:
parent
bb4315e486
commit
00fba54d7b
|
@ -16,18 +16,18 @@
|
||||||
jmp_buf* teavm_oldTryBuffer = teavm_shadowStack.header.jmpTarget; \
|
jmp_buf* teavm_oldTryBuffer = teavm_shadowStack.header.jmpTarget; \
|
||||||
teavm_shadowStack.header.jmpTarget = &teavm_tryBuffer; \
|
teavm_shadowStack.header.jmpTarget = &teavm_tryBuffer; \
|
||||||
int teavm_exceptionHandler = setjmp(teavm_tryBuffer); \
|
int teavm_exceptionHandler = setjmp(teavm_tryBuffer); \
|
||||||
switch (teavm_exceptionHandler) { \
|
if (teavm_exceptionHandler == 0) {
|
||||||
case 0: {
|
|
||||||
#define TEAVM_CATCH \
|
#define TEAVM_CATCH \
|
||||||
break; \
|
teavm_shadowStack.header.jmpTarget = teavm_oldTryBuffer; \
|
||||||
} \
|
} else { \
|
||||||
default: { \
|
teavm_shadowStack.header.jmpTarget = teavm_oldTryBuffer; \
|
||||||
longjmp(*teavm_oldTryBuffer, teavm_exceptionHandler); \
|
switch (teavm_exceptionHandler) {
|
||||||
break; \
|
|
||||||
}
|
|
||||||
#define TEAVM_END_TRY \
|
#define TEAVM_END_TRY \
|
||||||
|
default: \
|
||||||
|
longjmp(*teavm_oldTryBuffer, teavm_exceptionHandler); \
|
||||||
|
break; \
|
||||||
|
} \
|
||||||
} \
|
} \
|
||||||
teavm_shadowStack.header.jmpTarget = teavm_oldTryBuffer; \
|
|
||||||
} while (0);
|
} while (0);
|
||||||
|
|
||||||
#define TEAVM_JUMP_TO_FRAME(frame, id) \
|
#define TEAVM_JUMP_TO_FRAME(frame, id) \
|
||||||
|
|
Loading…
Reference in New Issue
Block a user