mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-08 21:13:39 +00:00
compiler: fix escapes due to nil checks
Some tests get bigger, most get smaller. However, all tested driver examples get smaller in size showing that this is a good change in the real world.
This commit is contained in:
committed by
Ron Evans
parent
cd8471acae
commit
d653088cbe
@@ -27,6 +27,14 @@ func _recover() interface{} {
|
||||
return nil
|
||||
}
|
||||
|
||||
// See emitNilCheck in compiler/asserts.go.
|
||||
// This function is a dummy function that has its first and only parameter
|
||||
// marked 'nocapture' to work around a limitation in LLVM: a regular pointer
|
||||
// comparison captures the pointer.
|
||||
func isnil(ptr *uint8) bool {
|
||||
return ptr == nil
|
||||
}
|
||||
|
||||
// Panic when trying to dereference a nil pointer.
|
||||
func nilpanic() {
|
||||
runtimePanic("nil pointer dereference")
|
||||
|
||||
Reference in New Issue
Block a user