adobe-flash / crossbridge

Welcome to visit the homepage!
http://www.crossbridge.io
542 stars 197 forks source link

Are there atomics support in crossbridge? #23

Closed vladkolotvin closed 11 years ago

vladkolotvin commented 11 years ago

Are there atomics support in crossbridge? For example GCC's built-in function "__sync_val_compare_and_swap"?

mbolt35 commented 11 years ago

Yes, support for the GNU atomic built-ins is "kind of" there. After I read this page: Multithreaded C Programming with the Adobe Flash C Compiler, I assumed that support was included for all of the built-ins mentioned here: Atomic Built-Ins

However, after some testing, __sync_val_compare_and_swap currently only supports 32-bit values. So, for example, __sync_bool_compare_and_swap will give you a nice error message:

"FlasCC does not support CAS on a non-32bit values..."

Other than the compare and swaps, all of the __sync_fetch_and_<action> and __sync_<action>_and_fetch implementations seem to be implemented and working correctly. Hope this helps.

cbakgly commented 11 years ago

Correct. Because flash vm is 32bit only. Besides check out posix/libcHack.cpp for atomic ops.

Sent Via Apple Glass

ÔÚ 2013-9-7£¬7:49£¬Matt Bolt notifications@github.com дµÀ£º

Yes, support for the GNU atomic built-ins is "kind of" there. After I read this page: Multithreaded C Programming with the Adobe Flash C Compiler, I assumed that support was included for all of the built-ins mentioned here: Atomic Built-Ins

However, after some testing, sync_val_compare_and_swap currently only supports 32-bit values. So, for example, sync_bool_compare_and_swap will give you a nice error message:

"FlasCC does not support CAS on a non-32bit values..." Other than the compare and swaps, all of the __sync_fetchand and _sync_and_fetch implementations seem to be implemented and working correctly. Hope this helps.

¡ª Reply to this email directly or view it on GitHub.