Skip to content

Commit c59671c

Browse files
committed
Merge pull request #436 from pguyot/w47/add-otp25-opcodes
Tests pass with beams compiled with OTP-25. These changes are made under both the "Apache 2.0" and the "GNU Lesser General Public License 2.1 or later" license terms (dual license). SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later
2 parents ca0b613 + 45ea90d commit c59671c

File tree

11 files changed

+573
-113
lines changed

11 files changed

+573
-113
lines changed

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

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@ on: [push, pull_request]
1010

1111
jobs:
1212
build-and-test:
13-
runs-on: "macos-11"
13+
runs-on: ${{ matrix.os }}
14+
strategy:
15+
matrix:
16+
os: ["macos-11"]
17+
otp: ["23", "24", "25"]
1418

1519
steps:
1620
# Setup
@@ -20,7 +24,7 @@ jobs:
2024
submodules: 'recursive'
2125

2226
- name: "Install deps"
23-
run: brew install gperf doxygen erlang@21 ninja
27+
run: brew install gperf doxygen erlang@${{ matrix.otp }} ninja
2428

2529
# Builder info
2630
- name: "System info"
@@ -40,13 +44,13 @@ jobs:
4044
- name: "Build: run cmake"
4145
working-directory: build
4246
run: |
43-
export PATH="/usr/local/opt/erlang@21/bin:$PATH"
47+
export PATH="/usr/local/opt/erlang@${{ matrix.otp }}/bin:$PATH"
4448
cmake -G Ninja -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl ..
4549
4650
- name: "Build: run ninja"
4751
working-directory: build
4852
run: |
49-
export PATH="/usr/local/opt/erlang@21/bin:$PATH"
53+
export PATH="/usr/local/opt/erlang@${{ matrix.otp }}/bin:$PATH"
5054
ninja
5155
5256
# Test

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ name: Build and Test on Other Architectures
99
on: [push, pull_request]
1010

1111
env:
12-
otp_version: 21
13-
elixir_version: 1.9
12+
otp_version: 24
13+
elixir_version: 1.14
1414

1515
jobs:
1616
build-and-test-other:

src/libAtomVM/defaultatoms.c

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,18 @@ static const char *const timeout_value_atom = "\xD" "timeout_value";
103103
static const char *const machine_atom = "\x7" "machine";
104104
static const char *const avm_floatsize_atom = "\xD" "avm_floatsize";
105105

106+
static const char *const append_atom = "\x6" "append";
107+
static const char *const private_append_atom = "\xE" "private_append";
108+
static const char *const binary_atom = "\x6" "binary";
109+
static const char *const integer_atom = "\x7" "integer";
110+
static const char *const little_atom = "\x6" "little";
111+
static const char *const native_atom = "\x6" "native";
112+
static const char *const string_atom = "\x6" "string";
113+
static const char *const utf8_atom = "\x4" "utf8";
114+
static const char *const utf16_atom = "\x5" "utf16";
115+
static const char *const utf32_atom = "\x5" "utf32";
116+
static const char *const badrecord_atom = "\x9" "badrecord";
117+
106118
void defaultatoms_init(GlobalContext *glb)
107119
{
108120
int ok = 1;
@@ -190,6 +202,18 @@ void defaultatoms_init(GlobalContext *glb)
190202
ok &= globalcontext_insert_atom(glb, machine_atom) == MACHINE_ATOM_INDEX;
191203
ok &= globalcontext_insert_atom(glb, avm_floatsize_atom) == AVM_FLOATSIZE_ATOM_INDEX;
192204

205+
ok &= globalcontext_insert_atom(glb, append_atom) == APPEND_ATOM_INDEX;
206+
ok &= globalcontext_insert_atom(glb, private_append_atom) == PRIVATE_APPEND_ATOM_INDEX;
207+
ok &= globalcontext_insert_atom(glb, binary_atom) == BINARY_ATOM_INDEX;
208+
ok &= globalcontext_insert_atom(glb, integer_atom) == INTEGER_ATOM_INDEX;
209+
ok &= globalcontext_insert_atom(glb, little_atom) == LITTLE_ATOM_INDEX;
210+
ok &= globalcontext_insert_atom(glb, native_atom) == NATIVE_ATOM_INDEX;
211+
ok &= globalcontext_insert_atom(glb, string_atom) == STRING_ATOM_INDEX;
212+
ok &= globalcontext_insert_atom(glb, utf8_atom) == UTF8_ATOM_INDEX;
213+
ok &= globalcontext_insert_atom(glb, utf16_atom) == UTF16_ATOM_INDEX;
214+
ok &= globalcontext_insert_atom(glb, utf32_atom) == UTF32_ATOM_INDEX;
215+
ok &= globalcontext_insert_atom(glb, badrecord_atom) == BADRECORD_ATOM_INDEX;
216+
193217
if (!ok) {
194218
AVM_ABORT();
195219
}

src/libAtomVM/defaultatoms.h

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,15 +112,27 @@ extern "C" {
112112
#define MACHINE_ATOM_INDEX 65
113113
#define AVM_FLOATSIZE_ATOM_INDEX 66
114114

115-
#define PLATFORM_ATOMS_BASE_INDEX 67
115+
#define APPEND_ATOM_INDEX 67
116+
#define PRIVATE_APPEND_ATOM_INDEX 68
117+
#define BINARY_ATOM_INDEX 69
118+
#define INTEGER_ATOM_INDEX 70
119+
#define LITTLE_ATOM_INDEX 71
120+
#define NATIVE_ATOM_INDEX 72
121+
#define STRING_ATOM_INDEX 73
122+
#define UTF8_ATOM_INDEX 74
123+
#define UTF16_ATOM_INDEX 75
124+
#define UTF32_ATOM_INDEX 76
125+
#define BADRECORD_ATOM_INDEX 77
126+
127+
#define PLATFORM_ATOMS_BASE_INDEX 78
116128

117129
#define FALSE_ATOM TERM_FROM_ATOM_INDEX(FALSE_ATOM_INDEX)
118130
#define TRUE_ATOM TERM_FROM_ATOM_INDEX(TRUE_ATOM_INDEX)
119131

120132
#define OK_ATOM term_from_atom_index(OK_ATOM_INDEX)
121133
#define ERROR_ATOM term_from_atom_index(ERROR_ATOM_INDEX)
122134

123-
#define UNDEFINED_ATOM term_from_atom_index(UNDEFINED_ATOM_INDEX)
135+
#define UNDEFINED_ATOM TERM_FROM_ATOM_INDEX(UNDEFINED_ATOM_INDEX)
124136

125137
#define BADARG_ATOM term_from_atom_index(BADARG_ATOM_INDEX)
126138
#define BADARITH_ATOM term_from_atom_index(BADARITH_ATOM_INDEX)
@@ -199,6 +211,18 @@ extern "C" {
199211
#define MACHINE_ATOM TERM_FROM_ATOM_INDEX(MACHINE_ATOM_INDEX)
200212
#define AVM_FLOATSIZE_ATOM TERM_FROM_ATOM_INDEX(AVM_FLOATSIZE_ATOM_INDEX)
201213

214+
#define APPEND_ATOM TERM_FROM_ATOM_INDEX(APPEND_ATOM_INDEX)
215+
#define PRIVATE_APPEND_ATOM TERM_FROM_ATOM_INDEX(PRIVATE_APPEND_ATOM_INDEX)
216+
#define BINARY_ATOM TERM_FROM_ATOM_INDEX(BINARY_ATOM_INDEX)
217+
#define INTEGER_ATOM TERM_FROM_ATOM_INDEX(INTEGER_ATOM_INDEX)
218+
#define LITTLE_ATOM TERM_FROM_ATOM_INDEX(LITTLE_ATOM_INDEX)
219+
#define NATIVE_ATOM TERM_FROM_ATOM_INDEX(NATIVE_ATOM_INDEX)
220+
#define STRING_ATOM TERM_FROM_ATOM_INDEX(STRING_ATOM_INDEX)
221+
#define UTF8_ATOM TERM_FROM_ATOM_INDEX(UTF8_ATOM_INDEX)
222+
#define UTF16_ATOM TERM_FROM_ATOM_INDEX(UTF16_ATOM_INDEX)
223+
#define UTF32_ATOM TERM_FROM_ATOM_INDEX(UTF32_ATOM_INDEX)
224+
#define BADRECORD_ATOM TERM_FROM_ATOM_INDEX(BADRECORD_ATOM_INDEX)
225+
202226
void defaultatoms_init(GlobalContext *glb);
203227

204228
void platform_defaultatoms_init(GlobalContext *glb);

src/libAtomVM/opcodes.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,9 @@
121121
#define OP_BS_CONTEXT_TO_BINARY 130
122122
#define OP_BS_TEST_UNIT 131
123123
#define OP_BS_MATCH_STRING 132
124+
#define OP_BS_INIT_WRITABLE 133
124125
#define OP_BS_APPEND 134
126+
#define OP_BS_PRIVATE_APPEND 135
125127
#define OP_TRIM 136
126128
#define OP_BS_INIT_BITS 137
127129
#define OP_BS_UTF8_SIZE 144
@@ -155,5 +157,8 @@
155157
#define OP_RECV_MARKER_CLEAR 174
156158
#define OP_RECV_MARKER_RESERVE 175
157159
#define OP_RECV_MARKER_USE 176
160+
#define OP_BS_CREATE_BIN 177
161+
#define OP_CALL_FUN2 178
162+
#define OP_BADRECORD 180
158163

159164
#endif

0 commit comments

Comments
 (0)