Skip to content

Commit

Permalink
Merge pull request svaarala#2339 from svaarala/makefile-cleanup
Browse files Browse the repository at this point in the history
Makefile cleanup, build/ and dist/ directories
  • Loading branch information
svaarala authored Jun 29, 2020
2 parents a4f82a5 + e8a47e2 commit c011f78
Show file tree
Hide file tree
Showing 21 changed files with 293 additions and 292 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/build-workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ jobs:
sudo apt install build-essential make python python-yaml bc git
- name: Build
run: |
make duk dukd duk-g++ duk-clang duk-fuzzilli
make build/duk build/dukd build/duk-g++ build/duk-clang build/duk-fuzzilli
- name: Test
run: |
./duk -e "print(Duktape.env); print('Hello world!');"
./duk dist-files/mandel.js
build/duk -e "print(Duktape.env); print('Hello world!');"
build/duk dist-files/mandel.js
build_duk_macos:
name: Duk macOS 10.15
runs-on: macos-10.15
Expand All @@ -28,11 +28,11 @@ jobs:
python2 -m pip install PyYAML
- name: Build
run: |
make duk
make build/duk
- name: Test
run: |
./duk -e "print(Duktape.env); print('Hello world!');"
./duk dist-files/mandel.js
build/duk -e "print(Duktape.env); print('Hello world!');"
build/duk dist-files/mandel.js
build_duk_windows:
name: Duk VS2019
runs-on: windows-2019
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test-workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
sudo apt install build-essential make python python-yaml bc git nodejs
- name: Build
run: |
make duk
make build/duk
- name: Ecmatest
run: |
make ecmatest
Expand All @@ -27,7 +27,7 @@ jobs:
sudo apt install build-essential make python python-yaml bc git nodejs
- name: Build
run: |
make duk
make build/duk
- name: Apitest
run: |
make apitest
Expand Down
26 changes: 0 additions & 26 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,31 +8,8 @@ ms_print.*
/*.gcda
/*.su
/_*
/duk.*
/duk
/dukd
/dukd.*
/duk-clang
/duk-fuzzilli
/duk-sanitize-clang
/duk-g++
/duk-size
/duk-perf
/duk-perf.*
/duk-perf-*
/duk-pgo
/duk-pgo.*
/duk-pgo-*
/duk-perf-pgo
/duk-perf-pgo.*
/duk-perf-pgo-*
/duk-low
/duk-low-norefc
/duk-low-rom
/libduktape.*
/runtests/package-lock.json
/docker-input.zip
/docker-output.zip
/docker/*/gitconfig
/docker/*/prepare_repo.sh
/deps/
Expand All @@ -42,11 +19,8 @@ ms_print.*
/tmp/
/site/
/stuff/
/duktape-releases/
/doc/*.pdf
/runtests/node_modules/
/dukweb.js
/dukweb.wasm
/debugger/jquery-ui-1.11.2.zip
/debugger/jquery-ui-1.11.2/
/debugger/node_modules/
Expand Down
371 changes: 183 additions & 188 deletions Makefile

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,8 @@ These are also **intended for Linux only**. For example:
# Build Docker images. This takes a long time.
$ make docker-images

# Equivalent of 'make dist', but runs inside a container.
$ make docker-dist-src-wd
# Equivalent of 'make dist-source', but runs inside a container.
$ make docker-dist-source-wd

# Run a shell with /work/duktape containing a disposable master snapshot.
$ make docker-shell-master
Expand Down
1 change: 1 addition & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ build_script:
# Make dist, ensure it works on Windows too.

- cmd: cd C:\projects\duktape
- cmd: mkdir dist
- cmd: python util\dist.py

# Prep a few variants of headers and sources.
Expand Down
2 changes: 1 addition & 1 deletion doc/release-checklist.rst
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ Checklist for ordinary releases
push it to the public repo until the tag is certain not to move anymore.

- There can be commits to the repo after tagging but nothing that will
affect "make dist" output.
affect "make dist/source" output.

- Make sure the tag is in the master commit chain, so that git describe will
provide a useful output for dist packages built after the release
Expand Down
2 changes: 1 addition & 1 deletion docker/duktape-base-ubuntu-18.04-s390x/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ RUN echo "=== Prepare duktape-prep repo ===" && \
cp -r repo-snapshots/duktape duktape-prep && \
cp -r repo-snapshots/duktape-releases duktape-prep/duktape-releases && \
cd duktape-prep && \
make linenoise && \
make deps/linenoise && \
make clean

RUN echo "=== Versions ===" && \
Expand Down
6 changes: 3 additions & 3 deletions docker/duktape-base-ubuntu-18.04-x64/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ RUN echo "=== Prepare duktape-prep repo ===" && \
cp -r repo-snapshots/duktape duktape-prep && \
cp -r repo-snapshots/duktape-releases duktape-prep/duktape-releases && \
cd duktape-prep && \
make runtestsdeps linenoise UglifyJS2 && \
make duktape-releases lz-string jquery-1.11.2.js && \
make luajs underscore lodash bluebird.js closure-compiler && \
make runtestsdeps deps/linenoise deps/UglifyJS && \
make deps/duktape-releases deps/lz-string deps/jquery-1.11.2.js && \
make deps/luajs deps/underscore deps/lodash deps/bluebird.js deps/closure-compiler && \
make clean

# Initialize Emscripten cached bytecode files.
Expand Down
6 changes: 3 additions & 3 deletions docker/duktape-dist-ubuntu-18.04-x64/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ set -e
source emsdk/emsdk_env.sh

cd duktape
make clean dist-src
ls -l duktape-*.tar.*
zip /tmp/out.zip duktape-*.tar.*
make clean dist-source
ls -l dist
zip -r /tmp/out.zip dist
cat /tmp/out.zip
12 changes: 6 additions & 6 deletions docker/duktape-release-1-ubuntu-18.04-x64/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ cd duktape
ROOT=`pwd`

test_combined_source_compilation() {
make clean dist
cd dist
make clean dist/source
cd dist/source
cat Makefile.cmdline
make -f Makefile.cmdline
ls -l duk; size duk
Expand Down Expand Up @@ -49,8 +49,8 @@ test_misc_compilation() {
}

test_configure_fastint() {
make clean dist
cd dist
make clean dist/source
cd dist/source
rm -rf /tmp/out
python tools/configure.py -DDUK_USE_FASTINT --output-directory /tmp/out
ls -l /tmp/out
Expand All @@ -62,8 +62,8 @@ test_releasetest() {
}

test_checklist_compile_test() {
make clean dist
cd dist
make clean dist/source
cd dist/source
bash ../util/checklist_compile_test.sh
}

Expand Down
4 changes: 2 additions & 2 deletions docker/duktape-site-ubuntu-18.04-x64/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ source emsdk/emsdk_env.sh

cd duktape
make clean dist-site
ls -l duktape-site-*.tar.*
zip /tmp/out.zip duktape-site-*.tar.*
ls -l dist/
zip -r /tmp/out.zip dist/
cat /tmp/out.zip
2 changes: 1 addition & 1 deletion examples/cmdline/duk_cmdline_lowmem.c
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ duk_uint16_t lowmem_enc16(void *ud, void *p) {

/* We should really never be here: Duktape should only be
* compressing pointers which are in the ROM compressed
* pointers list, which are known at 'make dist' time.
* pointers list, which are known when configuring sources.
* We go on, causing a pointer compression error.
*/
fprintf(stderr, "lowmem_enc16: rom pointer: %p could not be compressed, should never happen\n", (void *) p);
Expand Down
2 changes: 1 addition & 1 deletion extras/alloc-pool/duk_alloc_pool.c
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,7 @@ duk_uint16_t duk_alloc_pool_enc16_rom(void *ptr) {

/* We should really never be here: Duktape should only be
* compressing pointers which are in the ROM compressed
* pointers list, which are known at 'make dist' time.
* pointers list, which are known when configuring sources.
* We go on, causing a pointer compression error.
*/
return 0;
Expand Down
2 changes: 1 addition & 1 deletion runtests/runtests.js
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ function executeTest(options, callback) {

// FIXME: listing specific options here is awkward, must match Makefile
cmd = [ 'gcc', '-o', tempExe,
'-L.',
'-Lbuild',
'-Iprep/nondebug', // this particularly is awkward
'-Wl,-rpath,.',
'-pedantic', '-ansi', '-std=c99', '-Wall', '-Wdeclaration-after-statement', '-fstrict-aliasing', '-D_POSIX_C_SOURCE=200809L', '-D_GNU_SOURCE', '-D_XOPEN_SOURCE', '-Os', '-fomit-frame-pointer',
Expand Down
62 changes: 44 additions & 18 deletions src-input/duk_heap_memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@
* Allocate memory with garbage collection.
*/

DUK_LOCAL duk_bool_t duk__heap_suppress_debuglog(duk_heap *heap) {
/* Suppress debug logging in heap init, the heap->heap_object
* test approximately matches init.
*/
return heap->heap_object == NULL;
}

/* Slow path: voluntary GC triggered, first alloc attempt failed, or zero size. */
DUK_LOCAL DUK_NOINLINE_PERF DUK_COLD void *duk__heap_mem_alloc_slowpath(duk_heap *heap, duk_size_t size) {
void *res;
Expand All @@ -18,11 +25,14 @@ DUK_LOCAL DUK_NOINLINE_PERF DUK_COLD void *duk__heap_mem_alloc_slowpath(duk_heap
DUK_ASSERT_DISABLE(size >= 0);

if (size == 0) {
DUK_D(DUK_DPRINT("zero size alloc in slow path, return NULL"));
DUK_DD(DUK_DDPRINT("zero size alloc in slow path, return NULL"));
return NULL;
}

DUK_D(DUK_DPRINT("first alloc attempt failed or voluntary GC limit reached, attempt to gc and retry"));
if (!duk__heap_suppress_debuglog(heap)) {
/* heap_object check suppresses logging in heap init */
DUK_D(DUK_DPRINT("first alloc attempt failed or voluntary GC limit reached, attempt to gc and retry"));
}

#if 0
/*
Expand Down Expand Up @@ -57,8 +67,10 @@ DUK_LOCAL DUK_NOINLINE_PERF DUK_COLD void *duk__heap_mem_alloc_slowpath(duk_heap
DUK_ASSERT(size > 0);
res = heap->alloc_func(heap->heap_udata, size);
if (res != NULL) {
DUK_D(DUK_DPRINT("duk_heap_mem_alloc() succeeded after gc (pass %ld), alloc size %ld",
(long) (i + 1), (long) size));
if (!duk__heap_suppress_debuglog(heap)) {
DUK_D(DUK_DPRINT("duk_heap_mem_alloc() succeeded after gc (pass %ld), alloc size %ld",
(long) (i + 1), (long) size));
}
return res;
}
}
Expand Down Expand Up @@ -105,9 +117,11 @@ DUK_INTERNAL DUK_INLINE_PERF DUK_HOT void *duk_heap_mem_alloc(duk_heap *heap, du
slowpath:

if (size == 0) {
DUK_D(DUK_DPRINT("first alloc attempt returned NULL for zero size alloc, use slow path to deal with it"));
DUK_DD(DUK_DDPRINT("first alloc attempt returned NULL for zero size alloc, use slow path to deal with it"));
} else {
DUK_D(DUK_DPRINT("first alloc attempt failed, attempt to gc and retry"));
if (!duk__heap_suppress_debuglog(heap)) {
DUK_D(DUK_DPRINT("first alloc attempt failed, attempt to gc and retry"));
}
}
return duk__heap_mem_alloc_slowpath(heap, size);
}
Expand Down Expand Up @@ -181,11 +195,13 @@ DUK_LOCAL DUK_NOINLINE_PERF DUK_COLD void *duk__heap_mem_realloc_slowpath(duk_he
* of free(oldptr), i.e. memory was successfully freed.
*/
if (newsize == 0) {
DUK_D(DUK_DPRINT("zero size realloc in slow path, return NULL"));
DUK_DD(DUK_DDPRINT("zero size realloc in slow path, return NULL"));
return NULL;
}

DUK_D(DUK_DPRINT("first realloc attempt failed, attempt to gc and retry"));
if (!duk__heap_suppress_debuglog(heap)) {
DUK_D(DUK_DPRINT("first realloc attempt failed or voluntary GC limit reached, attempt to gc and retry"));
}

#if 0
/*
Expand Down Expand Up @@ -217,8 +233,10 @@ DUK_LOCAL DUK_NOINLINE_PERF DUK_COLD void *duk__heap_mem_realloc_slowpath(duk_he
DUK_ASSERT(newsize > 0);
res = heap->realloc_func(heap->heap_udata, ptr, newsize);
if (res || newsize == 0) {
DUK_D(DUK_DPRINT("duk_heap_mem_realloc() succeeded after gc (pass %ld), alloc size %ld",
(long) (i + 1), (long) newsize));
if (!duk__heap_suppress_debuglog(heap)) {
DUK_D(DUK_DPRINT("duk_heap_mem_realloc() succeeded after gc (pass %ld), alloc size %ld",
(long) (i + 1), (long) newsize));
}
return res;
}
}
Expand Down Expand Up @@ -262,9 +280,11 @@ DUK_INTERNAL DUK_INLINE_PERF DUK_HOT void *duk_heap_mem_realloc(duk_heap *heap,
slowpath:

if (newsize == 0) {
DUK_D(DUK_DPRINT("first realloc attempt returned NULL for zero size realloc, use slow path to deal with it"));
DUK_DD(DUK_DDPRINT("first realloc attempt returned NULL for zero size realloc, use slow path to deal with it"));
} else {
DUK_D(DUK_DPRINT("first realloc attempt failed, attempt to gc and retry"));
if (!duk__heap_suppress_debuglog(heap)) {
DUK_D(DUK_DPRINT("first realloc attempt failed, attempt to gc and retry"));
}
}
return duk__heap_mem_realloc_slowpath(heap, ptr, newsize);
}
Expand All @@ -285,11 +305,13 @@ DUK_LOCAL DUK_NOINLINE_PERF DUK_COLD void *duk__heap_mem_realloc_indirect_slowpa
DUK_ASSERT_DISABLE(newsize >= 0);

if (newsize == 0) {
DUK_D(DUK_DPRINT("zero size indirect realloc in slow path, return NULL"));
DUK_DD(DUK_DDPRINT("zero size indirect realloc in slow path, return NULL"));
return NULL;
}

DUK_D(DUK_DPRINT("first indirect realloc attempt failed, attempt to gc and retry"));
if (!duk__heap_suppress_debuglog(heap)) {
DUK_D(DUK_DPRINT("first indirect realloc attempt failed, attempt to gc and retry"));
}

#if 0
/*
Expand Down Expand Up @@ -340,8 +362,10 @@ DUK_LOCAL DUK_NOINLINE_PERF DUK_COLD void *duk__heap_mem_realloc_indirect_slowpa
DUK_ASSERT(newsize > 0);
res = heap->realloc_func(heap->heap_udata, cb(heap, ud), newsize);
if (res || newsize == 0) {
DUK_D(DUK_DPRINT("duk_heap_mem_realloc_indirect() succeeded after gc (pass %ld), alloc size %ld",
(long) (i + 1), (long) newsize));
if (!duk__heap_suppress_debuglog(heap)) {
DUK_D(DUK_DPRINT("duk_heap_mem_realloc_indirect() succeeded after gc (pass %ld), alloc size %ld",
(long) (i + 1), (long) newsize));
}
return res;
}
}
Expand Down Expand Up @@ -384,9 +408,11 @@ DUK_INTERNAL DUK_INLINE_PERF DUK_HOT void *duk_heap_mem_realloc_indirect(duk_hea
slowpath:

if (newsize == 0) {
DUK_D(DUK_DPRINT("first indirect realloc attempt returned NULL for zero size realloc, use slow path to deal with it"));
DUK_DD(DUK_DDPRINT("first indirect realloc attempt returned NULL for zero size realloc, use slow path to deal with it"));
} else {
DUK_D(DUK_DPRINT("first indirect realloc attempt failed, attempt to gc and retry"));
if (!duk__heap_suppress_debuglog(heap)) {
DUK_D(DUK_DPRINT("first indirect realloc attempt failed, attempt to gc and retry"));
}
}
return duk__heap_mem_realloc_indirect_slowpath(heap, cb, ud, newsize);
}
Expand Down
Loading

0 comments on commit c011f78

Please sign in to comment.