File consists sections:
  Header
  Roots
  Stack
  Heap


Header:
  CHAR[4] MAGIC     "PMAT"
  U8      FLAGS     0x01 : big-endian
                    0x02 : INT/UV/IV are 64-bit
                    0x04 : PTR is 64-bit
                    0x08 : NV is long double
                    0x10 : ithreads
  U8      zero
  U16BE   FORMATVER 0
  U32     PERLVER   rev<<24 | ver<<16 | sub

Roots:
  PTR     UNDEF         the "undef" immortal
  PTR     YES           the "yes" immortal
  PTR     NO            the "no" immortal

  U32     NROOTS=$n
  {STR    ROOTNAME
   PTR    ROOT} * $n

          main_cv         = the main code
          defstash        = the default stash
          mainstack       = the main stack AV
          beginav         = the BEGIN list
          checkav         = the CHECK list
          unitcheckav     = the UNITCHECK list
          initav          = the INIT list
          endav           = the END list
          strtab          = the shared string table HV
          envgv           = the ENV GV
          incgv           = the INC GV
          statgv          = the stat GV
          statname        = the statname SV
          tmpsv           = the temporary SV
          defgv           = the default GV
          argvgv          = the ARGV GV
          argoutgv        = the argvout GV
          argvout_stack   = the argout stack AV
          fdpidav         = the FD-to-PID mapping AV
          preambleav      = the compiler preamble AV
          modglobalhv     = the module data globals HV
          regex_padav     = the REGEXP pad AV
          sortstash       = the sort stash
          firstgv         = the *a GV
          secondgv        = the *b GV
          debstash        = the debugger stash
          stashcache      = the stash cache
          isarev          = the reverse map of @ISA dependencies
          registered_mros = the registered MROs HV
          rs              = the IRS
          last_in_gv      = the last input GV
          ofsgv           = the OFS GV
          defoutgv        = the default output GV
          hintgv          = the hints (%^H) GV
          patchlevel      = the patch level
          apiversion      = the API version
          e_script        = the '-e' script
          mess_sv         = the message SV
          ors_sv          = the ORS SV
          encoding        = the encoding
          blockhooks      = the block hooks
          custom_ops      = the custom ops HV
          custom_op_names = the custom op names HV
          custom_op_descs = the custom op descriptions HV

          # Plus miscellaneous other internal UTF-8 / text encoding support SVs

Stack:
  UINT    SIZE = $n
  {PTR    ELEM}*$n

Heap:
  type==0-terminated list of SVs


An SV:
  U8      TYPE       (0xff == UNKNOWN)
  PTR     ADDRESS
  U32     REFCNT
  PTR     BLESSED
  UINT    SIZE

  type: SCALAR:
    U8      FLAGS  0x01 : has IV
                   0x02 : IV is UV
                   0x04 : has NV
                   0x08 : has STR
                   0x10 : has RV
                   0x20 : RV is weak
    UINT?   IV
    double? NV
    UINT?   PVLEN
    STR?    PV
    PTR     RV

  type: GLOB
    STR     NAME
    STR     FILE
    UINT    LINE
    PTR     STASH
    PTR     SCALAR
    PTR     ARRAY
    PTR     HASH
    PTR     CODE
    PTR     EGV
    PTR     IO
    PTR     FORM

  type: ARRAY
    UINT    COUNT = $n
    {PTR    ELEM}*$n

  type: HASH
    PTR     BACKREFS
    UINT    COUNT = $n
    {STR    KEY
     PTR    VALUE}*$n

  type: STASH
    [fields as hash, then]
    STR     NAME
    PTR     MRO_LINEAR_ALL
    PTR     MRO_LINEAR_CURRENT
    PTR     MRO_NEXTMETHOD
    PTR     MRO_ISA

  type: CODE
    PTR     STASH
    PTR     GLOB
    STR     FILE
    UINT    LINE
    PTR     OUTSIDE
    PTR     PADLIST
    PTR     CONSTVAL
    {U8     TYPE
     ...         }    until TYPE==0

     type: CONSTSV
       PTR  SV

     type: CONSTIX
       UINT PADIX

     type: GVSV
       PTR  SV

     type: GVIX
       UINT PADIX

     type: PADNAME  == Only seen on 5.18+
       UINT PADIX
       STR  NAME

     type: PADSV    == Only seen on 5.18+
       UINT DEPTH
       UINT PADIX
       PTR  SV

  type: IO
    PTR     TOP
    PTR     FORMAT
    PTR     BOTTOM

  type: LVALUE
    U8      TYPE
    UINT    OFF
    UINT    LEN
    PTR     TARG

  type: REGEXP

  type: FORMAT
