summaryrefslogtreecommitdiff
path: root/test/threads.asm.js
blob: bedeb7a37336627f6e2b39edab66efa6684b1a80 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
Module["asm"] =  (function(global, env, buffer) {
  'use asm';


  var HEAP8 = new global.Int8Array(buffer);
  var HEAP16 = new global.Int16Array(buffer);
  var HEAP32 = new global.Int32Array(buffer);
  var HEAPU8 = new global.Uint8Array(buffer);
  var HEAPU16 = new global.Uint16Array(buffer);
  var HEAPU32 = new global.Uint32Array(buffer);
  var HEAPF32 = new global.Float32Array(buffer);
  var HEAPF64 = new global.Float64Array(buffer);

  var DYNAMICTOP_PTR=env.DYNAMICTOP_PTR|0;
  var tempDoublePtr=env.tempDoublePtr|0;
  var ABORT=env.ABORT|0;
  var STACKTOP=env.STACKTOP|0;
  var STACK_MAX=env.STACK_MAX|0;

  var __THREW__ = 0;
  var threwValue = 0;
  var setjmpId = 0;
  var undef = 0;
  var nan = global.NaN, inf = global.Infinity;
  var tempInt = 0, tempBigInt = 0, tempBigIntS = 0, tempValue = 0, tempDouble = 0.0;
  var tempRet0 = 0;

  var __pthread_ptr = 0;
  var __pthread_is_main_runtime_thread = 0;
  var __pthread_is_main_browser_thread = 0;

  var Math_floor=global.Math.floor;
  var Math_abs=global.Math.abs;
  var Math_sqrt=global.Math.sqrt;
  var Math_pow=global.Math.pow;
  var Math_cos=global.Math.cos;
  var Math_sin=global.Math.sin;
  var Math_tan=global.Math.tan;
  var Math_acos=global.Math.acos;
  var Math_asin=global.Math.asin;
  var Math_atan=global.Math.atan;
  var Math_atan2=global.Math.atan2;
  var Math_exp=global.Math.exp;
  var Math_log=global.Math.log;
  var Math_ceil=global.Math.ceil;
  var Math_imul=global.Math.imul;
  var Math_min=global.Math.min;
  var Math_max=global.Math.max;
  var Math_clz32=global.Math.clz32;
  var Math_fround=global.Math.fround;
  var abort=env.abort;
  var assert=env.assert;
  var enlargeMemory=env.enlargeMemory;
  var getTotalMemory=env.getTotalMemory;
  var abortOnCannotGrowMemory=env.abortOnCannotGrowMemory;
  var abortStackOverflow=env.abortStackOverflow;
  var nullFunc_iiii=env.nullFunc_iiii;
  var nullFunc_i=env.nullFunc_i;
  var nullFunc_vi=env.nullFunc_vi;
  var nullFunc_vii=env.nullFunc_vii;
  var nullFunc_ii=env.nullFunc_ii;
  var nullFunc_viii=env.nullFunc_viii;
  var nullFunc_v=env.nullFunc_v;
  var nullFunc_iii=env.nullFunc_iii;
  var invoke_iiii=env.invoke_iiii;
  var invoke_i=env.invoke_i;
  var invoke_vi=env.invoke_vi;
  var invoke_vii=env.invoke_vii;
  var invoke_ii=env.invoke_ii;
  var invoke_viii=env.invoke_viii;
  var invoke_v=env.invoke_v;
  var invoke_iii=env.invoke_iii;
  var __spawn_thread=env.__spawn_thread;
  var _putenv=env._putenv;
  var _emscripten_get_now_is_monotonic=env._emscripten_get_now_is_monotonic;
  var _fpathconf=env._fpathconf;
  var ___unlock=env.___unlock;
  var _emscripten_syscall=env._emscripten_syscall;
  var ___assert_fail=env.___assert_fail;
  var _utimes=env._utimes;
  var ___buildEnvironment=env.___buildEnvironment;
  var _emscripten_asm_const_i=env._emscripten_asm_const_i;
  var _clock_gettime=env._clock_gettime;
  var _emscripten_futex_wait=env._emscripten_futex_wait;
  var _tzset=env._tzset;
  var ___setErrNo=env.___setErrNo;
  var _emscripten_set_current_thread_status_js=env._emscripten_set_current_thread_status_js;
  var _pthread_getschedparam=env._pthread_getschedparam;
  var _clearenv=env._clearenv;
  var _emscripten_futex_wake=env._emscripten_futex_wake;
  var _sysconf=env._sysconf;
  var _utime=env._utime;
  var ___call_main=env.___call_main;
  var _emscripten_memcpy_big=env._emscripten_memcpy_big;
  var _confstr=env._confstr;
  var _getenv=env._getenv;
  var ___syscall54=env.___syscall54;
  var _emscripten_has_threading_support=env._emscripten_has_threading_support;
  var _pthread_create=env._pthread_create;
  var _emscripten_get_now=env._emscripten_get_now;
  var _chroot=env._chroot;
  var ___lock=env.___lock;
  var ___syscall6=env.___syscall6;
  var _unsetenv=env._unsetenv;
  var ___clock_gettime=env.___clock_gettime;
  var _gettimeofday=env._gettimeofday;
  var _atexit=env._atexit;
  var ___syscall140=env.___syscall140;
  var _emscripten_set_thread_name_js=env._emscripten_set_thread_name_js;
  var _setenv=env._setenv;
  var ___syscall146=env.___syscall146;
  var _emscripten_conditional_set_current_thread_status_js=env._emscripten_conditional_set_current_thread_status_js;
  var Atomics_load=global.Atomics.load;
  var Atomics_store=global.Atomics.store;
  var Atomics_exchange=global.Atomics.exchange;
  var Atomics_compareExchange=global.Atomics.compareExchange;
  var Atomics_add=global.Atomics.add;
  var Atomics_sub=global.Atomics.sub;
  var Atomics_and=global.Atomics.and;
  var Atomics_or=global.Atomics.or;
  var Atomics_xor=global.Atomics.xor;
  var tempFloat = Math_fround(0);
  const f0 = Math_fround(0);

  function test() {
   var $temp = 0;
   $temp = (Atomics_load(HEAP32, 1229)|0);
   $temp = (Atomics_load(HEAPU16, 1229)|0);
   $temp = (Atomics_store(HEAP32, $temp>>2, 0)|0);
   $temp = (Atomics_exchange(HEAP32, $temp>>2, 1)|0);
   $temp = (Atomics_compareExchange(HEAP32, $temp>>2, 1, 2)|0);
   $temp = (Atomics_add(HEAP32, $temp>>2, 0)|0);
   $temp = (Atomics_sub(HEAP32, $temp>>2, 0)|0);
   $temp = (Atomics_and(HEAP32, $temp>>2, 0)|0);
   $temp = (Atomics_or(HEAP32, $temp>>2, 0)|0);
   $temp = (Atomics_xor(HEAP32, $temp>>2, 0)|0);
   $temp = (Atomics_xor(HEAPU32, 1024, 0)|0);
   $temp = (Atomics_xor(HEAP16, 1024, 0)|0);
   $temp = (Atomics_xor(HEAPU8, 1024, 0)|0);
   // corner cases
   $temp = (Atomics_compareExchange(HEAP8, $temp | 0, 1, 2)|0);
   $temp = (Atomics_compareExchange(HEAP8, $temp >> 2, 1, 2)|0);
  }

  return { test: test };
})
;