[ion][python] Implement an architecture-dependant collect_registers.

setjmp is not guaranteed to collect all registers without modification
on all platforms.

This fixes the following bug: when the pointer of a newly allocated
object on the Python heap is stored in rpb registers on x86_64 arch, it
was not collected by the garbarge collector.
This commit is contained in:
Émilie Feral
2020-05-14 16:22:51 +02:00
committed by LeaNumworks
parent 5a32006dcd
commit 3f6647f3ae
13 changed files with 98 additions and 31 deletions

View File

@@ -17,6 +17,7 @@
#include <ion/unicode/utf8_helper.h>
#include <stdint.h>
#include <string.h>
#include <setjmp.h>
/* ION is not your regular library. It is a library you link against, but it
* will take care of configuring the whole environment for you. In POSIX terms,
@@ -48,6 +49,9 @@ void decompress(const uint8_t * src, uint8_t * dst, int srcSize, int dstSize);
// Tells whether the stack pointer is within acceptable bounds
bool stackSafe();
// Collect registers in a buffer and returns the stack pointer
uintptr_t collectRegisters(jmp_buf regs);
}
#endif