Skip to content

Commit c9845fc

Browse files
anonrigjuanarbol
authored andcommittedJan 31, 2023
deps: add simdutf dependency
PR-URL: #45803 Reviewed-By: Robert Nagy <ronagy@icloud.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Michael Dawson <midawson@redhat.com>
1 parent 9ca31cd commit c9845fc

File tree

12 files changed

+30637
-0
lines changed

12 files changed

+30637
-0
lines changed
 

‎.github/workflows/tools.yml

+10
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,16 @@ jobs:
125125
echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV
126126
./tools/dep_updaters/update-libuv.sh "$NEW_VERSION"
127127
fi
128+
- id: simdutf
129+
subsystem: deps
130+
label: dependencies
131+
run: |
132+
NEW_VERSION=$(gh api repos/simdutf/simdutf/releases/latest -q '.tag_name|ltrimstr("v")')
133+
CURRENT_VERSION=$(grep "#define SIMDUTF_VERSION" ./deps/simdutf/simdutf.h | sed -n "s/^.*VERSION \(.*\)/\1/p")
134+
if [ "$NEW_VERSION" != "$CURRENT_VERSION" ]; then
135+
echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV
136+
./tools/update-simdutf.sh "$NEW_VERSION"
137+
fi
128138
steps:
129139
- uses: actions/checkout@v3
130140
with:

‎LICENSE

+22
Original file line numberDiff line numberDiff line change
@@ -1316,6 +1316,28 @@ The externally maintained libraries used by Node.js are:
13161316
jloup@gzip.org madler@alumni.caltech.edu
13171317
"""
13181318

1319+
- simdutf, located at deps/simdutf, is licensed as follows:
1320+
"""
1321+
Copyright 2021 The simdutf authors
1322+
1323+
Permission is hereby granted, free of charge, to any person obtaining a copy of
1324+
this software and associated documentation files (the "Software"), to deal in
1325+
the Software without restriction, including without limitation the rights to
1326+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
1327+
the Software, and to permit persons to whom the Software is furnished to do so,
1328+
subject to the following conditions:
1329+
1330+
The above copyright notice and this permission notice shall be included in all
1331+
copies or substantial portions of the Software.
1332+
1333+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1334+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
1335+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
1336+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
1337+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
1338+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1339+
"""
1340+
13191341
- npm, located at deps/npm, is licensed as follows:
13201342
"""
13211343
The npm application

‎Makefile

+1
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ with-code-cache test-code-cache:
170170

171171
out/Makefile: config.gypi common.gypi node.gyp \
172172
deps/uv/uv.gyp deps/llhttp/llhttp.gyp deps/zlib/zlib.gyp \
173+
deps/simdutf/simdutf.gyp \
173174
tools/v8_gypfiles/toolchain.gypi tools/v8_gypfiles/features.gypi \
174175
tools/v8_gypfiles/inspector.gypi tools/v8_gypfiles/v8.gyp
175176
$(PYTHON) tools/gyp_node.py -f make

‎deps/simdutf/LICENSE-MIT

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
Copyright 2021 The simdutf authors
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy of
4+
this software and associated documentation files (the "Software"), to deal in
5+
the Software without restriction, including without limitation the rights to
6+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
7+
the Software, and to permit persons to whom the Software is furnished to do so,
8+
subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included in all
11+
copies or substantial portions of the Software.
12+
13+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
15+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
16+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

‎deps/simdutf/README.md

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# simdutf
2+
3+
This project boosts unicode validation and transcoding performance by
4+
utilizing SIMD operations where possible.
5+
6+
The source is pulled from: https://github.com/simdutf/simdutf
7+
8+
Active development occurs in the default branch (currently named `master`).
9+
10+
## Updating
11+
12+
See [tools/dep_updaters/README.md#simdutf](../../tools/dep_updaters/README.md#simdutf)
13+
for instructions.

‎deps/simdutf/simdutf.cpp

+28,037
Large diffs are not rendered by default.

‎deps/simdutf/simdutf.gyp

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
'targets': [
3+
{
4+
'target_name': 'simdutf',
5+
'type': 'static_library',
6+
'include_dirs': ['.'],
7+
'direct_dependent_settings': {
8+
'include_dirs': ['.'],
9+
},
10+
'sources': ['simdutf.cpp'],
11+
},
12+
]
13+
}

‎deps/simdutf/simdutf.h

+2,443
Large diffs are not rendered by default.

‎node.gyp

+1
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,7 @@
464464
'deps/googletest/googletest.gyp:gtest_prod',
465465
'deps/histogram/histogram.gyp:histogram',
466466
'deps/uvwasi/uvwasi.gyp:uvwasi',
467+
'deps/simdutf/simdutf.gyp:simdutf',
467468
],
468469

469470
'sources': [

‎tools/dep_updaters/README.md

+25
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,28 @@ been created with the changes), do the following:
3535
example).
3636

3737
[`c61870c`]: https://github.com/nodejs/node/commit/c61870c376e2f5b0dbaa939972c46745e21cdbdd
38+
39+
## simdutf
40+
41+
The `update-simdutf.sh` script takes the target version to update as its only
42+
argument, downloads it from the [GitHub repo](https://github.com/simdutf/simdutf)
43+
and uses it to replace the contents of `deps/simdutf/`. The contents are replaced
44+
entirely except for the `*.gyp` and `*.gypi` build files, which are part of the
45+
Node.js build definitions and are not present in the upstream repo.
46+
47+
For example, in order to update to version `2.0.7`, the following command can
48+
be run:
49+
50+
```bash
51+
./tools/dep_updaters/update-simdutf.sh 2.0.7
52+
```
53+
54+
Once the script has run (either manually, or by CI in which case a PR will have
55+
been created with the changes), do the following:
56+
57+
1. Check the [changelog](https://github.com/simdutf/simdutf/releases/tag/v2.0.7) for
58+
things that might require changes in Node.js.
59+
2. If necessary, update `simdutf.gyp` with build-related changes.
60+
3. Check that Node.js compiles without errors and the tests pass.
61+
4. Create a commit for the update and in the commit message include the
62+
important/relevant items from the changelog.

‎tools/dep_updaters/update-simdutf.sh

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#!/bin/sh
2+
set -e
3+
# Shell script to update simdutf in the source tree to a specific version
4+
5+
BASE_DIR=$(cd "$(dirname "$0")/../.." && pwd)
6+
DEPS_DIR="$BASE_DIR/deps"
7+
SIMDUTF_VERSION=$1
8+
9+
if [ "$#" -le 0 ]; then
10+
echo "Error: please provide an simdutf version to update to"
11+
echo " e.g. $0 2.0.3"
12+
exit 1
13+
fi
14+
15+
echo "Making temporary workspace..."
16+
17+
WORKSPACE=$(mktemp -d 2> /dev/null || mktemp -d -t 'tmp')
18+
19+
cleanup () {
20+
EXIT_CODE=$?
21+
[ -d "$WORKSPACE" ] && rm -rf "$WORKSPACE"
22+
exit $EXIT_CODE
23+
}
24+
25+
trap cleanup INT TERM EXIT
26+
27+
SIMDUTF_REF="v$SIMDUTF_VERSION"
28+
SIMDUTF_ZIP="simdutf-$SIMDUTF_VERSION.zip"
29+
SIMDUTF_LICENSE="LICENSE-MIT"
30+
31+
cd "$WORKSPACE"
32+
33+
echo "Fetching simdutf source archive..."
34+
curl -sL -o "$SIMDUTF_ZIP" "https://github.com/simdutf/simdutf/releases/download/$SIMDUTF_REF/singleheader.zip"
35+
unzip "$SIMDUTF_ZIP"
36+
rm "$SIMDUTF_ZIP"
37+
rm ./*_demo.cpp
38+
39+
curl -sL -o "$SIMDUTF_LICENSE" "https://raw.githubusercontent.com/simdutf/simdutf/HEAD/LICENSE-MIT"
40+
41+
echo "Replacing existing simdutf (except GYP build files)"
42+
mv "$DEPS_DIR/simdutf/"*.gyp "$DEPS_DIR/simdutf/README.md" "$WORKSPACE/"
43+
rm -rf "$DEPS_DIR/simdutf"
44+
mv "$WORKSPACE" "$DEPS_DIR/simdutf"
45+
46+
echo "All done!"
47+
echo ""
48+
echo "Please git add simdutf, commit the new version:"
49+
echo ""
50+
echo "$ git add -A deps/simdutf"
51+
echo "$ git commit -m \"deps: update simdutf to $SIMDUTF_VERSION\""
52+
echo ""

‎tools/license-builder.sh

+2
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ licenseText="$(sed -e '/You should have received a copy of the CC0/,$d' -e 's/^\
7979
addlicense "SipHash" "deps/v8/src/third_party/siphash" "$licenseText"
8080
licenseText="$(sed -e '/The data format used by the zlib library/,$d' -e 's/^\/\* *//' -e 's/^ *//' "${rootdir}/deps/zlib/zlib.h")"
8181
addlicense "zlib" "deps/zlib" "$licenseText"
82+
licenseText="$(cat "${rootdir}/deps/simdutf/LICENSE-MIT")"
83+
addlicense "simdutf" "deps/simdutf" "$licenseText"
8284

8385
# npm
8486
licenseText="$(cat "${rootdir}/deps/npm/LICENSE")"

0 commit comments

Comments
 (0)
Please sign in to comment.