Skip to content

Conversation

@aykevl
Copy link
Member

@aykevl aykevl commented Apr 23, 2019

Implement functions in package sync/atomic using LLVM intrinsics.
Does not work yet:

  • the compiler emits unresolved symbols like __sync_fetch_and_add_8 on Cortex-M, we need to implement something for that
  • atomic operations do not seem to be implemented in the WebAssembly backend: it crashes with a nasty LIBCLANG FATAL ERROR: Cannot select error
  • some functions need to be added to go-llvm.

I am making the PR anyway for future reference.

@aykevl
Copy link
Member Author

aykevl commented Apr 23, 2019

Also see: https://reviews.llvm.org/D61034

@aykevl
Copy link
Member Author

aykevl commented Apr 24, 2019

A patch that implements some atomic builtins: https://reviews.llvm.org/D61052

With the right patch to go-llvm, tests pass locally. I'll wait and see what happens with the upstream patches.

@aykevl
Copy link
Member Author

aykevl commented Apr 29, 2019

TODO: remove src/runtime/atomic.go.

@deadprogram
Copy link
Member

Seems like the upstream patch to LLVM was tagged "Abandoned".

Any chance of getting this feature anyhow?

@aykevl
Copy link
Member Author

aykevl commented Jul 1, 2019

Yes, this should be implemented on the TinyGo side because compiler-rt cannot know what to do in all cases. For example, none of the Cortex-M devices support 64-bit atomic stores so it should disable interrupts, but interrupts cannot be disabled in all cases because it can affect interrupt latency.

@aykevl
Copy link
Member Author

aykevl commented May 16, 2020

Replaced by #1113.

@aykevl aykevl closed this May 16, 2020
@aykevl aykevl deleted the atomic branch May 16, 2020 00:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants