File 1024-Undo-flattening-of-transformation-engine-instruction.patch of Package erlang

From f0c33521499b5959ef0b9652d8973ded5522dc42 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= <bjorn@erlang.org>
Date: Wed, 10 May 2023 09:17:16 +0200
Subject: [PATCH 4/5] Undo flattening of transformation engine instructions

---
 erts/emulator/utils/beam_makeops | 52 ++++++++++++++------------------
 1 file changed, 22 insertions(+), 30 deletions(-)

diff --git a/erts/emulator/utils/beam_makeops b/erts/emulator/utils/beam_makeops
index 57f9d0fe49..aee81dd420 100755
--- a/erts/emulator/utils/beam_makeops
+++ b/erts/emulator/utils/beam_makeops
@@ -2716,27 +2716,28 @@ sub tr_gen {
     print "const Uint op_transform[] = {\n";
     foreach $key (sort keys %gen_transform) {
 	$gen_transform_offset{$key} = $offset;
-	my @instr = @{$gen_transform{$key}};
-
-	foreach $instr (@instr) {
-	    my($size, $instr_ref, $comment) = @$instr;
-	    my($op, @args) = @$instr_ref;
-	    if (!defined $op) {
-		$comment =~ s/\n(.)/\n    $1/g;
-		print $comment;
-	    } else {
+        my $lref = $gen_transform{$key};
+
+        for (my $i = 0; $i < @$lref; $i++) {
+            my(undef,undef,undef,$comment,@instr) = @{${$lref}[$i]};
+            $comment =~ s/\n(.)/\n    $1/g;
+            print $comment;
+
+            foreach $instr (@instr) {
+                my($size, $instr_ref, $comment) = @$instr;
+                my($op, @args) = @$instr_ref;
                 print "    ";
-		$op = "TOP_$op";
-		$match_engine_ops{$op} = 1;
-		if ($comment ne '') {
-		    printf "%-30s /* %s */\n", (join(", ", ($op, @args)) . ","),
-		    $comment;
-		} else {
-		    print join(", ", ($op, @args)), ",\n";
-		}
-		$offset += $size;
-	    }
-	}
+                $op = "TOP_$op";
+                $match_engine_ops{$op} = 1;
+                if ($comment ne '') {
+                    printf "%-30s /* %s */\n", (join(", ", ($op, @args)) . ","),
+                        $comment;
+                } else {
+                    print join(", ", ($op, @args)), ",\n";
+                }
+                $offset += $size;
+            }
+        }
 	print "\n";
     }
     print starred_comment("Total number of words: $offset");
@@ -3103,16 +3104,7 @@ sub group_tr {
         }
     }
 
-    #
-    # Flatten the code to a one-dimensional sequence of instructions.
-    #
-    my @code;
-    for (my $i = 0; $i < @$lref; $i++) {
-        my($first,$second,$cannot_fail,$comment,@c) = @{${$lref}[$i]};
-        push @code, make_op($comment);
-        push @code, @c;
-    }
-    \@code;
+    $lref;
 }
 
 sub tr_maybe_keep {
-- 
2.35.3

openSUSE Build Service is sponsored by