Skip to content
Dmitry Zavalishin edited this page Sep 19, 2019 · 3 revisions

Table of Contents

Phantom .pc class file structure

See also VmLinker

Actually repesents any binary representation of class. All binaries are little endian.

{int8} {int32} {int64} - per se.

{string} - {int32} = length in bytes, data bytes follow

{reladdr} - {int32} = address in bytecode relative to the start of address field

{class_def} - {class_rec}....

{class_rec} - "phfr:" literal, {int8} record type, {int64} record length, record data bytes according to length field

{type-def} - {int32} is_container, {string} class name, {string} contained class name

{arg_sig} - {string} arg name, {type-def}

Record types and structure

  • 'C': Class name - {string} class name, {int32} n fields in object, {int32} n methods, {string} base class name
  • 'M': Method - {string} method name, {int32} ordinal, rest is code.
  • 'l': IP to line num map - pairs of {int32} IP address, {int32} line number
  • 'S': Method signature - {string} method name, {int32} ordinal, {int32} n args, rest is array of {arg_sig}
  • 'f': Field names - {string} name, {int32} ordinal, {type_def}
In progress:
  • 'c': constant - {int32} constant id (position in const array), {type_def}, rest is binary constant value

Constant types

  • String - binary is string content
  • Method - (not impl) binary is method as in method record binary content
  • Class ref (not impl)
  • Method/field ordinal (not impl)

Planned

Container for pre-compiled JIT-style binary?

Clone this wiki locally