kekyo / IL2C

IL2C - A translator for ECMA-335 CIL/MSIL to C language.
Apache License 2.0
402 stars 36 forks source link

Support Thread features. #50

Open kekyo opened 6 years ago

kekyo commented 6 years ago

Basic features.

What support platforms

Advanced features.

kekyo commented 5 years ago

Let there be thread ;)

7140e9bca425946728d3acc62ec0fc6fbacf21d7

The thread control block now defines IL2C_THREAD_CONTROL_BLOCK. And their's inside into System.Threading.Thread. Is it coming from?

First "Main thread" come from Main entry point. Currently IL2C supposes "il2c_initialize()" and "il2c_shutdown()" calling by same thread context. So, once example is initializing first thread context into il2c_initialize().

But it isn't everything. We can invoke first entry point from another thread context.

I feel we can acquire it inside into "il2c_link_execution_frame()". Because the anonymous native thread context will invoke IL2C's method, we have to initialize IL2C's thread context if anonymous threads enter the IL2C's world.

kekyo commented 5 years ago

First threading bones implemented. 🍰

It contains supporting for applying the arbitrary thread context. It begins on the native thread stacks, they'll enter the IL2C world by the method calling. (Exactly it means the Main method.)

The arbitrary thread is applied implicitly managed thread context (will allocates System.Threading.Thread into the heap memory.) Because IL2C runtime has to construct execution frame each threads. Current implementation is the Thread class contains both execution frames and exception frames. I feel it behavior isn't good manner.

kekyo commented 5 years ago

I made concurrent GC implementation 🎉 It still has mutex locks at the execution link/unlink, but it's locking at each threads.