Skip to content

Commit 8b98771

Browse files
committed
Rename atomic.wake -> atomic.notify to align with WebAssembbly Spec.
This follows the recent JavaScript name change, and was decided in the Nov 13 CG meeting.
1 parent e9cf712 commit 8b98771

File tree

5 files changed

+12
-13
lines changed

5 files changed

+12
-13
lines changed

examples/atomic-wait-wake/assembly/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@ export function wait(mutexAddr: i32 = 0, value: int = 1): void {
2121
export function wake(mutexAddr: i32 = 0, value: int = 0, numAgents: i32 = 1): void {
2222
log_str('[WASM][' + itoa<i32>(id) + '] waking '+ itoa<i32>(numAgents) + ' agent(s)...');
2323
Atomic.store<int>(mutexAddr, value);
24-
var count = Atomic.wake<int>(mutexAddr, numAgents);
24+
var count = Atomic.notify<int>(mutexAddr, numAgents);
2525
log_str('[WASM][' + itoa<i32>(id) + '] waken ' + itoa<i32>(count) + ' agent(s)');
2626
}

src/builtins.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2012,7 +2012,7 @@ export function compileCall(
20122012
arg0, arg1, arg2, type.toNativeType()
20132013
);
20142014
}
2015-
case "Atomic.wake": { // wake<T!>(ptr: usize, count: u32): u32;
2015+
case "Atomic.notify": { // notify<T!>(ptr: usize, count: u32): u32;
20162016
let hasError = typeArguments == null;
20172017
if (operands.length != 2) {
20182018
compiler.error(
@@ -3269,8 +3269,8 @@ function deferASMCall(
32693269

32703270
case "i32.wait": return deferASM("Atomic.wait", compiler, Type.i32, operands, Type.u32, reportNode);
32713271
case "i64.wait": return deferASM("Atomic.wait", compiler, Type.i64, operands, Type.i64, reportNode);
3272-
case "i32.wake": return deferASM("Atomic.wake", compiler, Type.i32, operands, Type.u32, reportNode);
3273-
case "i64.wake": return deferASM("Atomic.wake", compiler, Type.i64, operands, Type.i64, reportNode);
3272+
case "i32.notify": return deferASM("Atomic.notify", compiler, Type.i32, operands, Type.u32, reportNode);
3273+
case "i64.notify": return deferASM("Atomic.notify", compiler, Type.i64, operands, Type.i64, reportNode);
32743274
}
32753275
return 0;
32763276
}

std/assembly/builtins.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export namespace Atomic {
5353
@builtin export declare function xchg<T>(ptr: usize, value: T, constantOffset?: usize): T;
5454
@builtin export declare function cmpxchg<T>(ptr: usize, expected:T, replacement: T, constantOffset?: usize): T;
5555
@builtin export declare function wait<T>(ptr: usize, expected:T, timeout:i64): i32;
56-
@builtin export declare function wake<T>(ptr: usize, count: u32): u32;
56+
@builtin export declare function notify<T>(ptr: usize, count: u32): u32;
5757
}
5858

5959
@builtin export declare function i8(value: void): i8;
@@ -103,7 +103,7 @@ export namespace i32 {
103103
@builtin export declare function store16(offset: usize, value: i32, constantOffset?: usize): void;
104104
@builtin export declare function store(offset: usize, value: i32, constantOffset?: usize): void;
105105
@builtin export declare function wait(ptr: usize, expected:i32, timeout:i64): i32;
106-
@builtin export declare function wake(ptr: usize, count:u32): u32;
106+
@builtin export declare function notify(ptr: usize, count:u32): u32;
107107

108108
namespace rmw8_u {
109109
@builtin export declare function add(offset: usize, value: i32, constantOffset?: usize): i32
@@ -171,7 +171,7 @@ export namespace i64 {
171171
@builtin export declare function store16(offset: usize, value: i64, constantOffset?: usize): void;
172172
@builtin export declare function store(offset: usize, value: i64, constantOffset?: usize): void;
173173
@builtin export declare function wait(ptr: usize, expected:i64, timeout:i64): i32;
174-
@builtin export declare function wake(ptr: usize, count:u32): u32;
174+
@builtin export declare function notify(ptr: usize, count:u32): u32;
175175

176176
namespace rmw8_u {
177177
@builtin export declare function add(offset: usize, value: i64, constantOffset?: usize): i64

std/assembly/index.d.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ declare namespace Atomic {
171171

172172
export function wait<T>(offset: usize, expected: T, timeout: i64): i32;
173173

174-
export function wake<T>(offset: usize, count: u32): u32;
174+
export function notify<T>(offset: usize, count: u32): u32;
175175
}
176176

177177
/** Converts any other numeric value to an 8-bit signed integer. */
@@ -245,7 +245,7 @@ declare namespace i32 {
245245
export function store(offset: usize, value: i32, constantOffset?: usize): void;
246246

247247
export function wait(offset: usize, expected: i32, timeout: i64): i32;
248-
export function wake(offset: usize, count: u32): u32;
248+
export function notify(offset: usize, count: u32): u32;
249249

250250
namespace rmw8_u {
251251
export function add(offset: usize, value: i32, constantOffset?: usize): i32
@@ -337,7 +337,7 @@ declare namespace i64 {
337337
export function store(offset: usize, value: i64, constantOffset?: usize): void;
338338

339339
export function wait(offset: usize, expected: i64, timeout: i64): i32;
340-
export function wake(offset: usize, count: u32): u32;
340+
export function notify(offset: usize, count: u32): u32;
341341

342342
namespace rmw8_u {
343343
export function add(offset: usize, value: i64, constantOffset?: usize): i64

std/portable/index.d.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,6 @@ declare namespace Atomic {
581581
export function cmpxchg<T>(ptr: usize, expected:T, replacement: T): T;
582582
export function compareExchange<T>(ptr: usize, expected:T, replacement: T): T;
583583

584-
// TODO: wait - wake postponed to next version
585-
// export function wait()
586-
// export function wake()
584+
export function wait(offset: usize, expected: i32, timeout: i32): i32;
585+
export function notify(offset: usize, count: u32): u32;
587586
}

0 commit comments

Comments
 (0)