From d9167491db220756df159048348f006619df28c1 Mon Sep 17 00:00:00 2001
From: Jeremy Evans <code@jeremyevans.net>
Date: Wed, 20 Jul 2022 12:24:50 -0700
Subject: Revert "Remove reverse VM instruction"

This reverts commit 5512353d97250e85c13bf10b9b32e750478cf474.
---
 insns.def | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

(limited to 'insns.def')

diff --git a/insns.def b/insns.def
index 06ca31a850..ebdbed6237 100644
--- a/insns.def
+++ b/insns.def
@@ -597,6 +597,25 @@ swap
     /* none */
 }
 
+/* reverse stack top N order. */
+DEFINE_INSN
+reverse
+(rb_num_t n)
+(...)
+(...)
+// attr rb_snum_t sp_inc = 0;
+{
+    rb_num_t i;
+    VALUE *sp = STACK_ADDR_FROM_TOP(n);
+
+    for (i=0; i<n/2; i++) {
+	VALUE v0 = sp[i];
+	VALUE v1 = TOPN(i);
+	sp[i] = v1;
+	TOPN(i) = v0;
+    }
+}
+
 /* for stack caching. */
 DEFINE_INSN_IF(STACK_CACHING)
 reput
-- 
cgit v1.2.3

