Open quietpixel opened 10 years ago
At this point I'm not comfortable with the impact the suggested changes could have on the performance of the library to cover a rarely-used case. In particular, item 2 you mention above cannot be changed.
Supporting the situation you describe would require creating a new assembly specifically for Unity. However, before I incorporate this support in a release, I would need to address separate concerns regarding the installation process and MSBuild support for Unity projects.
FWIW I have the same need: running ANTLR on iOS. There is related issue (#96) that also require JIT fixes.
I've been working to integrate antlr4cs into a Unity3D project to run on iOS. Several of the classes in the Sharpen namespace rely on Just-in-Time compilation of generic types. Apple forbids using JIT compilation as a safety concern, and more likely, because it would allow developers to go around the App Store, and cut Apple out of the revenue stream.
Since Unity uses .NET v3.5, I have to use the v3.5 target of ANTLR C# that relies on the Sharpen classes to reproduce functionality not available in that version of .NET.
I ran into 3 places where JIT occurs:
To fix (1), I found a class from Lucene.Net.Support.Compatibility that replaces ConcurrentDictionary without needing JIT support.
To fix (2), I commented out the Interlocked.CompareExchange () function call, and handled the variable update manually with a spin lock around it.
I didn't spend a lot of time fixing (3), just commented out that line for now.
Would you guys be interested in rolling changes 1 and 2 into the main branch? I do not feel comfortable doing so, as I am new to this code base, and there may be unintended side affects I'm not aware of.