lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


> I'm trying to pursue porting Lua to Go language's C compiler[1], and
> currently I'm stuck at an error in the Lua testsuite, in "gc.lua" -
> console output looks like this:
> 
>     testing garbage collection
>     tables
>     strings
>     functions
>     functions with errors
>     long strings
>     ---
>     pre:    194
>     stop:   59
>     peak:   71
>     after:  62
>     result: 1
>     PANIC: unprotected error in call to Lua API ([string "from
> loadbuffer"]:117: assertion failed!)
> 
> The contents below the "---" line is from patched "dosteps()", which
> now looks like this:
> 
>     local function dosteps (siz)
>       print("---\npre:", gcinfo())      -- added
>       collectgarbage()
>       collectgarbage"stop"
>       print("stop:", gcinfo())      -- added
>       local a = {}
>       for i=1,100 do a[i] = {{}}; local b = {} end
>       local x = gcinfo()
>       local i = 0
>       repeat
>         i = i+1
>       until collectgarbage("step", siz)
>       assert(gcinfo() < x)
>       print("peak:", x)      -- added
>       print("after:", gcinfo())      -- added
>       print("result:", i)      -- added
>       return i
>     end
> 
> The line number 117 is in slightly modified source, so it should be
> understood as line 111 in original "gc.lua", i.e.:
> 
>     assert(dosteps(0) > 10)

I have no idea about the unprotected error, but please note that the
above assert is highly dependent on many things and probably does
not hold for different Lua implementations.

-- Roberto