File 1111-Don-t-fail-type-assertion-when-BEAM-file-lacks-types.patch of Package erlang

From 9da79ed538d721990cfae25253b4b06c850a98f0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= <bjorn@erlang.org>
Date: Mon, 4 Sep 2023 08:30:34 +0200
Subject: [PATCH] Don't fail type assertion when BEAM file lacks types

In the DEBUG build, the assertion that checks that a fun about to be
called is a fun would fail if the type information had been stripped
from the BEAM file.
---
 erts/emulator/beam/jit/arm/instr_fun.cpp | 4 ++--
 erts/emulator/beam/jit/x86/instr_fun.cpp | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/erts/emulator/beam/jit/arm/instr_fun.cpp b/erts/emulator/beam/jit/arm/instr_fun.cpp
index fd6bce467c..72b00e0392 100644
--- a/erts/emulator/beam/jit/arm/instr_fun.cpp
+++ b/erts/emulator/beam/jit/arm/instr_fun.cpp
@@ -403,7 +403,7 @@ void BeamModuleAssembler::emit_i_call_fun2(const ArgVal &Tag,
          * funs with the same arity. */
         mov_imm(ARG3, MAKE_FUN_HEADER(Arity.get(), 0, 0) & 0xFFFF);
 
-        ASSERT(Tag.as<ArgImmed>().get() != am_safe ||
+        ASSERT(Tag.as<ArgImmed>().get() != am_safe || beam->types.fallback ||
                exact_type<BeamTypeId::Fun>(Func));
         auto target =
                 emit_call_fun(always_one_of<BeamTypeId::AlwaysBoxed>(Func),
@@ -427,7 +427,7 @@ void BeamModuleAssembler::emit_i_call_fun2_last(const ArgVal &Tag,
          * funs with the same arity. */
         mov_imm(ARG3, MAKE_FUN_HEADER(Arity.get(), 0, 0) & 0xFFFF);
 
-        ASSERT(Tag.as<ArgImmed>().get() != am_safe ||
+        ASSERT(Tag.as<ArgImmed>().get() != am_safe || beam->types.fallback ||
                exact_type<BeamTypeId::Fun>(Func));
         auto target =
                 emit_call_fun(always_one_of<BeamTypeId::AlwaysBoxed>(Func),
diff --git a/erts/emulator/beam/jit/x86/instr_fun.cpp b/erts/emulator/beam/jit/x86/instr_fun.cpp
index e0413977c2..2d7fe8c168 100644
--- a/erts/emulator/beam/jit/x86/instr_fun.cpp
+++ b/erts/emulator/beam/jit/x86/instr_fun.cpp
@@ -372,7 +372,7 @@ void BeamModuleAssembler::emit_i_call_fun2(const ArgVal &Tag,
          * funs with the same arity. */
         mov_imm(ARG3, MAKE_FUN_HEADER(Arity.get(), 0, 0) & 0xFFFF);
 
-        ASSERT(Tag.as<ArgImmed>().get() != am_safe ||
+        ASSERT(Tag.as<ArgImmed>().get() != am_safe || beam->types.fallback ||
                exact_type<BeamTypeId::Fun>(Func));
         auto target =
                 emit_call_fun(always_one_of<BeamTypeId::AlwaysBoxed>(Func),
@@ -396,7 +396,7 @@ void BeamModuleAssembler::emit_i_call_fun2_last(const ArgVal &Tag,
          * funs with the same arity. */
         mov_imm(ARG3, MAKE_FUN_HEADER(Arity.get(), 0, 0) & 0xFFFF);
 
-        ASSERT(Tag.as<ArgImmed>().get() != am_safe ||
+        ASSERT(Tag.as<ArgImmed>().get() != am_safe || beam->types.fallback ||
                exact_type<BeamTypeId::Fun>(Func));
         auto target =
                 emit_call_fun(always_one_of<BeamTypeId::AlwaysBoxed>(Func),
-- 
2.35.3

openSUSE Build Service is sponsored by