Closed zherczeg closed 2 weeks ago
I don't want to work on any class optimizations at this point. The task is yours as we discussed. I will share my ideas on the topic, but it is your decision how to use them. This patch tries to improve existing code, nothing more.
Thank you Zoltan! I'm very grateful for your contributions, you are welcome to work on the code of course. I only wanted to make sure we don't duplicate work by mistake.
I did the requested changes except one. I could not find a nice way to pass around the class end without many defines. Maybe we can do that in a follow up patch if we find some nice solution.
I found a very different way to do the requested debug check. I have added a macro, CLASS_END_CASES
, which has a list of the allowed class token endings. With this macro, it is not possible that one loop handles a case, and the other does not:
/* Checks the allowed tokens at the end of a class structure in debug mode.
When a new token is processed by one loop, and not the other, and the token is
a) equals to one of the cases here: the compiler will complain
about a duplicated case value.
b) equals to none of the cases here: the loop without the handler will stop
with an assertion failure. */
I think the new code is quite nice and works nicely. I did some code reworks to improve the operations. There is no byte code optimizations. @NWilson please check.