serialization and rematerialization of CompiledMethods,assistance needed!

Tim Rowledge tim at sumeru.stanford.edu
Thu Feb 21 19:36:40 UTC 2002


"Stephen Pair" <spair at advantive.com> is claimed by the authorities to have written:

> It might be useful to come up with a "semi-compiled" format for compiled
> methods.  You could store the literals in source or some other encoded
> form.
If one really needs to do this before the VI4 is available, try the
following approach:-

Literals can be obtained from the method with #literals (duh!), stick
them in an array.
#initialPC gives you the index of the first actual bytecode, #endPC that
of the last - copy bytes from one to the other into a ByteArray.
#sourcePointer gets you the source pointer integer.
#header gets you the method header value

Now you have all the components available to save a clean set
of everything needed to recreate the method later. Take a look at
MethodNode>generate: to see how methods are normally put together and
copy as much as possible.

tim


-- 
Tim Rowledge, tim at sumeru.stanford.edu, http://sumeru.stanford.edu/tim
Strange OpCodes: CPP: Crush Plotter Pen




More information about the Squeak-dev mailing list