anchor.diff:              dispose = fun () -> GLVM.vmDelete prolog; GLVM.vmDelete epilog
           }
   
  -    let glvmOptimized (compile : Option<PreparedRenderObject> -> PreparedRenderObject -> IAdaptiveCode<Instruction>) () =
  -        glvmBase VMMode.None compile ()
  -
  -    let glvmRuntime (compile : PreparedRenderObject -> IAdaptiveCode<Instruction>)() =
  -        { glvmBase VMMode.RuntimeRedundancyChecks (fun _ v -> compile v) () with compileNeedsPrev = false }
  -
  -    let glvmUnoptimized (compile : PreparedRenderObject -> IAdaptiveCode<Instruction>)() =
  -        { glvmBase VMMode.None (fun _ v -> compile v) () with compileNeedsPrev = false }
  +    let glvmOptimized (vmStats : ref<VMStats>) (compile : Option<PreparedRenderObject> -> PreparedRenderObject -> IAdaptiveCode<Instruction>) () =
  +        glvmBase VMMode.None vmStats compile ()
  +
  +    let glvmRuntime (vmStats : ref<VMStats>) (compile : PreparedRenderObject -> IAdaptiveCode<Instruction>) () =
  +        { glvmBase VMMode.RuntimeRedundancyChecks vmStats (fun _ v -> compile v) () with compileNeedsPrev = false }
  +
  +    let glvmUnoptimized (vmStats : ref<VMStats>) (compile : PreparedRenderObject -> IAdaptiveCode<Instruction>) () =
  +        { glvmBase VMMode.None vmStats (fun _ v -> compile v) () with compileNeedsPrev = false }
   
       [<AllowNullLiteral>]
       type ManagedFragment =
  
positive.code:     member x.RemoveStats (f : FrameStatistics) = 
          frameStatistics <- frameStatistics - f
  
      abstract member CreateProgram : objects : aset<list<uint64> * PreparedRenderObject> -> IAdaptiveProgram<unit>
  
  
      override x.InputChanged(o : IAdaptiveObject) =
          match o with
  
negative.code:     // TODO: find a way to destroy sortKeys appropriately without using ConditionalWeakTable
      let preparedObjects = objects |> ASet.mapUse prepareRenderObject |> ASet.map (fun prep -> createSortKey prep, prep)
  
      let mutable hasProgram = false
      let mutable program = Unchecked.defaultof<_> // ( this.CreateProgram preparedObjects)
  
      let executionTime = System.Diagnostics.Stopwatch()
  
      member x.SetHandler (handler : unit -> FragmentHandler<unit, PreparedRenderObject, Instruction, 'a>) =
  //        let handlerWithStats () =
  //            let baseHandler = handler()
  //            {
  //                baseHandler with
  //                    compileDelta = fun l r ->
  //                        let code = baseHandler.compileDelta l r
  //                        code
  //            }
          
          hasProgram <- true
          program <- preparedObjects |> AdaptiveProgram.custom Comparer.Default handler
  
      member x.CurrentContext =
          currentContext :> IMod<_>
  