edit: $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/IronPython/IronPython/Compiler/Ast/LazyDynamicExpression.cs;C1305533 edit: $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/IronPython/Scripts/generate_dynamic_instructions.py;C1305319 File: generate_dynamic_instructions.py =================================================================== --- $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/IronPython/Scripts/generate_dynamic_instructions.py;C1305319 (server) 12/7/2009 1:59 PM +++ Shelved Change: $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/IronPython/Scripts/generate_dynamic_instructions.py;AstImprovements @@ -99,8 +99,11 @@ cw.write('case %d: genericType = typeof(DynamicInstruction<%s>); break;' % (i+1, ''.join([',']*i))) +def gen_untyped(cw): + for i in xrange(MAX_TYPES): + cw.write('case %d: return DynamicInstruction<%s>.Factory(binder);' % + (i, ', '.join(['object']*(i+1)))) - def gen_instructions(cw): for i in xrange(MAX_TYPES): gen_instruction(cw, i) @@ -179,6 +182,7 @@ ("LightLambda Run Methods", gen_run_methods), ("Dynamic Instructions", gen_instructions), ("Dynamic Instruction Types", gen_types), + ("Untyped Dynamic Instructions", gen_untyped), ) if __name__ == "__main__": =================================================================== edit: $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/Console/Program.cs;C1042261 edit: $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/IronRuby.Tests/Parser/ParserTests.cs;C1162930 File: ParserTests.cs =================================================================== --- $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/IronRuby.Tests/Parser/ParserTests.cs;C1162930 (server) 12/7/2009 4:21 PM +++ Shelved Change: $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/IronRuby.Tests/Parser/ParserTests.cs;AstImprovements @@ -952,6 +952,7 @@ } private void AstLocations1() { +#if FEATURE_CALL_SITE_TRACER // DumpExpression uses private reflection: if (_driver.PartialTrust) return; @@ -995,6 +996,7 @@ // TODO: doesn't include method body since its is lazily compiled: Debug.Assert(locations.Count == 2 && locations[0] == 31 && locations[1] == 41); // Debug.Assert(locations.Count == 4 && locations[0] == 31 && locations[1] == 19 && locations[2] == 41 && locations[3] == 19); +#endif } #region Helpers =================================================================== edit: $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/IronRuby.Tests/Runtime/BlockTests.cs;C1120203 edit: $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/IronRuby.Tests/Runtime/CloningTests.cs;C966724 edit: $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/IronRuby.Tests/Runtime/ConstantTests.cs;C1158858 edit: $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/Ruby/Builtins/RubyClass.cs;C1300588 File: RubyClass.cs =================================================================== --- $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/Ruby/Builtins/RubyClass.cs;C1300588 (server) 12/7/2009 3:51 PM +++ Shelved Change: $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/Ruby/Builtins/RubyClass.cs;AstImprovements @@ -1342,14 +1342,13 @@ initializer.BuildCallNoFlow(metaBuilder, args, Symbols.Initialize); } else { // TODO: we need more refactoring of RubyMethodGroupInfo.BuildCall to be able to inline this: - metaBuilder.Result = Ast.Dynamic( + metaBuilder.Result = AstUtils.LightDynamic( RubyCallAction.Make(args.RubyContext, "initialize", new RubyCallSignature( args.Signature.ArgumentCount, (args.Signature.Flags & ~RubyCallFlags.IsInteropCall) | RubyCallFlags.HasImplicitSelf ) ), - typeof(object), args.GetCallSiteArguments(instanceVariable) ); } =================================================================== edit: $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/Ruby/Compiler/Ast/CallSiteBuilder.cs;C1299354 File: CallSiteBuilder.cs =================================================================== --- $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/Ruby/Compiler/Ast/CallSiteBuilder.cs;C1299354 (server) 12/7/2009 3:01 PM +++ Shelved Change: $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/Ruby/Compiler/Ast/CallSiteBuilder.cs;AstImprovements @@ -75,7 +75,7 @@ return flags; } - public MSA.DynamicExpression/*!*/ MakeSuperCallAction(int lexicalScopeId, bool hasImplicitArguments) { + public MSA.Expression/*!*/ MakeSuperCallAction(int lexicalScopeId, bool hasImplicitArguments) { RubyCallFlags flags = GetSignatureFlags() | RubyCallFlags.HasImplicitSelf; if (hasImplicitArguments) { flags |= RubyCallFlags.HasImplicitArguments; @@ -84,7 +84,7 @@ return MakeCallSite(SuperCallAction.Make(_gen.Context, new RubyCallSignature(Count - HiddenArgumentCount, flags), lexicalScopeId)); } - public MSA.DynamicExpression/*!*/ MakeCallAction(string/*!*/ name, bool hasImplicitSelf) { + public MSA.Expression/*!*/ MakeCallAction(string/*!*/ name, bool hasImplicitSelf) { RubyCallFlags flags = GetSignatureFlags(); if (hasImplicitSelf) { flags |= RubyCallFlags.HasImplicitSelf; @@ -93,7 +93,7 @@ return MakeCallSite(RubyCallAction.Make(_gen.Context, name, new RubyCallSignature(Count - HiddenArgumentCount, flags))); } - internal MSA.DynamicExpression/*!*/ MakeCallSite(CallSiteBinder/*!*/ binder) { + internal MSA.Expression/*!*/ MakeCallSite(CallSiteBinder/*!*/ binder) { if (SplattedArgument != null) { Add(SplattedArgument); } @@ -105,32 +105,32 @@ switch (Count) { case 0: case 1: throw Assert.Unreachable; - case 2: return Ast.Dynamic(binder, typeof(object), Item000, Item001); - case 3: return Ast.Dynamic(binder, typeof(object), Item000, Item001, Item002); - case 4: return Ast.Dynamic(binder, typeof(object), Item000, Item001, Item002, Item003); - default: return Ast.Dynamic(binder, typeof(object), Items); + case 2: return AstUtils.LightDynamic(binder, Item000, Item001); + case 3: return AstUtils.LightDynamic(binder, Item000, Item001, Item002); + case 4: return AstUtils.LightDynamic(binder, Item000, Item001, Item002, Item003); + default: return AstUtils.LightDynamic(binder, Items); } } - internal static MSA.DynamicExpression/*!*/ InvokeMethod(RubyContext/*!*/ context, string/*!*/ name, RubyCallSignature signature, + internal static MSA.Expression/*!*/ InvokeMethod(RubyContext/*!*/ context, string/*!*/ name, RubyCallSignature signature, MSA.Expression/*!*/ scope, MSA.Expression/*!*/ target) { Debug.Assert(signature.HasScope); - return Ast.Dynamic(RubyCallAction.Make(context, name, signature), typeof(object), AstUtils.Convert(scope, typeof(RubyScope)), target); + return AstUtils.LightDynamic(RubyCallAction.Make(context, name, signature), AstUtils.Convert(scope, typeof(RubyScope)), target); } - internal static MSA.DynamicExpression/*!*/ InvokeMethod(RubyContext/*!*/ context, string/*!*/ name, RubyCallSignature signature, + internal static MSA.Expression/*!*/ InvokeMethod(RubyContext/*!*/ context, string/*!*/ name, RubyCallSignature signature, MSA.Expression/*!*/ scope, MSA.Expression/*!*/ target, MSA.Expression/*!*/ arg0) { Debug.Assert(signature.HasScope); - return Ast.Dynamic(RubyCallAction.Make(context, name, signature), typeof(object), AstUtils.Convert(scope, typeof(RubyScope)), target, arg0); + return AstUtils.LightDynamic(RubyCallAction.Make(context, name, signature), AstUtils.Convert(scope, typeof(RubyScope)), target, arg0); } - internal static MSA.DynamicExpression/*!*/ InvokeMethod(RubyContext/*!*/ context, string/*!*/ name, RubyCallSignature signature, + internal static MSA.Expression/*!*/ InvokeMethod(RubyContext/*!*/ context, string/*!*/ name, RubyCallSignature signature, MSA.Expression/*!*/ scope, MSA.Expression/*!*/ target, MSA.Expression/*!*/ arg0, MSA.Expression/*!*/ arg1) { Debug.Assert(signature.HasScope); - return Ast.Dynamic(RubyCallAction.Make(context, name, signature), typeof(object), AstUtils.Convert(scope, typeof(RubyScope)), target, arg0, arg1); + return AstUtils.LightDynamic(RubyCallAction.Make(context, name, signature), AstUtils.Convert(scope, typeof(RubyScope)), target, arg0, arg1); } } } =================================================================== edit: $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/Ruby/Compiler/Ast/Expressions/MethodCall.cs;C1305319 File: MethodCall.cs =================================================================== --- $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/Ruby/Compiler/Ast/Expressions/MethodCall.cs;C1305319 (server) 12/7/2009 3:02 PM +++ Shelved Change: $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/Ruby/Compiler/Ast/Expressions/MethodCall.cs;AstImprovements @@ -115,9 +115,11 @@ } var dynamicSite = siteBuilder.MakeCallAction(methodName, hasImplicitSelf); +#if FEATURE_CALL_SITE_TRACER if (gen.Context.CallSiteCreated != null) { gen.Context.CallSiteCreated(node, dynamicSite); } +#endif MSA.Expression result = gen.DebugMark(dynamicSite, methodName); =================================================================== edit: $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/Ruby/Runtime/Calls/CallArguments.cs;C1200585 File: CallArguments.cs =================================================================== --- $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/Ruby/Runtime/Calls/CallArguments.cs;C1200585 (server) 12/4/2009 2:35 PM +++ Shelved Change: $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/Ruby/Runtime/Calls/CallArguments.cs;AstImprovements @@ -171,32 +171,29 @@ public AstExpressions/*!*/ GetSimpleArgumentExpressions() { int count = SimpleArgumentCount; var result = new AstExpressions(count); - for (int i = 0, j = GetSimpleArgumentsIndex(0); i < count; j++, i++) { + for (int i = 0, j = GetSimpleArgumentIndex(0); i < count; j++, i++) { result.Add(_args[j].Expression); } return result; } - internal Expression[]/*!*/ GetCallSiteArguments(Expression/*!*/ targetExpression) { + internal ReadOnlyCollectionBuilder/*!*/ GetCallSiteArguments(Expression/*!*/ targetExpression) { // context, target, arguments: - var result = new Expression[CallSiteArgumentCount]; + var result = new ReadOnlyCollectionBuilder(CallSiteArgumentCount); - int i = 0; if (_hasScopeOrContextArg) { - result[i++] = _signature.HasScope ? MetaScope.Expression : MetaContext.Expression; + result.Add(_signature.HasScope ? MetaScope.Expression : MetaContext.Expression); } - result[i++] = targetExpression; + result.Add(targetExpression); for (int j = FirstArgumentIndex; j < _args.Length; j++) { - result[i++] = _args[j].Expression; + result.Add(_args[j].Expression); } - Debug.Assert(i == result.Length); - return result; } - private int GetSimpleArgumentsIndex(int i) { + private int GetSimpleArgumentIndex(int i) { return FirstArgumentIndex + (_signature.HasBlock ? 1 : 0) + i; } @@ -209,7 +206,7 @@ } internal DynamicMetaObject/*!*/ GetSimpleMetaArgument(int i) { - return _args[GetSimpleArgumentsIndex(i)]; + return _args[GetSimpleArgumentIndex(i)]; } internal int GetBlockIndex() { @@ -294,7 +291,7 @@ } public void InsertSimple(int index, DynamicMetaObject/*!*/ arg) { - index = GetSimpleArgumentsIndex(index); + index = GetSimpleArgumentIndex(index); _args = ArrayUtils.InsertAt(_args, index, arg); _signature = new RubyCallSignature(_signature.ArgumentCount + 1, _signature.Flags); @@ -307,7 +304,7 @@ } public void SetSimpleArgument(int index, DynamicMetaObject/*!*/ arg) { - SetArgument(GetSimpleArgumentsIndex(index), arg); + SetArgument(GetSimpleArgumentIndex(index), arg); } private void SetArgument(int index, DynamicMetaObject/*!*/ arg) { =================================================================== edit: $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/Ruby/Runtime/Calls/CallSiteTracer.cs;C1107696 File: CallSiteTracer.cs =================================================================== --- $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/Ruby/Runtime/Calls/CallSiteTracer.cs;C1107696 (server) 12/7/2009 4:16 PM +++ Shelved Change: $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/Ruby/Runtime/Calls/CallSiteTracer.cs;AstImprovements @@ -12,7 +12,7 @@ * * * ***************************************************************************/ - +#if FEATURE_CALL_SITE_TRACER #if !CLR2 using MSA = System.Linq.Expressions; #else @@ -148,3 +148,4 @@ } } } +#endif \ No newline at end of file =================================================================== edit: $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/Ruby/Runtime/Calls/MethodDispatcher.cs;C1305319 File: MethodDispatcher.cs =================================================================== --- $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/Ruby/Runtime/Calls/MethodDispatcher.cs;C1305319 (server) 12/7/2009 4:41 PM +++ Shelved Change: $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/Ruby/Runtime/Calls/MethodDispatcher.cs;AstImprovements @@ -97,6 +97,15 @@ return null; } + Func factory; + if (UntypedFuncDispatchers.TryGetValue(delegateType, out factory)) { + return factory(); + } + + PerfTrack.NoteEvent(PerfTrack.Categories.Binding, "Ruby: ! typed interpreted dispatcher " + + ReflectionUtils.FormatTypeName(new StringBuilder(), delegateType).ToString() + ); + // Func // Action var types = delegateType.GetGenericArguments(); @@ -115,7 +124,7 @@ return (InterpretedDispatcher)Activator.CreateInstance(dispatcherType.MakeGenericType(types)); } - public abstract object/*!*/ CreateDelegate(); + public abstract object/*!*/ CreateDelegate(bool isUntyped); internal abstract void Initialize(Delegate/*!*/ method, int version); } =================================================================== edit: $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/Ruby/Runtime/Calls/MethodDispatcher.Generated.cs;C1116347 File: MethodDispatcher.Generated.cs =================================================================== --- $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/Ruby/Runtime/Calls/MethodDispatcher.Generated.cs;C1116347 (server) 12/7/2009 4:42 PM +++ Shelved Change: $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/Ruby/Runtime/Calls/MethodDispatcher.Generated.cs;AstImprovements @@ -24,6 +24,7 @@ using System.Runtime.CompilerServices; using Microsoft.Scripting.Utils; using IronRuby.Builtins; +using System.Collections.Generic; namespace IronRuby.Runtime.Calls { public abstract partial class MethodDispatcher { @@ -37,10 +38,12 @@ typeof(RubyObjectMethodDispatcher<>), #endif #region Generated by MethodDispatcher.Generator.rb + typeof(RubyObjectMethodDispatcher<,>), typeof(RubyObjectMethodDispatcher<,,>), typeof(RubyObjectMethodDispatcher<,,,>), typeof(RubyObjectMethodDispatcher<,,,,>), + #endregion }; @@ -51,10 +54,12 @@ typeof(RubyObjectMethodDispatcherWithBlock<>), #endif #region Generated by MethodDispatcher.Generator.rb + typeof(RubyObjectMethodDispatcherWithBlock<,>), typeof(RubyObjectMethodDispatcherWithBlock<,,>), typeof(RubyObjectMethodDispatcherWithBlock<,,,>), typeof(RubyObjectMethodDispatcherWithBlock<,,,,>), + #endregion }; @@ -65,10 +70,12 @@ typeof(RubyObjectMethodDispatcherWithScope<>), #endif #region Generated by MethodDispatcher.Generator.rb + typeof(RubyObjectMethodDispatcherWithScope<,>), typeof(RubyObjectMethodDispatcherWithScope<,,>), typeof(RubyObjectMethodDispatcherWithScope<,,,>), typeof(RubyObjectMethodDispatcherWithScope<,,,,>), + #endregion }; @@ -79,10 +86,12 @@ typeof(RubyObjectMethodDispatcherWithScopeAndBlock<>), #endif #region Generated by MethodDispatcher.Generator.rb + typeof(RubyObjectMethodDispatcherWithScopeAndBlock<,>), typeof(RubyObjectMethodDispatcherWithScopeAndBlock<,,>), typeof(RubyObjectMethodDispatcherWithScopeAndBlock<,,,>), typeof(RubyObjectMethodDispatcherWithScopeAndBlock<,,,,>), + #endregion }; @@ -93,6 +102,7 @@ typeof(InterpretedFuncDispatcher<>), #endif #region Generated by MethodDispatcher.Generator.rb + typeof(InterpretedFuncDispatcher<,>), typeof(InterpretedFuncDispatcher<,,>), typeof(InterpretedFuncDispatcher<,,,>), @@ -108,6 +118,7 @@ typeof(InterpretedFuncDispatcher<,,,,,,,,,,,,,>), typeof(InterpretedFuncDispatcher<,,,,,,,,,,,,,,>), typeof(InterpretedFuncDispatcher<,,,,,,,,,,,,,,,>), + #endregion }; @@ -119,6 +130,7 @@ typeof(InterpretedActionDispatcher<>), #endif #region Generated by MethodDispatcher.Generator.rb + typeof(InterpretedActionDispatcher<,>), typeof(InterpretedActionDispatcher<,,>), typeof(InterpretedActionDispatcher<,,,>), @@ -133,8 +145,39 @@ typeof(InterpretedActionDispatcher<,,,,,,,,,,,,>), typeof(InterpretedActionDispatcher<,,,,,,,,,,,,,>), typeof(InterpretedActionDispatcher<,,,,,,,,,,,,,,>), + #endregion }; + + // TODO: an array, if all interpreted sites were untyped + internal static readonly Dictionary> UntypedFuncDispatchers = new Dictionary>() { +#if GENERATOR + def generate + $MaxInterpretedArity.times { |n| @n = n + 1; super } + end +#else + { typeof(Func), InterpretedFuncDispatcher.Factory }, +#endif +#region Generated by MethodDispatcher.Generator.rb + + { typeof(Func), InterpretedFuncDispatcher.Factory }, + { typeof(Func), InterpretedFuncDispatcher.Factory }, + { typeof(Func), InterpretedFuncDispatcher.Factory }, + { typeof(Func), InterpretedFuncDispatcher.Factory }, + { typeof(Func), InterpretedFuncDispatcher.Factory }, + { typeof(Func), InterpretedFuncDispatcher.Factory }, + { typeof(Func), InterpretedFuncDispatcher.Factory }, + { typeof(Func), InterpretedFuncDispatcher.Factory }, + { typeof(Func), InterpretedFuncDispatcher.Factory }, + { typeof(Func), InterpretedFuncDispatcher.Factory }, + { typeof(Func), InterpretedFuncDispatcher.Factory }, + { typeof(Func), InterpretedFuncDispatcher.Factory }, + { typeof(Func), InterpretedFuncDispatcher.Factory }, + { typeof(Func), InterpretedFuncDispatcher.Factory }, + { typeof(Func), InterpretedFuncDispatcher.Factory }, + +#endregion + }; } #if GENERATOR @@ -143,7 +186,7 @@ end #else public class RubyObjectMethodDispatcher/*$GenericDecl*/ : MethodDispatcher> { - public override object/*!*/ CreateDelegate() { + public override object/*!*/ CreateDelegate(bool isUntyped) { return new Func(Invoke); } @@ -159,33 +202,39 @@ } public class RubyObjectMethodDispatcherWithScope/*$GenericDecl*/ : MethodDispatcher> { - public override object/*!*/ CreateDelegate() { - return new Func(Invoke); + public override object/*!*/ CreateDelegate(bool isUntyped) { + return isUntyped ? + (object)new Func(Invoke) : + (object)new Func(Invoke); } - public object Invoke(CallSite/*!*/ callSite, RubyScope/*!*/ scope, object self /*$Parameters*/) { + public object Invoke(CallSite/*!*/ callSite, TScope/*!*/ scope, object self /*$Parameters*/) { IRubyObject obj = self as IRubyObject; if (obj != null && obj.ImmediateClass.Version.Method == Version) { return Method(self, null /*$Arguments*/); } else { - return ((CallSite>)callSite). + return ((CallSite>)callSite). Update(callSite, scope, self /*$Arguments*/); } } } public class RubyObjectMethodDispatcherWithBlock/*$GenericDecl*/ : MethodDispatcher> { - public override object/*!*/ CreateDelegate() { - return new Func(Invoke); + public override object/*!*/ CreateDelegate(bool isUntyped) { + return isUntyped ? + (object)new Func(Invoke) : + (object)new Func(Invoke); } - public object Invoke(CallSite/*!*/ callSite, object self, Proc proc /*$Parameters*/) { + public object Invoke(CallSite/*!*/ callSite, object self, TProc proc /*$Parameters*/) { IRubyObject obj = self as IRubyObject; if (obj != null && obj.ImmediateClass.Version.Method == Version) { + var p = (Proc)(object)proc; + // see RubyMethodInfo.cs: RuleControlFlowBuilder - var rfc = RubyOps.CreateRfcForMethod(proc); + var rfc = RubyOps.CreateRfcForMethod(p); try { - return Method(self, proc /*$Arguments*/); + return Method(self, p /*$Arguments*/); } catch (MethodUnwinder unwinder) { if (unwinder.TargetFrame == rfc) { return unwinder.ReturnValue; @@ -196,24 +245,29 @@ rfc.LeaveMethod(); } } else { - return ((CallSite>)callSite). + return ((CallSite>)callSite). Update(callSite, self, proc /*$Arguments*/); } } } public class RubyObjectMethodDispatcherWithScopeAndBlock/*$GenericDecl*/ : MethodDispatcher> { - public override object/*!*/ CreateDelegate() { - return new Func(Invoke); + public override object/*!*/ CreateDelegate(bool isUntyped) { + return isUntyped ? + (object)new Func(Invoke) : + (object)new Func(Invoke); + } - public object Invoke(CallSite/*!*/ callSite, RubyScope/*!*/ scope, object self, Proc proc /*$Parameters*/) { + public object Invoke(CallSite/*!*/ callSite, TScope/*!*/ scope, object self, TProc proc /*$Parameters*/) { IRubyObject obj = self as IRubyObject; if (obj != null && obj.ImmediateClass.Version.Method == Version) { + var p = (Proc)(object)proc; + // see RubyMethodInfo.cs: RuleControlFlowBuilder - var rfc = RubyOps.CreateRfcForMethod(proc); + var rfc = RubyOps.CreateRfcForMethod(p); try { - return Method(self, proc /*$Arguments*/); + return Method(self, p /*$Arguments*/); } catch (MethodUnwinder unwinder) { if (unwinder.TargetFrame == rfc) { return unwinder.ReturnValue; @@ -224,15 +278,16 @@ rfc.LeaveMethod(); } } else { - return ((CallSite>)callSite). + return ((CallSite>)callSite). Update(callSite, scope, self, proc /*$Arguments*/); } } } #endif #region Generated by MethodDispatcher.Generator.rb + public class RubyObjectMethodDispatcher : MethodDispatcher> { - public override object/*!*/ CreateDelegate() { + public override object/*!*/ CreateDelegate(bool isUntyped) { return new Func(Invoke); } @@ -248,33 +303,39 @@ } public class RubyObjectMethodDispatcherWithScope : MethodDispatcher> { - public override object/*!*/ CreateDelegate() { - return new Func(Invoke); + public override object/*!*/ CreateDelegate(bool isUntyped) { + return isUntyped ? + (object)new Func(Invoke) : + (object)new Func(Invoke); } - public object Invoke(CallSite/*!*/ callSite, RubyScope/*!*/ scope, object self ,T0 arg0) { + public object Invoke(CallSite/*!*/ callSite, TScope/*!*/ scope, object self ,T0 arg0) { IRubyObject obj = self as IRubyObject; if (obj != null && obj.ImmediateClass.Version.Method == Version) { return Method(self, null ,arg0); } else { - return ((CallSite>)callSite). + return ((CallSite>)callSite). Update(callSite, scope, self ,arg0); } } } public class RubyObjectMethodDispatcherWithBlock : MethodDispatcher> { - public override object/*!*/ CreateDelegate() { - return new Func(Invoke); + public override object/*!*/ CreateDelegate(bool isUntyped) { + return isUntyped ? + (object)new Func(Invoke) : + (object)new Func(Invoke); } - public object Invoke(CallSite/*!*/ callSite, object self, Proc proc ,T0 arg0) { + public object Invoke(CallSite/*!*/ callSite, object self, TProc proc ,T0 arg0) { IRubyObject obj = self as IRubyObject; if (obj != null && obj.ImmediateClass.Version.Method == Version) { + var p = (Proc)(object)proc; + // see RubyMethodInfo.cs: RuleControlFlowBuilder - var rfc = RubyOps.CreateRfcForMethod(proc); + var rfc = RubyOps.CreateRfcForMethod(p); try { - return Method(self, proc ,arg0); + return Method(self, p ,arg0); } catch (MethodUnwinder unwinder) { if (unwinder.TargetFrame == rfc) { return unwinder.ReturnValue; @@ -285,24 +346,29 @@ rfc.LeaveMethod(); } } else { - return ((CallSite>)callSite). + return ((CallSite>)callSite). Update(callSite, self, proc ,arg0); } } } public class RubyObjectMethodDispatcherWithScopeAndBlock : MethodDispatcher> { - public override object/*!*/ CreateDelegate() { - return new Func(Invoke); + public override object/*!*/ CreateDelegate(bool isUntyped) { + return isUntyped ? + (object)new Func(Invoke) : + (object)new Func(Invoke); + } - public object Invoke(CallSite/*!*/ callSite, RubyScope/*!*/ scope, object self, Proc proc ,T0 arg0) { + public object Invoke(CallSite/*!*/ callSite, TScope/*!*/ scope, object self, TProc proc ,T0 arg0) { IRubyObject obj = self as IRubyObject; if (obj != null && obj.ImmediateClass.Version.Method == Version) { + var p = (Proc)(object)proc; + // see RubyMethodInfo.cs: RuleControlFlowBuilder - var rfc = RubyOps.CreateRfcForMethod(proc); + var rfc = RubyOps.CreateRfcForMethod(p); try { - return Method(self, proc ,arg0); + return Method(self, p ,arg0); } catch (MethodUnwinder unwinder) { if (unwinder.TargetFrame == rfc) { return unwinder.ReturnValue; @@ -313,13 +379,13 @@ rfc.LeaveMethod(); } } else { - return ((CallSite>)callSite). + return ((CallSite>)callSite). Update(callSite, scope, self, proc ,arg0); } } } public class RubyObjectMethodDispatcher : MethodDispatcher> { - public override object/*!*/ CreateDelegate() { + public override object/*!*/ CreateDelegate(bool isUntyped) { return new Func(Invoke); } @@ -335,33 +401,39 @@ } public class RubyObjectMethodDispatcherWithScope : MethodDispatcher> { - public override object/*!*/ CreateDelegate() { - return new Func(Invoke); + public override object/*!*/ CreateDelegate(bool isUntyped) { + return isUntyped ? + (object)new Func(Invoke) : + (object)new Func(Invoke); } - public object Invoke(CallSite/*!*/ callSite, RubyScope/*!*/ scope, object self ,T0 arg0, T1 arg1) { + public object Invoke(CallSite/*!*/ callSite, TScope/*!*/ scope, object self ,T0 arg0, T1 arg1) { IRubyObject obj = self as IRubyObject; if (obj != null && obj.ImmediateClass.Version.Method == Version) { return Method(self, null ,arg0, arg1); } else { - return ((CallSite>)callSite). + return ((CallSite>)callSite). Update(callSite, scope, self ,arg0, arg1); } } } public class RubyObjectMethodDispatcherWithBlock : MethodDispatcher> { - public override object/*!*/ CreateDelegate() { - return new Func(Invoke); + public override object/*!*/ CreateDelegate(bool isUntyped) { + return isUntyped ? + (object)new Func(Invoke) : + (object)new Func(Invoke); } - public object Invoke(CallSite/*!*/ callSite, object self, Proc proc ,T0 arg0, T1 arg1) { + public object Invoke(CallSite/*!*/ callSite, object self, TProc proc ,T0 arg0, T1 arg1) { IRubyObject obj = self as IRubyObject; if (obj != null && obj.ImmediateClass.Version.Method == Version) { + var p = (Proc)(object)proc; + // see RubyMethodInfo.cs: RuleControlFlowBuilder - var rfc = RubyOps.CreateRfcForMethod(proc); + var rfc = RubyOps.CreateRfcForMethod(p); try { - return Method(self, proc ,arg0, arg1); + return Method(self, p ,arg0, arg1); } catch (MethodUnwinder unwinder) { if (unwinder.TargetFrame == rfc) { return unwinder.ReturnValue; @@ -372,24 +444,29 @@ rfc.LeaveMethod(); } } else { - return ((CallSite>)callSite). + return ((CallSite>)callSite). Update(callSite, self, proc ,arg0, arg1); } } } public class RubyObjectMethodDispatcherWithScopeAndBlock : MethodDispatcher> { - public override object/*!*/ CreateDelegate() { - return new Func(Invoke); + public override object/*!*/ CreateDelegate(bool isUntyped) { + return isUntyped ? + (object)new Func(Invoke) : + (object)new Func(Invoke); + } - public object Invoke(CallSite/*!*/ callSite, RubyScope/*!*/ scope, object self, Proc proc ,T0 arg0, T1 arg1) { + public object Invoke(CallSite/*!*/ callSite, TScope/*!*/ scope, object self, TProc proc ,T0 arg0, T1 arg1) { IRubyObject obj = self as IRubyObject; if (obj != null && obj.ImmediateClass.Version.Method == Version) { + var p = (Proc)(object)proc; + // see RubyMethodInfo.cs: RuleControlFlowBuilder - var rfc = RubyOps.CreateRfcForMethod(proc); + var rfc = RubyOps.CreateRfcForMethod(p); try { - return Method(self, proc ,arg0, arg1); + return Method(self, p ,arg0, arg1); } catch (MethodUnwinder unwinder) { if (unwinder.TargetFrame == rfc) { return unwinder.ReturnValue; @@ -400,13 +477,13 @@ rfc.LeaveMethod(); } } else { - return ((CallSite>)callSite). + return ((CallSite>)callSite). Update(callSite, scope, self, proc ,arg0, arg1); } } } public class RubyObjectMethodDispatcher : MethodDispatcher> { - public override object/*!*/ CreateDelegate() { + public override object/*!*/ CreateDelegate(bool isUntyped) { return new Func(Invoke); } @@ -422,33 +499,39 @@ } public class RubyObjectMethodDispatcherWithScope : MethodDispatcher> { - public override object/*!*/ CreateDelegate() { - return new Func(Invoke); + public override object/*!*/ CreateDelegate(bool isUntyped) { + return isUntyped ? + (object)new Func(Invoke) : + (object)new Func(Invoke); } - public object Invoke(CallSite/*!*/ callSite, RubyScope/*!*/ scope, object self ,T0 arg0, T1 arg1, T2 arg2) { + public object Invoke(CallSite/*!*/ callSite, TScope/*!*/ scope, object self ,T0 arg0, T1 arg1, T2 arg2) { IRubyObject obj = self as IRubyObject; if (obj != null && obj.ImmediateClass.Version.Method == Version) { return Method(self, null ,arg0, arg1, arg2); } else { - return ((CallSite>)callSite). + return ((CallSite>)callSite). Update(callSite, scope, self ,arg0, arg1, arg2); } } } public class RubyObjectMethodDispatcherWithBlock : MethodDispatcher> { - public override object/*!*/ CreateDelegate() { - return new Func(Invoke); + public override object/*!*/ CreateDelegate(bool isUntyped) { + return isUntyped ? + (object)new Func(Invoke) : + (object)new Func(Invoke); } - public object Invoke(CallSite/*!*/ callSite, object self, Proc proc ,T0 arg0, T1 arg1, T2 arg2) { + public object Invoke(CallSite/*!*/ callSite, object self, TProc proc ,T0 arg0, T1 arg1, T2 arg2) { IRubyObject obj = self as IRubyObject; if (obj != null && obj.ImmediateClass.Version.Method == Version) { + var p = (Proc)(object)proc; + // see RubyMethodInfo.cs: RuleControlFlowBuilder - var rfc = RubyOps.CreateRfcForMethod(proc); + var rfc = RubyOps.CreateRfcForMethod(p); try { - return Method(self, proc ,arg0, arg1, arg2); + return Method(self, p ,arg0, arg1, arg2); } catch (MethodUnwinder unwinder) { if (unwinder.TargetFrame == rfc) { return unwinder.ReturnValue; @@ -459,24 +542,29 @@ rfc.LeaveMethod(); } } else { - return ((CallSite>)callSite). + return ((CallSite>)callSite). Update(callSite, self, proc ,arg0, arg1, arg2); } } } public class RubyObjectMethodDispatcherWithScopeAndBlock : MethodDispatcher> { - public override object/*!*/ CreateDelegate() { - return new Func(Invoke); + public override object/*!*/ CreateDelegate(bool isUntyped) { + return isUntyped ? + (object)new Func(Invoke) : + (object)new Func(Invoke); + } - public object Invoke(CallSite/*!*/ callSite, RubyScope/*!*/ scope, object self, Proc proc ,T0 arg0, T1 arg1, T2 arg2) { + public object Invoke(CallSite/*!*/ callSite, TScope/*!*/ scope, object self, TProc proc ,T0 arg0, T1 arg1, T2 arg2) { IRubyObject obj = self as IRubyObject; if (obj != null && obj.ImmediateClass.Version.Method == Version) { + var p = (Proc)(object)proc; + // see RubyMethodInfo.cs: RuleControlFlowBuilder - var rfc = RubyOps.CreateRfcForMethod(proc); + var rfc = RubyOps.CreateRfcForMethod(p); try { - return Method(self, proc ,arg0, arg1, arg2); + return Method(self, p ,arg0, arg1, arg2); } catch (MethodUnwinder unwinder) { if (unwinder.TargetFrame == rfc) { return unwinder.ReturnValue; @@ -487,13 +575,13 @@ rfc.LeaveMethod(); } } else { - return ((CallSite>)callSite). + return ((CallSite>)callSite). Update(callSite, scope, self, proc ,arg0, arg1, arg2); } } } public class RubyObjectMethodDispatcher : MethodDispatcher> { - public override object/*!*/ CreateDelegate() { + public override object/*!*/ CreateDelegate(bool isUntyped) { return new Func(Invoke); } @@ -509,33 +597,39 @@ } public class RubyObjectMethodDispatcherWithScope : MethodDispatcher> { - public override object/*!*/ CreateDelegate() { - return new Func(Invoke); + public override object/*!*/ CreateDelegate(bool isUntyped) { + return isUntyped ? + (object)new Func(Invoke) : + (object)new Func(Invoke); } - public object Invoke(CallSite/*!*/ callSite, RubyScope/*!*/ scope, object self ,T0 arg0, T1 arg1, T2 arg2, T3 arg3) { + public object Invoke(CallSite/*!*/ callSite, TScope/*!*/ scope, object self ,T0 arg0, T1 arg1, T2 arg2, T3 arg3) { IRubyObject obj = self as IRubyObject; if (obj != null && obj.ImmediateClass.Version.Method == Version) { return Method(self, null ,arg0, arg1, arg2, arg3); } else { - return ((CallSite>)callSite). + return ((CallSite>)callSite). Update(callSite, scope, self ,arg0, arg1, arg2, arg3); } } } public class RubyObjectMethodDispatcherWithBlock : MethodDispatcher> { - public override object/*!*/ CreateDelegate() { - return new Func(Invoke); + public override object/*!*/ CreateDelegate(bool isUntyped) { + return isUntyped ? + (object)new Func(Invoke) : + (object)new Func(Invoke); } - public object Invoke(CallSite/*!*/ callSite, object self, Proc proc ,T0 arg0, T1 arg1, T2 arg2, T3 arg3) { + public object Invoke(CallSite/*!*/ callSite, object self, TProc proc ,T0 arg0, T1 arg1, T2 arg2, T3 arg3) { IRubyObject obj = self as IRubyObject; if (obj != null && obj.ImmediateClass.Version.Method == Version) { + var p = (Proc)(object)proc; + // see RubyMethodInfo.cs: RuleControlFlowBuilder - var rfc = RubyOps.CreateRfcForMethod(proc); + var rfc = RubyOps.CreateRfcForMethod(p); try { - return Method(self, proc ,arg0, arg1, arg2, arg3); + return Method(self, p ,arg0, arg1, arg2, arg3); } catch (MethodUnwinder unwinder) { if (unwinder.TargetFrame == rfc) { return unwinder.ReturnValue; @@ -546,24 +640,29 @@ rfc.LeaveMethod(); } } else { - return ((CallSite>)callSite). + return ((CallSite>)callSite). Update(callSite, self, proc ,arg0, arg1, arg2, arg3); } } } public class RubyObjectMethodDispatcherWithScopeAndBlock : MethodDispatcher> { - public override object/*!*/ CreateDelegate() { - return new Func(Invoke); + public override object/*!*/ CreateDelegate(bool isUntyped) { + return isUntyped ? + (object)new Func(Invoke) : + (object)new Func(Invoke); + } - public object Invoke(CallSite/*!*/ callSite, RubyScope/*!*/ scope, object self, Proc proc ,T0 arg0, T1 arg1, T2 arg2, T3 arg3) { + public object Invoke(CallSite/*!*/ callSite, TScope/*!*/ scope, object self, TProc proc ,T0 arg0, T1 arg1, T2 arg2, T3 arg3) { IRubyObject obj = self as IRubyObject; if (obj != null && obj.ImmediateClass.Version.Method == Version) { + var p = (Proc)(object)proc; + // see RubyMethodInfo.cs: RuleControlFlowBuilder - var rfc = RubyOps.CreateRfcForMethod(proc); + var rfc = RubyOps.CreateRfcForMethod(p); try { - return Method(self, proc ,arg0, arg1, arg2, arg3); + return Method(self, p ,arg0, arg1, arg2, arg3); } catch (MethodUnwinder unwinder) { if (unwinder.TargetFrame == rfc) { return unwinder.ReturnValue; @@ -574,13 +673,13 @@ rfc.LeaveMethod(); } } else { - return ((CallSite>)callSite). + return ((CallSite>)callSite). Update(callSite, scope, self, proc ,arg0, arg1, arg2, arg3); } } } public class RubyObjectMethodDispatcher : MethodDispatcher> { - public override object/*!*/ CreateDelegate() { + public override object/*!*/ CreateDelegate(bool isUntyped) { return new Func(Invoke); } @@ -596,33 +695,39 @@ } public class RubyObjectMethodDispatcherWithScope : MethodDispatcher> { - public override object/*!*/ CreateDelegate() { - return new Func(Invoke); + public override object/*!*/ CreateDelegate(bool isUntyped) { + return isUntyped ? + (object)new Func(Invoke) : + (object)new Func(Invoke); } - public object Invoke(CallSite/*!*/ callSite, RubyScope/*!*/ scope, object self ,T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4) { + public object Invoke(CallSite/*!*/ callSite, TScope/*!*/ scope, object self ,T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4) { IRubyObject obj = self as IRubyObject; if (obj != null && obj.ImmediateClass.Version.Method == Version) { return Method(self, null ,arg0, arg1, arg2, arg3, arg4); } else { - return ((CallSite>)callSite). + return ((CallSite>)callSite). Update(callSite, scope, self ,arg0, arg1, arg2, arg3, arg4); } } } public class RubyObjectMethodDispatcherWithBlock : MethodDispatcher> { - public override object/*!*/ CreateDelegate() { - return new Func(Invoke); + public override object/*!*/ CreateDelegate(bool isUntyped) { + return isUntyped ? + (object)new Func(Invoke) : + (object)new Func(Invoke); } - public object Invoke(CallSite/*!*/ callSite, object self, Proc proc ,T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4) { + public object Invoke(CallSite/*!*/ callSite, object self, TProc proc ,T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4) { IRubyObject obj = self as IRubyObject; if (obj != null && obj.ImmediateClass.Version.Method == Version) { + var p = (Proc)(object)proc; + // see RubyMethodInfo.cs: RuleControlFlowBuilder - var rfc = RubyOps.CreateRfcForMethod(proc); + var rfc = RubyOps.CreateRfcForMethod(p); try { - return Method(self, proc ,arg0, arg1, arg2, arg3, arg4); + return Method(self, p ,arg0, arg1, arg2, arg3, arg4); } catch (MethodUnwinder unwinder) { if (unwinder.TargetFrame == rfc) { return unwinder.ReturnValue; @@ -633,24 +738,29 @@ rfc.LeaveMethod(); } } else { - return ((CallSite>)callSite). + return ((CallSite>)callSite). Update(callSite, self, proc ,arg0, arg1, arg2, arg3, arg4); } } } public class RubyObjectMethodDispatcherWithScopeAndBlock : MethodDispatcher> { - public override object/*!*/ CreateDelegate() { - return new Func(Invoke); + public override object/*!*/ CreateDelegate(bool isUntyped) { + return isUntyped ? + (object)new Func(Invoke) : + (object)new Func(Invoke); + } - public object Invoke(CallSite/*!*/ callSite, RubyScope/*!*/ scope, object self, Proc proc ,T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4) { + public object Invoke(CallSite/*!*/ callSite, TScope/*!*/ scope, object self, TProc proc ,T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4) { IRubyObject obj = self as IRubyObject; if (obj != null && obj.ImmediateClass.Version.Method == Version) { + var p = (Proc)(object)proc; + // see RubyMethodInfo.cs: RuleControlFlowBuilder - var rfc = RubyOps.CreateRfcForMethod(proc); + var rfc = RubyOps.CreateRfcForMethod(p); try { - return Method(self, proc ,arg0, arg1, arg2, arg3, arg4); + return Method(self, p ,arg0, arg1, arg2, arg3, arg4); } catch (MethodUnwinder unwinder) { if (unwinder.TargetFrame == rfc) { return unwinder.ReturnValue; @@ -661,11 +771,12 @@ rfc.LeaveMethod(); } } else { - return ((CallSite>)callSite). + return ((CallSite>)callSite). Update(callSite, scope, self, proc ,arg0, arg1, arg2, arg3, arg4); } } } + #endregion #if GENERATOR @@ -684,6 +795,10 @@ internal override ReadOnlyCollection Parameters { get { return _Parameters; } } internal override LabelTarget ReturnLabel { get { return _ReturnLabel; } } + internal static InterpretedDispatcher/*!*/ Factory() { + return new InterpretedFuncDispatcher(); + } + internal override object/*!*/ GetInterpretingDelegate() { return new Func(Invoke); } @@ -707,6 +822,10 @@ internal override ReadOnlyCollection Parameters { get { return _Parameters; } } internal override LabelTarget ReturnLabel { get { return _ReturnLabel; } } + internal static InterpretedDispatcher/*!*/ Factory() { + return new InterpretedActionDispatcher/*$GenericParamsBrackets*/(); + } + internal override object/*!*/ GetInterpretingDelegate() { return new Action(Invoke); } @@ -720,6 +839,7 @@ } #endif #region Generated by MethodDispatcher.Generator.rb + public class InterpretedFuncDispatcher : InterpretedDispatcher { internal static readonly ReadOnlyCollection _Parameters = new ReadOnlyCollection(new ParameterExpression[] { @@ -731,6 +851,10 @@ internal override ReadOnlyCollection Parameters { get { return _Parameters; } } internal override LabelTarget ReturnLabel { get { return _ReturnLabel; } } + internal static InterpretedDispatcher/*!*/ Factory() { + return new InterpretedFuncDispatcher(); + } + internal override object/*!*/ GetInterpretingDelegate() { return new Func(Invoke); } @@ -754,6 +878,10 @@ internal override ReadOnlyCollection Parameters { get { return _Parameters; } } internal override LabelTarget ReturnLabel { get { return _ReturnLabel; } } + internal static InterpretedDispatcher/*!*/ Factory() { + return new InterpretedActionDispatcher(); + } + internal override object/*!*/ GetInterpretingDelegate() { return new Action(Invoke); } @@ -776,6 +904,10 @@ internal override ReadOnlyCollection Parameters { get { return _Parameters; } } internal override LabelTarget ReturnLabel { get { return _ReturnLabel; } } + internal static InterpretedDispatcher/*!*/ Factory() { + return new InterpretedFuncDispatcher(); + } + internal override object/*!*/ GetInterpretingDelegate() { return new Func(Invoke); } @@ -799,6 +931,10 @@ internal override ReadOnlyCollection Parameters { get { return _Parameters; } } internal override LabelTarget ReturnLabel { get { return _ReturnLabel; } } + internal static InterpretedDispatcher/*!*/ Factory() { + return new InterpretedActionDispatcher(); + } + internal override object/*!*/ GetInterpretingDelegate() { return new Action(Invoke); } @@ -821,6 +957,10 @@ internal override ReadOnlyCollection Parameters { get { return _Parameters; } } internal override LabelTarget ReturnLabel { get { return _ReturnLabel; } } + internal static InterpretedDispatcher/*!*/ Factory() { + return new InterpretedFuncDispatcher(); + } + internal override object/*!*/ GetInterpretingDelegate() { return new Func(Invoke); } @@ -844,6 +984,10 @@ internal override ReadOnlyCollection Parameters { get { return _Parameters; } } internal override LabelTarget ReturnLabel { get { return _ReturnLabel; } } + internal static InterpretedDispatcher/*!*/ Factory() { + return new InterpretedActionDispatcher(); + } + internal override object/*!*/ GetInterpretingDelegate() { return new Action(Invoke); } @@ -866,6 +1010,10 @@ internal override ReadOnlyCollection Parameters { get { return _Parameters; } } internal override LabelTarget ReturnLabel { get { return _ReturnLabel; } } + internal static InterpretedDispatcher/*!*/ Factory() { + return new InterpretedFuncDispatcher(); + } + internal override object/*!*/ GetInterpretingDelegate() { return new Func(Invoke); } @@ -889,6 +1037,10 @@ internal override ReadOnlyCollection Parameters { get { return _Parameters; } } internal override LabelTarget ReturnLabel { get { return _ReturnLabel; } } + internal static InterpretedDispatcher/*!*/ Factory() { + return new InterpretedActionDispatcher(); + } + internal override object/*!*/ GetInterpretingDelegate() { return new Action(Invoke); } @@ -911,6 +1063,10 @@ internal override ReadOnlyCollection Parameters { get { return _Parameters; } } internal override LabelTarget ReturnLabel { get { return _ReturnLabel; } } + internal static InterpretedDispatcher/*!*/ Factory() { + return new InterpretedFuncDispatcher(); + } + internal override object/*!*/ GetInterpretingDelegate() { return new Func(Invoke); } @@ -934,6 +1090,10 @@ internal override ReadOnlyCollection Parameters { get { return _Parameters; } } internal override LabelTarget ReturnLabel { get { return _ReturnLabel; } } + internal static InterpretedDispatcher/*!*/ Factory() { + return new InterpretedActionDispatcher(); + } + internal override object/*!*/ GetInterpretingDelegate() { return new Action(Invoke); } @@ -956,6 +1116,10 @@ internal override ReadOnlyCollection Parameters { get { return _Parameters; } } internal override LabelTarget ReturnLabel { get { return _ReturnLabel; } } + internal static InterpretedDispatcher/*!*/ Factory() { + return new InterpretedFuncDispatcher(); + } + internal override object/*!*/ GetInterpretingDelegate() { return new Func(Invoke); } @@ -979,6 +1143,10 @@ internal override ReadOnlyCollection Parameters { get { return _Parameters; } } internal override LabelTarget ReturnLabel { get { return _ReturnLabel; } } + internal static InterpretedDispatcher/*!*/ Factory() { + return new InterpretedActionDispatcher(); + } + internal override object/*!*/ GetInterpretingDelegate() { return new Action(Invoke); } @@ -1001,6 +1169,10 @@ internal override ReadOnlyCollection Parameters { get { return _Parameters; } } internal override LabelTarget ReturnLabel { get { return _ReturnLabel; } } + internal static InterpretedDispatcher/*!*/ Factory() { + return new InterpretedFuncDispatcher(); + } + internal override object/*!*/ GetInterpretingDelegate() { return new Func(Invoke); } @@ -1024,6 +1196,10 @@ internal override ReadOnlyCollection Parameters { get { return _Parameters; } } internal override LabelTarget ReturnLabel { get { return _ReturnLabel; } } + internal static InterpretedDispatcher/*!*/ Factory() { + return new InterpretedActionDispatcher(); + } + internal override object/*!*/ GetInterpretingDelegate() { return new Action(Invoke); } @@ -1046,6 +1222,10 @@ internal override ReadOnlyCollection Parameters { get { return _Parameters; } } internal override LabelTarget ReturnLabel { get { return _ReturnLabel; } } + internal static InterpretedDispatcher/*!*/ Factory() { + return new InterpretedFuncDispatcher(); + } + internal override object/*!*/ GetInterpretingDelegate() { return new Func(Invoke); } @@ -1069,6 +1249,10 @@ internal override ReadOnlyCollection Parameters { get { return _Parameters; } } internal override LabelTarget ReturnLabel { get { return _ReturnLabel; } } + internal static InterpretedDispatcher/*!*/ Factory() { + return new InterpretedActionDispatcher(); + } + internal override object/*!*/ GetInterpretingDelegate() { return new Action(Invoke); } @@ -1091,6 +1275,10 @@ internal override ReadOnlyCollection Parameters { get { return _Parameters; } } internal override LabelTarget ReturnLabel { get { return _ReturnLabel; } } + internal static InterpretedDispatcher/*!*/ Factory() { + return new InterpretedFuncDispatcher(); + } + internal override object/*!*/ GetInterpretingDelegate() { return new Func(Invoke); } @@ -1114,6 +1302,10 @@ internal override ReadOnlyCollection Parameters { get { return _Parameters; } } internal override LabelTarget ReturnLabel { get { return _ReturnLabel; } } + internal static InterpretedDispatcher/*!*/ Factory() { + return new InterpretedActionDispatcher(); + } + internal override object/*!*/ GetInterpretingDelegate() { return new Action(Invoke); } @@ -1136,6 +1328,10 @@ internal override ReadOnlyCollection Parameters { get { return _Parameters; } } internal override LabelTarget ReturnLabel { get { return _ReturnLabel; } } + internal static InterpretedDispatcher/*!*/ Factory() { + return new InterpretedFuncDispatcher(); + } + internal override object/*!*/ GetInterpretingDelegate() { return new Func(Invoke); } @@ -1159,6 +1355,10 @@ internal override ReadOnlyCollection Parameters { get { return _Parameters; } } internal override LabelTarget ReturnLabel { get { return _ReturnLabel; } } + internal static InterpretedDispatcher/*!*/ Factory() { + return new InterpretedActionDispatcher(); + } + internal override object/*!*/ GetInterpretingDelegate() { return new Action(Invoke); } @@ -1181,6 +1381,10 @@ internal override ReadOnlyCollection Parameters { get { return _Parameters; } } internal override LabelTarget ReturnLabel { get { return _ReturnLabel; } } + internal static InterpretedDispatcher/*!*/ Factory() { + return new InterpretedFuncDispatcher(); + } + internal override object/*!*/ GetInterpretingDelegate() { return new Func(Invoke); } @@ -1204,6 +1408,10 @@ internal override ReadOnlyCollection Parameters { get { return _Parameters; } } internal override LabelTarget ReturnLabel { get { return _ReturnLabel; } } + internal static InterpretedDispatcher/*!*/ Factory() { + return new InterpretedActionDispatcher(); + } + internal override object/*!*/ GetInterpretingDelegate() { return new Action(Invoke); } @@ -1226,6 +1434,10 @@ internal override ReadOnlyCollection Parameters { get { return _Parameters; } } internal override LabelTarget ReturnLabel { get { return _ReturnLabel; } } + internal static InterpretedDispatcher/*!*/ Factory() { + return new InterpretedFuncDispatcher(); + } + internal override object/*!*/ GetInterpretingDelegate() { return new Func(Invoke); } @@ -1249,6 +1461,10 @@ internal override ReadOnlyCollection Parameters { get { return _Parameters; } } internal override LabelTarget ReturnLabel { get { return _ReturnLabel; } } + internal static InterpretedDispatcher/*!*/ Factory() { + return new InterpretedActionDispatcher(); + } + internal override object/*!*/ GetInterpretingDelegate() { return new Action(Invoke); } @@ -1271,6 +1487,10 @@ internal override ReadOnlyCollection Parameters { get { return _Parameters; } } internal override LabelTarget ReturnLabel { get { return _ReturnLabel; } } + internal static InterpretedDispatcher/*!*/ Factory() { + return new InterpretedFuncDispatcher(); + } + internal override object/*!*/ GetInterpretingDelegate() { return new Func(Invoke); } @@ -1294,6 +1514,10 @@ internal override ReadOnlyCollection Parameters { get { return _Parameters; } } internal override LabelTarget ReturnLabel { get { return _ReturnLabel; } } + internal static InterpretedDispatcher/*!*/ Factory() { + return new InterpretedActionDispatcher(); + } + internal override object/*!*/ GetInterpretingDelegate() { return new Action(Invoke); } @@ -1316,6 +1540,10 @@ internal override ReadOnlyCollection Parameters { get { return _Parameters; } } internal override LabelTarget ReturnLabel { get { return _ReturnLabel; } } + internal static InterpretedDispatcher/*!*/ Factory() { + return new InterpretedFuncDispatcher(); + } + internal override object/*!*/ GetInterpretingDelegate() { return new Func(Invoke); } @@ -1339,6 +1567,10 @@ internal override ReadOnlyCollection Parameters { get { return _Parameters; } } internal override LabelTarget ReturnLabel { get { return _ReturnLabel; } } + internal static InterpretedDispatcher/*!*/ Factory() { + return new InterpretedActionDispatcher(); + } + internal override object/*!*/ GetInterpretingDelegate() { return new Action(Invoke); } @@ -1361,6 +1593,10 @@ internal override ReadOnlyCollection Parameters { get { return _Parameters; } } internal override LabelTarget ReturnLabel { get { return _ReturnLabel; } } + internal static InterpretedDispatcher/*!*/ Factory() { + return new InterpretedFuncDispatcher(); + } + internal override object/*!*/ GetInterpretingDelegate() { return new Func(Invoke); } @@ -1384,6 +1620,10 @@ internal override ReadOnlyCollection Parameters { get { return _Parameters; } } internal override LabelTarget ReturnLabel { get { return _ReturnLabel; } } + internal static InterpretedDispatcher/*!*/ Factory() { + return new InterpretedActionDispatcher(); + } + internal override object/*!*/ GetInterpretingDelegate() { return new Action(Invoke); } @@ -1395,6 +1635,7 @@ ((Action)_rule)(callSite ,arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14); } } + #endregion } =================================================================== edit: $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/Ruby/Runtime/Calls/MethodDispatcher.Generator.rb;C966724 File: MethodDispatcher.Generator.rb =================================================================== --- $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/Ruby/Runtime/Calls/MethodDispatcher.Generator.rb;C966724 (server) 12/7/2009 4:49 PM +++ Shelved Change: $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/Ruby/Runtime/Calls/MethodDispatcher.Generator.rb;AstImprovements @@ -16,6 +16,14 @@ def GenericParams Array.new(@n) { |i| ", T#{i}" }.join(" ") end + + def GenericParamsComma + Array.new(@n) { |i| "T#{i}, " }.join(" ") + end + + def GenericParamsBrackets + "<" + (Array.new(@n) { |i| "T#{i}" }.join(", ")) + ">" + end def Objects *args ", object" * @n =================================================================== edit: $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/Ruby/Runtime/Calls/RubyCallAction.cs;C1286631 File: RubyCallAction.cs =================================================================== --- $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/Ruby/Runtime/Calls/RubyCallAction.cs;C1286631 (server) 12/7/2009 5:21 PM +++ Shelved Change: $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/Ruby/Runtime/Calls/RubyCallAction.cs;AstImprovements @@ -128,7 +128,7 @@ var dispatcher = method.Info.GetDispatcher(Signature, target, version); if (dispatcher != null) { - T result = (T)dispatcher.CreateDelegate(); + T result = (T)dispatcher.CreateDelegate(MethodDispatcher.UntypedFuncDispatchers.ContainsKey(typeof(T))); CacheTarget(result); RubyBinder.DumpPrecompiledRule(this, dispatcher); return result; =================================================================== edit: $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/Ruby/Runtime/Calls/RubyMetaBinder.cs;C1264343 File: RubyMetaBinder.cs =================================================================== --- $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/Ruby/Runtime/Calls/RubyMetaBinder.cs;C1264343 (server) 12/7/2009 2:40 PM +++ Shelved Change: $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/Ruby/Runtime/Calls/RubyMetaBinder.cs;AstImprovements @@ -29,6 +29,7 @@ using Microsoft.Scripting; using Microsoft.Scripting.Runtime; using System.Runtime.CompilerServices; +using Microsoft.Scripting.Interpreter; namespace IronRuby.Runtime.Calls { using Ast = Expression; @@ -56,29 +57,29 @@ protected abstract bool Build(MetaObjectBuilder/*!*/ metaBuilder, CallArguments/*!*/ args, bool defaultFallback); public abstract Expression CreateExpression(); - public override T BindDelegate(System.Runtime.CompilerServices.CallSite site, object[] args) { + public override T BindDelegate(CallSite site, object[] args) { RubyContext context = _context ?? ((Signature.HasScope) ? ((RubyScope)args[0]).RubyContext : (RubyContext)args[0]); if (context.Options.NoAdaptiveCompilation) { - return base.BindDelegate(site, args); + return null; } InterpretedDispatcher dispatcher = MethodDispatcher.CreateInterpreted(typeof(T), args.Length); if (dispatcher == null) { // call site has too many arguments: PerfTrack.NoteEvent(PerfTrack.Categories.Binding, "Ruby: ! No dispatcher for " + Signature.ToString()); - return base.BindDelegate(site, args); - } else { - Expression binding = Bind(args, dispatcher.Parameters, dispatcher.ReturnLabel); + return null; + } - if (binding == null) { - throw new InvalidImplementationException("DynamicMetaObjectBinder.Bind must return non-null meta-object"); - } + Expression binding = Bind(args, dispatcher.Parameters, dispatcher.ReturnLabel); - T result = dispatcher.CreateDelegate(binding, context.Options.CompilationThreshold); - CacheTarget(result); - return result; + if (binding == null) { + throw new InvalidImplementationException("DynamicMetaObjectBinder.Bind must return non-null meta-object"); } + + T result = dispatcher.CreateDelegate(binding, context.Options.CompilationThreshold); + CacheTarget(result); + return result; } public override DynamicMetaObject/*!*/ Bind(DynamicMetaObject/*!*/ scopeOrContextOrTarget, DynamicMetaObject/*!*/[]/*!*/ args) { =================================================================== edit: $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/Ruby/Runtime/Conversions/ProtocolConversionAction.cs;C1221101 File: ProtocolConversionAction.cs =================================================================== --- $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/Ruby/Runtime/Conversions/ProtocolConversionAction.cs;C1221101 (server) 12/7/2009 4:17 PM +++ Shelved Change: $/Dev10/feature/vs_langs01_s/Merlin/Main/Languages/Ruby/Ruby/Runtime/Conversions/ProtocolConversionAction.cs;AstImprovements @@ -258,9 +258,8 @@ string toMethodName = conversions[i].ToMethodName; MethodInfo validator = conversions[i].ConversionResultValidator; - var conversionCallSite = Ast.Dynamic( + var conversionCallSite = AstUtils.LightDynamic( RubyCallAction.Make(args.RubyContext, toMethodName, RubyCallSignature.WithImplicitSelf(0)), - typeof(object), args.TargetExpression ); @@ -269,9 +268,8 @@ // respond_to?() Methods.IsTrue.OpCall( - Ast.Dynamic( + AstUtils.LightDynamic( RubyCallAction.Make(args.RubyContext, Symbols.RespondTo, RubyCallSignature.WithImplicitSelf(1)), - typeof(object), args.TargetExpression, AstUtils.Constant(SymbolTable.StringToId(toMethodName)) ) @@ -548,9 +546,8 @@ // that don't implement to_ary - probably a rare case. Methods.ToArrayValidator.OpCall( targetClassNameConstant, - Ast.Dynamic( + AstUtils.LightDynamic( RubyCallAction.Make(args.RubyContext, "to_a", RubyCallSignature.WithImplicitSelf(0)), - typeof(object), args.TargetExpression ) ); ===================================================================