investigate this issue, maybe check erlang/otp source
None of our tests are generating code making use of the following opcodes:
X_OPCODE(OP_ALLOCATE_ZERO, 14, allocate_zero)
X_OPCODE(OP_KILL, 17, kill)
X_OPCODE(OP_PUT, 71, put)
X_OPCODE(OP_MAKE_FUN2, 103, make_fun2)
X_OPCODE(OP_BS_ADD, 111, bs_add)
Are they still in use? Should we remove them?
Investigate unused opcodes in tests
Peter
Madsen-Mygdal • @outlog
7mo agoAll five opcodes are officially retired in Erlang/OTP's genop.tab (marked with -):
| Opcode | # | Replaced By | Since |
|---|---|---|---|
allocate_zero |
14 | allocate + init_yregs |
OTP 24 |
kill (actually init) |
17 | init_yregs |
OTP 24 |
put |
71 | put_tuple2 |
OTP 22 |
make_fun2 |
103 | make_fun3 |
OTP 24 |
bs_add |
111 | bs_create_bin |
OTP 25 |
The modern Erlang compiler has zero code paths that emit any of these. They are safe to remove if AtomVM only targets .beam files compiled with OTP 22+ (for put) / OTP 25+ (for bs_add). If you want to support loading older .beam files, keep them. Note that OP_PUT already has no case implementation in opcodesswitch.h — it's essentially dead code already.
write the table to FINDINGS.md
Done — written to FINDINGS.md.
files compiled with OTP 25+ mean otp25 included?
Yes — "OTP 25+" means OTP 25 and later. OTP 25 is the version that retired bs_add (the last of the five to go), so a .beam file compiled with OTP 25 itself will already not contain any of these opcodes.