-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tcc: update tcc to latest version, fix stdatomic #20726
base: master
Are you sure you want to change the base?
Conversation
Wow, that will be very nice indeed! |
Thanks @kbkpbot! This is some great work you did. |
I've rebuilt thirdparty/tcc's thirdparty-linux-amd64 branch, so that it has |
I've pushed the branch to https://github.com/vlang/tccbin . |
As a bonus, with the new tcc build, the executable sizes are now significantly smaller 🥳, while the compile speed is ~ the same, or even slightly better: Before:
After:
|
16a356e
to
f1ce91b
Compare
Something interesting, after apply this PR, v self compile time become 8x slower..... ~/github/kbkpbot/v/thirdparty/stdatomic/nix$ time v self
V self compiling ...
V built successfully as executable "v".
real 0m1.169s
user 0m1.321s
sys 0m0.127s
After apply PR: ~/github/kbkpbot/v/thirdparty/stdatomic/nix$ time v self
V self compiling ...
V built successfully as executable "v".
real 0m9.105s
user 0m8.566s
sys 0m0.401s Sorry, I found that is because TCC compile fail, and try CC instead. |
Yes, exactly. When tcc fails, V falls back to gcc/clang. It's the same error as before:
|
For me it compiles cleanly:
|
@spytheman you added |
As the v/thirdparty/tcc/README.md said, "This is a prebuild tcc (git://repo.or.cz/tinycc.git), cut at commit:
806b3f9 from 2021-03-17
which is the last good commit found by bisecting, that does not cause vlib/sync/channel_close_test.v to wait indefinitely ."
It seems that the atomic_load/atomic_store of TCC do not include memory barriers. (Windows version have MemoryBarrier() )
By adding
atomic_thread_fence(memory_order_acquire)
/atomic_thread_fence(memory_order_release)
before/afteratomic_load
/atomic_store
, it can be solved.And, latest TCC stdatomic.h already support a
generic
interface like gcc/clang.NOTE, to use this PR, tcc should update to latest version.