File 2121-Remove-unused-field-in-erl_bits_state-struct.patch of Package erlang

From de0b2b8b147cd368b707ae59a6e3dd7e6d2dd77a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= <bjorn@erlang.org>
Date: Tue, 17 May 2022 06:16:17 +0200
Subject: [PATCH 1/3] Remove unused field in erl_bits_state struct

While at it, also update the comments, removing mentions of
old and new instruction sets. (The old instruction set was removed
a long time ago.)
---
 erts/emulator/beam/emu/bs_instrs.tab       |  3 ---
 erts/emulator/beam/erl_bits.h              | 16 ++++++----------
 erts/emulator/beam/jit/beam_jit_common.cpp |  2 --
 3 files changed, 6 insertions(+), 15 deletions(-)

diff --git a/erts/emulator/beam/emu/bs_instrs.tab b/erts/emulator/beam/emu/bs_instrs.tab
index c8bba1e70a..fe37b6fe2c 100644
--- a/erts/emulator/beam/emu/bs_instrs.tab
+++ b/erts/emulator/beam/emu/bs_instrs.tab
@@ -427,7 +427,6 @@ bs_init.verify(Fail) {
 
 bs_init.execute(Live, Dst) {
     erts_bin_offset = 0;
-    erts_writable_bin = 0;
 
     if (BsOp1 <= ERL_ONHEAP_BIN_LIMIT) {
         ErlHeapBin* hb;
@@ -539,7 +538,6 @@ bs_init_bits.execute(Live, Dst) {
      }
 
      erts_bin_offset = 0;
-     erts_writable_bin = 0;
 
      /* num_bits = Number of bits to build
       * num_bytes = Number of bytes to allocate in the binary
@@ -1113,7 +1111,6 @@ i_bs_create_bin(Fail, Alloc, Live, Dst, N) {
          * alloc = Total number of words to allocate on heap
          */
         erts_bin_offset = 0;
-        erts_writable_bin = 0;
         if (num_bytes <= ERL_ONHEAP_BIN_LIMIT) {
             ErlHeapBin* hb;
 
diff --git a/erts/emulator/beam/erl_bits.h b/erts/emulator/beam/erl_bits.h
index 4596c65959..34af1051d4 100644
--- a/erts/emulator/beam/erl_bits.h
+++ b/erts/emulator/beam/erl_bits.h
@@ -51,23 +51,20 @@ typedef struct erl_bin_match_buffer {
 
 struct erl_bits_state {
     /*
-     * Used for building binaries.
+     * Temporary buffer sometimes used by erts_new_bs_put_integer().
      */
     byte *byte_buf_;
     Uint byte_buf_len_;
+
     /*
-     * Used for building binaries using the new instruction set.
+     * Pointer to the beginning of the current binary.
      */
-    byte* erts_current_bin_;	/* Pointer to beginning of current binary. */
+    byte* erts_current_bin_;
+
     /*
-     * Offset in bits into the current binary (new instruction set) or
-     * buffer (old instruction set).
+     * Offset in bits into the current binary.
      */
     Uint erts_bin_offset_;
-    /*
-     * Whether the current binary is writable.
-     */
-     unsigned erts_writable_bin_;
 };
 
 typedef struct erl_bin_match_struct{
@@ -117,7 +114,6 @@ typedef struct erl_bin_match_struct{
 
 #define erts_bin_offset		(ErlBitsState.erts_bin_offset_)
 #define erts_current_bin	(ErlBitsState.erts_current_bin_)
-#define erts_writable_bin       (ErlBitsState.erts_writable_bin_)
 
 #define copy_binary_to_buffer(DstBuffer, DstBufOffset, SrcBuffer, SrcBufferOffset, NumBits) \
   do {											    \
diff --git a/erts/emulator/beam/jit/beam_jit_common.cpp b/erts/emulator/beam/jit/beam_jit_common.cpp
index 9ff30cc984..70630e37cc 100644
--- a/erts/emulator/beam/jit/beam_jit_common.cpp
+++ b/erts/emulator/beam/jit/beam_jit_common.cpp
@@ -729,7 +729,6 @@ Eterm beam_jit_bs_init(Process *c_p,
                        Uint alloc,
                        unsigned Live) {
     erts_bin_offset = 0;
-    erts_writable_bin = 0;
     if (num_bytes <= ERL_ONHEAP_BIN_LIMIT) {
         ErlHeapBin *hb;
         Uint bin_need;
@@ -796,7 +795,6 @@ Eterm beam_jit_bs_init_bits(Process *c_p,
     }
 
     erts_bin_offset = 0;
-    erts_writable_bin = 0;
 
     /* num_bits = Number of bits to build
      * num_bytes = Number of bytes to allocate in the binary
-- 
2.35.3

openSUSE Build Service is sponsored by