Closed Bug 737608 Opened 8 years ago Closed 8 years ago

Submit halfmoon prototype to AVM mainline under feature ifdef


(Tamarin Graveyard :: Optimizing JIT, defect, P3)



(Not tracked)

Q2 12 - Cyril


(Reporter: edwsmith, Assigned: edwsmith)




(2 files)

Bitrot protection
This patch has the modifications to the existing VM, excluding new code (core/Deopt.* and halfmoon/*).

Tentative checkin notes for this part:

Changes to core, all #ifdef VMCFG_HALFMOON
 - hook BaseExecMgr::verifyJit() to run halfmoon jit and fallback
   to CodegenLIR.
 - Deopt flag in MethodFrame
 - JitManager pointer in CodeMgr (extra per-pool and per-function
   data managed by halfmoon
 - new friend statements routed through class halfmoon::JitFriend.
 - stubbed-out functions to invoke interpreter mid-way (for deopt
   and bailout).
 - exposed nativeLocalToAtom() and unbox_double() so they can be
   called for deopt.  (moved code, no changes)
 - #ifdefd deopt hooks in class MethodInfo
 - new (ifdefd) tables of pinned double & string constants in
   PoolObject.  (here, because putting them in JitManager
   would require JitManager and CodeMgr to be gc-traced)
 - exposed Verifier::findCommonBase() as a static method so halfmoon
   type system can use it.
 - new deoptimize() hook in ExecMgr interface.
 - new coercens_atom() helper function.  Not worth ifdefing but
   only called by halfmoon.

Changes to nanojit, not #ifdefd, but are essentially free until used
 - HashMap and Allocator needed some cleanup from the float4 changes;
 - the align parameter to operator new needs to be alignOf<T> not
 - HashMap's fourth template parameter (DefaultEquals) wasn't used
   in some places it should have been.
 - Added not-ifdef hook for MetaDataWriter in Assembler. (if null
   then not used).
 - Assembler::endAssembly() returns a CodeList.
 - new UseOperEqual template helper, for when you want a HashMap
   that uses operator== for key comparison.
 - boilerplate for LIR_safe and LIR_endsafe instructions.
 - added VerboseWriter::never_flush flag, for better control over
   verbose formatting interlaved with IR.

Changes to shell
 - added System::deopt() function, for testing.  AS3 declaration
   and native methods not ifdefd, but function body is no-op
   without halfmoon.
Attachment #608082 - Flags: review?(wmaddox)
Comments welcome, but I don't expect a full detailed review of the new compiler here on this bug.

The patch excludes some things:

halfmoon/utils - test scripts
halfmoon/test - misc tests.  needs harvesting for test/acceptance.
halfmoon/generated - generated files
halfmoon/attic - unused code and docs, but useful to keep around for history.
Attachment #608082 - Flags: review?(mzaleski)
Closed: 8 years ago
Resolution: --- → FIXED
changeset: 7316:a6cded0538e7
user:      Edwin Smith <>
summary:   Bug 737608 - Add Halfmoon compiler, enabled by AVMFEATURE_HALFMOON (r=wmaddox?)
Comment on attachment 608082 [details] [diff] [review]
hooks outside halfmoon (core, nanojit, shell)

Review of attachment 608082 [details] [diff] [review]:

Since the new interpreter entry points for deopt were not merged, I can't test that the deopt code wasn't broken, but it was already incomplete and in flux, so this represents progress.  I don't see any obvious problems with the rest of it.  This is a post-commit review, and we'll clean up any issues in future Halfmoon development -- it's configured out and should be OK for CodegenLIR.
Attachment #608082 - Flags: review?(wmaddox) → review+
You need to log in before you can comment on or make changes to this bug.