diff options
author | Ayke van Laethem <[email protected]> | 2022-06-20 14:56:55 +0200 |
---|---|---|
committer | Ron Evans <[email protected]> | 2022-06-24 11:10:24 +0200 |
commit | 1ceb63d14c69c013fb25d8ed09cbe45658ecf3ad (patch) | |
tree | 148e1e67a2af3b510c53c38da0d20426559e07db /testdata | |
parent | e1052f921c0d845fb6257d1347a97af4e4d8dfd9 (diff) | |
download | tinygo-1ceb63d14c69c013fb25d8ed09cbe45658ecf3ad.tar.gz tinygo-1ceb63d14c69c013fb25d8ed09cbe45658ecf3ad.zip |
compiler: really define runtime/volatile.* functions
This makes them available to deferred calls, among others.
Diffstat (limited to 'testdata')
-rw-r--r-- | testdata/atomic.go | 7 | ||||
-rw-r--r-- | testdata/atomic.txt | 1 |
2 files changed, 7 insertions, 1 deletions
diff --git a/testdata/atomic.go b/testdata/atomic.go index 2b9131c91..4d5ced301 100644 --- a/testdata/atomic.go +++ b/testdata/atomic.go @@ -3,6 +3,8 @@ package main import ( "sync/atomic" "unsafe" + + "runtime/volatile" ) func main() { @@ -82,7 +84,7 @@ func main() { testValue(int(3), int(-2)) testValue("", "foobar", "baz") - // Test atomic operations as deferred values. + // Test atomic and volatile operations as deferred values. testDefer() } @@ -99,8 +101,11 @@ func testValue(values ...interface{}) { func testDefer() { n1 := int32(5) + n2 := uint32(6) defer func() { println("deferred atomic add:", n1) + println("deferred volatile store:", n2) }() defer atomic.AddInt32(&n1, 3) + defer volatile.StoreUint32(&n2, 22) } diff --git a/testdata/atomic.txt b/testdata/atomic.txt index a03f292ce..7bcde9365 100644 --- a/testdata/atomic.txt +++ b/testdata/atomic.txt @@ -34,3 +34,4 @@ StoreUint64: 20 StoreUintptr: 20 StorePointer: true deferred atomic add: 8 +deferred volatile store: 22 |