Skip to content

Commit 726c7f1

Browse files
committed
Merge branch 'master' into feature/smp
Merge new term_compare API, new UTF opcodes and removed support for no floating point builds.
2 parents e2e83b6 + b316e88 commit 726c7f1

Some content is hidden

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

45 files changed

+2232
-1036
lines changed

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

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -132,16 +132,6 @@ jobs:
132132
compiler_pkgs: "gcc-10 g++-10 gcc-10-multilib g++-10-multilib libc6-dev-i386
133133
libc6-dbg:i386 zlib1g-dev:i386 libssl-dev:i386"
134134

135-
# keep one FP disabled configuration
136-
- os: "ubuntu-20.04"
137-
cc: "gcc-10"
138-
cxx: "g++-10"
139-
cflags: "-O3"
140-
otp: "24"
141-
elixir_version: "1.14"
142-
cmake_opts: "-DAVM_DISABLE_FP=on"
143-
compiler_pkgs: "gcc-10 g++-10"
144-
145135
env:
146136
CC: ${{ matrix.cc }}
147137
CXX: ${{ matrix.cxx }}

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
3434
- Added functions `esp:sleep_enable_ext0_wakeup/2` and `esp:sleep_enable_ext1_wakeup/2.`
3535
- Added support for FP opcodes 94-102 thus removing the need for `AVM_DISABLE_FP=On` with OTP-22+
3636
- Added support for stacktraces
37+
- Added support for `utf-8`, `utf-16`, and `utf-32` bit syntax modifiers (put and match)
38+
3739

3840
### Fixed
3941
- Fixed issue with formatting integers with io:format() on STM32 platform

README.Md

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -54,16 +54,6 @@ $ make
5454
$ ./src/AtomVM ./examples/erlang/hello_world.avm
5555
```
5656

57-
If you are using OTP 22 or 23, you need to disable FP opcodes with:
58-
59-
```
60-
$ mkdir build
61-
$ cd build
62-
$ cmake -DAVM_DISABLE_FP=on ..
63-
$ make
64-
$ ./src/AtomVM ./examples/erlang/hello_world.avm
65-
```
66-
6757
Run tests within build directory with:
6858
```
6959
$ ./tests/test-erlang

doc/src/programmers-guide.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ A high level overview of the supported language features include:
2020

2121
* All the major Erlang types, including
2222
* integers (with size limits)
23-
* limited support for floats (not supported on all platforms)
23+
* floats
2424
* tuples
2525
* lists
2626
* binaries

libs/estdlib/src/gen_statem.erl

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@
4242
%%-----------------------------------------------------------------------------
4343
-module(gen_statem).
4444

45-
-export([start/3, start/4, stop/1, stop/3, call/2, call/3, cast/2, reply/2]).
45+
-export([
46+
start/3, start/4, start_link/3, start_link/4, stop/1, stop/3, call/2, call/3, cast/2, reply/2
47+
]).
4648
-export([init/1, handle_call/3, handle_cast/2, handle_info/2, terminate/2]).
4749

4850
-record(state, {
@@ -98,6 +100,53 @@ start({local, Name} = ServerName, Module, Args, Options) when is_atom(Name) ->
98100
start(Module, Args, Options) ->
99101
gen_server:start(?MODULE, {Module, Args}, Options).
100102

103+
%%-----------------------------------------------------------------------------
104+
%% @param ServerName the name with which to register the gen_statem
105+
%% @param Module the module in which the gen_statem callbacks are defined
106+
%% @param Args the arguments to pass to the module's init callback
107+
%% @param Options the options used to create the gen_statem
108+
%% @returns the gen_statem pid, if successful; {error, Reason}, otherwise.
109+
%% @doc Start a named gen_statem.
110+
%%
111+
%% This function will start a gen_statem instance and register the
112+
%% newly created process with the process registry. Subsequent calls
113+
%% may use the gen_statem name, in lieu of the process id.
114+
%%
115+
%% This version of the start function will link the started gen_statem
116+
%% process to the calling process.
117+
%%
118+
%% <em><b>Note.</b> The Options argument is currently ignored.</em>
119+
%% @end
120+
%%-----------------------------------------------------------------------------
121+
-spec start_link(
122+
ServerName :: {local, Name :: atom()},
123+
Module :: module(),
124+
Args :: term(),
125+
Options :: options()
126+
) -> {ok, pid()} | {error, Reason :: term()}.
127+
start_link({local, Name} = ServerName, Module, Args, Options) when is_atom(Name) ->
128+
gen_server:start_link(ServerName, ?MODULE, {Module, Args}, Options).
129+
130+
%%-----------------------------------------------------------------------------
131+
%% @param Module the module in which the gen_statem callbacks are defined
132+
%% @param Args the arguments to pass to the module's init callback
133+
%% @param Options the options used to create the gen_statem
134+
%% @returns the gen_statem pid, if successful; {error, Reason}, otherwise.
135+
%% @doc Start an un-named gen_statem.
136+
%%
137+
%% This function will start a gen_statem instance.
138+
%%
139+
%% This version of the start function will link the started gen_statem
140+
%% process to the calling process.
141+
%%
142+
%% <em><b>Note.</b> The Options argument is currently ignored.</em>
143+
%% @end
144+
%%-----------------------------------------------------------------------------
145+
-spec start_link(Module :: module(), Args :: term(), Options :: options()) ->
146+
{ok, pid()} | {error, Reason :: term()}.
147+
start_link(Module, Args, Options) ->
148+
gen_server:start_link(?MODULE, {Module, Args}, Options).
149+
101150
%%-----------------------------------------------------------------------------
102151
%% @equiv stop(ServerRef, normal, infinity)
103152
%% @doc Stop a previously started gen_statem.

src/libAtomVM/CMakeLists.txt

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -102,22 +102,18 @@ if (ADVANCED_TRACING)
102102
target_compile_definitions(libAtomVM PUBLIC ENABLE_ADVANCED_TRACE)
103103
endif()
104104

105-
if (AVM_DISABLE_FP)
106-
target_compile_definitions(libAtomVM PUBLIC AVM_NO_FP)
107-
else()
108-
target_link_libraries(libAtomVM PUBLIC m)
109-
include(CheckCSourceCompiles)
110-
set(CMAKE_REQUIRED_FLAGS -Werror=unknown-pragmas)
111-
check_c_source_compiles("
112-
#include <fenv.h>
113-
int main() {
114-
#pragma STDC FENV_ACCESS ON
115-
return 0;
116-
}
117-
" HAVE_PRAGMA_STDC_FENV_ACCESS)
118-
if (HAVE_PRAGMA_STDC_FENV_ACCESS)
119-
target_compile_definitions(libAtomVM PUBLIC HAVE_PRAGMA_STDC_FENV_ACCESS)
120-
endif()
105+
target_link_libraries(libAtomVM PUBLIC m)
106+
include(CheckCSourceCompiles)
107+
set(CMAKE_REQUIRED_FLAGS -Werror=unknown-pragmas)
108+
check_c_source_compiles("
109+
#include <fenv.h>
110+
int main() {
111+
#pragma STDC FENV_ACCESS ON
112+
return 0;
113+
}
114+
" HAVE_PRAGMA_STDC_FENV_ACCESS)
115+
if (HAVE_PRAGMA_STDC_FENV_ACCESS)
116+
target_compile_definitions(libAtomVM PUBLIC HAVE_PRAGMA_STDC_FENV_ACCESS)
121117
endif()
122118

123119
if(${CMAKE_C_FLAGS} MATCHES -DAVM_NO_SMP)
@@ -137,9 +133,6 @@ endif()
137133

138134
if (AVM_USE_32BIT_FLOAT)
139135
target_compile_definitions(libAtomVM PUBLIC AVM_USE_SINGLE_PRECISION)
140-
if (AVM_DISABLE_FP)
141-
message(FATAL_ERROR "AVM_USE_32BIT_FLOAT and AVM_DISABLE_FP options conflict")
142-
endif()
143136
endif()
144137

145138
if (AVM_VERBOSE_ABORT)

0 commit comments

Comments
 (0)