File 0557-beam_dict-Correct-types-of-local_table-1-and-export_.patch of Package erlang
From 0cf5817ecfc54150b8d827ace5a1331c53f9cd8b Mon Sep 17 00:00:00 2001
From: Frej Drejhammar <frej.drejhammar@gmail.com>
Date: Thu, 17 Jun 2021 08:58:12 +0200
Subject: [PATCH] beam_dict: Correct types of local_table/1 and export_table/1
What is returned as the `Function` is not a label index, it is the
index into the atom table for the name of the function. Therefore
change the type from `label()` to `index()`.
---
lib/compiler/src/beam_dict.erl | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/compiler/src/beam_dict.erl b/lib/compiler/src/beam_dict.erl
index 8619056cbf..dfad05be78 100644
--- a/lib/compiler/src/beam_dict.erl
+++ b/lib/compiler/src/beam_dict.erl
@@ -239,14 +239,14 @@ atom_table(#asm{atoms=Atoms}, Encoding) ->
%% Returns the table of local functions.
%% local_table(Dict) -> {NumLocals, [{Function, Arity, Label}...]}
--spec local_table(bdict()) -> {non_neg_integer(), [{label(),arity(),label()}]}.
+-spec local_table(bdict()) -> {non_neg_integer(), [{index(),arity(),label()}]}.
local_table(#asm{locals = Locals}) ->
{length(Locals),Locals}.
%% Returns the export table.
%% export_table(Dict) -> {NumExports, [{Function, Arity, Label}...]}
--spec export_table(bdict()) -> {non_neg_integer(), [{label(),arity(),label()}]}.
+-spec export_table(bdict()) -> {non_neg_integer(), [{index(),arity(),label()}]}.
export_table(#asm{exports = Exports}) ->
{length(Exports),Exports}.
--
2.26.2