Machine-Code Reflection (RFC)

Kyle Lahnakoski kyle@arcavia.com
Tue, 06 Jun 2000 06:05:34 -0400


Joseph Bowers wrote:

> How might reflexive machine code be handled? There is going
> to have to be a little bit present, and it seems kind of sad
> to have some involate core at the center of the system. I suppose
> something like
> 
> some code...
> JMP past_comment
> metadata here
> past_comment: more code
> 
> is reasonable, as is accompanying all code segments with descriptor
> segments or something, but I haven't a clue as to the details of
> how this has been done in the past, or how it might be done, or
> how to get out of having to do it without sacraficing some important
> capabilities...

I consider executable code to be a particular view of the function.  The
code exists as a block of bytes.  This block of bytes is logged in an
entry somewhere that associates it with the other attributes of the
function.  This log entry could also store a second (readable) copy for
inspection.  Therefore it would not matter of the block of code is
directly interpretable or not; it can be a result of a one-way
function.  

My project stores everything in tables, here is a simplified version of
what I am doing:


Function_Type
	ID		//unique ID for this function
	Start_StateID	//points to a state machine describing function
	Return_TypeID	//what this function returns
	
CompiledFunction
	ID		//one-to-one match with ID of Function_Type
	CompiledCode	//Block of compiled code.

The CompiledFunction table has a matching record ID for any function
that has been compiled.

-- 
----------------------------------------------------------------------
Kyle Lahnakoski                                  Arcavia Software Ltd.
(416) 892-7784                                 http://www.arcavia.com