This is a patch for eq and ne that supports more combinations of
I, N and S, including ones that may be considered redundant.

There is also default popping of the call stack if there is no
branch address specified.  I understand that I can branch to an
intermediate label and call ret myself, but I'd like a more
concise way.

If this one is ok with you guys, I will patch lt and gt similarly.
An example will be posted in a separate email shortly.

-Hao

--- core.ops    Wed Dec  5 11:54:44 2001
+++ core.ops.old        Wed Dec  5 10:41:31 2001
@@ -447,245 +447,73 @@

 ########################################

-=item B<eq>(i|ic, i|ic)
+=item B<eq>(i, i, ic)

-=item B<eq>(n|nc, n|nc)
+=item B<eq>(i, ic, ic)

-=item B<eq>(s|sc, s|sc)
+=item B<eq>(n, n, ic)

-=item B<eq>(i|ic, i|ic, ic)
+=item B<eq>(n, nc, ic)

-=item B<eq>(n|nc, n|nc, ic)
+=item B<eq>(s, s, ic)

-=item B<eq>(s|sc, s|sc, ic)
+=item B<eq>(s, sc, ic)

 Branch if $1 is equal to $2.

-Return address is popped off the call stack if no address is supplied.
-
 =cut

-AUTO_OP eq (i, i|ic) {
-  opcode_t *dest;
-  if ($1 == $2) {
-    pop_generic_entry (
-      interpreter, &interpreter->control_stack_top,
-      &dest, STACK_ENTRY_DESTINATION
-    );
-    RETABS(dest);
-  }
-}
-
-AUTO_OP eq (ic, i|ic) {
-  opcode_t *dest;
-  if ($1 == $2) {
-    pop_generic_entry (
-      interpreter, &interpreter->control_stack_top,
-      &dest, STACK_ENTRY_DESTINATION
-    );
-    RETABS(dest);
-  }
-}
-
-AUTO_OP eq (n, n|nc) {
-  opcode_t *dest;
-  if ($1 == $2) {
-    pop_generic_entry (
-      interpreter, &interpreter->control_stack_top,
-      &dest, STACK_ENTRY_DESTINATION
-    );
-    RETABS(dest);
-  }
-}
-
-AUTO_OP eq (nc, n|nc) {
-  opcode_t *dest;
-  if ($1 == $2) {
-    pop_generic_entry (
-      interpreter, &interpreter->control_stack_top,
-      &dest, STACK_ENTRY_DESTINATION
-    );
-    RETABS(dest);
-  }
-}
-
-AUTO_OP eq (s, s|sc) {
-  opcode_t *dest;
-  if (string_compare (interpreter, $1, $2) == 0) {
-    pop_generic_entry (
-      interpreter, &interpreter->control_stack_top,
-      &dest, STACK_ENTRY_DESTINATION
-    );
-    RETABS(dest);
-  }
-}
-
-AUTO_OP eq (sc, s|sc) {
-  opcode_t *dest;
-  if (string_compare (interpreter, $1, $2) == 0) {
-    pop_generic_entry (
-      interpreter, &interpreter->control_stack_top,
-      &dest, STACK_ENTRY_DESTINATION
-    );
-    RETABS(dest);
-  }
-}
-
 AUTO_OP eq(i, i|ic, ic) {
   if ($1 == $2) {
     RETREL($3);
   }
 }

-AUTO_OP eq (ic, i|ic, ic) {
-  if ($1 == $2) {
-    RETREL($3);
-  }
-}
-
 AUTO_OP eq(n, n|nc, ic) {
   if ($1 == $2) {
     RETREL($3);
   }
 }

-AUTO_OP eq (nc, n|nc, ic) {
-  if ($1 == $2) {
-    RETREL($3);
-  }
-}
-
 AUTO_OP eq(s, s|sc, ic) {
   if (string_compare(interpreter, $1, $2) == 0) {
     RETREL($3);
   }
 }

-AUTO_OP eq (sc, s|sc, ic) {
-  if (string_compare (interpreter, $1, $2) == 0) {
-    RETREL($3);
-  }
-}
-

 ########################################

-=item B<ne>(i|ic, i|ic)
+=item B<ne>(i, i, ic)

-=item B<ne>(n|nc, n|nc)
+=item B<ne>(i, ic, ic)

-=item B<ne>(s|sc, s|sc)
+=item B<ne>(n, n, ic)

-=item B<ne>(i|ic, i|ic, ic)
+=item B<ne>(n, nc, ic)

-=item B<ne>(n|nc, n|nc, ic)
+=item B<ne>(s, s, ic)

-=item B<ne>(s|sc, s|sc, ic)
+=item B<ne>(s, sc, ic)

 Branch if $1 is not equal to $2.

-Return address is popped off the call stack if no address is supplied.
-
 =cut

-AUTO_OP ne (i, i|ic) {
-  opcode_t *dest;
-  if ($1 != $2) {
-    pop_generic_entry (
-      interpreter, &interpreter->control_stack_top,
-      &dest, STACK_ENTRY_DESTINATION
-    );
-    RETABS(dest);
-  }
-}
-
-AUTO_OP ne (ic, i|ic) {
-  opcode_t *dest;
-  if ($1 != $2) {
-    pop_generic_entry (
-      interpreter, &interpreter->control_stack_top,
-      &dest, STACK_ENTRY_DESTINATION
-    );
-    RETABS(dest);
-  }
-}
-
-AUTO_OP ne (n, n|nc) {
-  opcode_t *dest;
-  if ($1 != $2) {
-    pop_generic_entry (
-      interpreter, &interpreter->control_stack_top,
-      &dest, STACK_ENTRY_DESTINATION
-    );
-    RETABS(dest);
-  }
-}
-
-AUTO_OP ne (nc, n|nc) {
-  opcode_t *dest;
-  if ($1 != $2) {
-    pop_generic_entry (
-      interpreter, &interpreter->control_stack_top,
-      &dest, STACK_ENTRY_DESTINATION
-    );
-    RETABS(dest);
-  }
-}
-
-AUTO_OP ne (s, s|sc) {
-  opcode_t *dest;
-  if (string_compare (interpreter, $1, $2) != 0) {
-    pop_generic_entry (
-      interpreter, &interpreter->control_stack_top,
-      &dest, STACK_ENTRY_DESTINATION
-    );
-    RETABS(dest);
-  }
-}
-
-AUTO_OP ne (sc, s|sc) {
-  opcode_t *dest;
-  if (string_compare (interpreter, $1, $2) != 0) {
-    pop_generic_entry (
-      interpreter, &interpreter->control_stack_top,
-      &dest, STACK_ENTRY_DESTINATION
-    );
-    RETABS(dest);
-  }
-}
-
 AUTO_OP ne(i, i|ic, ic) {
   if ($1 != $2) {
     RETREL($3);
   }
 }

-AUTO_OP ne (ic, i|ic, ic) {
-  if ($1 != $2) {
-    RETREL($3);
-  }
-}
-
 AUTO_OP ne(n, n|nc, ic) {
   if ($1 != $2) {
     RETREL($3);
   }
 }

-AUTO_OP ne (nc, n|nc, ic) {
-  if ($1 != $2) {
-    RETREL($3);
-  }
-}
-
 AUTO_OP ne(s, s|sc, ic) {
   if (string_compare(interpreter, $1, $2) != 0) {
-    RETREL($3);
-  }
-}
-
-AUTO_OP ne (sc, s|sc, ic) {
-  if (string_compare (interpreter, $1, $2) != 0) {
     RETREL($3);
   }
 }

Reply via email to