mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-05 03:27:48 +00:00
compiler,runtime: check for channel size limits
This patch is a combination of two related changes:
1. The compiler now allows other types than `int` when specifying the
size of a channel in a make(chan ..., size) call.
2. The compiler now checks for maximum allowed channel sizes. Such
checks are trivially optimized out in the vast majority of cases as
channel sizes are usually constant.
I discovered this issue when trying out channels on AVR.
This commit is contained in:
committed by
Ron Evans
parent
1a7369af6e
commit
79dae62c78
@@ -50,6 +50,11 @@ func slicePanic() {
|
||||
runtimePanic("slice out of range")
|
||||
}
|
||||
|
||||
// Panic when trying to create a new channel that is too big.
|
||||
func chanMakePanic() {
|
||||
runtimePanic("new channel is too big")
|
||||
}
|
||||
|
||||
func blockingPanic() {
|
||||
runtimePanic("trying to do blocking operation in exported function")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user