Skip to content
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

Lock-free guarantees #327

Merged
merged 2 commits into from
Sep 2, 2015
Merged

Lock-free guarantees #327

merged 2 commits into from
Sep 2, 2015

Conversation

jfbastien
Copy link
Member

Addresses #300.

@jfbastien jfbastien added this to the MVP milestone Sep 2, 2015
@@ -39,6 +39,9 @@ characteristics:
processes executing on the same machine.
* An execution environment which offers forward progress guarantees to all
threads of execution (even when executing in a non-parallel manner).
* Availability of lock-free atomic memory operations, when naturally aligned, for
8- 16- and 32-bit accesses. At a minimum this must include an atomic
compare-and-exchange operation (including load-linked/store-conditional).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"(including load-linked/store-conditional)" could be misconstrued as requiring ll/sc. How about "(load-linked/store-conditional is permitted)" or so?

@sunfishcode
Copy link
Member

lgtm, with nit above.

jfbastien added a commit that referenced this pull request Sep 2, 2015
@jfbastien jfbastien merged commit cc1d5dc into master Sep 2, 2015
@jfbastien jfbastien deleted the jfbastien-patch-1 branch September 2, 2015 23:38
sunfishcode added a commit that referenced this pull request Sep 5, 2015
According to clang, all common 64-bit CPUs, x86-64, arm64, mips64,
ppc64, sparcv9, and systemz (and bpf, if that counts) support a 64-bit
integer type as "lock free". In the spirit of #327, this is a
significant agreement among 64-bit architectures, but not 32-bit
architectures.

I propose we think about the >4GiB linear memory feature as belonging to
a distinct "architecture" called *wasm64*, when we need to distinguish
it from *wasm32*. This will allow us to say that wasm64 has up to 64-bit
lock-free integers, while wasm32 only has up to 32-bit lock-free
integers. If we add signal handling it could also let us say that wasm64
has up to 64-bit signal-atomic integers (sig_atomic_t). It would also
make it obvious what types to use around page_size and resize_memory.

Except where it makes sense to make them different, wasm32 and wasm64
would otherwise be kept identical. In particular, wasm32 would still have
64-bit integers.

The main negative consequence of this distinction is that wasm64 code
would not be supported on many popular 32-bit CPUs. This is unfortunate,
but it would already be the case that code using 64-bit pointers
wouldn't run as efficiently as code using 32-bit pointers on 32-bit
platforms.

There's a desire to leave open the possibility of having both 32-bit and
64-bit linear memory addressing within a single instance. wasm64 could
still be made to support mixing 64-bit indices and 32-bit indices if we
choose, for example. We could potentially even permit wasm32 libraries
to be linked into wasm64 applications (though there would of course be
ABI complications at the C/C++ level, non-C/C++ code might be able to
take advantage of this).
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.

2 participants