From 3e9cc61631776bb43f24fce59a3a504d859ce4f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C3=BAl=20Ibarra=20Corretg=C3=A9?= Date: Tue, 5 Mar 2024 09:45:47 +0100 Subject: [PATCH 1/2] Add Big Endian CI target --- .github/workflows/ci.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a17f940ad..f94e30750 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -71,6 +71,26 @@ jobs: - name: test run: | make test + linux-s390x: + runs-on: ubuntu-latest + defaults: + run: + shell: alpine.sh {0} + steps: + - uses: actions/checkout@v3 + - uses: jirutka/setup-alpine@v1 + with: + arch: s390x + packages: "build-base make cmake" + - name: build + run: | + make + - name: stats + run: | + make stats + - name: test + run: | + make test linux-gcc48: runs-on: ubuntu-latest container: From 30e8c4baf43fde747b44c844596cf937487418c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C3=BAl=20Ibarra=20Corretg=C3=A9?= Date: Wed, 6 Mar 2024 09:52:03 +0100 Subject: [PATCH 2/2] Log endianness when dumping memory stats --- quickjs.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/quickjs.c b/quickjs.c index 97db3bcf1..56b61e88e 100644 --- a/quickjs.c +++ b/quickjs.c @@ -1506,6 +1506,15 @@ static inline int is_digit(int c) { return c >= '0' && c <= '9'; } +static inline BOOL is_be(void) +{ + union { + uint16_t a; + uint8_t b; + } u = {0x100}; + return u.b; +} + typedef struct JSClassShortDef { JSAtom class_name; JSClassFinalizer *finalizer; @@ -6148,8 +6157,8 @@ void JS_ComputeMemoryUsage(JSRuntime *rt, JSMemoryUsage *s) void JS_DumpMemoryUsage(FILE *fp, const JSMemoryUsage *s, JSRuntime *rt) { - fprintf(fp, "QuickJS-ng memory usage -- %s version, %d-bit, malloc limit: %"PRId64"\n\n", - JS_GetVersion(), (int)sizeof(void *) * 8, s->malloc_limit); + fprintf(fp, "QuickJS-ng memory usage -- %s version, %d-bit, %s Endian, malloc limit: %"PRId64"\n\n", + JS_GetVersion(), (int)sizeof(void *) * 8, is_be() ? "Big" : "Little", s->malloc_limit); if (rt) { static const struct { const char *name; @@ -32335,15 +32344,6 @@ static const char * const bc_tag_str[] = { }; #endif -static inline BOOL is_be(void) -{ - union { - uint16_t a; - uint8_t b; - } u = {0x100}; - return u.b; -} - static void bc_put_u8(BCWriterState *s, uint8_t v) { dbuf_putc(&s->dbuf, v);