The method trailer format

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The method trailer format

Igor Stasenko
Here is my proposal for changing the method trailer in order to be
able to encode various stuff to trailer.

Any corrections, suggestions are welcome.

The kind of compiled method trailer is determined by the last byte of
compiled method.

The format is following:
        "2rkkkkkkdd"

where 'k' bits stands for 'kind' , allowing totally 2^6 different
kinds of method trailer
and 'd' bits is data.

The following is description of defined trailer kinds:

k = 000000, dd = 00
method has no trailer, and total trailer size bytes is 1 (just for last byte)

k = 000001,
method has cleared trailer (it was set to something else, but then cleared)
dd+1  determines the number of bytes for size field, and size is a
total length of trailer bytes
So a total length of trailer is: 1 + (dd + 1) + size

k = 000010
the trailer contains a list of method temp names,  compressed using
qCompress: method.
dd+1  determines the number of bytes for size field, and size is a
number of bytes of compressed buffer.
So a total length of trailer is:  1 + (dd + 1) + size

k = 000011
the trailer contains a list of method temp names,  compressed using
GZIP compression method.
dd+1  determines the number of bytes for size field, and size is a
number of bytes of compressed buffer
So a total length of trailer is: 1 + (dd + 1) + size

k = 000100
the trailer indicates , that method source is determined by a class +
selector where it is installed to.
Trailer size = 1.

k = 000101
the trailer indicates , that method source is determined by a class +
some ByteString identifier.
dd+1  determines the number of bytes for size field, denoting the
length of ByteString identifier.
A total length of trailer is:  1 + (dd + 1) + size

k = 000110
the trailer contains an utf-8 encoded method source code, compressed
using qCompress: method.
dd+1  determines the number of bytes for size field, denoting the
length of compressed buffer
A total length of trailer is:  1 + (dd + 1) + size

k = 000111
the trailer contains an utf-8 encoded method source code, comressed using GZIP
dd+1  determines the number of bytes for size field, denoting the
length of compressed buffer
A total length of trailer is:  1 + (dd + 1) + size

k = 111111
the trailer is encoded source pointer. Total trailer size is 4-bytes
(this is backwards compatible with most of currently existing compiled
methods)

k = 111110
the trailer is encoded source pointer. Total trailer size is 5-bytes

k = 111101
the trailer is encoded source pointer. Total trailer size is 6-bytes

k = 111100
the trailer is encoded source pointer. Total trailer size is 7-bytes

k = 111011
the trailer is encoded source pointer. Total trailer size is 8-bytes



--
Best regards,
Igor Stasenko AKA sig.

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project