Version 8 (modified by cotto, 5 years ago)

some initial comments on freeze/thaw and packfile

Hudson: Is this gonna be a standup fight, sir, or another bughunt?
Gorman: All we know is that there's still no contact with the colony, and that a xenomorph may be involved.
Frost: Excuse me sir, a-a what?
Gorman: A xenomorph.
Hicks: It's a bughunt.

-- Aliens, 1986

These subsystems need rethinking and revision and refactoring, because:

  • freeze/thaw and packfile
    • The freeze/thaw and packfile code do similar but slightly different things. They should be unified to cut down on duplication.
    • In a packfile, a sub's bytecode is stored in the bytecode segment with a separate fixup segment indication which chunk of bytecode belongs to which sub.
      • Storing a sub's bytecode as its data in the constant PMC segment (i.e. having a sub carry its code with it) would greatly simplify much of the code that deals with packfiles.
  • hashes
    • the Hash PMC is too intertwined with the guts of src/hash.c
    • it's not clear if the hash/bucket algorithm is sufficiently collision free
    • OrderedHash is a mess of semantics and implementation
      • Question: Does this still apply since the OrderedHash revamp branch was merged? --cotto
    • some Parrot systems need C-like hashes while user-visible parts of Parrot need PMC-ish hashes

(Perhaps now is a good time to re-examine the thought of using an external hash library rather than re-inventing our own. --coke)

  • CLI argument parsing
    • The current code is closely tied to imcc and will inhibit the eventual migration to pirc.
    • It's not possible to add new options at runtime.
    • It's not possible for subsystems to register new options.
    • Subsystems do not have access to arguments passed directly to the parrot binary.
  • lvalue model (WhyDoesNQPGenerateInefficientCode)
    • PIR does not have clear and consistent assignment/binding semantics.
    • This forces nqp to be rather pessimal in the assumptions it makes about the contents of lexical variables.
    • It's also a source (actual, not potential) of confusion for HLL developers.
    • Note: Research into this problem should include a look at how other VMs (e.g. JVM, CLI, PyPy, CPython, Perl 5, MRI, etc) deal with this. PyPy may be of special interest because that project aims for a similar niche to Parrot.