[MUD-Dev] Re: PDMud thread summary

Jon A. Lambert jlsysinc at ix.netcom.com
Fri Oct 23 11:05:51 New Zealand Daylight Time 1998


> From: Jon A. Lambert <jlsysinc at ix.netcom.com>
>

Replying to my post.  Sort of like talking to myself. ;)
 
> 
> An example header entry protocol using name-mangling:
> 
> #module at function!offset$arg1$arg1...$argn
>  
> Where #module is the module or class name
> Where @function is the function name, method name, or dataname
> Where !offset is the relative offset to executable bytecode or symbol table
> Where $arg entry would be of the following format
>

Upon further review this is lame name mangling scheme..  

Rather:  #module at function$args  makes more sense. 

The first 3 parts can be used to match the function called
allowing polymorphism.  !offset shouldn't be part of a scheme but
can be included in a module header in table format:

#mangled_name  offset

I think Chris Gray mentioned fixing bytecode memory addresses 
at startup, allowing direct jumps into functions.  While a performance
boost, it makes dynamic registration and unregistration of modules
more complex.  

Are function calls resolved at compile-time, registration, or run-time?

> $ style type 
> 
> Where style would be:
>              a argument 
>              r  return

Having the return value, buys nothing either, since the caller may not use 
it and wouldn't be able to build a proper mangled name.  
  
> int cast(int time, string spell)  ---->   #magic at cast!0x00000000$ri$ai$as
> char foo(char * bptr, bar i)    ---->  #magic at foo!0x1FBA2000$rc$apc$aebar

int cast(int time, string spell)  ---->   #magic at cast$ai$as 
char foo(char * bptr, bar i)    ---->  #magic at foo$apc$aebar

For a standard call format, why not just have the caller push() it's address and then all the 
arguments from left-to-right onto the stack then jump to the callee.  The callee pops() them 
out and loads local variables right-to-left.  Return would pop() the return address off the 
stack and push() the result and jump to the address just popped.

This is pretty simple.  There maybe better ways of doing this.  Message passing perhaps?
Thoughts?








More information about the MUD-Dev mailing list