Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion make.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ function ReadyToRun([String] $configuration, [String[]] $frameworks) {

# publishing for a specific runtime also produces runtime specific deps.json/runtimeconfig.json files
# so build and publish to a separate folder and only copy the precompiled assemblies over the portable build
dotnet publish ([System.IO.Path]::Combine($_BASEDIR, "src", "executables", "IronPython.Console", "IronPython.Console.csproj")) -c $configuration -f $framework --use-current-runtime --self-contained false -p:PublishReadyToRun=true "-p:OutputPath=$([System.IO.Path]::Combine($workDir, "build"))/" -o $publishDir -nologo -v minimal
dotnet publish ([System.IO.Path]::Combine($_BASEDIR, "src", "executables", "IronPython.Console", "IronPython.Console.csproj")) -c $configuration -f $framework --use-current-runtime --self-contained false -p:PublishReadyToRun=true "-p:BaseOutputPath=$([System.IO.Path]::Combine($workDir, "build"))/" -o $publishDir -nologo -v minimal
if ($LastExitCode -ne 0) {
$global:Result = $LastExitCode
continue
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ public override T BindDelegate<T>(CallSite<T> site, object[] args) {
}
}

return base.BindDelegate<T>(site, args);
var rule = this.LightBind<T>(args, _convBinder.Context.Options.CompilationThreshold);
CacheTarget(rule);
return rule;
}
/*
private Func<CallSite, object, object, bool> GetStringObjectObjectDelegate(BinaryOperationBinder opBinder) {
Expand Down
4 changes: 3 additions & 1 deletion src/core/IronPython/Runtime/Binding/ConversionBinder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,9 @@ public override T BindDelegate<T>(CallSite<T> site, object[] args) {
}

PerfTrack.NoteEvent(PerfTrack.Categories.Binding, "Convert " + Type.FullName + " " + CompilerHelpers.GetType(args[0]) + " " + typeof(T));
return base.BindDelegate(site, args);
var rule = this.LightBind<T>(args, Context.Options.CompilationThreshold);
CacheTarget(rule);
return rule;
}

public string StringConversion(CallSite site, object value) {
Expand Down
36 changes: 21 additions & 15 deletions src/core/IronPython/Runtime/Binding/PythonBinaryOperationBinder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ public override DynamicMetaObject FallbackBinaryOperation(DynamicMetaObject targ

//private static Func<CallSite, object, object, object> DoubleAddSite = new Func<CallSite, object, object, object>(DoubleAdd);

private T LightBindAndCache<T>(object[] args) where T : class {
var rule = this.LightBind<T>(args, Context.Options.CompilationThreshold);
CacheTarget(rule);
return rule;
}

public override T BindDelegate<T>(CallSite<T> site, object[] args) {
if (args[0] != null &&
CompilerHelpers.GetType(args[0]) == CompilerHelpers.GetType(args[1])) {
Expand Down Expand Up @@ -83,7 +89,7 @@ public override T BindDelegate<T>(CallSite<T> site, object[] args) {
}
}

return base.BindDelegate<T>(site, args);
return LightBindAndCache<T>(args);
}

private T BindModulo<T>(CallSite<T> site, object[] args) where T : class {
Expand All @@ -103,7 +109,7 @@ private T BindModulo<T>(CallSite<T> site, object[] args) where T : class {
}

}
return base.BindDelegate(site, args);
return LightBindAndCache<T>(args);
}

private T BindMultiply<T>(CallSite<T> site, object[] args) where T : class {
Expand All @@ -118,7 +124,7 @@ private T BindMultiply<T>(CallSite<T> site, object[] args) where T : class {
}
}

return base.BindDelegate(site, args);
return LightBindAndCache<T>(args);
}

private T BindMultiplyDifferentTypes<T>(CallSite<T> site, object[] args) where T : class {
Expand All @@ -140,7 +146,7 @@ private T BindMultiplyDifferentTypes<T>(CallSite<T> site, object[] args) where T
}


return base.BindDelegate(site, args);
return LightBindAndCache<T>(args);
}


Expand All @@ -156,7 +162,7 @@ private T BindDivide<T>(CallSite<T> site, object[] args) where T : class {
}
}

return base.BindDelegate(site, args);
return LightBindAndCache<T>(args);
}

private T BindLessThanOrEqual<T>(CallSite<T> site, object[] args) where T : class {
Expand All @@ -171,7 +177,7 @@ private T BindLessThanOrEqual<T>(CallSite<T> site, object[] args) where T : clas
}
}

return base.BindDelegate(site, args);
return LightBindAndCache<T>(args);
}

private T BindGreaterThanOrEqual<T>(CallSite<T> site, object[] args) where T : class {
Expand All @@ -186,7 +192,7 @@ private T BindGreaterThanOrEqual<T>(CallSite<T> site, object[] args) where T : c
}
}

return base.BindDelegate(site, args);
return LightBindAndCache<T>(args);
}

private T BindGreaterThan<T>(CallSite<T> site, object[] args) where T : class {
Expand All @@ -201,7 +207,7 @@ private T BindGreaterThan<T>(CallSite<T> site, object[] args) where T : class {
}
}

return base.BindDelegate(site, args);
return LightBindAndCache<T>(args);
}

private T BindLessThan<T>(CallSite<T> site, object[] args) where T : class {
Expand All @@ -216,7 +222,7 @@ private T BindLessThan<T>(CallSite<T> site, object[] args) where T : class {
}
}

return base.BindDelegate(site, args);
return LightBindAndCache<T>(args);
}

private T BindAnd<T>(CallSite<T> site, object[] args) where T : class {
Expand All @@ -231,7 +237,7 @@ private T BindAnd<T>(CallSite<T> site, object[] args) where T : class {
}
}

return base.BindDelegate(site, args);
return LightBindAndCache<T>(args);
}

private T BindOr<T>(CallSite<T> site, object[] args) where T : class {
Expand All @@ -246,7 +252,7 @@ private T BindOr<T>(CallSite<T> site, object[] args) where T : class {
}
}

return base.BindDelegate(site, args);
return LightBindAndCache<T>(args);
}

private T BindAdd<T>(CallSite<T> site, object[] args) where T : class {
Expand Down Expand Up @@ -290,7 +296,7 @@ private T BindAdd<T>(CallSite<T> site, object[] args) where T : class {
break;
}
}
return base.BindDelegate(site, args);
return LightBindAndCache<T>(args);
}

private T BindSubtract<T>(CallSite<T> site, object[] args) where T : class {
Expand All @@ -313,7 +319,7 @@ private T BindSubtract<T>(CallSite<T> site, object[] args) where T : class {
break;
}
}
return base.BindDelegate(site, args);
return LightBindAndCache<T>(args);
}

private T BindEqual<T>(CallSite<T> site, object[] args) where T : class {
Expand All @@ -334,7 +340,7 @@ private T BindEqual<T>(CallSite<T> site, object[] args) where T : class {
return (T)(object)new Func<CallSite, object, object, object>(IntEqual);
}
}
return base.BindDelegate(site, args);
return LightBindAndCache<T>(args);
}

private T BindNotEqual<T>(CallSite<T> site, object[] args) where T : class {
Expand All @@ -355,7 +361,7 @@ private T BindNotEqual<T>(CallSite<T> site, object[] args) where T : class {
return (T)(object)new Func<CallSite, object, object, object>(IntNotEqual);
}
}
return base.BindDelegate(site, args);
return LightBindAndCache<T>(args);
}

private object StringModulo(CallSite site, string self, PythonDictionary other) {
Expand Down
4 changes: 3 additions & 1 deletion src/core/IronPython/Runtime/Binding/PythonGetIndexBinder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ public override T BindDelegate<T>(CallSite<T> site, object[] args) {
}
}

return base.BindDelegate<T>(site, args);
var rule = this.LightBind<T>(args, Context.Options.CompilationThreshold);
CacheTarget(rule);
return rule;
}

private object ListIndex(CallSite site, PythonList target, object index) {
Expand Down
14 changes: 10 additions & 4 deletions src/core/IronPython/Runtime/Binding/PythonGetMemberBinder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,12 @@ public PythonGetMemberBinder(PythonContext/*!*/ context, string/*!*/ name, bool
return Fallback(target, cc);
}

private T LightBindAndCache<T>(object[] args) where T : class {
var rule = this.LightBind<T>(args, Context.Options.CompilationThreshold);
CacheTarget(rule);
return rule;
}

public override T BindDelegate<T>(CallSite<T> site, object[] args) {
Debug.Assert(args[1].GetType() == typeof(CodeContext));

Expand All @@ -84,7 +90,7 @@ public override T BindDelegate<T>(CallSite<T> site, object[] args) {
}

PerfTrack.NoteEvent(PerfTrack.Categories.BindingSlow, "IFastGettable");
return base.BindDelegate<T>(site, args);
return LightBindAndCache<T>(args);
}

if (args[0] is IPythonObject pyObj && !(args[0] is IProxyObject)) {
Expand All @@ -98,7 +104,7 @@ public override T BindDelegate<T>(CallSite<T> site, object[] args) {
}

PerfTrack.NoteEvent(PerfTrack.Categories.BindingSlow, "IPythonObject Get");
return base.BindDelegate<T>(site, args);
return LightBindAndCache<T>(args);
}

if (args[0] != null) {
Expand Down Expand Up @@ -153,11 +159,11 @@ public override T BindDelegate<T>(CallSite<T> site, object[] args) {
if (res != null) {
return (T)(object)res;
}
return base.BindDelegate<T>(site, args);
return LightBindAndCache<T>(args);
}

PerfTrack.NoteEvent(PerfTrack.Categories.BindingSlow, "GetNoFast " + IsNoThrow + " " + CompilerHelpers.GetType(args[0]));
return this.LightBind<T>(args, Context.Options.CompilationThreshold);
return LightBindAndCache<T>(args);
}

private class FastErrorGet<TSelfType> : FastGetBase {
Expand Down
4 changes: 3 additions & 1 deletion src/core/IronPython/Runtime/Binding/PythonOperationBinder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,9 @@ public override T BindDelegate<T>(CallSite<T> site, object[] args) {
break;

}
return base.BindDelegate<T>(site, args);
var rule = this.LightBind<T>(args, Context.Options.CompilationThreshold);
CacheTarget(rule);
return rule;
}

private KeyValuePair<IEnumerator, IDisposable> GetListEnumerator(CallSite site, PythonList value) {
Expand Down
4 changes: 3 additions & 1 deletion src/core/IronPython/Runtime/Binding/PythonSetIndexBinder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ public override T BindDelegate<T>(CallSite<T> site, object[] args) {
}
}

return base.BindDelegate(site, args);
var rule = this.LightBind<T>(args, Context.Options.CompilationThreshold);
CacheTarget(rule);
return rule;
}

private object DictAssign(CallSite site, object dict, object key, object value) {
Expand Down
5 changes: 4 additions & 1 deletion src/core/IronPython/Runtime/Binding/PythonSetMemberBinder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using System.Dynamic;
using Microsoft.Scripting;
using Microsoft.Scripting.Runtime;
using Microsoft.Scripting.Utils;
using AstUtils = Microsoft.Scripting.Ast.Utils;

using IronPython.Runtime.Binding;
Expand Down Expand Up @@ -67,7 +68,9 @@ public override T BindDelegate<T>(CallSite<T> site, object[] args) {
PerfTrack.NoteEvent(PerfTrack.Categories.BindingSlow, "IPythonObject Set");
}

return base.BindDelegate(site, args);
var rule = this.LightBind<T>(args, Context.Options.CompilationThreshold);
CacheTarget(rule);
return rule;
}

public PythonContext/*!*/ Context {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,9 @@ public override T BindDelegate<T>(CallSite<T> site, object[] args) {
break;
}

return base.BindDelegate(site, args);
var rule = this.LightBind<T>(args, Context.Options.CompilationThreshold);
CacheTarget(rule);
return rule;
}

private object IntNegate(CallSite site, object value) {
Expand Down
4 changes: 3 additions & 1 deletion src/core/IronPython/Runtime/Types/PythonType.Generated.cs
Original file line number Diff line number Diff line change
Expand Up @@ -792,7 +792,9 @@ public override T BindDelegate<T>(CallSite<T> site, object[] args) {
}
}

return base.BindDelegate(site, args);
var rule = this.LightBind<T>(args, _newType.PythonContext.Options.CompilationThreshold);
CacheTarget(rule);
return rule;
}

class FastInitSite {
Expand Down
2 changes: 1 addition & 1 deletion src/dlr
Submodule dlr updated 42 files
+12 −5 .github/workflows/main.yml
+2 −2 .vsts-ci.yml
+11 −26 eng/steps.yml
+0 −283 src/core/Microsoft.Dynamic/Interpreter/Instructions/AddInstruction.cs
+0 −162 src/core/Microsoft.Dynamic/Interpreter/Instructions/DivInstruction.cs
+9 −0 src/core/Microsoft.Dynamic/Interpreter/Instructions/DotNet/.editorconfig
+316 −0 src/core/Microsoft.Dynamic/Interpreter/Instructions/DotNet/AddInstruction.cs
+191 −0 src/core/Microsoft.Dynamic/Interpreter/Instructions/DotNet/AndInstruction.cs
+174 −0 src/core/Microsoft.Dynamic/Interpreter/Instructions/DotNet/DecrementInstruction.cs
+182 −0 src/core/Microsoft.Dynamic/Interpreter/Instructions/DotNet/DivInstruction.cs
+558 −0 src/core/Microsoft.Dynamic/Interpreter/Instructions/DotNet/EqualInstruction.cs
+179 −0 src/core/Microsoft.Dynamic/Interpreter/Instructions/DotNet/ExclusiveOrInstruction.cs
+320 −0 src/core/Microsoft.Dynamic/Interpreter/Instructions/DotNet/GreaterThanInstruction.cs
+320 −0 src/core/Microsoft.Dynamic/Interpreter/Instructions/DotNet/GreaterThanOrEqualInstruction.cs
+174 −0 src/core/Microsoft.Dynamic/Interpreter/Instructions/DotNet/IncrementInstruction.cs
+23 −0 src/core/Microsoft.Dynamic/Interpreter/Instructions/DotNet/LICENSE.TXT
+178 −0 src/core/Microsoft.Dynamic/Interpreter/Instructions/DotNet/LeftShiftInstruction.cs
+319 −0 src/core/Microsoft.Dynamic/Interpreter/Instructions/DotNet/LessThanInstruction.cs
+320 −0 src/core/Microsoft.Dynamic/Interpreter/Instructions/DotNet/LessThanOrEqualInstruction.cs
+182 −0 src/core/Microsoft.Dynamic/Interpreter/Instructions/DotNet/ModuloInstruction.cs
+317 −0 src/core/Microsoft.Dynamic/Interpreter/Instructions/DotNet/MulInstruction.cs
+194 −0 src/core/Microsoft.Dynamic/Interpreter/Instructions/DotNet/NegateInstruction.cs
+540 −0 src/core/Microsoft.Dynamic/Interpreter/Instructions/DotNet/NotEqualInstruction.cs
+188 −0 src/core/Microsoft.Dynamic/Interpreter/Instructions/DotNet/NotInstruction.cs
+195 −0 src/core/Microsoft.Dynamic/Interpreter/Instructions/DotNet/OrInstruction.cs
+38 −0 src/core/Microsoft.Dynamic/Interpreter/Instructions/DotNet/README.md
+180 −0 src/core/Microsoft.Dynamic/Interpreter/Instructions/DotNet/RightShiftInstruction.cs
+316 −0 src/core/Microsoft.Dynamic/Interpreter/Instructions/DotNet/SubInstruction.cs
+0 −146 src/core/Microsoft.Dynamic/Interpreter/Instructions/EqualInstruction.cs
+0 −132 src/core/Microsoft.Dynamic/Interpreter/Instructions/GreaterThanInstruction.cs
+0 −15 src/core/Microsoft.Dynamic/Interpreter/Instructions/Instruction.cs
+86 −34 src/core/Microsoft.Dynamic/Interpreter/Instructions/InstructionList.cs
+0 −251 src/core/Microsoft.Dynamic/Interpreter/Instructions/LessThanInstruction.cs
+0 −146 src/core/Microsoft.Dynamic/Interpreter/Instructions/NotEqualInstruction.cs
+17 −0 src/core/Microsoft.Dynamic/Interpreter/Instructions/Utils.cs
+16 −0 src/core/Microsoft.Dynamic/Interpreter/InterpretedFrame.cs
+124 −27 src/core/Microsoft.Dynamic/Interpreter/LightCompiler.cs
+6 −0 src/core/Microsoft.Dynamic/Microsoft.Dynamic.csproj
+2 −0 src/core/Microsoft.Dynamic/Utils/ContractUtils.cs
+10 −3 src/core/Microsoft.Dynamic/Utils/DynamicUtils.cs
+8 −6 src/core/Microsoft.Dynamic/Utils/TypeUtils.cs
+219 −0 tests/Microsoft.Dynamic.Test/InterpreterTest.cs
8 changes: 8 additions & 0 deletions tests/IronPython.Tests/Cases/CaseExecuter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,14 @@ private static string Executable {

private static readonly string IRONPYTHONPATH = GetIronPythonPath();

static CaseExecuter() {
// Mono writes runtime warnings to stdout (e.g. "abort_threads: Failed aborting id" during shutdown),
// which breaks tests that check the output of child processes
if (ClrModule.IsMono && !RuntimeInformation.IsOSPlatform(OSPlatform.Windows) && string.IsNullOrEmpty(Environment.GetEnvironmentVariable("MONO_LOG_DEST"))) {
Environment.SetEnvironmentVariable("MONO_LOG_DEST", "/dev/null");
}
}

private ScriptEngine defaultEngine;

public static ScriptEngine CreateEngine(TestOptions options) {
Expand Down
6 changes: 5 additions & 1 deletion tests/suite/stdlib/test_weakset.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import sys

from iptest import is_ironpython, generate_suite, run_test
from iptest import is_ironpython, generate_suite, run_test, is_mono

import test.test_weakset

Expand All @@ -22,6 +22,10 @@ def load_tests(loader, standard_tests, pattern):
]

skip_tests = []
if is_mono:
skip_tests += [
test.test_weakset.TestWeakSet('test_union'), # https://github.com/IronLanguages/ironpython3/issues/544
]

return generate_suite(tests, failing_tests, skip_tests)

Expand Down
Loading