# New Ticket Created by  "Sean O'Rourke" 
# Please include the string:  [netlabs #791]
# in the subject line of all future correspondence about this issue. 
# <URL: http://bugs6.perl.org/rt2/Ticket/Display.html?id=791 >


This patch adds several ops that exist in the vtables, and seem useful,
but aren't in core.ops yet:

- le, lt, ge, gt, eq, ne on PMC's
- defined(INT, PMC)
- neg(PMC, PMC)

/s


-- attachment  1 ------------------------------------------------------
url: http://bugs6.perl.org/rt2/attach/3731/3471/05e9b6/core.ops.patch

*** core.ops.~1.181.~   Sat Jul  6 13:08:59 2002
--- core.ops    Wed Jul 10 19:03:39 2002
***************
*** 1132,1143 ****
--- 1132,1147 ----
  
  =item B<eq>(in STR, in STR)
  
+ =item B<eq>(in PMC, in PMC)
+ 
  =item B<eq>(in INT, in INT, inconst INT)
  
  =item B<eq>(in NUM, in NUM, inconst INT)
  
  =item B<eq>(in STR, in STR, inconst INT)
  
+ =item B<eq>(in PMC, in PMC, inconst INT)
+ 
  Branch if $1 is equal to $2.
  
  Return address is popped off the call stack if no address is supplied.
***************
*** 1165,1170 ****
--- 1169,1181 ----
    goto NEXT();
  }
  
+ op eq (in PMC, in PMC) {
+   if ($1->vtable->is_equal(interpreter, $1, $2)) {
+     goto POP();
+   }
+   goto NEXT();
+ }
+ 
  inline op eq(in INT, in INT, inconst INT) {
    if ($1 == $2) {
      goto OFFSET($3);
***************
*** 1186,1191 ****
--- 1197,1208 ----
    goto NEXT();
  }
  
+ op eq (in PMC, in PMC, inconst INT) {
+   if ($1->vtable->is_equal(interpreter, $1, $2)) {
+     goto OFFSET($3);
+   }
+   goto NEXT();
+ }
  
  ########################################
  
***************
*** 1195,1206 ****
--- 1212,1227 ----
  
  =item B<ne>(in STR, in STR)
  
+ =item B<ne>(in PMC, in PMC)
+ 
  =item B<ne>(in INT, in INT, inconst INT)
  
  =item B<ne>(in NUM, in NUM, inconst INT)
  
  =item B<ne>(in STR, in STR, inconst INT)
  
+ =item B<ne>(in PMC, in PMC, inconst INT)
+ 
  Branch if $1 is not equal to $2.
  
  Return address is popped off the call stack if no address is supplied.
***************
*** 1228,1233 ****
--- 1249,1261 ----
    goto NEXT();
  }
  
+ op ne (in PMC, in PMC) {
+   if (! $1->vtable->is_equal(interpreter, $1, $2)) {
+     goto POP();
+   }
+   goto NEXT();
+ }
+ 
  inline op ne(in INT, in INT, inconst INT) {
    if ($1 != $2) {
      goto OFFSET($3);
***************
*** 1249,1254 ****
--- 1277,1288 ----
    goto NEXT();
  }
  
+ op ne(in PMC, in PMC, inconst INT) {
+   if (! $1->vtable->is_equal(interpreter, $1, $2)) {
+     goto OFFSET($3);
+   }
+   goto NEXT();
+ }
  
  ########################################
  
***************
*** 1256,1265 ****
  
  =item B<lt>(in NUM, in NUM, inconst INT)
  
- =item B<lt>(in PMC, in PMC, inconst INT)
- 
  =item B<lt>(in STR, in STR, inconst INT)
  
  Branch if $1 is less than $2.
  
  =cut
--- 1290,1299 ----
  
  =item B<lt>(in NUM, in NUM, inconst INT)
  
  =item B<lt>(in STR, in STR, inconst INT)
  
+ =item B<lt>(in PMC, in PMC, inconst INT)
+ 
  Branch if $1 is less than $2.
  
  =cut
***************
*** 1285,1290 ****
--- 1319,1330 ----
    goto NEXT();
  }
  
+ op lt (in PMC, in PMC, inconst INT) {
+   if ($1->vtable->cmp(interpreter, $1, $2) < 0) {
+     goto OFFSET($3);
+   }
+   goto NEXT();
+ }
  
  ########################################
  
***************
*** 1294,1299 ****
--- 1334,1341 ----
  
  =item B<le>(in STR, in STR, inconst INT)
  
+ =item B<le>(in PMC, in PMC, inconst INT)
+ 
  Branch if $1 is less than or equal to $2.
  
  =cut
***************
*** 1319,1324 ****
--- 1361,1372 ----
    goto NEXT();
  }
  
+ op le(in PMC, in PMC, inconst INT) {
+   if ($1->vtable->cmp(interpreter, $1, $2) <= 0) {
+     goto OFFSET($3);
+   }
+   goto NEXT();
+ }
  
  ########################################
  
***************
*** 1328,1333 ****
--- 1376,1383 ----
  
  =item B<gt>(in STR, in STR, inconst INT)
  
+ =item B<gt>(in PMC, in PMC, inconst INT)
+ 
  Branch if $1 is greater than $2.
  
  =cut
***************
*** 1353,1358 ****
--- 1403,1414 ----
    goto NEXT();
  }
  
+ op gt(in PMC, in PMC, inconst INT) {
+   if ($1->vtable->cmp(interpreter, $1, $2) > 0) {
+     goto OFFSET($3);
+   }
+   goto NEXT();
+ }
  
  ########################################
  
***************
*** 1362,1367 ****
--- 1418,1425 ----
  
  =item B<ge>(in STR, in STR, inconst INT)
  
+ =item B<ge>(in PMC, in PMC, inconst INT)
+ 
  Branch if $1 is greater than or equal to $2.
  
  =cut
***************
*** 1387,1392 ****
--- 1445,1457 ----
    goto NEXT();
  }
  
+ op ge(in PMC, in PMC, inconst INT) {
+   if ($1->vtable->cmp(interpreter, $1, $2) >= 0) {
+     goto OFFSET($3);
+   }
+   goto NEXT();
+ }
+ 
  ########################################
  
  =item B<if>(in INT, inconst INT)
***************
*** 1926,1931 ****
--- 1991,1998 ----
  
  =item B<neg>(out NUM, in NUM)
  
+ =item B<neg>(out PMC, in PMC)
+ 
  Set $1 to the negative of $2.
  
  =cut
***************
*** 1950,1955 ****
--- 2017,2026 ----
    goto NEXT();
  }
  
+ inline op neg(out PMC, in PMC) {
+   $2->vtable->neg(interpreter, $2, $1);
+   goto NEXT();
+ }
  
  ########################################
  
***************
*** 3064,3069 ****
--- 3135,3153 ----
  
  inline op xor(out PMC, in PMC, in PMC) {
    $2->vtable->logical_xor(interpreter, $2, $3, $1);
+   goto NEXT();
+ }
+ 
+ =cut
+ 
+ =item B<defined>(out INT, in PMC)
+ 
+ Test for PMC definedness.
+ 
+ =cut
+ 
+ inline op defined(out INT, in PMC) {
+   $1 = $2->vtable->defined(interpreter, $2);
    goto NEXT();
  }
  

Reply via email to