Skip to content

Commit 198a20c

Browse files
committed
build: update compiler flags and export resolution
1 parent 85a6c6a commit 198a20c

File tree

5 files changed

+55
-62
lines changed

5 files changed

+55
-62
lines changed

lib/node_modules/@stdlib/blas/base/srot-wasm/lib/binary.browser.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ var base64ToUint8Array = require( '@stdlib/string/base/base64-to-uint8array' );
2525

2626
// MAIN //
2727

28-
var wasm = base64ToUint8Array( 'AGFzbQEAAAAADwhkeWxpbmsuMAEEAAAAAAEaA2AAAGAHf39/f399fQBgCX9/f39/f399fQACDwEDZW52Bm1lbW9yeQIAAAMEAwABAgdKBBFfX3dhc21fY2FsbF9jdG9ycwAAGF9fd2FzbV9hcHBseV9kYXRhX3JlbG9jcwAABmNfc3JvdAABDmNfc3JvdF9uZGFycmF5AAIKqwEDAwABCz8BAn4gACABIAIgAqwiB0IBIACsIgh9fkIAIAdCAFcbpyADIAQgBKwiB0IBIAh9fkIAIAdCAFcbpyAFIAYQAgtlAgJ/An0gAEEASgRAA0AgBCAGQQJ0aiIJIAcgCSoCACILlCAIIAEgA0ECdGoiCSoCACIMlJM4AgAgCSAHIAyUIAggC5SSOAIAIAUgBmohBiACIANqIQMgCkEBaiIKIABHDQALCws=' );
28+
var wasm = base64ToUint8Array( 'AGFzbQEAAAAADwhkeWxpbmsuMAEEAAAAAAEaA2AAAGAHf39/f399fQBgCX9/f39/f399fQACDwEDZW52Bm1lbW9yeQIAAAMEAwABAgdKBBFfX3dhc21fY2FsbF9jdG9ycwAAGF9fd2FzbV9hcHBseV9kYXRhX3JlbG9jcwAABmNfc3JvdAABDmNfc3JvdF9uZGFycmF5AAIKpAEDAwABCzEAIAAgASACQQEgAGsiACACbEEAIAJBAEwbIAMgBCAAIARsQQAgBEEATBsgBSAGEAILbAICfwJ9AkAgAEEATA0AA0AgACAJRg0BIAQgBkECdGoiCiAHIAoqAgAiC5QgCCABIANBAnRqIgoqAgAiDJSTOAIAIAogByAMlCAIIAuUkjgCACAJQQFqIQkgBSAGaiEGIAIgA2ohAwwACwALCw==' );
2929

3030

3131
// EXPORTS //

lib/node_modules/@stdlib/blas/base/srot-wasm/src/Makefile

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,26 +80,37 @@ else
8080
NODEJS := node
8181
endif
8282

83+
# Define the integer size:
84+
ifdef CBLAS_INT
85+
INT_TYPE := $(CBLAS_INT)
86+
else
87+
INT_TYPE := int32_t
88+
endif
89+
8390
# Define the command-line options when compiling C files:
8491
CFLAGS ?= \
8592
-std=c99 \
8693
-O3 \
94+
-flto \
8795
-Wall \
8896
-pedantic \
89-
-D CBLAS_INT=int32_t
97+
-D CBLAS_INT=$(INT_TYPE)
9098

9199
# Define the command-line options when compiling C files to WebAssembly and asm.js:
92100
EMCCFLAGS ?= $(CFLAGS)
93101

94102
# Define shared `emcc` flags:
95103
EMCC_SHARED_FLAGS := \
104+
-Oz \
105+
-fwasm-exceptions \
106+
-s SUPPORT_LONGJMP=1 \
96107
-s SIDE_MODULE=2 \
97-
-s WASM_BIGINT=0 \
98-
-s EXPORTED_FUNCTIONS="['_c_srot','_c_srot_ndarray']"
108+
-s EXPORTED_FUNCTIONS="$(shell cat exports.json | tr -d ' \t\n' | sed s/\"/\'/g)"
99109

100110
# Define WebAssembly `emcc` flags:
101111
EMCC_WASM_FLAGS := $(EMCC_SHARED_FLAGS) \
102-
-s WASM=1
112+
-s WASM=1 \
113+
-s WASM_BIGINT=0
103114

104115
# List of includes (e.g., `-I /foo/bar -I /beep/boop/include`):
105116
INCLUDE ?=
@@ -217,7 +228,7 @@ $(browser_js_targets): $(wasm_targets)
217228
# make clean-wasm
218229
#/
219230
clean-wasm:
220-
$(QUIET) -rm -f *.wasm *.wat *.wasm.js
231+
$(QUIET) -rm -f *.wasm *.wat *.wasm.js $(browser_js_targets)
221232

222233
.PHONY: clean-wasm
223234

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[
2+
"_c_srot",
3+
"_c_srot_ndarray"
4+
]
-7 Bytes
Binary file not shown.

lib/node_modules/@stdlib/blas/base/srot-wasm/src/main.wat

Lines changed: 34 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,3 @@
1-
;; @license Apache-2.0
2-
;;
3-
;; Copyright (c) 2024 The Stdlib Authors.
4-
;;
5-
;; Licensed under the Apache License, Version 2.0 (the "License");
6-
;; you may not use this file except in compliance with the License.
7-
;; You may obtain a copy of the License at
8-
;;
9-
;; http://www.apache.org/licenses/LICENSE-2.0
10-
;;
11-
;; Unless required by applicable law or agreed to in writing, software
12-
;; distributed under the License is distributed on an "AS IS" BASIS,
13-
;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14-
;; See the License for the specific language governing permissions and
15-
;; limitations under the License.
16-
171
(module
182
(type (;0;) (func))
193
(type (;1;) (func (param i32 i32 i32 i32 i32 f32 f32)))
@@ -22,58 +6,53 @@
226
(func (;0;) (type 0)
237
nop)
248
(func (;1;) (type 1) (param i32 i32 i32 i32 i32 f32 f32)
25-
(local i64 i64)
269
local.get 0
2710
local.get 1
2811
local.get 2
29-
local.get 2
30-
i64.extend_i32_s
31-
local.tee 7
32-
i64.const 1
12+
i32.const 1
3313
local.get 0
34-
i64.extend_i32_s
35-
local.tee 8
36-
i64.sub
37-
i64.mul
38-
i64.const 0
39-
local.get 7
40-
i64.const 0
41-
i64.le_s
14+
i32.sub
15+
local.tee 0
16+
local.get 2
17+
i32.mul
18+
i32.const 0
19+
local.get 2
20+
i32.const 0
21+
i32.le_s
4222
select
43-
i32.wrap_i64
4423
local.get 3
4524
local.get 4
25+
local.get 0
26+
local.get 4
27+
i32.mul
28+
i32.const 0
4629
local.get 4
47-
i64.extend_i32_s
48-
local.tee 7
49-
i64.const 1
50-
local.get 8
51-
i64.sub
52-
i64.mul
53-
i64.const 0
54-
local.get 7
55-
i64.const 0
56-
i64.le_s
30+
i32.const 0
31+
i32.le_s
5732
select
58-
i32.wrap_i64
5933
local.get 5
6034
local.get 6
6135
call 2)
6236
(func (;2;) (type 2) (param i32 i32 i32 i32 i32 i32 i32 f32 f32)
6337
(local i32 i32 f32 f32)
64-
local.get 0
65-
i32.const 0
66-
i32.gt_s
67-
if ;; label = @1
38+
block ;; label = @1
39+
local.get 0
40+
i32.const 0
41+
i32.le_s
42+
br_if 0 (;@1;)
6843
loop ;; label = @2
44+
local.get 0
45+
local.get 9
46+
i32.eq
47+
br_if 1 (;@1;)
6948
local.get 4
7049
local.get 6
7150
i32.const 2
7251
i32.shl
7352
i32.add
74-
local.tee 9
53+
local.tee 10
7554
local.get 7
76-
local.get 9
55+
local.get 10
7756
f32.load
7857
local.tee 11
7958
f32.mul
@@ -83,13 +62,13 @@
8362
i32.const 2
8463
i32.shl
8564
i32.add
86-
local.tee 9
65+
local.tee 10
8766
f32.load
8867
local.tee 12
8968
f32.mul
9069
f32.sub
9170
f32.store
92-
local.get 9
71+
local.get 10
9372
local.get 7
9473
local.get 12
9574
f32.mul
@@ -98,6 +77,10 @@
9877
f32.mul
9978
f32.add
10079
f32.store
80+
local.get 9
81+
i32.const 1
82+
i32.add
83+
local.set 9
10184
local.get 5
10285
local.get 6
10386
i32.add
@@ -106,14 +89,9 @@
10689
local.get 3
10790
i32.add
10891
local.set 3
109-
local.get 10
110-
i32.const 1
111-
i32.add
112-
local.tee 10
113-
local.get 0
114-
i32.ne
115-
br_if 0 (;@2;)
92+
br 0 (;@2;)
11693
end
94+
unreachable
11795
end)
11896
(export "__wasm_call_ctors" (func 0))
11997
(export "__wasm_apply_data_relocs" (func 0))

0 commit comments

Comments
 (0)