Skip to content

Commit 41521c0

Browse files
committed
Merge remote-tracking branch 'upstream/main' into w14/main-to-disterl-merge
1. Partial revert of a6add4b regarding removal of stop handler for BSD sockets and move of reference count logic to monitor to resources.c. Indeed, main features another approach for fixing race conditions in monitors involving signals which is a better design 2. Slight modification of resource monitor logic in context_destroy so that `resource_type_fire_monitor` is called with the current context as the erl_nif env, which was the case in feature/distributed-erlang branch and that `dist_connection_down` relied upon. This is a hack documented in `dist_connection_down` so that the exit reason is passed to distributed monitors 3. Fix typo in emscripten platform_nifs regarding crypto
2 parents 62a5859 + 3044560 commit 41521c0

File tree

105 files changed

+5685
-813
lines changed

Some content is hidden

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

105 files changed

+5685
-813
lines changed

.github/workflows/build-and-test-macos.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,12 @@ jobs:
4949

5050
- name: "Install deps"
5151
if: matrix.otp != '24'
52-
run: HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 brew install gperf doxygen erlang@${{ matrix.otp }} ninja mbedtls rebar3
52+
run: HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 brew install gperf doxygen erlang@${{ matrix.otp }} gleam ninja mbedtls rebar3
5353

5454
- name: "Install deps"
5555
if: matrix.otp == '24'
5656
run: |
57-
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 brew install gperf doxygen erlang@${{ matrix.otp }} ninja mbedtls
57+
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 brew install gperf doxygen erlang@${{ matrix.otp }} gleam ninja mbedtls
5858
wget https://github.com/erlang/rebar3/releases/download/3.23.0/rebar3
5959
chmod +x rebar3
6060
if [ -e /usr/local/opt/erlang@24/bin/ ] ; then

.github/workflows/build-and-test.yaml

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ jobs:
5151
cc: ["gcc-9", "gcc-11", "gcc-13", "clang-10", "clang-14", "clang-18"]
5252
cflags: ["-O3"]
5353
otp: ["25", "26", "27"]
54+
gleam_version: ["1.8.0"]
5455

5556
include:
5657
- cc: "gcc-7"
@@ -301,6 +302,7 @@ jobs:
301302
otp-version: ${{ matrix.otp }}
302303
elixir-version: ${{ matrix.elixir_version }}
303304
rebar3-version: ${{ matrix.rebar3_version }}
305+
gleam-version: ${{ matrix.gleam_version }}
304306
hexpm-mirrors: |
305307
https://builds.hex.pm
306308
https://repo.hex.pm
@@ -365,37 +367,37 @@ jobs:
365367
working-directory: build
366368
run: |
367369
ulimit -c unlimited
370+
valgrind --error-exitcode=1 ./tests/test-erlang -s prime_smp
368371
./tests/test-erlang -s prime_smp
369-
valgrind ./tests/test-erlang -s prime_smp
370372
371373
- name: "Test: test-enif"
372374
working-directory: build
373375
run: |
374376
ulimit -c unlimited
377+
valgrind --error-exitcode=1 ./tests/test-enif
375378
./tests/test-enif
376-
valgrind ./tests/test-enif
377379
378380
- name: "Test: test-heap"
379381
working-directory: build
380382
run: |
381383
ulimit -c unlimited
384+
valgrind --error-exitcode=1 ./tests/test-heap
382385
./tests/test-heap
383-
valgrind ./tests/test-heap
384386
385387
- name: "Test: test-mailbox"
386388
working-directory: build
387389
run: |
388390
ulimit -c unlimited
391+
valgrind --error-exitcode=1 ./tests/test-mailbox
389392
./tests/test-mailbox
390-
valgrind ./tests/test-mailbox
391393
392394
- name: "Test: test-structs"
393395
timeout-minutes: 10
394396
working-directory: build
395397
run: |
396398
ulimit -c unlimited
399+
valgrind --error-exitcode=1 ./tests/test-structs
397400
./tests/test-structs
398-
valgrind ./tests/test-structs
399401
400402
- name: "Test: test_etest.avm"
401403
timeout-minutes: 5
@@ -410,24 +412,24 @@ jobs:
410412
working-directory: build
411413
run: |
412414
ulimit -c unlimited
415+
valgrind --error-exitcode=1 ./src/AtomVM ./tests/libs/estdlib/test_estdlib.avm
413416
./src/AtomVM ./tests/libs/estdlib/test_estdlib.avm
414-
valgrind ./src/AtomVM ./tests/libs/estdlib/test_estdlib.avm
415417
416418
- name: "Test: test_eavmlib.avm"
417419
timeout-minutes: 10
418420
working-directory: build
419421
run: |
420422
ulimit -c unlimited
423+
valgrind --error-exitcode=1 ./src/AtomVM ./tests/libs/eavmlib/test_eavmlib.avm
421424
./src/AtomVM ./tests/libs/eavmlib/test_eavmlib.avm
422-
valgrind ./src/AtomVM ./tests/libs/eavmlib/test_eavmlib.avm
423425
424426
- name: "Test: test_alisp.avm"
425427
timeout-minutes: 10
426428
working-directory: build
427429
run: |
428430
ulimit -c unlimited
431+
valgrind --error-exitcode=1 ./src/AtomVM ./tests/libs/alisp/test_alisp.avm
429432
./src/AtomVM ./tests/libs/alisp/test_alisp.avm
430-
valgrind ./src/AtomVM ./tests/libs/alisp/test_alisp.avm
431433
432434
- name: "Test: Tests.avm (Elixir)"
433435
timeout-minutes: 10
@@ -436,8 +438,8 @@ jobs:
436438
ulimit -c unlimited
437439
if command -v elixirc &> /dev/null
438440
then
441+
valgrind --error-exitcode=1 ./src/AtomVM ./tests/libs/exavmlib/Tests.avm
439442
./src/AtomVM ./tests/libs/exavmlib/Tests.avm
440-
valgrind ./src/AtomVM ./tests/libs/exavmlib/Tests.avm
441443
fi
442444
443445
- name: "Install and smoke test"

.github/workflows/build-libraries.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@ jobs:
8989
timeout-minutes: 10
9090
working-directory: build
9191
run: |
92+
valgrind --error-exitcode=1 ./src/AtomVM ./tests/libs/estdlib/test_estdlib.avm
9293
./src/AtomVM ./tests/libs/estdlib/test_estdlib.avm
93-
valgrind ./src/AtomVM ./tests/libs/estdlib/test_estdlib.avm
9494
9595
- name: "Rename and write sha256sum"
9696
working-directory: build

.github/workflows/pico-build.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ jobs:
4848
- name: "Install deps"
4949
run: |
5050
sudo apt install -y \
51-
cmake gperf ninja-build gcc-arm-none-eabi \
51+
cmake doxygen gperf ninja-build gcc-arm-none-eabi \
5252
libnewlib-arm-none-eabi libstdc++-arm-none-eabi-newlib \
5353
erlang-base erlang-dev erlang-dialyzer erlang-eunit rebar3
5454

.github/workflows/publish-docs.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ jobs:
129129
git add "doc/${{ github.ref_name }}"
130130
git add .
131131
git diff --exit-code Production || echo "Going to commit"
132-
git diff --exit-code Production || git commit -m "Update Documentation"
132+
git diff --exit-code Production || git commit -m "Update Documentation for ${{ github.ref_name }}"
133133
git log -1
134134
- name: Push changes
135135
if: github.repository == 'atomvm/AtomVM'

.github/workflows/wasm-build.yaml

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ jobs:
4747
cd build
4848
cmake .. -G Ninja -DAVM_WARNINGS_ARE_ERRORS=ON
4949
# test_eavmlib does not work with wasm due to http + ssl test
50-
ninja AtomVM atomvmlib test_etest test_alisp hello_world run_script call_cast html5_events wasm_webserver
50+
ninja AtomVM atomvmlib erlang_test_modules test_etest test_alisp test_estdlib hello_world run_script call_cast html5_events wasm_webserver
5151
5252
- name: Upload AtomVM and test modules
5353
uses: actions/upload-artifact@v4
@@ -112,9 +112,11 @@ jobs:
112112
node src/AtomVM.js ../../../../build/examples/erlang/hello_world.beam ../../../../build/libs/eavmlib/src/eavmlib.avm
113113
# Run tests that pass
114114
node src/AtomVM.js ../../../../build/tests/libs/alisp/test_alisp.avm
115+
node src/AtomVM.js ../../../../build/tests/libs/estdlib/test_estdlib.avm
115116
# test_eavmlib does not work with wasm due to http + ssl test
116117
# node src/AtomVM.js ../../../../build/tests/libs/eavmlib/test_eavmlib.avm
117118
node src/AtomVM.js ../../../../build/tests/libs/etest/test_etest.avm
119+
node src/AtomVM.js ../../../../build/tests/erlang_tests/test_crypto.beam
118120
119121
- name: "Rename and write sha256sum (node)"
120122
if: startsWith(github.ref, 'refs/tags/')
@@ -124,9 +126,6 @@ jobs:
124126
ATOMVM_JS=AtomVM-node-${{ github.ref_name }}.js
125127
mv AtomVM.js "${ATOMVM_JS}"
126128
sha256sum "${ATOMVM_JS}" > "${ATOMVM_JS}.sha256"
127-
ATOMVM_WORKER_JS=AtomVM.worker-node-${{ github.ref_name }}.js
128-
mv AtomVM.worker.js "${ATOMVM_WORKER_JS}"
129-
sha256sum "${ATOMVM_WORKER_JS}" > "${ATOMVM_WORKER_JS}.sha256"
130129
ATOMVM_WASM=AtomVM-node-${{ github.ref_name }}.wasm
131130
mv AtomVM.wasm "${ATOMVM_WASM}"
132131
sha256sum "${ATOMVM_WASM}" > "${ATOMVM_WASM}.sha256"
@@ -140,8 +139,6 @@ jobs:
140139
files: |
141140
src/platforms/emscripten/build/src/AtomVM-node-${{ github.ref_name }}.js
142141
src/platforms/emscripten/build/src/AtomVM-node-${{ github.ref_name }}.js.sha256
143-
src/platforms/emscripten/build/src/AtomVM.worker-node-${{ github.ref_name }}.js
144-
src/platforms/emscripten/build/src/AtomVM.worker-node-${{ github.ref_name }}.js.sha256
145142
src/platforms/emscripten/build/src/AtomVM-node-${{ github.ref_name }}.wasm
146143
src/platforms/emscripten/build/src/AtomVM-node-${{ github.ref_name }}.wasm.sha256
147144
@@ -227,9 +224,6 @@ jobs:
227224
ATOMVM_JS=AtomVM-web-${{ github.ref_name }}.js
228225
mv AtomVM.js "${ATOMVM_JS}"
229226
sha256sum "${ATOMVM_JS}" > "${ATOMVM_JS}.sha256"
230-
ATOMVM_WORKER_JS=AtomVM.worker-web-${{ github.ref_name }}.js
231-
mv AtomVM.worker.js "${ATOMVM_WORKER_JS}"
232-
sha256sum "${ATOMVM_WORKER_JS}" > "${ATOMVM_WORKER_JS}.sha256"
233227
ATOMVM_WASM=AtomVM-web-${{ github.ref_name }}.wasm
234228
mv AtomVM.wasm "${ATOMVM_WASM}"
235229
sha256sum "${ATOMVM_WASM}" > "${ATOMVM_WASM}.sha256"
@@ -243,7 +237,5 @@ jobs:
243237
files: |
244238
src/platforms/emscripten/build/src/AtomVM-web-${{ github.ref_name }}.js
245239
src/platforms/emscripten/build/src/AtomVM-web-${{ github.ref_name }}.js.sha256
246-
src/platforms/emscripten/build/src/AtomVM.worker-web-${{ github.ref_name }}.js
247-
src/platforms/emscripten/build/src/AtomVM.worker-web-${{ github.ref_name }}.js.sha256
248240
src/platforms/emscripten/build/src/AtomVM-web-${{ github.ref_name }}.wasm
249241
src/platforms/emscripten/build/src/AtomVM-web-${{ github.ref_name }}.wasm.sha256

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
*.o
99
build/**
1010
xcode/**
11+
examples/**/build
12+
libs/**/build
1113
src/platforms/esp32/build/**
1214
src/platforms/esp32/build/**/*.d
1315
src/platforms/esp32/test/build/**

CHANGELOG.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
3030
- Added `erl_epmd` client implementation to epmd using `socket` module
3131
- Added support for socket asynchronous API for `recv`, `recvfrom` and `accept`.
3232
- Added support for UDP multicast with socket API.
33+
- Added support for `ets:update_counter/3` and `ets:update_counter/4`.
34+
- Added `erlang:+/1`
35+
- Added `lists:append/1` and `lists:append/2`
36+
- Added `erlang:spawn_monitor/1`, `erlang:spawn_monitor/3`
37+
- Added `lists:dropwhile/2`.
38+
- Support for `float/1` BIF.
39+
- Added `erlang:get/0` and `erlang:erase/0`.
40+
- Added `erlang:unique_integer/0` and `erlang:unique_integer/1`
41+
- Added support for 'ets:delete/1'.
3342

3443
### Changed
3544

@@ -40,6 +49,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
4049
- ESP32: improved sntp sync speed from a cold boot.
4150
- Fixed `gen_server` internal messages to match OTP so it works across erlang distribution
4251
- Utilize reserved `phy_init` partition on ESP32 to store wifi calibration for faster connections.
52+
- Support for zero count in `lists:duplicate/2`.
4353

4454
## [0.6.6] - Unreleased
4555

@@ -49,6 +59,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
4959
with nodejs and emscripten)
5060
- Added preliminary support for ESP32P4 (no networking support yet).
5161
- Added memory info in `out_of_memory` crash logs to help developers fix memory issues.
62+
- Added documentation and function specs for uart driver
63+
- Added `uart:read/2` with a timeout parameter.
64+
- Missing `erlang:is_function/2` BIF
65+
- Added `erlang:is_record/2`
5266

5367
### Fixed
5468

@@ -87,6 +101,21 @@ bug when handling errors from BIFs used as NIFs (when called with `CALL_EXT` and
87101
- Fixed call to funs such as fun erlang:'not'/1, that make use of BIFs
88102
- Fixed potential crashes or memory leaks caused by a mistake in calculation of reference counts
89103
and a race condition in otp_socket code
104+
- Fixed an out of memory issue by forcing GC to copy data from message fragments
105+
- Fixed a bug where calling repeatedly `process_info` on a stopped process could cause an out of
106+
memory error
107+
- Fixed possible concurrency problems in ESP32 UART driver
108+
- Fixed concurrency and memory leak related to links and monitors
109+
- Fixed issues with parsing of line references for stack traces
110+
- Fixed memory corruption issue with `erlang:make_tuple/2`
111+
- Fix potential use after free with code generated from OTP <= 24
112+
- Fix `is_function/2` guard
113+
- Fixed segfault when calling `lists:reverse/1` (#1600)
114+
- Fixed nif_atomvm_posix_read GC bug
115+
116+
### Changed
117+
118+
- ESP32 UART driver no longer aborts because of badargs in configuration, instead raising an error
90119

91120
## [0.6.5] - 2024-10-15
92121

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMakeModules)
2525

2626
find_package(Dialyzer)
2727
find_package(Elixir)
28+
find_package(Gleam)
2829

2930
option(AVM_DISABLE_FP "Disable floating point support." OFF)
3031
option(AVM_DISABLE_SMP "Disable SMP." OFF)

CMakeModules/BuildErlang.cmake

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,12 @@ endmacro()
6161
macro(pack_lib avm_name)
6262

6363
foreach(archive_name ${ARGN})
64-
if(NOT ${archive_name} STREQUAL "exavmlib")
65-
set(pack_lib_${avm_name}_archives ${pack_lib_${avm_name}_archives} ${CMAKE_BINARY_DIR}/libs/${archive_name}/src/${archive_name}.avm)
66-
else()
64+
if(${archive_name} STREQUAL "exavmlib")
6765
set(pack_lib_${avm_name}_archives ${pack_lib_${avm_name}_archives} ${CMAKE_BINARY_DIR}/libs/${archive_name}/lib/${archive_name}.avm)
66+
elseif(${archive_name} STREQUAL "gleam_avm")
67+
set(pack_lib_${avm_name}_archives ${pack_lib_${avm_name}_archives} ${CMAKE_BINARY_DIR}/libs/${archive_name}/${archive_name}.avm)
68+
else()
69+
set(pack_lib_${avm_name}_archives ${pack_lib_${avm_name}_archives} ${CMAKE_BINARY_DIR}/libs/${archive_name}/src/${archive_name}.avm)
6870
endif()
6971
set(pack_lib_${avm_name}_archive_targets ${pack_lib_${avm_name}_archive_targets} ${archive_name})
7072
endforeach()

0 commit comments

Comments
 (0)