I raised an issue in the Github project with the same code from this thread.
I think it just means that the function that is called in a specific location is chosen from a large set of possible functions, and the function that is chosen varies a lot.I'm not familiar with that terminology, so I may easily be wrong. From my reading of this: https://en.wikipedia.org/wiki/Inline_ca ... ne_caching it appears that the term "megamorphic" refers to a state in which in a certain code path, a certain variable (or several of them) adopts values of multiple types during a trace.
The only thing thats truly dynamic in my code is the selection of functions. There are no dynamic allocations, or changing types. There are no dynamic tables or types, not even a single key that gets added or removed at runtime. The number of tables, the keys and the number of values in those tables are constant after initialization. All logic is based on selecting a function based on global state. I thought I was being so clever when I wrote almost branchless code that uses zero runtime allocations.
Yeah, that's just me confusing Lua with MoonScript which adds the return implicitely. The return is there in the actual code. It's not much different from yours. I'm trying to pass as few arguments as possible though, because I fear that the compiler runs out of registers and starts spilling onto the stack, which seems like a thing that should be avoided. The code has gone from nice and clean to a pile of shit because of that.Shouldn't that beto be a proper tail call? Or is LuaJIT clever enough to figure out that there's no difference and use a tail call in that case? I doubt it.Code: Select all
return tick()
At least I can play Super Mario Bros. at 1800 fps on my computer. No other emulator I've tried is that fast. It's just those pesky slowdowns to 15 fps in the middle of the game that kind of suck.