mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
Merge branch 'master' into f7
This commit is contained in:
@@ -138,9 +138,9 @@ void gc_collect(void) {
|
||||
/* On the device, the stack is stored in reverse order, but it might not be
|
||||
* the case on a computer. We thus have to take the absolute value of the
|
||||
* addresses difference. */
|
||||
size_t stackLength;
|
||||
size_t stackLengthInByte;
|
||||
void ** scanStart;
|
||||
if ((uintptr_t)python_stack_top > (uintptr_t)®s) {
|
||||
if ((uintptr_t)python_stack_top > (uintptr_t)regs_ptr) {
|
||||
|
||||
/* To compute the stack length:
|
||||
* regs
|
||||
@@ -149,7 +149,7 @@ void gc_collect(void) {
|
||||
* ^®s ^python_stack_top
|
||||
* */
|
||||
|
||||
stackLength = ceil((float)((uintptr_t)python_stack_top - (uintptr_t)®s) / (float)sizeof(uintptr_t));
|
||||
stackLengthInByte = (uintptr_t)python_stack_top - (uintptr_t)regs_ptr;
|
||||
scanStart = regs_ptr;
|
||||
|
||||
} else {
|
||||
@@ -161,12 +161,13 @@ void gc_collect(void) {
|
||||
* ^python_stack_top ^®s
|
||||
* */
|
||||
|
||||
size_t sizeOfRegs = ceil(((float)sizeof(regs))/(float)sizeof(uintptr_t));
|
||||
stackLength = (size_t)ceil(((float)((uintptr_t)(®s) - (uintptr_t)python_stack_top)) / (float)sizeof(uintptr_t)) + sizeOfRegs;
|
||||
stackLengthInByte = (uintptr_t)regs_ptr - (uintptr_t)python_stack_top + sizeof(regs);
|
||||
scanStart = (void **)python_stack_top;
|
||||
|
||||
}
|
||||
gc_collect_root(scanStart, stackLength);
|
||||
/* Memory error detectors might find an error here as they might split regs
|
||||
* and stack memory zones. */
|
||||
gc_collect_root(scanStart, stackLengthInByte/sizeof(void *));
|
||||
|
||||
gc_collect_end();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user