diku-dk / diku-canvas

Simple canvas library for F# (2d-drawing, loading/saving of image files, using SDL2)
https://diku-dk.github.io/diku-canvas/
MIT License
25 stars 9 forks source link

Stack Overflow on multiple examples on Windows #32

Closed casperbrahe closed 1 year ago

casperbrahe commented 1 year ago

@sporring @kfl

We have found that on windows 10/11 certain examples results in stack overflow. Adjusting the drawLines examples to show 100 lines instead of 1000 solves the issue.

Tested examples are: https://github.com/diku-dk/diku-canvas/blob/main/examples/drawLines.fsx

And circles (Slide 9 on 2.4Lecture.pdf):

#r "nuget:DIKU.Canvas, 2.0.0"
open Canvas
open Color
open System
let w = 400
let R = 100.0
let c = 200.0
let point R c0 c1 t =
    let s = t*System.Math.PI/180.0
    (c0+R*cos s, c1+R*sin s)
let rec makeCircle p0 t1 =
    if t1 <= 360.0 then
        let p1 = point R c c t1
        let line = piecewiseAffine blue 1.0 [p0;p1]
        let line2 = (makeCircle p1 (t1+0.1))
        onto line line2
    else
        emptyTree
let draw =
    let p0 = point R c c 0.0
    let tree = makeCircle p0 0.1
    make tree
render "Circle" w w draw

Error message from Windows 10:

Stack overflow.
   at SixLabors.ImageSharp.Drawing.Processing.SolidBrush..ctor(SixLabors.ImageSharp.Color)      
   at SixLabors.ImageSharp.Drawing.Processing.SolidPen..ctor(SixLabors.ImageSharp.Color, Single)
   at SixLabors.ImageSharp.Drawing.Processing.Pens.Solid(SixLabors.ImageSharp.Color, Single)    
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.compile(Int32, Boolean, PrimitiveTree)
   at Canvas.make(PrimitiveTree)
   at <StartupCode$FSI_0002>.$FSI_0002.main@()
   at System.RuntimeMethodHandle.InvokeMethod(System.Object, Void**, System.Signature, Boolean)
   at System.Reflection.MethodInvoker.Invoke(System.Object, IntPtr*, System.Reflection.BindingFlags)
   at System.Reflection.RuntimeMethodInfo.Invoke(System.Object, System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo)
   at System.RuntimeType.InvokeMember(System.String, System.Reflection.BindingFlags, System.Reflection.Binder, System.Object, System.Object[], System.Reflection.ParameterModifier[], System.Globalization.CultureInfo, System.String[])
   at System.Type.InvokeMember(System.String, System.Reflection.BindingFlags, System.Reflection.Binder, System.Object, System.Object[], System.Globalization.CultureInfo)
   at FSharp.Compiler.Interactive.Shell+execs@1900.Invoke(Microsoft.FSharp.Core.Unit)
   at FSharp.Compiler.Interactive.Shell.arg10@2041(FsiDynamicCompiler, DiagnosticsLogger, Microsoft.FSharp.Core.FSharpRef`1<Microsoft.FSharp.Collections.FSharpList`1<Microsoft.FSharp.Core.FSharpFunc`2<Microsoft.FSharp.Core.Unit,Microsoft.FSharp.Core.FSharpOption`1<System.Exception>>>>, Microsoft.FSharp.Core.Unit)
   at FSharp.Compiler.Interactive.Shell+FsiDynamicCompiler.ProcessCodegenResults(Internal.Utilities.Library.CompilationThreadToken, DiagnosticsLogger, FsiDynamicCompilerState, IncrementalOptimizationEnv, TcState, TcConfig, Microsoft.FSharp.Collections.FSharpList`1<FSharp.Compiler.Syntax.Ident>, Boolean, Boolean, System.String, Microsoft.FSharp.Collections.FSharpList`1<CheckedImplFile>, IlxAssemblyGenerator, IlxGenResults, FSharp.Compiler.Text.Range)
   at FSharp.Compiler.Interactive.Shell+FsiDynamicCompiler.ProcessInputs(Internal.Utilities.Library.CompilationThreadToken, DiagnosticsLogger, FsiDynamicCompilerState, Microsoft.FSharp.Collections.FSharpList`1<FSharp.Compiler.Syntax.ParsedInput>, Boolean, Boolean, Boolean, Microsoft.FSharp.Collections.FSharpList`1<FSharp.Compiler.Syntax.Ident>, FSharp.Compiler.Text.Range)
   at FSharp.Compiler.Interactive.Shell+FsiDynamicCompiler.EvalParsedDefinitions(Internal.Utilities.Library.CompilationThreadToken, DiagnosticsLogger, FsiDynamicCompilerState, Boolean, 
Boolean, Microsoft.FSharp.Collections.FSharpList`1<FSharp.Compiler.Syntax.SynModuleDecl>)
   at FSharp.Compiler.Interactive.Shell.loop@3847-108(FsiInteractionProcessor, DiagnosticsLogger, Internal.Utilities.Library.CompilationThreadToken, FsiDynamicCompilerState, InteractionGroup)
   at System.Runtime.CompilerServices.RuntimeHelpers.DispatchTailCalls(IntPtr, Void (IntPtr, Byte ByRef, System.Runtime.CompilerServices.PortableTailCallFrame*), Byte ByRef)
   at FSharp.Compiler.Interactive.Shell+clo@3846-581.Invoke(FsiDynamicCompilerState)
   at FSharp.Compiler.Interactive.Shell+FsiInteractionProcessor.InteractiveCatch[[System.__Canon, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](DiagnosticsLogger, Microsoft.FSharp.Core.FSharpFunc`2<System.__Canon,System.Tuple`2<System.__Canon,FsiInteractionStepStatus>>, System.__Canon)
   at FSharp.Compiler.Interactive.Shell+FsiInteractionProcessor.ExecuteParsedInteractionInGroups(Internal.Utilities.Library.CompilationThreadToken, FsiDynamicCompilerState, Microsoft.FSharp.Core.FSharpOption`1<FSharp.Compiler.Syntax.ParsedScriptInteraction>, DiagnosticsLogger, Microsoft.FSharp.Core.FSharpOption`1<FsiValue>, System.Threading.CancellationToken)
   at System.Runtime.CompilerServices.RuntimeHelpers.DispatchTailCalls(IntPtr, Void (IntPtr, Byte ByRef, System.Runtime.CompilerServices.PortableTailCallFrame*), Byte ByRef)
   at FSharp.Compiler.Interactive.Shell+clo@3978-582.Invoke(Microsoft.FSharp.Core.FSharpOption`1<FsiValue>, FsiDynamicCompilerState)
   at FSharp.Compiler.Interactive.Shell+FsiInteractionProcessor.ExecuteParsedInteraction(Internal.Utilities.Library.CompilationThreadToken, FsiDynamicCompilerState, Microsoft.FSharp.Core.FSharpOption`1<FSharp.Compiler.Syntax.ParsedScriptInteraction>, DiagnosticsLogger, Microsoft.FSharp.Core.FSharpOption`1<FsiValue>, System.Threading.CancellationToken)
   at System.Runtime.CompilerServices.RuntimeHelpers.DispatchTailCalls(IntPtr, Void (IntPtr, Byte ByRef, System.Runtime.CompilerServices.PortableTailCallFrame*), Byte ByRef)
   at FSharp.Compiler.Interactive.Shell+clo@4052-585.Invoke(Internal.Utilities.Library.CompilationThreadToken, FsiDynamicCompilerState)
   at FSharp.Compiler.Interactive.Shell+clo@4017-584[[System.__Canon, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].Invoke()
   at FSharp.Compiler.Interactive.Shell+FsiInteractionProcessor.mainThreadProcessAction[[System.__Canon, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.__Canon, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.__Canon, Microsoft.FSharp.Core.FSharpFunc`2<System.__Canon,Microsoft.FSharp.Core.FSharpFunc`2<System.__Canon,System.Tuple`2<System.__Canon,FsiInteractionStepStatus>>>, System.__Canon)
   at FSharp.Compiler.Interactive.Shell+res@4127-36.Invoke(Internal.Utilities.Library.CompilationThreadToken, FsiDynamicCompilerState)
   at FSharp.Compiler.Interactive.Shell+ParseAndExecuteInteractionFromLexbuf@4112.Invoke(FsiDynamicCompilerState)
   at FSharp.Compiler.Interactive.Shell+FsiInteractionProcessor.InteractiveCatch[[System.__Canon, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](DiagnosticsLogger, Microsoft.FSharp.Core.FSharpFunc`2<System.__Canon,System.Tuple`2<System.__Canon,FsiInteractionStepStatus>>, System.__Canon)
   at FSharp.Compiler.Interactive.Shell.run@4154-1(FsiInteractionProcessor, DiagnosticsLogger, Internal.Utilities.Library.CompilationThreadToken, LexFilter, FsiDynamicCompilerState)    
   at FSharp.Compiler.Interactive.Shell+EvalIncludedScript@4145.Invoke(Microsoft.FSharp.Core.Unit)
   at FSharp.Compiler.Interactive.Shell.WithImplicitHome[[System.__Canon, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](TcConfigBuilder, System.String, Microsoft.FSharp.Core.FSharpFunc`2<Microsoft.FSharp.Core.Unit,System.__Canon>)
   at FSharp.Compiler.Interactive.Shell+FsiInteractionProcessor.EvalIncludedScript(Internal.Utilities.Library.CompilationThreadToken, FsiDynamicCompilerState, System.String, FSharp.Compiler.Text.Range, DiagnosticsLogger)
   at FSharp.Compiler.Interactive.Shell+status@4171-1.Invoke(FsiDynamicCompilerState)
   at FSharp.Compiler.Interactive.Shell+FsiInteractionProcessor.InteractiveCatch[[System.__Canon, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](DiagnosticsLogger, Microsoft.FSharp.Core.FSharpFunc`2<System.__Canon,System.Tuple`2<System.__Canon,FsiInteractionStepStatus>>, System.__Canon)
   at FSharp.Compiler.Interactive.Shell+FsiInteractionProcessor.EvalIncludedScripts(Internal.Utilities.Library.CompilationThreadToken, FsiDynamicCompilerState, Microsoft.FSharp.Collections.FSharpList`1<System.String>, DiagnosticsLogger)
   at FSharp.Compiler.Interactive.Shell.consume@4178-1(FsiInteractionProcessor, DiagnosticsLogger, Internal.Utilities.Library.CompilationThreadToken, FsiDynamicCompilerState, Microsoft.FSharp.Collections.FSharpList`1<System.Tuple`2<System.String,Boolean>>)
   at FSharp.Compiler.Interactive.Shell+FsiInteractionProcessor.LoadInitialFiles(Internal.Utilities.Library.CompilationThreadToken, DiagnosticsLogger)
   at FSharp.Compiler.Interactive.Shell+FsiEvaluationSession.Run()
   at Sample.FSharp.Compiler.Interactive.Main.evaluateSession(System.String[])
   at Sample.FSharp.Compiler.Interactive.Main.MainMain(System.String[])
kfl commented 1 year ago

The reason is that the last six cases in canvas.compile isn't tail-recursive. For the given example, it's because the Onto case isn't tail-recursive.

sporring commented 1 year ago

@kfl Jeg har ikke erfaring med dette, men løsningen lader til at være at bruge continuation-passing style (https://en.wikipedia.org/wiki/Continuation-passing_style). Onto i canvas.compile er implementeret som:

    | Onto(p1, p2, rect) ->
        let dc1 = compile next expFlag p1
        let dc2 = compile next expFlag p2
        let dc = Lowlevel.(<+>) dc2 dc1 // dc2 is drawn first
        wrap Matrix3x2.Identity rect expFlag dc

Er følgende en passende CPS omskrivning?

    | Onto(p1, p2, rect) ->
        let compile' p cont =
          cont (compile next expFlag p)
        let add' dc2 dc1 cont =
          cont (Lowlevel.(<+>) dc2 dc1)
        compile' p1 (fun dc1 -> 
            compile' p2 (fun dc2 -> 
                add' dc2 dc1 (fun dc -> 
                    wrap Matrix3x2.Identity rect expFlag dc)))
kfl commented 1 year ago

@sporring at omskrive med CPS vil altid virke (generelt resultat, der kan bevises, spørg bare Andrzej). Men det er også en "tung" omskrivning, som ofte vil resultere i flere/mange store allokeringer, og koden kommer til at drive mod højre med dyb indentering.

Umiddelbart ser din omskrivning rigtig ud for Onto. Dog så er den lokal og ikke-standard, dvs at den kun virker for Onto og hvad værre er så virker den ikke hvis man blander de ikke-rekursive matches. En mere standard CPS omskrivning ville være at compile også skal tage en continuation som argument (continuations navngives traditionelt k):

    | Onto(p1, p2, rect) ->
        let compile' p k =
          compile next expFlag p k
        let add' dc2 dc1 k =
          k <| Lowlevel.(<+>) dc2 dc1
        compile' p1 (fun dc1 -> 
            compile' p2 (fun dc2 -> 
                add' dc2 dc1 (fun dc -> 
                    k <| wrap Matrix3x2.Identity rect expFlag dc)))

Et alternativ er at bruge defunctionalisation, og få en mere konkrete repræsentation af continuation (se fx construct.loop eller flatten.traverse i lowlevel.fs.)

Bonus alternativ: Man kan bruge en CPS monade/computational expression til omskrivningen hvis man er til den slags.

kfl commented 1 year ago

@sporring jeg kan evt gøre et forsøg på at omskrive. Jeg ved ikke om jeg får tid i dag, men ellers kan jeg nok se på det på fredag.

kfl commented 1 year ago

Fixed by PR #33