You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In full AOT environment like iOS, runtime jitting is not allowed, which means no runtime code generation at all.
For example, it's impossible to emit code and use a generic type which parameter types are not determined at compile time.
To support this, we need to put workaround code for every dynamic code. For example, CodeGenerator.GenerateWriteAllFieldsDelegate can be changed like:
privatestatic ValueWriter GenerateWriteAllFieldsDelegate(List<ValueWriter>fieldWriters){if(fieldWriters==null)thrownew ArgumentNullException(nameof(fieldWriters));if(use_dynamic_code)// CHECK SERIALIZER OPTION TO USE DYNAMIC CODE{// fast but not working code on AOT.varstreamParam= Parameter(typeof(Stream));varobjectParam= Parameter(typeof(object));varsessionParam= Parameter(typeof(SerializerSession));varxs= fieldWriters
.Select(Constant).Select(fieldWriterExpression => Invoke(fieldWriterExpression, streamParam, objectParam, sessionParam)).ToList();varbody= Block(xs);varwriteallFields=Lambda<ValueWriter>(body, streamParam, objectParam,
sessionParam).Compile();returnwriteallFields;}else{// slow but working code on AOT.return(stream,obj,session)=> fieldWriters.ForEach(w => w(stream, obj, session));}}
How about this?
The text was updated successfully, but these errors were encountered:
veblush
changed the title
Full AOT (Ahead of Time compilation) support.
Support Full AOT (Ahead of Time compilation).
Jul 19, 2016
Asked on Gitter but Ill add it here too.
How does the AOT path work? it will end up using reflection with FieldInfo.Get/SetValue or how does that work?
Yes. It usually ends up with a bunch of Get/SetValue that is safe on AOT environment. And it's also possible to use generic types or methods which can be instantiated in compile-time.
In full AOT environment like iOS, runtime jitting is not allowed, which means no runtime code generation at all.
For example, it's impossible to emit code and use a generic type which parameter types are not determined at compile time.
To support this, we need to put workaround code for every dynamic code. For example,
CodeGenerator.GenerateWriteAllFieldsDelegate
can be changed like:How about this?
The text was updated successfully, but these errors were encountered: