arcadia-unity / Arcadia

Clojure in Unity

Home Page:http://arcadia-unity.github.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

double compilation for AOT

timsgardner opened this issue · comments

The menu item "AOT Compile" currently triggers two compilation passes (the second of which seemingly fails in the circumstance that there is a top-level (snapshot (->SomeDefmutable x y)) form).

I'm not completely clear why this causes a failure later, though protocols are twitchy about double-evaluation. In any event, we shouldn't be doing two compilation passes, it invites weird race conditions. The cause seems to be in Arcadia.Menu#AOTCompile:

        [MenuItem("Arcadia/AOT Compile")]
        public static void AOTCompile()
        {
            BuildPipeline.BuildInternal();
            BuildPipeline.BuildUser();
        }

Even if this works, however, there's still a question of how AOTing user code should work if Internal code is already AOT'd, and if doing one after the other can cause a problem. The safest approach is probably to clear all AOT'd code before every compile.