mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-13 07:23:39 +00:00
esp32: remove dead code and fix GC root scanning
Remove unused cpuIntUsed and cpuIntToPeripheral variables from interrupt_esp32.go because these were declared but never read. Fix _globals_end in the linker script to cover .data in addition to .bss and .wifi_bss. Previously the GC scan range ended at _wifi_bss_end, missing any heap pointers stored in initialized globals (.data section). Extend to _edata so the conservative collector sees all global root pointers. Signed-off-by: deadprogram <ron@hybridgroup.com>
This commit is contained in:
@@ -53,13 +53,6 @@ const (
|
|||||||
lastCPUInt = 30
|
lastCPUInt = 30
|
||||||
)
|
)
|
||||||
|
|
||||||
// cpuIntUsed tracks which CPU interrupt lines have been allocated.
|
|
||||||
var cpuIntUsed [32]bool
|
|
||||||
|
|
||||||
// cpuIntToPeripheral maps CPU interrupt number → peripheral IRQ source,
|
|
||||||
// so that handleInterrupt can dispatch to the correct Go handler.
|
|
||||||
var cpuIntToPeripheral [32]int
|
|
||||||
|
|
||||||
// inInterrupt is set while we're inside the interrupt handler so that
|
// inInterrupt is set while we're inside the interrupt handler so that
|
||||||
// interrupt.In() returns the correct value.
|
// interrupt.In() returns the correct value.
|
||||||
var inInterrupt bool
|
var inInterrupt bool
|
||||||
@@ -75,9 +68,6 @@ func (i Interrupt) Enable() error {
|
|||||||
return errInterruptRange
|
return errInterruptRange
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mark as used.
|
|
||||||
cpuIntUsed[i.num] = true
|
|
||||||
|
|
||||||
// Read current INTENABLE, set the bit for this CPU interrupt.
|
// Read current INTENABLE, set the bit for this CPU interrupt.
|
||||||
cur := readINTENABLE()
|
cur := readINTENABLE()
|
||||||
cur |= 1 << uint(i.num)
|
cur |= 1 << uint(i.num)
|
||||||
|
|||||||
+1
-1
@@ -185,7 +185,7 @@ SECTIONS
|
|||||||
|
|
||||||
/* For the garbage collector. */
|
/* For the garbage collector. */
|
||||||
_globals_start = _sbss;
|
_globals_start = _sbss;
|
||||||
_globals_end = _wifi_bss_end;
|
_globals_end = _edata;
|
||||||
_heap_start = _edata;
|
_heap_start = _edata;
|
||||||
/* Go GC heap = the rest of SRAM2 above .data (~113KB), a single safe contiguous
|
/* Go GC heap = the rest of SRAM2 above .data (~113KB), a single safe contiguous
|
||||||
* block. The WiFi arena lives in DRAM1 (SRAM1 pool 7/6), so its ~64KB does not
|
* block. The WiFi arena lives in DRAM1 (SRAM1 pool 7/6), so its ~64KB does not
|
||||||
|
|||||||
Reference in New Issue
Block a user