aboutsummaryrefslogtreecommitdiff
path: root/test/compress/asm.js
blob: 9b22732649eb938ecc9fb8c5a65c30024429966c (about) (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
asm_mixed: {
    options = {
        sequences     : true,
        properties    : true,
        dead_code     : true,
        drop_debugger : true,
        conditionals  : true,
        comparisons   : true,
        evaluate      : true,
        booleans      : true,
        loops         : true,
        unused        : true,
        hoist_funs    : true,
        keep_fargs    : true,
        keep_fnames   : false,
        hoist_vars    : true,
        if_return     : true,
        join_vars     : true,
        cascade       : true,
        side_effects  : true,
        negate_iife   : true
    };
    input: {
        // adapted from http://asmjs.org/spec/latest/
        function asm_GeometricMean(stdlib, foreign, buffer) {
          "use asm";
          var exp = stdlib.Math.exp;
          var log = stdlib.Math.log;
          var values = new stdlib.Float64Array(buffer);
          function logSum(start, end) {
            start = start|0;
            end = end|0;
            var sum = 0.0, p = 0, q = 0;
            // asm.js forces byte addressing of the heap by requiring shifting by 3
            for (p = start << 3, q = end << 3; (p|0) < (q|0); p = (p + 8)|0) {
              sum = sum + +log(values[p>>3]);
            }
            return +sum;
          }
          function geometricMean(start, end) {
            start = start|0;
            end = end|0;
            return +exp(+logSum(start, end) / +((end - start)|0));
          }
          return { geometricMean: geometricMean };
        }
        function no_asm_GeometricMean(stdlib, foreign, buffer) {
          var exp = stdlib.Math.exp;
          var log = stdlib.Math.log;
          var values = new stdlib.Float64Array(buffer);
          function logSum(start, end) {
            start = start|0;
            end = end|0;
            var sum = 0.0, p = 0, q = 0;
            // asm.js forces byte addressing of the heap by requiring shifting by 3
            for (p = start << 3, q = end << 3; (p|0) < (q|0); p = (p + 8)|0) {
              sum = sum + +log(values[p>>3]);
            }
            return +sum;
          }
          function geometricMean(start, end) {
            start = start|0;
            end = end|0;
            return +exp(+logSum(start, end) / +((end - start)|0));
          }
          return { geometricMean: geometricMean };
        }
    }
    expect: {
        function asm_GeometricMean(stdlib, foreign, buffer) {
            "use asm";
            var exp = stdlib.Math.exp;
            var log = stdlib.Math.log;
            var values = new stdlib.Float64Array(buffer);
            function logSum(start, end) {
                start = start | 0;
                end = end | 0;
                var sum = 0.0, p = 0, q = 0;
                for (p = start << 3, q = end << 3; (p | 0) < (q | 0); p = p + 8 | 0) {
                    sum = sum + +log(values[p >> 3]);
                }
                return +sum;
            }
            function geometricMean(start, end) {
                start = start | 0;
                end = end | 0;
                return +exp(+logSum(start, end) / +(end - start | 0));
            }
            return { geometricMean: geometricMean };
        }
        function no_asm_GeometricMean(stdlib, foreign, buffer) {
            function logSum(start, end) {
                start |= 0, end |= 0;
                var sum = 0, p = 0, q = 0;
                for (p = start << 3, q = end << 3; (0 | p) < (0 | q); p = p + 8 | 0) sum += +log(values[p >> 3]);
                return +sum;
            }
            function geometricMean(start, end) {
                return start |= 0, end |= 0, +exp(+logSum(start, end) / +(end - start | 0));
            }
            var exp = stdlib.Math.exp, log = stdlib.Math.log, values = new stdlib.Float64Array(buffer);
            return { geometricMean: geometricMean };
        }
    }
}

-checkout): Use 'repository-close!' unconditionally. * m4/guix.m4 (GUIX_CHECK_GUILE_GIT): New macro. * configure.ac: Use it and error out when it fails. * doc/guix.texi (Requirements): Bump to Guile-Git 0.3.0. Ludovic Courtès 2020-10-05build: Use a 'guile' executable that doesn't warn about locales....This gets rid of: guile: warning: failed to install locale when running the 'guix' command on a foreign distro where 'GUIX_LOCPATH' isn't set. * Makefile.am (pkglibexec_PROGRAMS, guile_SOURCES, guile_LDADD) (guile_CFLAGS): New variables. (install-exec-hook): New target. (AUX_FILES): Remove 'guile-launcher.c'. * configure.ac: Use 'GUILE_FLAGS'. Ludovic Courtès 2020-08-29build: Remove references to the 'nix-hash' program....* configure.ac: Remove check for 'nix-hash'. * tests/base32.scm (%nix-hash, %have-nix-hash?): Remove. ("sha256 & bytevector->nix-base32-string"): Remove test. * build-aux/pre-inst-env.in: Do not set 'NIX_HASH' environment variable. Ludovic Courtès 2020-08-29build: Remove check for Guile 2.2.1 bug....This check is unnecessary since e688c2df3924423b67892cc9939ca099c729d1cb. * m4/guix.m4 (GUIX_ASSERT_SYNTAX_OBJECT_EQUAL): Remove. * configure.ac: Remove user. Ludovic Courtès 2020-08-24Use "guile-zlib" and "guile-lzlib" instead of (guix config)....* Makefile.am (MODULES): Remove guix/zlib.scm and guix/lzlib.scm, (SCM_TESTS): remove tests/zlib.scm, tests/lzlib.scm. * build-aux/build-self.scm (make-config.scm): Remove unused %libz variable. * configure.ac: Remove LIBZ and LIBLZ variables and check instead for Guile-zlib and Guile-lzlib. * doc/guix.texi ("Requirements"): Remove zlib requirement and add Guile-zlib and Guile-lzlib instead. * gnu/packages/package-management.scm (guix)[native-inputs]: Add "guile-zlib" and "guile-lzlib", [inputs]: remove "zlib" and "lzlib", [propagated-inputs]: ditto, [arguments]: add "guile-zlib" and "guile-lzlib" to Guile load path. * guix/config.scm.in (%libz, %liblz): Remove them. * guix/lzlib.scm: Remove it. * guix/man-db.scm: Use (zlib) instead of (guix zlib). * guix/profiles.scm (manual-database): Do not stub (guix config) in imported modules list, instead add "guile-zlib" to the extension list. * guix/scripts/publish.scm: Use (zlib) instead of (guix zlib) and (lzlib) instead of (guix lzlib), (string->compression-type, effective-compression): do not check for zlib and lzlib availability. * guix/scripts/substitute.scm (%compression-methods): Do not check for lzlib availability. * guix/self.scm (specification->package): Add "guile-zlib" and "guile-lzlib" and remove "zlib" and "lzlib", (compiled-guix): remove "zlib" and "lzlib" arguments and add guile-zlib and guile-lzlib to the dependencies, also do not pass "zlib" and "lzlib" to "make-config.scm" procedure, (make-config.scm): remove "zlib" and "lzlib" arguments as well as %libz and %liblz variables. * guix/utils.scm (lzip-port): Use (lzlib) instead of (guix lzlib) and do not check for lzlib availability. * guix/zlib.scm: Remove it. * m4/guix.m4 (GUIX_LIBZ_LIBDIR, GUIX_LIBLZ_FILE_NAME): Remove them. * tests/lzlib.scm: Use (zlib) instead of (guix zlib) and (lzlib) instead of (guix lzlib), and do not check for zlib and lzlib availability. * tests/publish.scm: Ditto. * tests/substitute.scm: Do not check for lzlib availability. * tests/utils.scm: Ditto. * tests/zlib.scm: Remove it. Mathieu Othacehe 2020-06-16etc: Add committer script....* etc/committer.scm.in: New file. * configure.ac: Configure it. Ricardo Wurmus 2020-05-28maint: Check whether Guile-Gcrypt is recent enough....Suggested by Danny Milosavljevic <dannym@scratchpost.org> in <https://bugs.gnu.org/41494>. * m4/guix.m4 (GUIX_CHECK_GUILE_GCRYPT): New macro. * configure.ac: Use it. Ludovic Courtès 2020-05-14etc: indent-code.el: Use the --quick option....This prevents Emacs from loading the autoload definitions found in its profile, which needlessly clutters the output. It also prevents Geiser (if installed) from blocking the script and asking the user to input the Scheme implementation to use. The trick for passing multiple arguments to Emacs is to use what is called a "sesquicolon" (see https://www.emacswiki.org/emacs/EmacsScripts). * etc/indent-code.el.in: Rename to... * etc/indent-code.el: ...this. Adapt the shebang to use a sesquicolon, and pass the --quick option to Emacs. Since this line is interpreted by the shell, simply use Emacs from the PATH instead of from a hard coded location. (main): New procedure, used as the entry point. * configure.ac: Remove the warning about Emacs. Emacs can now be installed any time by the user if they want to use the script. * .gitignore: No longer ignore changes to etc/indent-code.el. Maxim Cournoyer 2020-04-23build: Don't build man pages when cross-compiling....* configure.ac: Define 'CROSS_COMPILING' Automake conditional. * doc/local.mk (dist_man1_MANS): Wrap in "if !CROSS_COMPILING". Ludovic Courtès 2020-03-11build: Require Guile 2.2.3 or later....* configure.ac: For 2.2.x, require 2.2.3 or later. Ludovic Courtès 2020-01-17build: Allow builds with Guile 3.0....* configure.ac: Add "3.0" in 'GUILE_PKG' invocation. * doc/guix.texi (Requirements): Mention 3.0.x. Ludovic Courtès 2019-11-09build: Warn about etc/indent-code.el when Emacs is absent....* configure.ac: Warn when 'emacs' is not found, and emit 'etc/indent-code.el' otherwise. Signed-off-by: Ludovic Courtès <ludo@gnu.org> zimoun 2019-07-25maint: Switch to Guile-JSON 3.x....Guile-JSON 3.x is incompatible with Guile-JSON 1.x, which we relied on until now: it maps JSON dictionaries to alists (instead of hash tables), and JSON arrays to vectors (instead of lists). This commit is about adjusting all the existing code to this new mapping. * m4/guix.m4 (GUIX_CHECK_GUILE_JSON): New macro. * configure.ac: Use it. * doc/guix.texi (Requirements): Mention the Guile-JSON version. * guix/git-download.scm (git-fetch)[guile-json]: Use GUILE-JSON-3. * guix/import/cpan.scm (string->license): Expect vectors instead of lists. (module->dist-name): Use 'json-fetch' instead of 'json-fetch-alist'. (cpan-fetch): Likewise. * guix/import/crate.scm (crate-fetch): Likewise, and call 'vector->list' for DEPS. * guix/import/gem.scm (rubygems-fetch): Likewise. * guix/import/json.scm (json-fetch-alist): Remove. * guix/import/pypi.scm (pypi-fetch): Use 'json-fetch' instead of 'json-fetch-alist'. (latest-source-release, latest-wheel-release): Call 'vector->list' on RELEASES. * guix/import/stackage.scm (stackage-lts-info-fetch): Use 'json-fetch' instead of 'json-fetch-alist'. (lts-package-version): Use 'vector->list'. * guix/import/utils.scm (hash-table->alist): Remove. (alist->package): Pass 'vector->list' on the inputs fields, and default to the empty vector. * guix/scripts/import/json.scm (guix-import-json): Remove call to 'hash-table->alist'. * guix/swh.scm (define-json-reader): Expect pair? or null? instead of hash-table?. [extract-field]: Use 'assoc-ref' instead of 'hash-ref'. (json->branches): Use 'map' instead of 'hash-map->list'. (json->checksums): Likewise. (json->directory-entries, origin-visits): Call 'vector->list' on the result of 'json->scm'. * tests/import-utils.scm ("alist->package with dependencies"): New test. * gnu/installer.scm (build-compiled-file)[builder]: Use GUILE-JSON-3. * gnu/installer.scm (installer-program)[installer-builder]: Likewise. * gnu/installer/locale.scm (iso639->iso639-languages): Use 'assoc-ref' instead of 'hash-ref', and pass vectors through 'vector->list'. (iso3166->iso3166-territories): Likewise. * gnu/system/vm.scm (system-docker-image)[build]: Use GUILE-JSON-3. * guix/docker.scm (manifest, config): Adjust for Guile-JSON 3. * guix/scripts/pack.scm (docker-image)[build]: Use GUILE-JSON-3. * guix/import/github.scm (fetch-releases-or-tags): Update docstring. (latest-released-version): Use 'assoc-ref' instead of 'hash-ref'. Pass the result of 'fetch-releases-or-tags' to 'vector->list'. * guix/import/launchpad.scm (latest-released-version): Likewise. Ludovic Courtès 2019-05-06Add (guix lzlib)....* guix/lzlib.scm, tests/lzlib.scm: New files. * Makefile.am (MODULES): Add guix/lzlib.scm. (SCM_TESTS): Add tests/lzlib.scm. * m4/guix.m4 (GUIX_LIBLZ_LIBDIR): New macro. * configure.ac (LIBLZ_LIBDIR): Use it. Define and substitute 'LIBLZ'. * guix/config.scm.in (%liblz): New variable. * guix/self.scm (make-config.scm): Add TODO comment. Co-authored-by: Ludovic Courtès <ludo@gnu.org> Pierre Neidhardt 2019-04-17build: No longer substitute 'LIBGCRYPT'....This had become useless since ca719424455465fca4b872c371daf2a46de88b33. * configure.ac (LIBGCRYPT): Remove. * guix/config.scm.in (%libgcrypt): Remove. Ludovic Courtès