mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-27 06:34:11 +00:00
[gamecode] Skip return ptr restore if depth changed
When calling a builtin, normally the return pointer needs to be restored, but if the builtin changes the call depth (usually by effecting "return foo()" as in support for objects, but possibly setjmp/longjmp when they are implemented), then the return pointer must not be restored. This gets vkgen past object allocation, but it dies when trying to send messages to super. This appears to be a compiler bug.
This commit is contained in:
parent
c5ae1ae13c
commit
cabb53e693
1 changed files with 4 additions and 1 deletions
|
@ -452,9 +452,12 @@ PR_CallFunction (progs_t *pr, pr_func_t fnum, pr_type_t *return_ptr)
|
|||
PR_GetString (pr, f->descriptor->name), f->func);
|
||||
}
|
||||
pr_type_t *saved_return = pr->pr_return;
|
||||
int builtin_depth = pr->pr_depth;
|
||||
pr->pr_return = return_ptr;
|
||||
f->func (pr);
|
||||
if (builtin_depth == pr->pr_depth) {
|
||||
pr->pr_return = saved_return;
|
||||
}
|
||||
return 0;
|
||||
} else {
|
||||
PR_EnterFunction (pr, f);
|
||||
|
|
Loading…
Reference in a new issue