mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-07-27 23:28:42 +00:00
9e7d89d4d5
LLVM ComputeValueVTs recursively expands arrays and structs into one value type per scalar leaf. SelectionDAG call lowering allocates data structures proportional to this count, which makes very large values exhaust memory or crash LLVM. Count scalar leaves and use pointers for internal parameters and results when the count exceeds 1024. A result pointer is the first parameter, and aggregate parameters point to read-only memory. Exported function types are unchanged. Keep these SSA values in memory and copy them with memcpy when needed. Handle calls, interfaces, maps, channels, selects, defers, goroutines, phis, and multiple results. Update the expected compiler IR and re-enable the native compress/flate tests.
21 lines
417 B
Go
21 lines
417 B
Go
package main
|
|
|
|
type largeOptimizedValue [1025]byte
|
|
|
|
type mixedLargeOptimizedValue struct {
|
|
value [1025]byte
|
|
any any
|
|
}
|
|
|
|
func makeLargeOptimizedValue() largeOptimizedValue {
|
|
return largeOptimizedValue{}
|
|
}
|
|
|
|
func readLargeOptimizedValue(value largeOptimizedValue) byte {
|
|
return value[len(value)-1]
|
|
}
|
|
|
|
func readMixedLargeOptimizedValue(value mixedLargeOptimizedValue) byte {
|
|
return value.value[len(value.value)-1]
|
|
}
|