Skip to content

Commit 6a01a3f

Browse files
committed
deps,src: use SIMD for normal base64 encoding
1 parent 1150cfe commit 6a01a3f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+5630
-0
lines changed

LICENSE

+32
Original file line numberDiff line numberDiff line change
@@ -1603,3 +1603,35 @@ The externally maintained libraries used by Node.js are:
16031603
OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
16041604
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
16051605
"""
1606+
1607+
- base64, located at deps/base64/base64/, is licensed as follows:
1608+
"""
1609+
Copyright (c) 2005-2007, Nick Galbreath
1610+
Copyright (c) 2013-2019, Alfred Klomp
1611+
Copyright (c) 2015-2017, Wojciech Mula
1612+
Copyright (c) 2016-2017, Matthieu Darbois
1613+
All rights reserved.
1614+
1615+
Redistribution and use in source and binary forms, with or without
1616+
modification, are permitted provided that the following conditions are
1617+
met:
1618+
1619+
- Redistributions of source code must retain the above copyright notice,
1620+
this list of conditions and the following disclaimer.
1621+
1622+
- Redistributions in binary form must reproduce the above copyright
1623+
notice, this list of conditions and the following disclaimer in the
1624+
documentation and/or other materials provided with the distribution.
1625+
1626+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
1627+
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
1628+
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
1629+
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
1630+
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
1631+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
1632+
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
1633+
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
1634+
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
1635+
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
1636+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1637+
"""

deps/base64/base64.gyp

+173
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,173 @@
1+
{
2+
'variables': {
3+
'arm_fpu%': '',
4+
'target_arch%': '',
5+
},
6+
'targets': [
7+
{
8+
'target_name': 'base64',
9+
'type': 'static_library',
10+
'include_dirs': [ 'base64/include', 'base64/lib' ],
11+
'direct_dependent_settings': {
12+
'include_dirs': [ 'base64/include' ],
13+
},
14+
'sources': [
15+
'base64/include/libbase64.h',
16+
'base64/lib/arch/generic/codec.c',
17+
'base64/lib/tables/tables.c',
18+
'base64/lib/codec_choose.c',
19+
'base64/lib/codecs.h',
20+
'base64/lib/lib.c',
21+
],
22+
23+
'conditions': [
24+
[ 'arm_fpu=="neon" and target_arch=="arm"', {
25+
'defines': [ 'HAVE_NEON32=1' ],
26+
'dependencies': [ 'base64_neon32' ],
27+
}, {
28+
'sources': [ 'base64/lib/arch/neon32/codec.c' ],
29+
}],
30+
31+
# arm64 requires NEON, so it's safe to always use it
32+
[ 'target_arch=="arm64"', {
33+
'defines': [ 'HAVE_NEON64=1' ],
34+
'dependencies': [ 'base64_neon64' ],
35+
}, {
36+
'sources': [ 'base64/lib/arch/neon64/codec.c' ],
37+
}],
38+
39+
# Runtime detection will happen for x86 CPUs
40+
[ 'target_arch in "ia32 x64 x32"', {
41+
'defines': [
42+
'HAVE_SSSE3=1',
43+
'HAVE_SSE41=1',
44+
'HAVE_SSE42=1',
45+
'HAVE_AVX=1',
46+
'HAVE_AVX2=1',
47+
],
48+
'dependencies': [
49+
'base64_ssse3',
50+
'base64_sse41',
51+
'base64_sse42',
52+
'base64_avx',
53+
'base64_avx2',
54+
],
55+
}, {
56+
'sources': [
57+
'base64/lib/arch/ssse3/codec.c',
58+
'base64/lib/arch/sse41/codec.c',
59+
'base64/lib/arch/sse42/codec.c',
60+
'base64/lib/arch/avx/codec.c',
61+
'base64/lib/arch/avx2/codec.c',
62+
],
63+
}],
64+
],
65+
},
66+
67+
{
68+
'target_name': 'base64_ssse3',
69+
'type': 'static_library',
70+
'include_dirs': [ 'base64/include', 'base64/lib' ],
71+
'sources': [ 'base64/lib/arch/ssse3/codec.c' ],
72+
'defines': [ 'HAVE_SSSE3=1' ],
73+
'conditions': [
74+
[ 'OS!="win"', {
75+
'cflags': [ '-mssse3' ],
76+
'xcode_settings': {
77+
'OTHER_CFLAGS': [ '-mssse3' ]
78+
},
79+
}],
80+
],
81+
},
82+
83+
{
84+
'target_name': 'base64_sse41',
85+
'type': 'static_library',
86+
'include_dirs': [ 'base64/include', 'base64/lib' ],
87+
'sources': [ 'base64/lib/arch/sse41/codec.c' ],
88+
'defines': [ 'HAVE_SSE41=1' ],
89+
'conditions': [
90+
[ 'OS!="win"', {
91+
'cflags': [ '-msse4.1' ],
92+
'xcode_settings': {
93+
'OTHER_CFLAGS': [ '-msse4.1' ]
94+
},
95+
}],
96+
],
97+
},
98+
99+
{
100+
'target_name': 'base64_sse42',
101+
'type': 'static_library',
102+
'include_dirs': [ 'base64/include', 'base64/lib' ],
103+
'sources': [ 'base64/lib/arch/sse42/codec.c' ],
104+
'defines': [ 'HAVE_SSE42=1' ],
105+
'conditions': [
106+
[ 'OS!="win"', {
107+
'cflags': [ '-msse4.2' ],
108+
'xcode_settings': {
109+
'OTHER_CFLAGS': [ '-msse4.2' ]
110+
},
111+
}],
112+
],
113+
},
114+
115+
{
116+
'target_name': 'base64_avx',
117+
'type': 'static_library',
118+
'include_dirs': [ 'base64/include', 'base64/lib' ],
119+
'sources': [ 'base64/lib/arch/avx/codec.c' ],
120+
'defines': [ 'HAVE_AVX=1' ],
121+
'conditions': [
122+
[ 'OS!="win"', {
123+
'cflags': [ '-mavx' ],
124+
'xcode_settings': {
125+
'OTHER_CFLAGS': [ '-mavx' ]
126+
},
127+
}],
128+
],
129+
},
130+
131+
{
132+
'target_name': 'base64_avx2',
133+
'type': 'static_library',
134+
'include_dirs': [ 'base64/include', 'base64/lib' ],
135+
'sources': [ 'base64/lib/arch/avx2/codec.c' ],
136+
'defines': [ 'HAVE_AVX2=1' ],
137+
'conditions': [
138+
[ 'OS!="win"', {
139+
'cflags': [ '-mavx2' ],
140+
'xcode_settings': {
141+
'OTHER_CFLAGS': [ '-mavx2' ]
142+
},
143+
}],
144+
],
145+
},
146+
147+
{
148+
'target_name': 'base64_neon32',
149+
'type': 'static_library',
150+
'include_dirs': [ 'base64/include', 'base64/lib' ],
151+
'sources': [ 'base64/lib/arch/neon32/codec.c' ],
152+
'defines': [ 'HAVE_NEON32=1' ],
153+
'conditions': [
154+
[ 'OS!="win"', {
155+
'cflags': [ '-mfpu=neon' ],
156+
'xcode_settings': {
157+
'OTHER_CFLAGS': [ '-mfpu=neon' ]
158+
},
159+
}],
160+
],
161+
},
162+
163+
{
164+
'target_name': 'base64_neon64',
165+
'type': 'static_library',
166+
'include_dirs': [ 'base64/include', 'base64/lib' ],
167+
'sources': [ 'base64/lib/arch/neon64/codec.c' ],
168+
'defines': [ 'HAVE_NEON64=1' ],
169+
# NEON is required in arm64, so no -mfpu flag is needed
170+
}
171+
172+
]
173+
}

deps/base64/base64/.gitignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
*.o
2+
bin/base64
3+
lib/config.h
4+
test/benchmark
5+
test/test_base64

deps/base64/base64/.travis.yml

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
language: c
2+
services: docker
3+
4+
jobs:
5+
allow_failures:
6+
- os: osx
7+
- arch: ppc64le
8+
9+
include:
10+
- name: linux-amd64-gcc
11+
os: linux
12+
arch: amd64
13+
compiler: gcc
14+
script: test/ci/amd64.sh
15+
16+
- name: linux-amd64-gcc +openmp
17+
os: linux
18+
arch: amd64
19+
compiler: gcc
20+
env: OPENMP=1 OMP_NUM_THREADS=4
21+
script: test/ci/amd64.sh
22+
23+
- name: linux-amd64-clang
24+
os: linux
25+
arch: amd64
26+
compiler: clang
27+
script: test/ci/amd64.sh
28+
29+
- name: linux-arm32-gcc
30+
compiler: gcc
31+
script: test/ci/docker-arm32.sh
32+
33+
- name: linux-arm32-clang
34+
compiler: clang
35+
script: test/ci/docker-arm32.sh
36+
37+
- name: linux-powerpc-gcc
38+
compiler: gcc
39+
script: test/ci/docker-powerpc.sh
40+
41+
- name: linux-arm64-gcc
42+
os: linux
43+
arch: arm64
44+
compiler: gcc
45+
env: NEON64_CFLAGS="-march=armv8-a"
46+
script: test/ci/generic.sh
47+
48+
- name: linux-arm64-clang
49+
os: linux
50+
arch: arm64
51+
compiler: clang
52+
env: NEON64_CFLAGS="-march=armv8-a"
53+
script: test/ci/generic.sh
54+
55+
- name: linux-s390x-gcc
56+
os: linux
57+
arch: s390x
58+
compiler: gcc
59+
script: test/ci/generic.sh
60+
61+
- name: linux-ppc64le-gcc
62+
os: linux
63+
arch: ppc64le
64+
compiler: gcc
65+
script: test/ci/generic.sh
66+
67+
- name: osx-amd64-clang
68+
os: osx
69+
arch: amd64
70+
compiler: clang
71+
script: test/ci/amd64.sh

deps/base64/base64/LICENSE

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
Copyright (c) 2005-2007, Nick Galbreath
2+
Copyright (c) 2013-2019, Alfred Klomp
3+
Copyright (c) 2015-2017, Wojciech Mula
4+
Copyright (c) 2016-2017, Matthieu Darbois
5+
All rights reserved.
6+
7+
Redistribution and use in source and binary forms, with or without
8+
modification, are permitted provided that the following conditions are
9+
met:
10+
11+
- Redistributions of source code must retain the above copyright notice,
12+
this list of conditions and the following disclaimer.
13+
14+
- Redistributions in binary form must reproduce the above copyright
15+
notice, this list of conditions and the following disclaimer in the
16+
documentation and/or other materials provided with the distribution.
17+
18+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
19+
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20+
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
21+
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22+
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
24+
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
25+
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
26+
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
27+
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

0 commit comments

Comments
 (0)