Hot update
The World Martial arts, no hard to break, only fast not broken
Hot updates are meant to push content into the hands of users faster.
Before, I designed the c#light, after more than half a year of continuous repair, reluctantly available, stumbling.
Thank those, tried, scolded, used friends, in your company along the way, also let me more determined to take this matter to do a good job. So there is the c#light of the 2.0,l#.
Why is it called l#?
Because this is the direct load parsing DLL execution, load, there is an L
Because the direct execution of something called IL, there is an L
Because simulating the work of the CLR, there is an L
So, there's l#.
Https://github.com/lightszero/LSharp
Welcome to add QQ Group 223823428 discussion:
Why is l# so refreshing?
The previous article has explained the mode of work
You can see that this time C#light "clever" use VS, mono to do grammar check to really use VS, mono to compile
Completely solved the problem of incomplete support for C#light grammar
At the beginning of the C#light design, it was defined as a subset of C # syntax
It has been written, limited, and constrained, preserving only the C # form
This time, l#, the form of God both. And more than just c#,l# supports C # vb.net unityscript F # Boo, as long as it can be compiled into a dotnet DLL
?
Last article see here http://www.cnblogs.com/crazylights/p/4216913.html
After the last post, l# 's interface made some adjustments.
There's the latest source code on Github https://github.com/lightszero/LSharp
There's a forunity directory, which is for unity.
The two extreme environments, iOS and WP8, have been tested
l# improvements made on the basis of c#light
1.c#light's context design is unclear
Many people are wondering when to new, why new
l# completely modified this design to Threadcontext, the thread management object in the script, only need new once on a thread, and can be obtained at any time threadcontext.active.
Previously, C#light was called from the callback, only to see the callback part of the script stack.
l# modified the design, a script stack on a thread is all in one, even after the callback is fully visible, after the callback is not difficult to debug
2. Change the interface structure
More like reflection, facilitates quick switching between reflection and l# scripts
The interface structure of the l# is consistent with reflection, and the reflection can be invoked directly using the l# invocation method.
Added the quick switch reflection and l# script mode, when difficult to judge the bug, you can cut into reflection mode to troubleshoot.
On platforms that support reflection, you can also switch to reflection mode acceleration
Fast switching example, there is an independent test program, TEST01
3. Registration changed to optional
C#light adopts the mode of first registration and re-invocation, many people complain about inconvenience.
This is actually a congenital difficulty in c#light design.
While the IL parsing DLL executes, the information in the DLL is complete, so IL can automatically complete all type registrations by default
Also retains the manually registered interface.
4.l# 's Artifact Crossbind
l# designed a crossbind way to allow scripts to inherit directly from the interface in the program.
For example, in the program to design a
Interface istate
{
void Abc ();
}
The script can inherit this interface and return an instance of a compatible istate to the program
Two crossbind on iterators have been implemented in the script
That is, it supports the use of yield statements in scripts.
Optimized space for l#
Many people are concerned about l# performance problems, l# 's work has not advanced to that stage.
Now in the alpha stage, mice are welcome to join and step on the pits.
The bug is a lot less than the C#light alpha phase, based on the current few user trial feedback.
But l# has a lot of room for optimization.
- There are plenty of stages to fill the cache with space.
- Since we are working with the CLR, we can naturally make JIT-like optimizations for IL statements.
For example, the A.NOP statement is a complete waste of time to remove
B.stloc Ldloc This two consecutive, parameter-consistent statements, whose meaning is to save the variable and load the variable, we can design an optimization instruction, Stlocandstayinstack, save the variable and keep it on the stack.
C. Many arithmetic operations are LD to the stack, calculate, and then save back, as long as the design optimization of the self-increment operation instructions, you can change the three bar
3. You can consider unsafe or the introduction of local code
Unity3d Logic Hot Update, second generation of refreshing solutions, l# use profile