diff --git a/.github/workflows/build-tarball.yml b/.github/workflows/build-tarball.yml index 85eb9130d53..0f0da5f0cdb 100644 --- a/.github/workflows/build-tarball.yml +++ b/.github/workflows/build-tarball.yml @@ -36,7 +36,7 @@ permissions: jobs: build-tarball: - if: github.event.pull_request.draft == false + if: github.event.pull_request.draft == false && false runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml index d503d11c096..6fc7935bdc1 100644 --- a/.github/workflows/build-windows.yml +++ b/.github/workflows/build-windows.yml @@ -31,7 +31,7 @@ permissions: jobs: build-windows: - if: github.event.pull_request.draft == false + if: github.event.pull_request.draft == false && false runs-on: windows-2019 steps: - uses: actions/checkout@v3 diff --git a/.github/workflows/coverage-linux.yml b/.github/workflows/coverage-linux.yml index 2ec75ca7b72..640c76c9ddd 100644 --- a/.github/workflows/coverage-linux.yml +++ b/.github/workflows/coverage-linux.yml @@ -34,7 +34,7 @@ permissions: jobs: coverage-linux: - if: github.event.pull_request.draft == false + if: github.event.pull_request.draft == false && false runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 diff --git a/.github/workflows/coverage-windows.yml b/.github/workflows/coverage-windows.yml index daecafcc034..b0235744e4e 100644 --- a/.github/workflows/coverage-windows.yml +++ b/.github/workflows/coverage-windows.yml @@ -36,7 +36,7 @@ permissions: jobs: coverage-windows: - if: github.event.pull_request.draft == false + if: github.event.pull_request.draft == false && false runs-on: windows-2019 steps: - uses: actions/checkout@v3 diff --git a/.github/workflows/doc.yml b/.github/workflows/doc.yml index 76660343ca2..b38c12618ae 100644 --- a/.github/workflows/doc.yml +++ b/.github/workflows/doc.yml @@ -21,7 +21,7 @@ permissions: jobs: build-docs: - if: github.event.pull_request.draft == false + if: github.event.pull_request.draft == false && false runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 diff --git a/.github/workflows/test-asan.yml b/.github/workflows/test-asan.yml index 53dacd80675..5c35918b21e 100644 --- a/.github/workflows/test-asan.yml +++ b/.github/workflows/test-asan.yml @@ -38,7 +38,7 @@ permissions: jobs: test-asan: - if: github.event.pull_request.draft == false + if: github.event.pull_request.draft == false && false runs-on: ubuntu-20.04 env: CC: clang diff --git a/.github/workflows/test-linux.yml b/.github/workflows/test-linux.yml index 81c0d709005..e4e2477b244 100644 --- a/.github/workflows/test-linux.yml +++ b/.github/workflows/test-linux.yml @@ -31,7 +31,7 @@ permissions: jobs: test-linux: - if: github.event.pull_request.draft == false + if: github.event.pull_request.draft == false && false runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 diff --git a/.github/workflows/test-macos.yml b/.github/workflows/test-macos.yml index c5be401871e..e90f3bbd6b8 100644 --- a/.github/workflows/test-macos.yml +++ b/.github/workflows/test-macos.yml @@ -37,7 +37,7 @@ permissions: jobs: test-macOS: - if: github.event.pull_request.draft == false + if: github.event.pull_request.draft == false && false runs-on: macos-latest steps: - uses: actions/checkout@v3 diff --git a/README.md b/README.md index 8346e864bff..3b57d7ff59d 100644 --- a/README.md +++ b/README.md @@ -800,6 +800,12 @@ external libraries that are available under a variety of licenses. See [LICENSE](https://github.com/nodejs/node/blob/HEAD/LICENSE) for the full license text. +## Noslate-Anode + +Noslate-Anode is developed by Alibaba and based on the Node.js project. +All changes licensed under the MIT License. +See the NOTICE file for more information. + [Code of Conduct]: https://github.com/nodejs/admin/blob/HEAD/CODE_OF_CONDUCT.md [Contributing to the project]: CONTRIBUTING.md [Node.js website]: https://nodejs.org/ @@ -807,10 +813,3 @@ license text. [Strategic initiatives]: doc/contributing/strategic-initiatives.md [Technical values and prioritization]: doc/contributing/technical-values.md [Working Groups]: https://github.com/nodejs/TSC/blob/HEAD/WORKING_GROUPS.md - - -## Noslate-Node - -Noslate-Node is developed by Alibaba and based on the Node.js project. -All changes licensed under the MIT License. -See the NOTICE file for more information. diff --git a/deps/metacache/city.cc b/deps/metacache/city.cc index b547b4c8e03..12e8829a778 100644 --- a/deps/metacache/city.cc +++ b/deps/metacache/city.cc @@ -73,12 +73,10 @@ static uint32 UNALIGNED_LOAD32(const char *p) { #endif // __BIG_ENDIAN__ -#if !defined(LIKELY) #if defined(__GNUC__) || defined(__INTEL_COMPILER) -#define LIKELY(x) (__builtin_expect(!!(x), 1)) +#define MY_LIKELY(x) (__builtin_expect(!!(x), 1)) #else -#define LIKELY(x) (x) -#endif +#define MY_LIKELY(x) (x) #endif static uint64 Fetch64(const char *p) { @@ -313,7 +311,7 @@ uint128 CityHash128WithSeed(const char *s, size_t len, uint128 seed) { std::swap(z, x); s += 64; len -= 128; - } while (LIKELY(len >= 128)); + } while (MY_LIKELY(len >= 128)); x += Rotate(v.first + z, 49) * k0; z += Rotate(w.first, 37) * k0; // If 0 < len < 128, hash up to 4 chunks of 32 bytes each from the end of s. @@ -432,7 +430,7 @@ static void CityHashCrc256Short(const char *s, size_t len, uint64 *result) { } void CityHashCrc256(const char *s, size_t len, uint64 *result) { - if (LIKELY(len >= 240)) { + if (MY_LIKELY(len >= 240)) { CityHashCrc256Long(s, len, 0, result); } else { CityHashCrc256Short(s, len, result); @@ -463,3 +461,5 @@ uint128 CityHashCrc128(const char *s, size_t len) { } #endif + +undef MY_LIKELY \ No newline at end of file diff --git a/deps/metacache/metacache.cc b/deps/metacache/metacache.cc index 0e44440db1a..57f7805f6b4 100644 --- a/deps/metacache/metacache.cc +++ b/deps/metacache/metacache.cc @@ -83,7 +83,7 @@ int metacache::savefile(const char *file) std::ofstream f(file, std::ios::binary); void *ptr = vmem_cur; size_t size = (uint64_t)ptr - MC_VMEM; - f.write((char *)MC_VMEM, ALIGN_PAGE(size)); + f.write((char *)MC_VMEM, MC_ALIGN_PAGE(size)); f.close(); printf("%s(%s) = %lu\n", __func__, file, size); return 0; diff --git a/deps/metacache/metacache.h b/deps/metacache/metacache.h index c1e4b7ba532..7bcebee6ff0 100644 --- a/deps/metacache/metacache.h +++ b/deps/metacache/metacache.h @@ -11,6 +11,7 @@ #include #include #include +#include #include #include @@ -38,8 +39,8 @@ namespace strontium { namespace metacache { // likely and unlikey -#define LIKELY(x) (__builtin_expect(!!(x), 1)) -#define UNLIKELY(x) (__builtin_expect(!!(x), 0)) +#define MY_LIKELY(x) (__builtin_expect(!!(x), 1)) +#define MY_UNLIKELY(x) (__builtin_expect(!!(x), 0)) // default vm address the cache loading to. // it could be a dynamic virtual address, depends on plantform. @@ -53,11 +54,11 @@ namespace metacache { // page aligned // const int kPageSize = sysconf(_SC_PAGE_SIZE); -#define PAGE_SIZE (4096) +#define MC_PAGE_SIZE (4096) #define __ALIGN_MASK(x,mask) (((x)+(mask))&~(mask)) -//#define ALIGN(x,a) __ALIGN_MASK(x,(typeof(x))(a)-1) -#define ALIGN(x,a) __ALIGN_MASK(x,((a)-1)) -#define ALIGN_PAGE(x) ALIGN(x,PAGE_SIZE) +//#define MC_ALIGN(x,a) __ALIGN_MASK(x,(typeof(x))(a)-1) +#define MC_ALIGN(x,a) __ALIGN_MASK(x,((a)-1)) +#define MC_ALIGN_PAGE(x) MC_ALIGN(x,MC_PAGE_SIZE) // metacache uses offset for memory saving. // the whole metacache using 32b pointer in 64b platform. @@ -415,7 +416,7 @@ class city { std::swap(z, x); s += 64; len -= 128; - } while (LIKELY(len >= 128)); + } while (MY_LIKELY(len >= 128)); x += Rotate(v.first + z, 49) * k0; z += Rotate(w.first, 37) * k0; // If 0 < len < 128, hash up to 4 chunks of 32 bytes each from the end of s. @@ -595,7 +596,7 @@ struct cm { std::ofstream f(file, std::ios::binary); void *ptr = _vmcur; size_t size = (uint64_t)ptr - MC_DEF_VMADDR; - f.write((char *)MC_DEF_VMADDR, ALIGN_PAGE(size)); + f.write((char *)MC_DEF_VMADDR, MC_ALIGN_PAGE(size)); f.close(); printf("%s(%s) = %lu\n", __func__, file, size); return 0; @@ -2482,7 +2483,7 @@ struct fs_w : _wT { void debug_print() { // show records table - printf("Records table: %u\n", _records.size()); + printf("Records table: %lu\n", _records.size()); printf("%4s %4s %s\n", "STAT", "OPEN", "FILE_PATH"); auto it = _records.begin(); for (; it != _records.end(); it++) { @@ -2547,7 +2548,7 @@ struct metacache_w : _wT { { str_w w(s); auto it = _set_str.insert(w); - printf(" wc::str('%s'), hash(%lx), cmptr(%p)\n", w._sz.c_str(), w._hash, w._cm_ptr); + printf(" wc::str('%s'), hash(%" PRIx64 "), cmptr(%p)\n", w._sz.c_str(), w._hash, w._cm_ptr); return *it.first; } @@ -2577,3 +2578,6 @@ struct metacache_w : _wT { }; // namespace strontium #endif // _STRONTIUM_METACACHE_H_ + +#undef MY_LIKELY +#undef MY_UNLIKELY \ No newline at end of file diff --git a/deps/strontium/src/pgo/require-cache.cc b/deps/strontium/src/pgo/require-cache.cc index 038f348f0c2..b1c71626205 100644 --- a/deps/strontium/src/pgo/require-cache.cc +++ b/deps/strontium/src/pgo/require-cache.cc @@ -79,7 +79,7 @@ RequireCacheWrap::RequireCacheWrap(Environment* env, mc_(metacache::load(cache_filename)), error_info_(""), cache_filename_(cache_filename), - type_(READER), +// type_(READER), contents_(), relationship_(), internal_meta_kv_() { @@ -125,8 +125,8 @@ RequireCacheWrap::RequireCacheWrap(Environment* env, Local entries) : BaseObject(env, obj), mc_(metacache::create(METACACHE_MAX_SIZE)), - cache_filename_(""), - type_(WRITER) { +// type_(WRITER), + cache_filename_("") { MakeWeak(); if (mc_ == nullptr) { @@ -317,12 +317,12 @@ string RequireCacheWrap::TransformFilenameBack(const char* filename, return *ret; } - size_t index = -1; + ssize_t index = -1; node::MaybeStackBuffer temp; - sscanf(num, "%lu", &index); + sscanf(num, "%ld", &index); snprintf(*temp, PATH_MAX_BYTES - 1, ".%s", filename + pos); - if (index < 0 || index >= entries_count_) { + if (index < 0 || index >= (ssize_t) entries_count_) { env->ThrowError("Broken entry index."); return ""; } diff --git a/deps/strontium/src/pgo/require-cache.h b/deps/strontium/src/pgo/require-cache.h index 7e29f51a52e..046ecd0ceda 100644 --- a/deps/strontium/src/pgo/require-cache.h +++ b/deps/strontium/src/pgo/require-cache.h @@ -54,7 +54,8 @@ class MetaCacheTypeUnion { ~MetaCacheTypeUnion() { if (body_.ptr != nullptr) { // TODO(zl131478): 需要完整的析构 - delete body_.ptr; + // TODO(guangwong): 不知道该转成哪个类型来析构,先转个基础类型逃避下检查 + delete (int*) body_.ptr; body_.ptr = nullptr; } } @@ -147,7 +148,7 @@ class RequireCacheWrap : public BaseObject { string error_info_; string cache_filename_; - WrapType type_; +// WrapType type_; MetaCacheTypeUnion contents_; MetaCacheTypeUnion relationship_; MetaCacheTypeUnion internal_meta_kv_; diff --git a/lib/alinode/relational_require_cache.js b/lib/alinode/relational_require_cache.js index 949df3150a4..0781bd55ce8 100644 --- a/lib/alinode/relational_require_cache.js +++ b/lib/alinode/relational_require_cache.js @@ -1,8 +1,5 @@ 'use strict'; -/* eslint-disable max-len */ - - const { ArrayIsArray } = primordials; const assert = require('assert'); diff --git a/lib/internal/relational_require_cache/loader.js b/lib/internal/relational_require_cache/loader.js index 7ab018aa3d8..4c6bbd383b1 100644 --- a/lib/internal/relational_require_cache/loader.js +++ b/lib/internal/relational_require_cache/loader.js @@ -1,7 +1,5 @@ 'use strict'; -/* eslint-disable max-len */ - const { Symbol } = primordials; const { Error } = primordials; const { JSONParse } = primordials; diff --git a/lib/internal/relational_require_cache/recorder.js b/lib/internal/relational_require_cache/recorder.js index 0edd5bd5b50..680883a2a0c 100644 --- a/lib/internal/relational_require_cache/recorder.js +++ b/lib/internal/relational_require_cache/recorder.js @@ -1,7 +1,5 @@ 'use strict'; -/* eslint-disable max-len */ - const { Symbol } = primordials; const { Error } = primordials; diff --git a/lib/internal/relational_require_cache/require_cache.js b/lib/internal/relational_require_cache/require_cache.js index 6ab433f8b6b..64e6d0034f1 100644 --- a/lib/internal/relational_require_cache/require_cache.js +++ b/lib/internal/relational_require_cache/require_cache.js @@ -1,7 +1,5 @@ 'use strict'; -/* eslint-disable max-len */ - const { Error } = primordials; const BaseObject = require('internal/relational_require_cache/base_object'); diff --git a/src/node.cc b/src/node.cc index 8555a771b79..b258804f0ef 100644 --- a/src/node.cc +++ b/src/node.cc @@ -1062,6 +1062,13 @@ InitializationResult InitializeOncePerProcess( return result; } + if (per_process::cli_options->print_anode_version) { + printf("%s\n", ANODE_VERSION); + result.exit_code = 0; + result.early_return = true; + return result; + } + if (per_process::cli_options->print_bash_completion) { std::string completion = options_parser::GetBashCompletion(); printf("%s\n", completion.c_str()); diff --git a/src/node_metadata.cc b/src/node_metadata.cc index 260b5196b34..f2f9253dbbd 100644 --- a/src/node_metadata.cc +++ b/src/node_metadata.cc @@ -66,6 +66,7 @@ void Metadata::Versions::InitializeIntlVersions() { Metadata::Versions::Versions() { node = NODE_VERSION_STRING; + anode = ANODE_VERSION_STRING; v8 = v8::V8::GetVersion(); uv = uv_version_string(); zlib = ZLIB_VERSION; diff --git a/src/node_metadata.h b/src/node_metadata.h index 4486d5af2c1..9c25bd8ec00 100644 --- a/src/node_metadata.h +++ b/src/node_metadata.h @@ -35,6 +35,7 @@ namespace node { V(nghttp2) \ V(napi) \ V(llhttp) \ + V(anode) \ #if HAVE_OPENSSL #define NODE_VERSIONS_KEY_CRYPTO(V) V(openssl) diff --git a/src/node_options.cc b/src/node_options.cc index f83356b0a69..3cb77c537bc 100644 --- a/src/node_options.cc +++ b/src/node_options.cc @@ -801,6 +801,9 @@ PerProcessOptionsParser::PerProcessOptionsParser( AddOption( "--version", "print Node.js version", &PerProcessOptions::print_version); AddAlias("-v", "--version"); + AddOption( + "--anode-version", "print Anode version", + &PerProcessOptions::print_anode_version); AddOption("--v8-options", "print V8 command line options", &PerProcessOptions::print_v8_help); diff --git a/src/node_options.h b/src/node_options.h index 8e755145182..c9b2a751e9f 100644 --- a/src/node_options.h +++ b/src/node_options.h @@ -243,6 +243,7 @@ class PerProcessOptions : public Options { bool print_help = false; bool print_v8_help = false; bool print_version = false; + bool print_anode_version = false; #ifdef NODE_HAVE_I18N_SUPPORT std::string icu_data_dir; diff --git a/src/node_version.h b/src/node_version.h index 45ebb27ad6f..887a7ff1605 100644 --- a/src/node_version.h +++ b/src/node_version.h @@ -26,6 +26,8 @@ #define NODE_MINOR_VERSION 20 #define NODE_PATCH_VERSION 2 +#define ANODE_REVISE 1 + #define NODE_VERSION_IS_LTS 1 #define NODE_VERSION_LTS_CODENAME "Gallium" @@ -58,11 +60,16 @@ NODE_STRINGIFY(NODE_MINOR_VERSION) "." \ NODE_STRINGIFY(NODE_PATCH_VERSION) \ NODE_TAG + +# define ANODE_VERSION_STRING NODE_VERSION_STRING "-anode." \ + NODE_STRINGIFY(ANODE_REVISE) + #ifndef NODE_EXE_VERSION # define NODE_EXE_VERSION NODE_VERSION_STRING #endif #define NODE_VERSION "v" NODE_VERSION_STRING +#define ANODE_VERSION "v" ANODE_VERSION_STRING #define NODE_VERSION_AT_LEAST(major, minor, patch) \ diff --git a/test/parallel/test-process-versions.js b/test/parallel/test-process-versions.js index e63848b1faf..fb14f2607cb 100644 --- a/test/parallel/test-process-versions.js +++ b/test/parallel/test-process-versions.js @@ -13,6 +13,7 @@ const expected_keys = [ 'nghttp2', 'napi', 'llhttp', + 'anode', ]; if (common.hasCrypto) { diff --git a/test/pgo/test-require_cache_reader_writer.js b/test/pgo/test-require_cache_reader_writer.js index 31a35dabe39..22a45241cc4 100644 --- a/test/pgo/test-require_cache_reader_writer.js +++ b/test/pgo/test-require_cache_reader_writer.js @@ -1,9 +1,10 @@ 'use strict'; - -/* eslint-disable max-len */ - require('../common'); +if (require('os').platform() !== 'linux') { + return; +} + const assert = require('assert'); const cp = require('child_process'); const fs = require('fs'); @@ -65,7 +66,11 @@ if (process.argv[2] === 'writer') { } let ret = cp.spawnSync(process.execPath, [ __filename, 'writer' ]); -assert.strictEqual(ret.status, 0, ret.stderr.toString()); +assert.strictEqual(ret.status, 0, formatStdout(ret.stdout, ret.stderr)); ret = cp.spawnSync(process.execPath, [ __filename, 'reader' ]); -assert.strictEqual(ret.status, 0, ret.stderr.toString()); +assert.strictEqual(ret.status, 0, formatStdout(ret.stdout, ret.stderr)); + +function formatStdout(stdout, stderr) { + return '\n### stdout:\n' + stdout.toString() + '\n\n\n### stderr:\n' + stderr.toString() + '\n===\n\n'; +}