MOO-cows Mailing List Archive

[Prev][Next][Index][Thread]

Unknown opcode in disassemble()



I disassembled the following verb($list_utils:assoc):

"assoc(target,list[,index]) returns the first element of `list' whose own index-th element is target.  Index defaults to 1.";
"returns {} if no such element is found";
try
  return listassoc(@args);
except (E_INVARG)
  {target, lst, ?indx = 1} = args;
  for t in (lst)
    if (t[indx] == target)
      "... do this test first since it's the most likely to fail; this needs -d";
      if (typeof(t) == LIST && length(t) >= indx)
        return t;
      endif
    endif
  endfor
  return {};
endtry

The try-except-endtry stuff is in there incase I ever compile the server
without the listassoc() builtin.  Anyway, here's the disassemble of it:

Language version number: 3
First line number: 1
 
Main code vector:
=================
[Bytes for labels = 1, literals = 1, forks = 1, variables = 1, stack refs = 1]
[Maximum stack size = 4]
  0: 100 000               PUSH_LITERAL "assoc(target,list[,index]) returns 
the first element of `list' whose own index-th element is target.  Index 
defaults to 1."
  2: 111                   POP
  3: 100 001               PUSH_LITERAL "returns {} if no such element is 
found"
  5: 111                   POP
  6: 100 002               PUSH_LITERAL E_INVARG
  8: 016                 * MAKE_SINGLETON_LIST
  9: 112 002 023           *** Unknown extended opcode *** 23
 12: 112 008 001         * TRY_EXCEPT 1
 15: 076                   PUSH args
 16: 017                 * CHECK_LIST_FOR_SPLICE
 17: 012 023             * CALL_FUNC listassoc
 19: 108                   RETURN
 20: 112 004 082           END_EXCEPT 82
 23: 111                   POP
 24: 076                   PUSH args
 25: 112 013 003 002 004
     018 000 019 000 020
     037 040             * SCATTER 3/2/4: target/0 lst/0 indx/37 40
 37: 124                   NUM 1
 38: 054                 * PUT indx
 39: 111                   POP
 40: 111                   POP
 41: 086                   PUSH lst
 42: 124                   NUM 1
 43: 005 021 080         * FOR_LIST t 80
 46: 088                   PUSH t
 47: 087                   PUSH indx
 48: 014                 * INDEX
 49: 085                   PUSH target
 50: 023                 * EQ
 51: 000 078             * IF 78
 53: 100 003               PUSH_LITERAL "... do this test first since it's the 
most likely to fail; this needs -d"
 55: 111                   POP
 56: 088                   PUSH t
 57: 016                 * MAKE_SINGLETON_LIST
 58: 012 093             * CALL_FUNC typeof
 60: 070                   PUSH LIST
 61: 023                 * EQ
 62: 030 070             * AND 70
 64: 088                   PUSH t
 65: 016                 * MAKE_SINGLETON_LIST
 66: 012 046             * CALL_FUNC length
 68: 087                   PUSH indx
 69: 028                 * GE
 70: 000 076             * IF 76
 72: 088                   PUSH t
 73: 108                   RETURN
 74: 107 076               JUMP 76
 76: 107 078               JUMP 78
 78: 107 043               JUMP 43
 80: 101                   MAKE_EMPTY_LIST
 81: 108                   RETURN
 82: 110                   DONE

Line 9 is what threw me... I dunno if that's dangerous or just something
that wasn't updated in disassemble().  This is under version 1.8.0p2.

---
   Brian Buchanan    sysop@calbbs.com    brian@wasteland.calbbs.com
-= ArchWizard of Digital Wasteland MOO (wasteland.calbbs.com 8888) =-


Follow-Ups:

Home | Subject Index | Thread Index