1998Q1/
<!-- MHonArc v2.4.4 -->
<!--X-Subject: Re: [MUD&#45;Dev] byte&#45;code anyone? -->
<!--X-From-R13: Xba Zrbaneq <wyrbaneqNqvipbz.hzbc&#45;nc.pbz> -->
<!--X-Date: Fri, 20 Feb 1998 16:13:45 +0000 -->
<!--X-Message-Id: 19980218170928.04865#divcom,umop&#45;ap.com -->
<!--X-Content-Type: text/plain -->
<!--X-Reference: 9802161647.8ues@ami&#45;cg.GraySage.Edmonton.AB.CA -->
<!--X-Head-End-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html>
<head>
<title>MUD-Dev message, Re: [MUD-Dev] byte-code anyone?</title>
<!-- meta name="robots" content="noindex,nofollow" -->
<link rev="made" href="mailto:jleonard#divcom,umop-ap.com">
</head>
<body background="/backgrounds/paperback.gif" bgcolor="#ffffff"
      text="#000000" link="#0000FF" alink="#FF0000" vlink="#006000">

  <font size="+4" color="#804040">
    <strong><em>MUD-Dev<br>mailing list archive</em></strong>
  </font>
      
<br>
[&nbsp;<a href="../">Other Periods</a>
&nbsp;|&nbsp;<a href="../../">Other mailing lists</a>
&nbsp;|&nbsp;<a href="/search.php3">Search</a>
&nbsp;]
<br clear=all><hr>
<!--X-Body-Begin-->
<!--X-User-Header-->
<!--X-User-Header-End-->
<!--X-TopPNI-->

Date:&nbsp;
[&nbsp;<a href="msg00538.html">Previous</a>
&nbsp;|&nbsp;<a href="msg00540.html">Next</a>
&nbsp;]
&nbsp;&nbsp;&nbsp;&nbsp;
Thread:&nbsp;
[&nbsp;<a href="msg00492.html">Previous</a>
&nbsp;|&nbsp;<a href="msg00458.html">Next</a>
&nbsp;]
&nbsp;&nbsp;&nbsp;&nbsp;
Index:&nbsp;
[&nbsp;<A HREF="author.html#00539">Author</A>
&nbsp;|&nbsp;<A HREF="#00539">Date</A>
&nbsp;|&nbsp;<A HREF="thread.html#00539">Thread</A>
&nbsp;]

<!--X-TopPNI-End-->
<!--X-MsgBody-->
<!--X-Subject-Header-Begin-->
<H1>Re: [MUD-Dev] byte-code anyone?</H1>
<HR>
<!--X-Subject-Header-End-->
<!--X-Head-of-Message-->
<UL>
<LI><em>To</em>: <A HREF="mailto:mud-dev#null,net">mud-dev#null,net</A></LI>
<LI><em>Subject</em>: Re: [MUD-Dev] byte-code anyone?</LI>
<LI><em>From</em>: Jon Leonard &lt;<A HREF="mailto:jleonard#divcom,umop-ap.com">jleonard#divcom,umop-ap.com</A>&gt;</LI>
<LI><em>Date</em>: Wed, 18 Feb 1998 17:09:28 -0800</LI>
<LI><em>Cc</em>: Jon Leonard &lt;<A HREF="mailto:jleonard#divcom,umop-ap.com">jleonard#divcom,umop-ap.com</A>&gt;</LI>
</UL>
<!--X-Head-of-Message-End-->
<!--X-Head-Body-Sep-Begin-->
<HR>
<!--X-Head-Body-Sep-End-->
<!--X-Body-of-Message-->
<PRE>
On Mon, Feb 16, 1998 at 10:40:57AM +0000, Chris Gray wrote:
&gt; [Jon Leonard:]
[stuff on byte codes and compiling to machine language for speed]
&gt; :My recommendations would be more complete if I were done, but here's the
&gt; :advice I'm giving myself:
&gt; :
&gt; :1) Test the virtual machine carefully starting early on, so fewer bugs need
&gt; :  to be laboriously traced by single-stepping an interpreter.
&gt;
&gt; Hmm. I'd planned on testing by fire. My byte-code machine is going to be
&gt; quite low level, so visual inspection is feasible. Also, it would be extra
&gt; work to create an 'assembler' for it.

Maybe I should have said "test with tiny cases first".  Whenever I've
spent a long time tracking down a bug, it turns out that there's a simpler
test that would have shown me the bug if I'd been more careful.
Consequently, I test for correctness early and often.

&gt; :2) Design so that no matter how perverse the byte codes you get fed are,
&gt; :  you don't crash or violate security assumptions.  Going from an interpreted
&gt; :  language to byte codes or machine code makes demonstrating correctness
&gt; :  much harder.
&gt;
&gt; That would slow the system down too much. I've found, for example, that
&gt; even having a 'default' in the byte-code case statement adds noticeable
&gt; overhead. I have made a simple disassembler that lets me see the byte-
&gt; code for functions. Since the only source of byte-code will be the simple
&gt; compiler, my current view is that checking the byte-code is not needed.
&gt; There will be some processing required to set it up for execution (linking
&gt; to other bytecode), but I think that's about it.

That is the other option, controlling all the possible bytecode sources.
Since my design calls for (eventually) passing code between servers that
don't trust each other, I can't do that.

It's a matter of taste, efficiency, and paranoia.

I'm a little suprised that the default case slows it down a lot.  Maybe
the C compiler doesn't know to just translate it as an index into a
256-element jump table (I assume you switch() on a byte), and fill in
all the unspecified ones with the default.

&gt; :4) Don't expect to be done soon.  A compiler can be a lot of work.
&gt;
&gt; Ah, but most of it is already done. I expect to be running some simple
&gt; byte-code today. I haven't even specified all of the byte-codes yet, but
&gt; doing things incrementally lets me cycle the design with little cost. As
&gt; long as I have enough for at least function entry and exit, I can run things.

File that under "Jon's advice to himself", then.  This stuff is taking
me quite a while.  Maybe the fact that I keep working on other things
is at fault.

&gt; Oh yes, AmigaOS has the 'load' and 'unload' calls, so the scheme of
&gt; compiling via an external compiler could be made to work. The big issue
&gt; would be resolution of references to the already-loaded code. You'd have
&gt; to do that with a jump vector passed to the loaded code. (I did that on
&gt; a game system on CP/M, and I also use it in my current AmigaMUD system.)

If the boundaries of your computation work out right, then you could
pass arguments through IO.  Done right, this would provide a migration
path to a distributed MUD.  One of the shared library techniques is needed
for a more typical compiled function.

Jon Leonard

</PRE>

<!--X-Body-of-Message-End-->
<!--X-MsgBody-End-->
<!--X-Follow-Ups-->
<HR>
<!--X-Follow-Ups-End-->
<!--X-References-->
<UL><LI><STRONG>References</STRONG>:
<UL>
<LI><STRONG><A NAME="00492" HREF="msg00492.html">Re: [MUD-Dev]	byte-code anyone?</A></STRONG>
<UL><LI><EM>From:</EM> cg#ami-cg,GraySage.Edmonton.AB.CA (Chris Gray)</LI></UL></LI>
</UL></LI></UL>
<!--X-References-End-->
<!--X-BotPNI-->
<UL>
<LI>Prev by Date:
<STRONG><A HREF="msg00538.html">Re: [MUD-Dev] Unique items</A></STRONG>
</LI>
<LI>Next by Date:
<STRONG><A HREF="msg00540.html">Re: [MUD-Dev]	Back on the list</A></STRONG>
</LI>
<LI>Prev by thread:
<STRONG><A HREF="msg00492.html">Re: [MUD-Dev]	byte-code anyone?</A></STRONG>
</LI>
<LI>Next by thread:
<STRONG><A HREF="msg00458.html">[MUD-Dev] Moore's Law sucks (was: 3D graphics)</A></STRONG>
</LI>
<LI>Index(es):
<UL>
<LI><A HREF="index.html#00539"><STRONG>Date</STRONG></A></LI>
<LI><A HREF="thread.html#00539"><STRONG>Thread</STRONG></A></LI>
</UL>
</LI>
</UL>

<!--X-BotPNI-End-->
<!--X-User-Footer-->
<!--X-User-Footer-End-->
<ul><li>Thread context:
<BLOCKQUOTE><UL>
<LI><strong><A NAME="00528" HREF="msg00528.html">[MUD-Dev] Re: Version Control (was: DBs and Events)</A></strong>, 
Raph &amp; Kristen Koster <a href="mailto:koster#eden,com">koster#eden,com</a>, Wed 18 Feb 1998, 19:28 GMT
<UL>
<LI><strong><A NAME="00559" HREF="msg00559.html">Re: [MUD-Dev] Re: Version Control (was: DBs and Events)</A></strong>, 
coder <a href="mailto:coder#ibm,net">coder#ibm,net</a>, Mon 23 Feb 1998, 17:31 GMT
</LI>
</UL>
<UL>
<li>&lt;Possible follow-up(s)&gt;<br>
<LI><strong><A NAME="00561" HREF="msg00561.html">Re: [MUD-Dev] Re: Version Control (was: DBs and Events)</A></strong>, 
Felix A. Croes <a href="mailto:felix#xs1,simplex.nl">felix#xs1,simplex.nl</a>, Mon 23 Feb 1998, 18:19 GMT
</LI>
</UL>
</LI>
<LI><strong><A NAME="00492" HREF="msg00492.html">Re: [MUD-Dev]	byte-code anyone?</A></strong>, 
Chris Gray <a href="mailto:cg#ami-cg,GraySage.Edmonton.AB.CA">cg#ami-cg,GraySage.Edmonton.AB.CA</a>, Mon 16 Feb 1998, 18:27 GMT
<UL>
<LI><strong><A NAME="00539" HREF="msg00539.html">Re: [MUD-Dev] byte-code anyone?</A></strong>, 
Jon Leonard <a href="mailto:jleonard#divcom,umop-ap.com">jleonard#divcom,umop-ap.com</a>, Fri 20 Feb 1998, 16:13 GMT
</LI>
</UL>
</LI>
<LI><strong><A NAME="00458" HREF="msg00458.html">[MUD-Dev] Moore's Law sucks (was: 3D graphics)</A></strong>, 
Brandon J. Rickman <a href="mailto:ashes#pc4,zennet.com">ashes#pc4,zennet.com</a>, Sat 14 Feb 1998, 04:16 GMT
<UL>
<LI><strong><A NAME="00459" HREF="msg00459.html">Re: [MUD-Dev] Moore's Law sucks (was: 3D graphics)</A></strong>, 
Adam Wiggins <a href="mailto:nightfall#user2,inficad.com">nightfall#user2,inficad.com</a>, Sat 14 Feb 1998, 09:49 GMT
<UL>
<LI><strong><A NAME="00483" HREF="msg00483.html">Re: [MUD-Dev] Moore's Law sucks (was: 3D graphics)</A></strong>, 
coder <a href="mailto:coder#ibm,net">coder#ibm,net</a>, Mon 16 Feb 1998, 07:38 GMT
<UL>
<LI><strong><A NAME="00537" HREF="msg00537.html">Net protocols for MUDing (was: Moore's Law sucks)</A></strong>, 
Jon Leonard <a href="mailto:jleonard#divcom,umop-ap.com">jleonard#divcom,umop-ap.com</a>, Fri 20 Feb 1998, 10:24 GMT
</LI>
</UL>
</LI>
</UL>
</LI>
</UL>
</LI>
</UL></BLOCKQUOTE>

</ul>
<hr>
<center>
[&nbsp;<a href="../">Other Periods</a>
&nbsp;|&nbsp;<a href="../../">Other mailing lists</a>
&nbsp;|&nbsp;<a href="/search.php3">Search</a>
&nbsp;]
</center>
<hr>
</body>
</html>