public JSMethod( MethodReference reference, MethodInfo method, MethodTypeFactory methodTypes, IEnumerable <TypeReference> genericArguments = null ) { if (reference == null) { throw new ArgumentNullException("reference"); } if (method == null) { throw new ArgumentNullException("method"); } Reference = reference; Method = method; MethodTypes = methodTypes; if (genericArguments == null) { var gim = Reference as GenericInstanceMethod; if (gim != null) { genericArguments = gim.GenericArguments; } } GenericArguments = genericArguments; }
public ExpandCastExpressions (TypeSystem typeSystem, JSSpecialIdentifiers js, JSILIdentifier jsil, ITypeInfoSource typeInfo, MethodTypeFactory methodTypeFactory) { TypeSystem = typeSystem; JS = js; JSIL = jsil; TypeInfo = typeInfo; MethodTypeFactory = methodTypeFactory; }
public IntroduceEnumCasts( TypeSystem typeSystem, JSSpecialIdentifiers js, TypeInfoProvider typeInfo, MethodTypeFactory methodTypes, IFunctionSource functionSource ) { TypeSystem = typeSystem; TypeInfo = typeInfo; MethodTypes = methodTypes; JS = js; FunctionSource = functionSource; LogicalOperators = new HashSet <JSOperator>() { JSOperator.LogicalAnd, JSOperator.LogicalOr, JSOperator.LogicalNot }; BitwiseOperators = new HashSet <JSOperator>() { JSOperator.BitwiseAnd, JSOperator.BitwiseOr, JSOperator.BitwiseXor }; }
public JSCachedMethod( MethodReference reference, MethodInfo method, MethodTypeFactory methodTypes, IEnumerable <TypeReference> genericArguments, int index ) : base(reference, method, methodTypes, genericArguments) { Index = index; }
public SpecialIdentifiers(MethodTypeFactory methodTypes, TypeSystem typeSystem, ITypeInfoSource typeInfo) { TypeSystem = typeSystem; JS = new JSSpecialIdentifiers(methodTypes, typeSystem); CLR = new CLRSpecialIdentifiers(typeSystem); JSIL = new JSILIdentifier(methodTypes, typeSystem, typeInfo, JS); }
public ExpandCastExpressions(TypeSystem typeSystem, JSSpecialIdentifiers js, JSILIdentifier jsil, ITypeInfoSource typeInfo, MethodTypeFactory methodTypeFactory) { TypeSystem = typeSystem; JS = js; JSIL = jsil; TypeInfo = typeInfo; MethodTypeFactory = methodTypeFactory; }
public UnsafeCodeTransforms ( Configuration configuration, TypeSystem typeSystem, MethodTypeFactory methodTypes ) { Configuration = configuration; TypeSystem = typeSystem; MethodTypes = methodTypes; }
public JSILIdentifier(MethodTypeFactory methodTypes, TypeSystem typeSystem, JSSpecialIdentifiers js) { TypeSystem = typeSystem; MethodTypes = methodTypes; JS = js; GlobalNamespace = Dot("GlobalNamespace", TypeSystem.Object); CopyMembers = Dot("CopyMembers", TypeSystem.Void); }
public EmulateInt64(MethodTypeFactory methodTypeFactory, TypeSystem typeSystem) { TypeSystem = typeSystem; MethodTypeFactory = methodTypeFactory; int64 = new JSType(TypeSystem.Int64); uint64 = new JSType(TypeSystem.UInt64); }
public FunctionCache(ITypeInfoSource typeInfo) { TypeInfo = typeInfo; Comparer = new QualifiedMemberIdentifier.Comparer(typeInfo); Cache = new ConcurrentCache <QualifiedMemberIdentifier, Entry>( Environment.ProcessorCount, 4096, Comparer ); PendingTransformsQueue = new ConcurrentHashQueue <QualifiedMemberIdentifier>( Math.Max(1, Environment.ProcessorCount / 4), 4096, Comparer ); ActiveTransformPipelines = new ConcurrentDictionary <QualifiedMemberIdentifier, FunctionTransformPipeline>( Math.Max(1, Environment.ProcessorCount / 4), 128, Comparer ); MethodTypes = new MethodTypeFactory(); MakeCacheEntry = (id, method) => { PendingTransformsQueue.TryEnqueue(id); return(new Entry(id, Locks) { Info = method.Method, Reference = method.Reference, SecondPass = new FunctionAnalysis2ndPass(this, method.Method) }); }; MakePopulatedCacheEntry = (id, args) => { var result = new JSFunctionExpression( new JSMethod(args.Method, args.Info, MethodTypes), args.Translator.Variables, args.Parameters, args.Body, MethodTypes ); PendingTransformsQueue.TryEnqueue(id); return(new Entry(id, Locks) { Info = args.Info, Reference = args.Method, Expression = result, SpecialIdentifiers = args.Translator.SpecialIdentifiers }); }; MakeNullCacheEntry = (id, args) => { return(new Entry(id, Locks) { Info = args.Info, Reference = args.Method, Expression = null }); }; }
public HoistAllocations ( QualifiedMemberIdentifier member, IFunctionSource functionSource, TypeSystem typeSystem, MethodTypeFactory methodTypes ) : base (member, functionSource) { TypeSystem = typeSystem; MethodTypes = methodTypes; }
public UnsafeCodeTransforms( Configuration configuration, TypeSystem typeSystem, MethodTypeFactory methodTypes ) { Configuration = configuration; TypeSystem = typeSystem; MethodTypes = methodTypes; }
public FunctionCache(ITypeInfoSource typeInfo) { var comparer = new QualifiedMemberIdentifier.Comparer(typeInfo); Cache = new ConcurrentCache <QualifiedMemberIdentifier, Entry>( Environment.ProcessorCount, 4096, comparer ); OptimizationQueue = new ConcurrentHashQueue <QualifiedMemberIdentifier>( Math.Max(1, Environment.ProcessorCount / 4), 4096, comparer ); MethodTypes = new MethodTypeFactory(); MakeCacheEntry = (id, method) => { OptimizationQueue.TryEnqueue(id); return(new Entry { Info = method.Method, Reference = method.Reference, Identifier = id, ParameterNames = new HashSet <string>(from p in method.Method.Parameters select p.Name), SecondPass = new FunctionAnalysis2ndPass(this, method.Method) }); }; MakePopulatedCacheEntry = (id, args) => { var result = new JSFunctionExpression( new JSMethod(args.Method, args.Info, MethodTypes), args.Translator.Variables, args.Parameters, args.Body, MethodTypes ); OptimizationQueue.TryEnqueue(id); return(new Entry { Identifier = id, Info = args.Info, Reference = args.Method, Expression = result, Variables = args.Translator.Variables, ParameterNames = args.Translator.ParameterNames, SpecialIdentifiers = args.Translator.SpecialIdentifiers }); }; MakeNullCacheEntry = (id, args) => { return(new Entry { Identifier = id, Info = args.Info, Reference = args.Method, Expression = null }); }; }
public FunctionCache(ITypeInfoSource typeInfo) { TypeInfo = typeInfo; Comparer = new QualifiedMemberIdentifier.Comparer(typeInfo); Cache = new ConcurrentCache<QualifiedMemberIdentifier, Entry>( Environment.ProcessorCount, 4096, Comparer ); PendingTransformsQueue = new ConcurrentHashQueue<QualifiedMemberIdentifier>( Math.Max(1, Environment.ProcessorCount / 4), 4096, Comparer ); ActiveTransformPipelines = new ConcurrentDictionary<QualifiedMemberIdentifier, FunctionTransformPipeline>( Math.Max(1, Environment.ProcessorCount / 4), 128, Comparer ); MethodTypes = new MethodTypeFactory(); MakeCacheEntry = (id, method) => { PendingTransformsQueue.TryEnqueue(id); return new Entry(id, Locks) { Info = method.Method, Reference = method.Reference, SecondPass = new FunctionAnalysis2ndPass(this, method.Method) }; }; MakePopulatedCacheEntry = (id, args) => { var result = new JSFunctionExpression( new JSMethod(args.Method, args.Info, MethodTypes), args.Translator.Variables, args.Parameters, args.Body, MethodTypes ); PendingTransformsQueue.TryEnqueue(id); return new Entry(id, Locks) { Info = args.Info, Reference = args.Method, Expression = result, Variables = args.Translator.Variables, SpecialIdentifiers = args.Translator.SpecialIdentifiers }; }; MakeNullCacheEntry = (id, args) => { return new Entry(id, Locks) { Info = args.Info, Reference = args.Method, Expression = null }; }; }
public FunctionCache(ITypeInfoSource typeInfo) { var comparer = new QualifiedMemberIdentifier.Comparer(typeInfo); Cache = new ConcurrentCache<QualifiedMemberIdentifier, Entry>( Environment.ProcessorCount, 4096, comparer ); OptimizationQueue = new ConcurrentHashQueue<QualifiedMemberIdentifier>( Math.Max(1, Environment.ProcessorCount / 4), 4096, comparer ); MethodTypes = new MethodTypeFactory(); }
public UnsafeCodeTransforms ( Configuration configuration, TypeSystem typeSystem, MethodTypeFactory methodTypes, IFunctionSource functionSource ) { Configuration = configuration; TypeSystem = typeSystem; MethodTypes = methodTypes; FunctionSource = functionSource; }
public HoistAllocations( QualifiedMemberIdentifier member, IFunctionSource functionSource, TypeSystem typeSystem, MethodTypeFactory methodTypes ) : base(member, functionSource) { TypeSystem = typeSystem; MethodTypes = methodTypes; }
public JSSpecialIdentifiers (MethodTypeFactory methodTypes, TypeSystem typeSystem) { TypeSystem = typeSystem; MethodTypes = methodTypes; prototype = Object("prototype"); eval = new JSFakeMethod("eval", TypeSystem.Object, new[] { TypeSystem.String }, methodTypes); toString = new JSFakeMethod("toString", TypeSystem.String, null, methodTypes); floor = new JSDotExpression(Object("Math"), new JSFakeMethod("floor", TypeSystem.Int32, null, methodTypes)); fromCharCode = new JSDotExpression(Object("String"), new JSFakeMethod("fromCharCode", TypeSystem.Char, new[] { TypeSystem.Int32 }, methodTypes)); charCodeAt = new JSFakeMethod("charCodeAt", TypeSystem.Int32, new[] { TypeSystem.Char }, methodTypes); }
public FunctionCache(ITypeInfoSource typeInfo) { var comparer = new QualifiedMemberIdentifier.Comparer(typeInfo); Cache = new ConcurrentCache<QualifiedMemberIdentifier, Entry>( Environment.ProcessorCount, 4096, comparer ); OptimizationQueue = new ConcurrentHashQueue<QualifiedMemberIdentifier>( Math.Max(1, Environment.ProcessorCount / 4), 4096, comparer ); MethodTypes = new MethodTypeFactory(); MakeCacheEntry = (id, method) => { OptimizationQueue.TryEnqueue(id); return new Entry { Info = method.Method, Reference = method.Reference, Identifier = id, ParameterNames = new HashSet<string>(from p in method.Method.Parameters select p.Name), SecondPass = new FunctionAnalysis2ndPass(this, method.Method) }; }; MakePopulatedCacheEntry = (id, args) => { var result = new JSFunctionExpression( new JSMethod(args.Method, args.Info, MethodTypes), args.Translator.Variables, args.Parameters, args.Body, MethodTypes ); OptimizationQueue.TryEnqueue(id); return new Entry { Identifier = id, Info = args.Info, Reference = args.Method, Expression = result, Variables = args.Translator.Variables, ParameterNames = args.Translator.ParameterNames, SpecialIdentifiers = args.Translator.SpecialIdentifiers }; }; MakeNullCacheEntry = (id, args) => { return new Entry { Identifier = id, Info = args.Info, Reference = args.Method, Expression = null }; }; }
public FunctionCache(ITypeInfoSource typeInfo) { var comparer = new QualifiedMemberIdentifier.Comparer(typeInfo); Cache = new ConcurrentCache <QualifiedMemberIdentifier, Entry>( Environment.ProcessorCount, 4096, comparer ); OptimizationQueue = new ConcurrentHashQueue <QualifiedMemberIdentifier>( Math.Max(1, Environment.ProcessorCount / 4), 4096, comparer ); MethodTypes = new MethodTypeFactory(); }
public UnsafeCodeTransforms( Configuration configuration, TypeSystem typeSystem, MethodTypeFactory methodTypes, IFunctionSource functionSource ) { Configuration = configuration; TypeSystem = typeSystem; MethodTypes = methodTypes; FunctionSource = functionSource; }
public JSFakeMethod( string name, TypeReference returnType, TypeReference[] parameterTypes, MethodTypeFactory methodTypes, JSExpression[] genericArguments = null ) { Name = name; ReturnType = returnType; ParameterTypes = parameterTypes ?? new TypeReference[0]; MethodTypes = methodTypes; GenericArguments = genericArguments; }
public JSSpecialIdentifiers(MethodTypeFactory methodTypes, TypeSystem typeSystem) { TypeSystem = typeSystem; MethodTypes = methodTypes; prototype = Object("prototype"); eval = new JSFakeMethod("eval", TypeSystem.Object, new[] { TypeSystem.String }, methodTypes); toString = new JSFakeMethod("toString", TypeSystem.String, null, methodTypes); floor = new JSDotExpression(Object("Math"), new JSFakeMethod("floor", TypeSystem.Int32, null, methodTypes)); fromCharCode = new JSDotExpression(Object("String"), new JSFakeMethod("fromCharCode", TypeSystem.Char, new[] { TypeSystem.Int32 }, methodTypes)); charCodeAt = new JSFakeMethod("charCodeAt", TypeSystem.Int32, new[] { TypeSystem.Char }, methodTypes); }
public EliminatePointlessRetargeting ( QualifiedMemberIdentifier member, IFunctionSource functionSource, TypeSystem typeSystem, MethodTypeFactory methodTypes ) : base (member, functionSource) { TypeSystem = typeSystem; MethodTypes = methodTypes; SeenRetargetsInScope.Push(new Dictionary<RetargetKey, int>()); ScopeNodeIndices.Push(-1); }
public IntroduceEnumCasts(TypeSystem typeSystem, JSSpecialIdentifiers js, TypeInfoProvider typeInfo, MethodTypeFactory methodTypes) { TypeSystem = typeSystem; TypeInfo = typeInfo; MethodTypes = methodTypes; JS = js; LogicalOperators = new HashSet <JSOperator>() { JSOperator.LogicalAnd, JSOperator.LogicalOr, JSOperator.LogicalNot }; }
public EliminatePointlessRetargeting( QualifiedMemberIdentifier member, IFunctionSource functionSource, TypeSystem typeSystem, MethodTypeFactory methodTypes ) : base(member, functionSource) { TypeSystem = typeSystem; MethodTypes = methodTypes; SeenRetargetsInScope.Push(new Dictionary <RetargetKey, int>()); ScopeNodeIndices.Push(-1); }
public EmulateStructAssignment ( QualifiedMemberIdentifier member, IFunctionSource functionSource, TypeSystem typeSystem, TypeInfoProvider typeInfo, CLRSpecialIdentifiers clr, MethodTypeFactory methodTypes, bool optimizeCopies ) : base (member, functionSource) { TypeSystem = typeSystem; TypeInfo = typeInfo; CLR = clr; MethodTypes = methodTypes; OptimizeCopies = optimizeCopies; }
public EmulateStructAssignment( QualifiedMemberIdentifier member, IFunctionSource functionSource, TypeSystem typeSystem, TypeInfoProvider typeInfo, CLRSpecialIdentifiers clr, MethodTypeFactory methodTypes, bool optimizeCopies ) : base(member, functionSource) { TypeSystem = typeSystem; TypeInfo = typeInfo; CLR = clr; MethodTypes = methodTypes; OptimizeCopies = optimizeCopies; }
public IntroduceEnumCasts (TypeSystem typeSystem, JSSpecialIdentifiers js, TypeInfoProvider typeInfo, MethodTypeFactory methodTypes) { TypeSystem = typeSystem; TypeInfo = typeInfo; MethodTypes = methodTypes; JS = js; LogicalOperators = new HashSet<JSOperator>() { JSOperator.LogicalAnd, JSOperator.LogicalOr, JSOperator.LogicalNot }; BitwiseOperators = new HashSet<JSOperator>() { JSOperator.BitwiseAnd, JSOperator.BitwiseOr, JSOperator.BitwiseXor }; }
public FixupPointerArithmetic(TypeSystem typeSystem, MethodTypeFactory methodTypes) { TypeSystem = typeSystem; MethodTypes = methodTypes; }
public UnsafeCodeTransforms(TypeSystem typeSystem, MethodTypeFactory methodTypes) { TypeSystem = typeSystem; MethodTypes = methodTypes; }
public JSAstBuilder FakeMethod(string name, TypeReference returnType, TypeReference[] parameterTypes, MethodTypeFactory methodTypeFactory) { return Dot(new JSFakeMethod(name, returnType, parameterTypes, methodTypeFactory)); }
public static JSExpression GetItem(TypeReference targetType, TypeInfo targetTypeInfo, JSExpression target, JSExpression index, MethodTypeFactory methodTypes, bool proxy = false) { var targetGit = (GenericInstanceType)targetType; var getMethodName = "get_Item"; var getMethod = (JSIL.Internal.MethodInfo)targetTypeInfo.Members.First( (kvp) => kvp.Key.Name == getMethodName ).Value; if (proxy) { return(new JSNewPackedArrayElementProxy( target, index, targetGit.GenericArguments[0] )); } // We have to construct a custom reference to the method in order for ILSpy's // SubstituteTypeArgs method not to explode later on var getMethodReference = CecilUtil.RebindMethod(getMethod.Member, targetGit, targetGit.GenericArguments[0]); var result = JSInvocationExpression.InvokeMethod( new JSType(targetType), new JSMethod(getMethodReference, getMethod, methodTypes), target, new JSExpression[] { index }, constantIfArgumentsAre: proxy ); return(result); }
public JSAstBuilder FakeMethod(string name, TypeReference returnType, TypeReference[] parameterTypes, MethodTypeFactory methodTypeFactory) { return(Dot(new JSFakeMethod(name, returnType, parameterTypes, methodTypeFactory))); }
public IntroducePackedArrays(TypeSystem typeSystem, MethodTypeFactory methodTypes) { TypeSystem = typeSystem; MethodTypes = methodTypes; }
public EmulateInt64(MethodTypeFactory methodTypeFactory, TypeSystem typeSystem) { TypeSystem = typeSystem; MethodTypeFactory = methodTypeFactory; }
public static JSExpression GetItem (TypeReference targetType, TypeInfo targetTypeInfo, JSExpression target, JSExpression index, MethodTypeFactory methodTypes, bool proxy = false) { var targetGit = (GenericInstanceType)targetType; var getMethodName = "get_Item"; var getMethod = (JSIL.Internal.MethodInfo)targetTypeInfo.Members.First( (kvp) => kvp.Key.Name == getMethodName ).Value; if (proxy) return new JSNewPackedArrayElementProxy( target, index, targetGit.GenericArguments[0] ); // We have to construct a custom reference to the method in order for ILSpy's // SubstituteTypeArgs method not to explode later on var getMethodReference = CecilUtil.RebindMethod(getMethod.Member, targetGit, targetGit.GenericArguments[0]); var result = JSInvocationExpression.InvokeMethod( new JSType(targetType), new JSMethod(getMethodReference, getMethod, methodTypes), target, new JSExpression[] { index }, constantIfArgumentsAre: proxy ); return result; }
public SpecialIdentifiers(MethodTypeFactory methodTypes, TypeSystem typeSystem) { TypeSystem = typeSystem; JS = new JSSpecialIdentifiers(methodTypes, typeSystem); CLR = new CLRSpecialIdentifiers(typeSystem); JSIL = new JSILIdentifier(methodTypes, typeSystem, JS); }
public JSMethod( MethodReference reference, MethodInfo method, MethodTypeFactory methodTypes, IEnumerable<TypeReference> genericArguments = null ) { if (reference == null) throw new ArgumentNullException("reference"); if (method == null) throw new ArgumentNullException("method"); Reference = reference; Method = method; MethodTypes = methodTypes; if (genericArguments == null) { var gim = Reference as GenericInstanceMethod; if (gim != null) genericArguments = gim.GenericArguments; } GenericArguments = genericArguments; }
public JSCachedMethod ( MethodReference reference, MethodInfo method, MethodTypeFactory methodTypes, IEnumerable<TypeReference> genericArguments, int index ) : base (reference, method, methodTypes, genericArguments) { Index = index; }
public IntroducePackedArrays (TypeSystem typeSystem, MethodTypeFactory methodTypes) { TypeSystem = typeSystem; MethodTypes = methodTypes; }