Compare commits

...
20 Commits
Author SHA1 Message Date
Duncan Mak 7c7fcc7676 Bump version number to 3.2.0 2013-07-22 13:25:03 -04:00
Zoltan Varga 96f89ed2e5 Put the unbox_trampolines table into the .text segment instead of .rodata on mt since it contains code. 2013-07-15 20:55:41 +02:00
Rodrigo Kumpera 74639ebf72 [runtime] Add a fallback on the TLS probing code that does a range scan in the pthread structure. 2013-07-15 12:31:29 -04:00
Marek Safar 588d52e205 Implement webrequest cancellation. Fixes #13200 2013-07-15 14:19:37 +02:00
Marek Safar a2ba6c3973 Prefer user operators over predefined operators for binary enum operations too. Fixes #13202 2013-07-12 16:33:03 +02:00
Marek Safar 007e816592 Allow async for explicitly implemented interface methods. Fixes #13197 2013-07-12 16:32:51 +02:00
Sebastien Pouliot 5d38f94238 Escape the .file path name generated in the asembly code. clang does not mind, but gcc does 2013-07-11 15:40:41 -04:00
Duncan Mak c02b7ff194 Bump mono to 3.1.2 2013-07-10 20:16:43 -04:00
Marek Safar 5f877073e0 Add await support in to evaluator and REPL 2013-07-10 15:44:09 +02:00
Marek Safar 5219618357 Loading of nested type of missing type needs to create another missing type. Fixes #12989 2013-07-10 15:43:44 +02:00
Marek Safar 9f4d1dc49f Interface members are hidden by class members if a type parameter has an effective base other than object 2013-07-10 15:43:23 +02:00
Marek Safar fbfd2ab406 Emit additional sequence points for call entry when needed. Fixes #10782 and similars 2013-07-10 15:42:32 +02:00
Marek Safar 9601199486 Equality structural comparer needs to do recursive comparisons. Fixes #13110 2013-07-10 15:41:37 +02:00
Rodrigo Kumpera bed040e520 [runtime]Revert the fast tls check as we always need it on mach. Add another iOS 7 offset. 2013-07-09 18:06:11 -04:00
Rodrigo Kumpera 5804e12677 [runtime] On mach-arm don't probe for tls offsets if the runtime was not built with support for fast tls. 2013-07-09 15:51:17 -04:00
Rodrigo Kumpera c07cb682b7 [runtime]On install, symlink mono to the right binary. 2013-07-09 13:27:18 -04:00
Zoltan Varga 7c084530b0 Place the method_addresses symbol into the .text segment on mt, not rodata, since it is actually code. 2013-07-09 00:27:43 +02:00
Rodrigo Kumpera 8b3e6c0526 Bump mono to 3.1.1 2013-07-08 17:47:00 -04:00
Zoltan Varga 7fbce79900 Avoid passing class pointers to some marshal icalls since its not aot compatible. Fixes #12595. 2013-07-08 22:47:55 +02:00
Zoltan Varga 13e536a659 Update the Mono LLVM EH Frame reading code to match llvm 5f3329c6d97bb765dc54592367087d9ce8cd0040. 2013-07-08 22:47:30 +02:00
46 changed files with 960 additions and 145 deletions

No files matched your search

+1 -1
View File
@@ -1,7 +1,7 @@
# Process this file with autoconf to produce a configure script.
#AC_PREREQ([2.62])
AC_INIT(mono, [3.1.0],
AC_INIT(mono, [3.2.0],
[http://bugzilla.xamarin.com/enter_bug.cgi?classification=Mono])
AC_CONFIG_SRCDIR([README])
@@ -139,5 +139,16 @@ namespace MonoTests.EvaluatorTest
Evaluator.Run ("d.GetType ();");
}
#endif
#if NET_4_5
[Test]
public void AwaitExpression ()
{
Evaluator.WaitOnTask = true;
var res = Evaluator.Evaluate("var res = await System.Threading.Tasks.Task.FromResult (1) + await System.Threading.Tasks.Task.FromResult (2);");
res = Evaluator.Evaluate ("res;");
Assert.AreEqual (3, res, "#1");
}
#endif
}
}
@@ -312,8 +312,22 @@ namespace System.Net.Http
await request.Content.CopyToAsync (stream).ConfigureAwait (false);
}
// FIXME: GetResponseAsync does not accept cancellationToken
var wresponse = (HttpWebResponse) await wrequest.GetResponseAsync ().ConfigureAwait (false);
HttpWebResponse wresponse = null;
using (cancellationToken.Register (l => ((HttpWebRequest) l).Abort (), wrequest)) {
try {
wresponse = (HttpWebResponse) await wrequest.GetResponseAsync ().ConfigureAwait (false);
} catch (WebException we) {
if (we.Status != WebExceptionStatus.RequestCanceled)
throw;
}
if (cancellationToken.IsCancellationRequested) {
var cancelled = new TaskCompletionSource<HttpResponseMessage> ();
cancelled.SetCanceled ();
return await cancelled.Task;
}
}
return CreateResponseMessage (wresponse, request);
}
}
@@ -45,7 +45,7 @@ namespace System.Collections
int IEqualityComparer.GetHashCode (object obj)
{
var comparer = obj as IEqualityComparer;
var comparer = obj as IStructuralEquatable;
if (comparer != null)
return comparer.GetHashCode (this);
@@ -54,7 +54,7 @@ namespace System.Collections
bool IEqualityComparer.Equals (object x, object y)
{
var comparer = x as IEqualityComparer;
var comparer = x as IStructuralEquatable;
if (comparer != null)
return comparer.Equals (y, this);
@@ -0,0 +1,55 @@
//
// StructuralComparisonsTest.cs
//
// Authors:
// Marek Safar <[email protected]>
//
// Copyright (C) 2013 Xamarin Inc (http://www.xamarin.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if NET_4_0
using System.Collections;
using NUnit.Framework;
namespace MonoTests.System.Collections
{
[TestFixture]
public class StructuralComparisonsTest
{
[Test]
public void EqualsTest ()
{
int[] a1 = new[] { 9, 1, 3, 4 };
int[] a2 = new[] { 9, 1, 3, 4 };
Assert.IsTrue (StructuralComparisons.StructuralEqualityComparer.Equals (a1, a2), "#1");
Assert.IsFalse (StructuralComparisons.StructuralEqualityComparer.Equals (null, a2), "#2");
Assert.IsFalse (StructuralComparisons.StructuralEqualityComparer.Equals (a1, null), "#3");
Assert.IsTrue (StructuralComparisons.StructuralEqualityComparer.Equals (null, null), "#4");
Assert.IsTrue (StructuralComparisons.StructuralEqualityComparer.Equals (4, 4), "#5");
Assert.IsFalse (StructuralComparisons.StructuralEqualityComparer.Equals (4, 5), "#6");
}
}
}
#endif
+1
View File
@@ -39,6 +39,7 @@ System.Collections/QueueTest.cs
System.Collections/ReadOnlyCollectionBaseTest.cs
System.Collections/SortedListTest.cs
System.Collections/StackTest.cs
System.Collections/StructuralComparisonsTest.cs
System.Collections.Generic/ComparerTest.cs
System.Collections.Generic/DictionaryTest.cs
System.Collections.Generic/EqualityComparerTest.cs
+31
View File
@@ -0,0 +1,31 @@
.assembly extern mscorlib
{
}
.assembly extern 'CS0012-lib-missing'
{
}
.assembly 'CS0012-21-lib'
{
.hash algorithm 0x00008004
.ver 0:0:0:0
}
.module 'CS0012-21-lib.dll'
.class public auto ansi beforefieldinit B
extends class ['CS0012-lib-missing']X`1/Y/Z/W<int32>
{
.method public hidebysig specialname rtspecialname
instance void .ctor() cil managed
{
// Code size 7 (0x7)
.maxstack 8
IL_0000: ldarg.0
IL_0001: call instance void class ['CS0012-lib-missing']X`1/Y/Z/W<int32>::.ctor()
IL_0006: ret
}
}
+1 -1
View File
@@ -21,7 +21,7 @@ DISTFILES = \
$(wildcard dlls/second/*.cs)
TEST_SUPPORT_FILES = \
CS0012-lib.dll CS0012-2-lib.dll CS0012-3-lib.dll CS0012-4-lib.dll CS0012-5-lib.dll CS0012-6-lib.dll CS0012-9-lib.dll CS0012-10-lib.dll CS0012-11-lib.dll CS0012-12-lib.dll CS0012-13-lib.dll CS0012-14-lib.dll CS0012-15-lib.dll CS0012-16-lib.dll CS0012-17-lib.dll CS0012-18-lib.dll CS0029-26-lib.dll \
CS0012-lib.dll CS0012-2-lib.dll CS0012-3-lib.dll CS0012-4-lib.dll CS0012-5-lib.dll CS0012-6-lib.dll CS0012-9-lib.dll CS0012-10-lib.dll CS0012-11-lib.dll CS0012-12-lib.dll CS0012-13-lib.dll CS0012-14-lib.dll CS0012-15-lib.dll CS0012-16-lib.dll CS0012-17-lib.dll CS0012-18-lib.dll CS0012-21-lib.dll CS0029-26-lib.dll \
CS0103-2-lib.dll CS0118-2-lib.dll CS0122-8-lib.dll CS0122-10-lib.dll CS0122-14-lib.dll CS0122-15-lib.dll CS0122-19-lib.dll CS0122-35-lib.dll CS0122-36-lib.dll CS0143-lib.dll CS0144-3-lib.dll CS0165-19-lib.dll \
CS0205-3-lib.dll CS0229-3-lib.dll CS0229-4-lib.dll CS0266-25-lib.dll \
CS0315-2-lib.dll \
+11
View File
@@ -0,0 +1,11 @@
// CS0012: The type `X`1.Y.Z.W' is defined in an assembly that is not referenced. Consider adding a reference to assembly `CS0012-lib-missing, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'
// Line: 9
// Compiler options: -r:CS0012-21-lib.dll
public class C
{
public static void Main ()
{
new B ();
}
}
+36 -28
View File
@@ -195,7 +195,9 @@ namespace Mono.CSharp
protected override void DoEmit (EmitContext ec)
{
GetResultExpression (ec).Emit (ec);
using (ec.With (BuilderContext.Options.OmitDebugInfo, true)) {
GetResultExpression (ec).Emit (ec);
}
}
public Expression GetResultExpression (EmitContext ec)
@@ -224,34 +226,34 @@ namespace Mono.CSharp
var fe_awaiter = new FieldExpr (awaiter, loc);
fe_awaiter.InstanceExpression = new CompilerGeneratedThis (ec.CurrentType, loc);
//
// awaiter = expr.GetAwaiter ();
//
Label skip_continuation = ec.DefineLabel ();
using (ec.With (BuilderContext.Options.OmitDebugInfo, true)) {
//
// awaiter = expr.GetAwaiter ();
//
fe_awaiter.EmitAssign (ec, expr, false, false);
Expression completed_expr;
if (IsDynamic) {
var rc = new ResolveContext (ec.MemberContext);
Arguments dargs = new Arguments (1);
dargs.Add (new Argument (fe_awaiter));
completed_expr = new DynamicMemberBinder ("IsCompleted", dargs, loc).Resolve (rc);
dargs = new Arguments (1);
dargs.Add (new Argument (completed_expr));
completed_expr = new DynamicConversion (ec.Module.Compiler.BuiltinTypes.Bool, 0, dargs, loc).Resolve (rc);
} else {
var pe = PropertyExpr.CreatePredefined (awaiter_definition.IsCompleted, loc);
pe.InstanceExpression = fe_awaiter;
completed_expr = pe;
}
completed_expr.EmitBranchable (ec, skip_continuation, true);
}
Label skip_continuation = ec.DefineLabel ();
Expression completed_expr;
if (IsDynamic) {
var rc = new ResolveContext (ec.MemberContext);
Arguments dargs = new Arguments (1);
dargs.Add (new Argument (fe_awaiter));
completed_expr = new DynamicMemberBinder ("IsCompleted", dargs, loc).Resolve (rc);
dargs = new Arguments (1);
dargs.Add (new Argument (completed_expr));
completed_expr = new DynamicConversion (ec.Module.Compiler.BuiltinTypes.Bool, 0, dargs, loc).Resolve (rc);
} else {
var pe = PropertyExpr.CreatePredefined (awaiter_definition.IsCompleted, loc);
pe.InstanceExpression = fe_awaiter;
completed_expr = pe;
}
completed_expr.EmitBranchable (ec, skip_continuation, true);
base.DoEmit (ec);
//
@@ -741,7 +743,9 @@ namespace Mono.CSharp
var args = new Arguments (2);
args.Add (new Argument (awaiter, Argument.AType.Ref));
args.Add (new Argument (new CompilerGeneratedThis (CurrentType, Location), Argument.AType.Ref));
mg.EmitCall (ec, args);
using (ec.With (BuilderContext.Options.OmitDebugInfo, true)) {
mg.EmitCall (ec, args);
}
}
public void EmitInitializer (EmitContext ec)
@@ -817,7 +821,9 @@ namespace Mono.CSharp
Arguments args = new Arguments (1);
args.Add (new Argument (exceptionVariable));
mg.EmitCall (ec, args);
using (ec.With (BuilderContext.Options.OmitDebugInfo, true)) {
mg.EmitCall (ec, args);
}
}
public void EmitSetResult (EmitContext ec)
@@ -839,7 +845,9 @@ namespace Mono.CSharp
args.Add (new Argument (new LocalVariableReference (hoisted_return, Location)));
}
mg.EmitCall (ec, args);
using (ec.With (BuilderContext.Options.OmitDebugInfo, true)) {
mg.EmitCall (ec, args);
}
}
protected override TypeSpec[] ResolveBaseTypes (out FullNamedExpression base_class)
+5 -5
View File
@@ -356,7 +356,6 @@ namespace Mono.CSharp
public string GetSignatureForMetadata ()
{
#if STATIC
if (Parent is TypeDefinition) {
return Parent.GetSignatureForMetadata () + "+" + TypeNameParser.Escape (MemberName.Basename);
}
@@ -364,9 +363,6 @@ namespace Mono.CSharp
var sb = new StringBuilder ();
CreateMetadataName (sb);
return sb.ToString ();
#else
throw new NotImplementedException ();
#endif
}
public virtual void RemoveContainer (TypeContainer cont)
@@ -3334,7 +3330,11 @@ namespace Mono.CSharp
Parent.PartialContainer.VerifyImplements (this);
}
ModifiersExtensions.Check (Modifiers.AllowedExplicitImplFlags, explicit_mod_flags, 0, Location, Report);
Modifiers allowed_explicit = Modifiers.AllowedExplicitImplFlags;
if (this is Method)
allowed_explicit |= Modifiers.ASYNC;
ModifiersExtensions.Check (allowed_explicit, explicit_mod_flags, 0, Location, Report);
}
return base.Define ();
+16 -5
View File
@@ -248,6 +248,21 @@ namespace Mono.CSharp
return true;
}
public void MarkCallEntry (Location loc)
{
if (!EmitAccurateDebugInfo)
return;
//
// TODO: This should emit different kind of sequence point to make
// step-over work for statement over multiple lines
//
// Debugging experience for Foo (A () + B ()) where A and B are
// on separate lines is not great
//
Mark (loc);
}
public void DefineLocalVariable (string name, LocalBuilder builder)
{
if ((flags & Options.OmitDebugInfo) != 0)
@@ -1014,11 +1029,7 @@ namespace Mono.CSharp
// Emit explicit sequence point for expressions like Foo.Bar () to help debugger to
// break at right place when LHS expression can be stepped-into
//
// TODO: The list is probably not comprehensive, need to do more testing
//
if (InstanceExpression is PropertyExpr || InstanceExpression is Invocation || InstanceExpression is IndexerExpr ||
InstanceExpression is New || InstanceExpression is DelegateInvocation)
ec.Mark (loc.Value);
ec.MarkCallEntry (loc.Value);
}
//
+16 -11
View File
@@ -116,6 +116,8 @@ namespace Mono.CSharp
// Keeps track of global data changes to undo on parser error
//
public Undo undo;
bool? interactive_async;
Stack<Linq.QueryBlock> linq_clause_blocks;
@@ -3926,6 +3928,9 @@ unary_expression
} else if (current_anonymous_method is AnonymousMethodExpression) {
report.Error (4035, GetLocation ($1),
"The `await' operator can only be used when its containing anonymous method is marked with the `async' modifier");
} else if (interactive_async != null) {
current_block.Explicit.RegisterAsyncAwait ();
interactive_async = true;
} else {
report.Error (4033, GetLocation ($1),
"The `await' operator can only be used when its containing method is marked with the `async' modifier");
@@ -5377,10 +5382,7 @@ interactive_statement_expression
: expression
{
Expression expr = (Expression) $1;
ExpressionStatement s;
s = new OptionalAssign (new SimpleName ("$retval", lexer.Location), expr, lexer.Location);
$$ = new StatementExpression (s);
$$ = new StatementExpression (new OptionalAssign (expr, lexer.Location));
}
| error
{
@@ -6653,27 +6655,30 @@ interactive_parsing
mods |= Modifiers.UNSAFE;
current_local_parameters = pars;
Method method = new Method (
var method = new InteractiveMethod (
current_type,
new TypeExpression (compiler.BuiltinTypes.Void, Location.Null),
mods,
new MemberName ("Host"),
pars,
null /* attributes */);
pars);
current_type.AddMember (method);
oob_stack.Push (method);
interactive_async = false;
++lexer.parsing_block;
start_block (lexer.Location);
}
interactive_statement_list opt_COMPLETE_COMPLETION
{
--lexer.parsing_block;
Method method = (Method) oob_stack.Pop ();
var method = (InteractiveMethod) oob_stack.Pop ();
method.Block = (ToplevelBlock) end_block(lexer.Location);
if (interactive_async == true) {
method.ChangeToAsync ();
}
InteractiveResult = (Class) pop_current_class ();
current_local_parameters = null;
}
+1 -1
View File
@@ -857,7 +857,7 @@ namespace Mono.CSharp {
//
var call = new CallEmitter ();
call.InstanceExpression = InstanceExpr;
call.EmitPredefined (ec, method, arguments);
call.EmitPredefined (ec, method, arguments, loc);
}
public override void EmitStatement (EmitContext ec)
+59 -1
View File
@@ -778,8 +778,18 @@ namespace Mono.CSharp {
}
if ((restrictions & MemberLookupRestrictions.InvocableOnly) != 0) {
if (member is MethodSpec)
if (member is MethodSpec) {
//
// Interface members that are hidden by class members are removed from the set. This
// step only has an effect if T is a type parameter and T has both an effective base
// class other than object and a non-empty effective interface set
//
var tps = queried_type as TypeParameterSpec;
if (tps != null && tps.HasTypeConstraint)
members = RemoveHiddenTypeParameterMethods (members);
return new MethodGroupExpr (members, queried_type, loc);
}
if (!Invocation.IsMemberInvocable (member))
continue;
@@ -834,6 +844,54 @@ namespace Mono.CSharp {
return null;
}
static IList<MemberSpec> RemoveHiddenTypeParameterMethods (IList<MemberSpec> members)
{
if (members.Count < 2)
return members;
//
// If M is a method, then all non-method members declared in an interface declaration
// are removed from the set, and all methods with the same signature as M declared in
// an interface declaration are removed from the set
//
bool copied = false;
for (int i = 0; i < members.Count; ++i) {
var method = members[i] as MethodSpec;
if (method == null) {
if (!copied) {
copied = true;
members = new List<MemberSpec> (members);
}
members.RemoveAt (i--);
continue;
}
if (!method.DeclaringType.IsInterface)
continue;
for (int ii = 0; ii < members.Count; ++ii) {
var candidate = members[ii] as MethodSpec;
if (candidate == null || !candidate.DeclaringType.IsClass)
continue;
if (!TypeSpecComparer.Override.IsEqual (candidate.Parameters, method.Parameters))
continue;
if (!copied) {
copied = true;
members = new List<MemberSpec> (members);
}
members.RemoveAt (i--);
break;
}
}
return members;
}
protected virtual void Error_NegativeArrayIndex (ResolveContext ec, Location loc)
{
throw new NotImplementedException ();
+98 -8
View File
@@ -131,6 +131,12 @@ namespace Mono.CSharp
Location.Initialize (ctx.SourceFiles);
}
/// <summary>
/// When set evaluator will automatically wait on Task of async methods. When not
/// set it's called responsibility to handle Task execution
/// </summary>
public bool WaitOnTask { get; set; }
/// <summary>
/// If true, turns type expressions into valid expressions
/// and calls the describe method on it
@@ -429,7 +435,7 @@ namespace Mono.CSharp
throw new ArgumentException ("Syntax error on input: partial input");
if (result_set == false)
throw new ArgumentException ("The expression did not set a result");
throw new ArgumentException ("The expression failed to resolve");
return result;
}
@@ -657,11 +663,47 @@ namespace Mono.CSharp
host.SetBaseTypes (baseclass_list);
host.CreateContainer ();
host.DefineContainer ();
host.Define ();
expression_method = (Method) host.Members[0];
if ((expression_method.ModFlags & Modifiers.ASYNC) != 0) {
//
// Host method is async. When WaitOnTask is set we wrap it with wait
//
// void AsyncWait (ref object $retval) {
// $retval = Host();
// ((Task)$retval).Wait(); // When WaitOnTask is set
// }
//
var p = new ParametersCompiled (
new Parameter (new TypeExpression (module.Compiler.BuiltinTypes.Object, Location.Null), "$retval", Parameter.Modifier.REF, null, Location.Null)
);
var method = new Method(host, new TypeExpression(module.Compiler.BuiltinTypes.Void, Location.Null),
Modifiers.PUBLIC | Modifiers.STATIC, new MemberName("AsyncWait"), p, null);
method.Block = new ToplevelBlock(method.Compiler, p, Location.Null);
method.Block.AddStatement(new StatementExpression (new SimpleAssign(
new SimpleName(p [0].Name, Location.Null),
new Invocation(new SimpleName(expression_method.MemberName.Name, Location.Null), new Arguments(0)),
Location.Null), Location.Null));
if (WaitOnTask) {
var task = new Cast (expression_method.TypeExpression, new SimpleName (p [0].Name, Location.Null), Location.Null);
method.Block.AddStatement (new StatementExpression (new Invocation (
new MemberAccess (task, "Wait", Location.Null),
new Arguments (0)), Location.Null));
}
host.AddMember(method);
expression_method = method;
}
host.CreateContainer();
host.DefineContainer();
host.Define();
} else {
expression_method = null;
}
@@ -1056,6 +1098,27 @@ namespace Mono.CSharp
#endif
}
class InteractiveMethod : Method
{
public InteractiveMethod(TypeDefinition parent, FullNamedExpression returnType, Modifiers mod, ParametersCompiled parameters)
: base(parent, returnType, mod, new MemberName("Host"), parameters, null)
{
}
public void ChangeToAsync ()
{
ModFlags |= Modifiers.ASYNC;
ModFlags &= ~Modifiers.UNSAFE;
type_expr = new TypeExpression(Module.PredefinedTypes.Task.TypeSpec, Location);
parameters = ParametersCompiled.EmptyReadOnlyParameters;
}
public override string GetSignatureForError()
{
return "InteractiveHost";
}
}
class HoistedEvaluatorVariable : HoistedVariable
{
public HoistedEvaluatorVariable (Field field)
@@ -1076,11 +1139,17 @@ namespace Mono.CSharp
/// the return value for an invocation.
/// </summary>
class OptionalAssign : SimpleAssign {
public OptionalAssign (Expression t, Expression s, Location loc)
: base (t, s, loc)
public OptionalAssign (Expression s, Location loc)
: base (null, s, loc)
{
}
public override Location StartLocation {
get {
return Location.Null;
}
}
protected override Expression DoResolve (ResolveContext ec)
{
Expression clone = source.Clone (new CloneContext ());
@@ -1093,7 +1162,7 @@ namespace Mono.CSharp
// A useful feature for the REPL: if we can resolve the expression
// as a type, Describe the type;
//
if (ec.Module.Evaluator.DescribeTypeExpressions){
if (ec.Module.Evaluator.DescribeTypeExpressions && !(ec.CurrentAnonymousMethod is AsyncInitializer)) {
var old_printer = ec.Report.SetPrinter (new SessionReportPrinter ());
Expression tclone;
try {
@@ -1119,8 +1188,29 @@ namespace Mono.CSharp
}
source = clone;
var host = (Method) ec.MemberContext.CurrentMemberDefinition;
if (host.ParameterInfo.IsEmpty) {
eclass = ExprClass.Value;
type = InternalType.FakeInternalType;
return this;
}
target = new SimpleName (host.ParameterInfo[0].Name, Location);
return base.DoResolve (ec);
}
public override void EmitStatement(EmitContext ec)
{
if (target == null) {
source.Emit (ec);
return;
}
base.EmitStatement(ec);
}
}
public class Undo
+11 -7
View File
@@ -80,7 +80,7 @@ namespace Mono.CSharp
public override void Emit (EmitContext ec)
{
var call = new CallEmitter ();
call.EmitPredefined (ec, oper, arguments);
call.EmitPredefined (ec, oper, arguments, loc);
}
public override SLE.Expression MakeExpression (BuilderContext ctx)
@@ -2752,6 +2752,12 @@ namespace Mono.CSharp
if (l.IsPointer || r.IsPointer)
return ResolveOperatorPointer (rc, l, r);
// User operators
expr = ResolveUserOperator (rc, left, right);
if (expr != null)
return expr;
bool lenum = l.IsEnum;
bool renum = r.IsEnum;
if ((oper & (Operator.ComparisonMask | Operator.BitwiseMask)) != 0) {
@@ -2805,11 +2811,6 @@ namespace Mono.CSharp
return expr;
}
}
// User operators
expr = ResolveUserOperator (rc, left, right);
if (expr != null)
return expr;
}
//
@@ -6533,14 +6534,16 @@ namespace Mono.CSharp
}
if (vr != null) {
ec.MarkCallEntry (loc);
ec.Emit (OpCodes.Call, method);
return false;
}
}
if (type is TypeParameterSpec)
return DoEmitTypeParameter (ec);
return DoEmitTypeParameter (ec);
ec.MarkCallEntry (loc);
ec.Emit (OpCodes.Newobj, method);
return true;
}
@@ -10037,6 +10040,7 @@ namespace Mono.CSharp
public override void Emit (EmitContext ec)
{
source.Emit (ec);
ec.MarkCallEntry (loc);
ec.Emit (OpCodes.Call, method);
}
+1 -1
View File
@@ -800,7 +800,7 @@ namespace Mono.CSharp
}
}
public class FlowBranchingAsync : FlowBranchingBlock
public class FlowBranchingAsync : FlowBranchingBlock
{
readonly AsyncInitializer async_init;
+20 -10
View File
@@ -774,24 +774,34 @@ namespace Mono.CSharp
for (int i = nested_hierarchy.Count; i != 0; --i) {
var t = nested_hierarchy [i - 1];
spec = MemberCache.FindNestedType (spec, t.Name, t.Arity);
if (t.Kind == MemberKind.MissingType)
spec = t;
else
spec = MemberCache.FindNestedType (spec, t.Name, t.Arity);
if (t.Arity > 0) {
spec = spec.MakeGenericType (module, targs.Skip (targs_pos).Take (spec.Arity).ToArray ());
targs_pos += t.Arity;
}
}
string name = type.Name;
int index = name.IndexOf ('`');
if (index > 0)
name = name.Substring (0, index);
if (spec.Kind == MemberKind.MissingType) {
spec = new TypeSpec (MemberKind.MissingType, spec, new ImportedTypeDefinition (type_def, this), type_def, Modifiers.PUBLIC);
spec.MemberCache = MemberCache.Empty;
} else {
if ((type_def.Attributes & TypeAttributes.VisibilityMask) == TypeAttributes.NestedPrivate && IgnorePrivateMembers)
return null;
spec = MemberCache.FindNestedType (spec, name, targs.Length - targs_pos);
if (spec == null)
return null;
string name = type.Name;
int index = name.IndexOf ('`');
if (index > 0)
name = name.Substring (0, index);
if (spec.Arity > 0) {
spec = spec.MakeGenericType (module, targs.Skip (targs_pos).ToArray ());
spec = MemberCache.FindNestedType (spec, name, targs.Length - targs_pos);
if (spec.Arity > 0) {
spec = spec.MakeGenericType (module, targs.Skip (targs_pos).ToArray ());
}
}
}
+34
View File
@@ -322,4 +322,38 @@ namespace Mono.CSharp {
}
}
}
struct TypeNameParser
{
internal static string Escape(string name)
{
if (name == null) {
return null;
}
StringBuilder sb = null;
for (int pos = 0; pos < name.Length; pos++) {
char c = name[pos];
switch (c) {
case '\\':
case '+':
case ',':
case '[':
case ']':
case '*':
case '&':
if (sb == null) {
sb = new StringBuilder(name, 0, pos, name.Length + 3);
}
sb.Append("\\").Append(c);
break;
default:
if (sb != null) {
sb.Append(c);
}
break;
}
}
return sb != null ? sb.ToString() : name;
}
}
}
+40
View File
@@ -0,0 +1,40 @@
using System;
public class Z : IGenericInterface<Z>
{
public Z Start ()
{
return this;
}
Z IGenericInterface<Z>.Start ()
{
throw new ApplicationException ();
}
}
public interface IGenericInterface<T>
{
T Start ();
}
public class A<T> where T : Z, IGenericInterface<int>
{
public void SomeOperation (T t)
{
t.Start ();
}
}
public class C : Z, IGenericInterface<int>
{
int IGenericInterface<int>.Start ()
{
throw new NotImplementedException ();
}
public static void Main ()
{
new A<C> ().SomeOperation (new C ());
}
}
+39
View File
@@ -0,0 +1,39 @@
using System;
public class C
{
public static readonly C Token = new C ();
public static C operator & (C set, E value)
{
return Token;
}
public static implicit operator E (C c)
{
throw new ApplicationException ();
}
}
public enum E
{
Item = 2
}
class FooClass
{
public static int Main ()
{
C m = new C ();
var x = E.Item;
var res = m & x;
if (res != C.Token)
return 1;
res = m & E.Item;
if (res != C.Token)
return 2;
return 0;
}
}
+10 -2
View File
@@ -2,8 +2,7 @@ using System;
using System.Threading.Tasks;
// contextual async, parser tests
class A
class A : Iasync
{
async Task<int> async ()
{
@@ -21,6 +20,10 @@ class A
var res = (int) await async ();
var res2 = (Int32) await async ();
}
async void Iasync.async ()
{
}
public static int Main ()
{
@@ -28,6 +31,11 @@ class A
}
}
interface Iasync
{
void async ();
}
class B
{
class async
+1
View File
@@ -44,6 +44,7 @@
<sequencepoints>
<entry il="0x0" row="4" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="5" col="3" file_ref="1" hidden="false" />
<entry il="0x2" row="5" col="3" file_ref="1" hidden="false" />
<entry il="0x7" row="6" col="2" file_ref="1" hidden="false" />
</sequencepoints>
<locals />
+22 -2
View File
@@ -15,7 +15,7 @@
<method token="0x6000002">
<sequencepoints>
<entry il="0x0" row="12" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="13" col="3" file_ref="1" hidden="false" />
<entry il="0x1" row="13" col="10" file_ref="1" hidden="false" />
<entry il="0x6" row="13" col="26" file_ref="1" hidden="false" />
<entry il="0x16" row="14" col="2" file_ref="1" hidden="false" />
</sequencepoints>
@@ -41,6 +41,7 @@
<entry il="0x1" row="25" col="10" file_ref="1" hidden="false" />
<entry il="0x9" row="26" col="3" file_ref="1" hidden="false" />
<entry il="0xa" row="27" col="3" file_ref="1" hidden="false" />
<entry il="0x18" row="25" col="14" file_ref="1" hidden="false" />
<entry il="0x1e" row="28" col="2" file_ref="1" hidden="false" />
</sequencepoints>
<locals>
@@ -58,6 +59,8 @@
<entry il="0x9" row="32" col="26" file_ref="1" hidden="false" />
<entry il="0x11" row="33" col="3" file_ref="1" hidden="false" />
<entry il="0x12" row="34" col="3" file_ref="1" hidden="false" />
<entry il="0x20" row="32" col="26" file_ref="1" hidden="false" />
<entry il="0x33" row="32" col="12" file_ref="1" hidden="false" />
<entry il="0x39" row="35" col="2" file_ref="1" hidden="false" />
</sequencepoints>
<locals>
@@ -75,6 +78,7 @@
<entry il="0x1" row="39" col="10" file_ref="1" hidden="false" />
<entry il="0x10" row="40" col="3" file_ref="1" hidden="false" />
<entry il="0x11" row="41" col="3" file_ref="1" hidden="false" />
<entry il="0x2e" row="39" col="13" file_ref="1" hidden="false" />
<entry il="0x34" row="42" col="2" file_ref="1" hidden="false" />
</sequencepoints>
<locals>
@@ -88,10 +92,12 @@
<method token="0x6000008">
<sequencepoints>
<entry il="0x0" row="45" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="46" col="10" file_ref="1" hidden="false" />
<entry il="0x1" row="46" col="19" file_ref="1" hidden="false" />
<entry il="0x7" row="47" col="3" file_ref="1" hidden="false" />
<entry il="0x8" row="48" col="4" file_ref="1" hidden="false" />
<entry il="0xd" row="48" col="12" file_ref="1" hidden="false" />
<entry il="0x12" row="49" col="3" file_ref="1" hidden="false" />
<entry il="0x1f" row="46" col="14" file_ref="1" hidden="false" />
<entry il="0x25" row="50" col="2" file_ref="1" hidden="false" />
</sequencepoints>
<locals>
@@ -167,6 +173,7 @@
<sequencepoints>
<entry il="0x0" row="103" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="105" col="3" file_ref="1" hidden="false" />
<entry il="0x86" row="104" col="3" file_ref="1" hidden="false" />
<entry il="0xb3" row="107" col="5" file_ref="1" hidden="false" />
<entry il="0xb8" row="109" col="4" file_ref="1" hidden="false" />
<entry il="0xb9" row="110" col="5" file_ref="1" hidden="false" />
@@ -255,6 +262,7 @@
<entry il="0x1" row="175" col="3" file_ref="1" hidden="false" />
<entry il="0x2" row="176" col="3" file_ref="1" hidden="false" />
<entry il="0x3" row="177" col="4" file_ref="1" hidden="false" />
<entry il="0x8" row="177" col="12" file_ref="1" hidden="false" />
<entry il="0xd" row="178" col="3" file_ref="1" hidden="false" />
</sequencepoints>
<locals />
@@ -266,6 +274,7 @@
<sequencepoints>
<entry il="0x0" row="182" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="183" col="3" file_ref="1" hidden="false" />
<entry il="0x7" row="183" col="7" file_ref="1" hidden="false" />
<entry il="0x11" row="184" col="3" file_ref="1" hidden="false" />
<entry il="0x12" row="185" col="3" file_ref="1" hidden="false" />
<entry il="0x18" row="187" col="3" file_ref="1" hidden="false" />
@@ -282,9 +291,11 @@
<sequencepoints>
<entry il="0x0" row="192" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="193" col="3" file_ref="1" hidden="false" />
<entry il="0x7" row="193" col="7" file_ref="1" hidden="false" />
<entry il="0x11" row="194" col="3" file_ref="1" hidden="false" />
<entry il="0x12" row="195" col="3" file_ref="1" hidden="false" />
<entry il="0x18" row="196" col="8" file_ref="1" hidden="false" />
<entry il="0x1e" row="196" col="12" file_ref="1" hidden="false" />
<entry il="0x28" row="197" col="3" file_ref="1" hidden="false" />
<entry il="0x29" row="198" col="3" file_ref="1" hidden="false" />
<entry il="0x2f" row="200" col="3" file_ref="1" hidden="false" />
@@ -375,9 +386,13 @@
<entry il="0x0" row="246" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="247" col="3" file_ref="1" hidden="false" />
<entry il="0x2" row="250" col="3" file_ref="1" hidden="false" />
<entry il="0x3" row="250" col="3" file_ref="1" hidden="false" />
<entry il="0xe" row="248" col="4" file_ref="1" hidden="false" />
<entry il="0x10" row="250" col="3" file_ref="1" hidden="false" />
<entry il="0x16" row="251" col="3" file_ref="1" hidden="false" />
<entry il="0x17" row="252" col="3" file_ref="1" hidden="false" />
<entry il="0x1a" row="250" col="3" file_ref="1" hidden="false" />
<entry il="0x31" row="250" col="3" file_ref="1" hidden="false" />
<entry il="0x37" row="253" col="2" file_ref="1" hidden="false" />
</sequencepoints>
<locals>
@@ -393,9 +408,12 @@
<entry il="0x0" row="256" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="257" col="3" file_ref="1" hidden="false" />
<entry il="0x2" row="260" col="3" file_ref="1" hidden="false" />
<entry il="0x4" row="260" col="3" file_ref="1" hidden="false" />
<entry il="0xf" row="258" col="4" file_ref="1" hidden="false" />
<entry il="0x10" row="260" col="3" file_ref="1" hidden="false" />
<entry il="0x16" row="261" col="3" file_ref="1" hidden="false" />
<entry il="0x17" row="262" col="3" file_ref="1" hidden="false" />
<entry il="0x19" row="260" col="3" file_ref="1" hidden="false" />
<entry il="0x3c" row="263" col="2" file_ref="1" hidden="false" />
</sequencepoints>
<locals>
@@ -411,6 +429,8 @@
<entry il="0x0" row="266" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="267" col="3" file_ref="1" hidden="false" />
<entry il="0x2" row="269" col="6" file_ref="1" hidden="false" />
<entry il="0x6" row="269" col="6" file_ref="1" hidden="false" />
<entry il="0xe" row="269" col="6" file_ref="1" hidden="false" />
<entry il="0x24" row="268" col="3" file_ref="1" hidden="false" />
<entry il="0x2f" row="270" col="3" file_ref="1" hidden="false" />
<entry il="0x30" row="271" col="3" file_ref="1" hidden="false" />
+4 -3
View File
@@ -52,6 +52,7 @@
</method>
<method token="0x6000006">
<sequencepoints>
<entry il="0x0" row="34" col="2" file_ref="1" hidden="false" />
<entry il="0xd" row="34" col="2" file_ref="1" hidden="false" />
<entry il="0xe" row="35" col="3" file_ref="1" hidden="false" />
<entry il="0x1b" row="37" col="2" file_ref="1" hidden="false" />
@@ -63,7 +64,7 @@
</method>
<method token="0x6000007">
<sequencepoints>
<entry il="0x0" row="13" col="3" file_ref="1" hidden="false" />
<entry il="0x0" row="13" col="11" file_ref="1" hidden="false" />
</sequencepoints>
<locals />
<scopes />
@@ -71,7 +72,7 @@
<method token="0x6000008">
<sequencepoints>
<entry il="0x0" row="20" col="3" file_ref="1" hidden="false" />
<entry il="0x1" row="21" col="4" file_ref="1" hidden="false" />
<entry il="0x1" row="21" col="12" file_ref="1" hidden="false" />
<entry il="0x6" row="22" col="3" file_ref="1" hidden="false" />
</sequencepoints>
<locals />
@@ -80,7 +81,7 @@
<method token="0x6000009">
<sequencepoints>
<entry il="0x0" row="28" col="3" file_ref="1" hidden="false" />
<entry il="0x1" row="29" col="4" file_ref="1" hidden="false" />
<entry il="0x1" row="29" col="12" file_ref="1" hidden="false" />
<entry il="0x6" row="30" col="3" file_ref="1" hidden="false" />
</sequencepoints>
<locals />
+2
View File
@@ -13,6 +13,8 @@
<sequencepoints>
<entry il="0x0" row="6" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="7" col="3" file_ref="1" hidden="false" />
<entry il="0xb" row="7" col="21" file_ref="1" hidden="false" />
<entry il="0x16" row="5" col="6" file_ref="1" hidden="false" />
<entry il="0x1c" row="8" col="5" file_ref="1" hidden="false" />
</sequencepoints>
<locals />
+4 -2
View File
@@ -20,9 +20,11 @@
<method token="0x6000003">
<sequencepoints>
<entry il="0x0" row="14" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="15" col="3" file_ref="1" hidden="false" />
<entry il="0x1" row="15" col="11" file_ref="1" hidden="false" />
<entry il="0x7" row="17" col="4" file_ref="1" hidden="false" />
<entry il="0xe" row="17" col="4" file_ref="1" hidden="false" />
<entry il="0x13" row="20" col="4" file_ref="1" hidden="false" />
<entry il="0x1a" row="20" col="4" file_ref="1" hidden="false" />
<entry il="0x21" row="24" col="2" file_ref="1" hidden="false" />
</sequencepoints>
<locals>
@@ -33,7 +35,7 @@
<method token="0x6000004">
<sequencepoints>
<entry il="0x0" row="27" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="28" col="3" file_ref="1" hidden="false" />
<entry il="0x1" row="28" col="14" file_ref="1" hidden="false" />
<entry il="0x7" row="30" col="4" file_ref="1" hidden="false" />
<entry il="0x12" row="31" col="4" file_ref="1" hidden="false" />
<entry il="0x1b" row="33" col="2" file_ref="1" hidden="false" />
+7
View File
@@ -19,8 +19,12 @@
</method>
<method token="0x6000003">
<sequencepoints>
<entry il="0xf" row="13" col="5" file_ref="1" hidden="false" />
<entry il="0x24" row="13" col="8" file_ref="1" hidden="false" />
<entry il="0x2a" row="11" col="2" file_ref="1" hidden="false" />
<entry il="0x2b" row="12" col="3" file_ref="1" hidden="false" />
<entry il="0x2d" row="14" col="4" file_ref="1" hidden="false" />
<entry il="0x40" row="13" col="4" file_ref="1" hidden="false" />
<entry il="0x46" row="16" col="3" file_ref="1" hidden="false" />
<entry il="0x4b" row="17" col="2" file_ref="1" hidden="false" />
</sequencepoints>
@@ -33,6 +37,9 @@
<sequencepoints>
<entry il="0x0" row="20" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="21" col="3" file_ref="1" hidden="false" />
<entry il="0x11" row="21" col="59" file_ref="1" hidden="false" />
<entry il="0x1c" row="21" col="53" file_ref="1" hidden="false" />
<entry il="0x2c" row="21" col="47" file_ref="1" hidden="false" />
<entry il="0x32" row="22" col="2" file_ref="1" hidden="false" />
</sequencepoints>
<locals>
+2 -2
View File
@@ -67,7 +67,7 @@
<entry il="0x0" row="30" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="31" col="3" file_ref="1" hidden="false" />
<entry il="0x7" row="32" col="3" file_ref="1" hidden="false" />
<entry il="0xe" row="33" col="3" file_ref="1" hidden="false" />
<entry il="0xe" row="33" col="15" file_ref="1" hidden="false" />
<entry il="0x14" row="34" col="3" file_ref="1" hidden="false" />
<entry il="0x81" row="35" col="2" file_ref="1" hidden="false" />
</sequencepoints>
@@ -81,7 +81,7 @@
<method token="0x6000009">
<sequencepoints>
<entry il="0x0" row="38" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="39" col="3" file_ref="1" hidden="false" />
<entry il="0x1" row="39" col="15" file_ref="1" hidden="false" />
<entry il="0x7" row="40" col="3" file_ref="1" hidden="false" />
<entry il="0x1e4" row="41" col="2" file_ref="1" hidden="false" />
</sequencepoints>
+3 -2
View File
@@ -25,7 +25,7 @@
<method token="0x6000004">
<sequencepoints>
<entry il="0x0" row="16" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="17" col="3" file_ref="1" hidden="false" />
<entry il="0x1" row="17" col="15" file_ref="1" hidden="false" />
<entry il="0x23" row="17" col="23" file_ref="1" hidden="false" />
<entry il="0x2e" row="21" col="2" file_ref="1" hidden="false" />
</sequencepoints>
@@ -40,7 +40,7 @@
<method token="0x6000006">
<sequencepoints>
<entry il="0x0" row="29" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="30" col="3" file_ref="1" hidden="false" />
<entry il="0x1" row="30" col="15" file_ref="1" hidden="false" />
<entry il="0x23" row="30" col="23" file_ref="1" hidden="false" />
<entry il="0x2e" row="31" col="2" file_ref="1" hidden="false" />
</sequencepoints>
@@ -99,6 +99,7 @@
<sequencepoints>
<entry il="0x21" row="34" col="2" file_ref="1" hidden="false" />
<entry il="0x22" row="35" col="3" file_ref="1" hidden="false" />
<entry il="0x23" row="35" col="15" file_ref="1" hidden="false" />
<entry il="0x2d" row="36" col="3" file_ref="1" hidden="false" />
<entry il="0x8b" row="37" col="3" file_ref="1" hidden="false" />
<entry il="0x3ab" row="38" col="3" file_ref="1" hidden="false" />
+2
View File
@@ -41,6 +41,7 @@
<sequencepoints>
<entry il="0x27" row="7" col="2" file_ref="1" hidden="false" />
<entry il="0x28" row="8" col="3" file_ref="1" hidden="false" />
<entry il="0x2d" row="8" col="11" file_ref="1" hidden="false" />
<entry il="0x32" row="9" col="3" file_ref="1" hidden="false" />
<entry il="0x41" row="10" col="3" file_ref="1" hidden="false" />
<entry il="0x42" row="11" col="4" file_ref="1" hidden="false" />
@@ -77,6 +78,7 @@
<sequencepoints>
<entry il="0x0" row="14" col="3" file_ref="1" hidden="false" />
<entry il="0x1" row="15" col="4" file_ref="1" hidden="false" />
<entry il="0x6" row="15" col="12" file_ref="1" hidden="false" />
<entry il="0xb" row="16" col="3" file_ref="1" hidden="false" />
</sequencepoints>
<locals />
+2 -1
View File
@@ -31,7 +31,7 @@
<method token="0x6000005">
<sequencepoints>
<entry il="0x0" row="20" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="21" col="3" file_ref="1" hidden="false" />
<entry il="0x1" row="21" col="9" file_ref="1" hidden="false" />
</sequencepoints>
<locals />
<scopes />
@@ -68,6 +68,7 @@
<sequencepoints>
<entry il="0x21" row="15" col="2" file_ref="1" hidden="false" />
<entry il="0x22" row="16" col="3" file_ref="1" hidden="false" />
<entry il="0x29" row="16" col="21" file_ref="1" hidden="false" />
<entry il="0x47" row="17" col="2" file_ref="1" hidden="false" />
</sequencepoints>
<locals />
+3
View File
@@ -22,6 +22,7 @@
<sequencepoints>
<entry il="0x0" row="8" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="9" col="3" file_ref="1" hidden="false" />
<entry il="0x2" row="9" col="3" file_ref="1" hidden="false" />
<entry il="0x7" row="9" col="8" file_ref="1" hidden="false" />
<entry il="0xd" row="10" col="2" file_ref="1" hidden="false" />
</sequencepoints>
@@ -32,6 +33,7 @@
<sequencepoints>
<entry il="0x0" row="13" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="14" col="3" file_ref="1" hidden="false" />
<entry il="0x2" row="14" col="3" file_ref="1" hidden="false" />
<entry il="0x7" row="14" col="11" file_ref="1" hidden="false" />
<entry il="0xd" row="15" col="2" file_ref="1" hidden="false" />
</sequencepoints>
@@ -53,6 +55,7 @@
<entry il="0x0" row="23" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="24" col="3" file_ref="1" hidden="false" />
<entry il="0x1f" row="25" col="3" file_ref="1" hidden="false" />
<entry il="0x20" row="25" col="3" file_ref="1" hidden="false" />
<entry il="0x25" row="25" col="8" file_ref="1" hidden="false" />
<entry il="0x2b" row="26" col="2" file_ref="1" hidden="false" />
</sequencepoints>
+2 -2
View File
@@ -12,8 +12,8 @@
<method token="0x6000002">
<sequencepoints>
<entry il="0x0" row="6" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="7" col="3" file_ref="1" hidden="false" />
<entry il="0x7" row="7" col="30" file_ref="1" hidden="false" />
<entry il="0x1" row="7" col="14" file_ref="1" hidden="false" />
<entry il="0x7" row="7" col="34" file_ref="1" hidden="false" />
<entry il="0xd" row="8" col="2" file_ref="1" hidden="false" />
</sequencepoints>
<locals>
+125
View File
@@ -0,0 +1,125 @@
<?xml version="1.0" encoding="utf-8"?>
<symbols>
<files>
<file id="1" name="test-debug-27.cs" checksum="a14fe1107e45236d0519cb2c2c65cd46" />
</files>
<methods>
<method token="0x6000001">
<sequencepoints>
<entry il="0x0" row="6" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="8" col="2" file_ref="1" hidden="false" />
</sequencepoints>
<locals />
<scopes />
</method>
<method token="0x6000002">
<sequencepoints>
<entry il="0x0" row="11" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="12" col="3" file_ref="1" hidden="false" />
<entry il="0x8" row="13" col="2" file_ref="1" hidden="false" />
</sequencepoints>
<locals />
<scopes />
</method>
<method token="0x6000003">
<sequencepoints />
<locals />
<scopes />
</method>
<method token="0x6000004">
<sequencepoints>
<entry il="0x0" row="19" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="20" col="3" file_ref="1" hidden="false" />
<entry il="0x8" row="21" col="2" file_ref="1" hidden="false" />
</sequencepoints>
<locals />
<scopes />
</method>
<method token="0x6000005">
<sequencepoints>
<entry il="0x0" row="24" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="25" col="3" file_ref="1" hidden="false" />
<entry il="0x8" row="26" col="2" file_ref="1" hidden="false" />
</sequencepoints>
<locals />
<scopes />
</method>
<method token="0x6000006">
<sequencepoints>
<entry il="0x0" row="29" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="30" col="10" file_ref="1" hidden="false" />
<entry il="0xc" row="31" col="2" file_ref="1" hidden="false" />
</sequencepoints>
<locals />
<scopes />
</method>
<method token="0x6000007">
<sequencepoints>
<entry il="0x0" row="34" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="35" col="3" file_ref="1" hidden="false" />
<entry il="0x8" row="36" col="2" file_ref="1" hidden="false" />
</sequencepoints>
<locals />
<scopes />
</method>
<method token="0x6000008">
<sequencepoints>
<entry il="0x0" row="39" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="40" col="3" file_ref="1" hidden="false" />
<entry il="0x1f" row="42" col="3" file_ref="1" hidden="false" />
<entry il="0x20" row="42" col="13" file_ref="1" hidden="false" />
<entry il="0x26" row="42" col="20" file_ref="1" hidden="false" />
<entry il="0x2d" row="43" col="2" file_ref="1" hidden="false" />
</sequencepoints>
<locals>
<entry name="f" il_index="0" scope_ref="0" />
<entry name="res" il_index="1" scope_ref="0" />
</locals>
<scopes />
</method>
<method token="0x6000009">
<sequencepoints>
<entry il="0x0" row="46" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="47" col="3" file_ref="1" hidden="false" />
<entry il="0x4" row="47" col="11" file_ref="1" hidden="false" />
<entry il="0x9" row="48" col="2" file_ref="1" hidden="false" />
</sequencepoints>
<locals>
<entry name="s" il_index="0" scope_ref="0" />
</locals>
<scopes />
</method>
<method token="0x600000a">
<sequencepoints>
<entry il="0x0" row="51" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="52" col="3" file_ref="1" hidden="false" />
<entry il="0xa" row="52" col="11" file_ref="1" hidden="false" />
<entry il="0x18" row="52" col="22" file_ref="1" hidden="false" />
<entry il="0x1f" row="53" col="2" file_ref="1" hidden="false" />
</sequencepoints>
<locals>
<entry name="i" il_index="0" scope_ref="0" />
</locals>
<scopes />
</method>
<method token="0x600000b">
<sequencepoints>
<entry il="0x0" row="56" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="57" col="3" file_ref="1" hidden="false" />
<entry il="0x6" row="57" col="11" file_ref="1" hidden="false" />
<entry il="0xc" row="58" col="2" file_ref="1" hidden="false" />
</sequencepoints>
<locals />
<scopes />
</method>
<method token="0x600000c">
<sequencepoints>
<entry il="0x0" row="61" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="62" col="3" file_ref="1" hidden="false" />
<entry il="0x8" row="63" col="2" file_ref="1" hidden="false" />
</sequencepoints>
<locals />
<scopes />
</method>
</methods>
</symbols>
+68
View File
@@ -0,0 +1,68 @@
using System;
// Tests for explicit call sequence point
struct S
{
public S (int i)
{
}
public static implicit operator int (S s)
{
return 1;
}
}
class C
{
public static int A ()
{
return 1;
}
public static int B (C c)
{
return 2;
}
public static C Test ()
{
return new C ();
}
public string Foo ()
{
return null;
}
void Test_1 ()
{
Func<int> f = A;
var res = f () + f ();
}
void Test_2 ()
{
var s = new S (0);
}
void Test_3 ()
{
int i = new S () + new S ();
}
void Test_4 ()
{
Test ().Foo ();
}
static int Main ()
{
return 0;
}
}
+128 -21
View File
@@ -18346,6 +18346,38 @@
</method>
</type>
</test>
<test name="gtest-589.cs">
<type name="Z">
<method name="Z Start()" attrs="134">
<size>10</size>
</method>
<method name="Z IGenericInterface&lt;Z&gt;.Start()" attrs="481">
<size>7</size>
</method>
<method name="Void .ctor()" attrs="6278">
<size>7</size>
</method>
</type>
<type name="A`1[T]">
<method name="Void SomeOperation(T)" attrs="134">
<size>16</size>
</method>
<method name="Void .ctor()" attrs="6278">
<size>7</size>
</method>
</type>
<type name="C">
<method name="Int32 IGenericInterface&lt;int&gt;.Start()" attrs="481">
<size>7</size>
</method>
<method name="Void Main()" attrs="150">
<size>17</size>
</method>
<method name="Void .ctor()" attrs="6278">
<size>7</size>
</method>
</type>
</test>
<test name="gtest-anontype-01.cs">
<type name="Test">
<method name="Int32 Main()" attrs="150">
@@ -47512,6 +47544,30 @@
</method>
</type>
</test>
<test name="test-869.cs">
<type name="C">
<method name="C op_BitwiseAnd(C, E)" attrs="2198">
<size>14</size>
</method>
<method name="E op_Implicit(C)" attrs="2198">
<size>7</size>
</method>
<method name="Void .ctor()" attrs="6278">
<size>7</size>
</method>
<method name="Void .cctor()" attrs="6289">
<size>11</size>
</method>
</type>
<type name="FooClass">
<method name="Int32 Main()" attrs="150">
<size>70</size>
</method>
<method name="Void .ctor()" attrs="6278">
<size>7</size>
</method>
</type>
</test>
<test name="test-87.cs">
<type name="Top">
<method name="Int32 Main()" attrs="150">
@@ -57795,14 +57851,9 @@
<size>0</size>
</method>
</type>
<type name="A+&lt;async&gt;c__async0">
<method name="Void MoveNext()" attrs="486">
<size>38</size>
</method>
</type>
<type name="A+&lt;async&gt;c__async1">
<method name="Void MoveNext()" attrs="486">
<size>37</size>
<size>38</size>
</method>
</type>
<type name="A">
@@ -57810,26 +57861,11 @@
<size>35</size>
</method>
</type>
<type name="A+&lt;CastTest&gt;c__async2">
<method name="Void MoveNext()" attrs="486">
<size>285</size>
</method>
</type>
<type name="A+&lt;async&gt;c__async0">
<method name="Void SetStateMachine(IAsyncStateMachine)" attrs="486">
<size>13</size>
</method>
</type>
<type name="A+&lt;async&gt;c__async1">
<method name="Void SetStateMachine(IAsyncStateMachine)" attrs="486">
<size>13</size>
</method>
</type>
<type name="A+&lt;CastTest&gt;c__async2">
<method name="Void SetStateMachine(IAsyncStateMachine)" attrs="486">
<size>13</size>
</method>
</type>
<type name="C">
<method name="Void Test(Boolean)" attrs="145">
<size>20</size>
@@ -57942,6 +57978,35 @@
<size>14</size>
</method>
</type>
<type name="A">
<method name="Void Iasync.async()" attrs="481">
<size>27</size>
</method>
</type>
<type name="A+&lt;async&gt;c__async2">
<method name="Void MoveNext()" attrs="486">
<size>37</size>
</method>
<method name="Void SetStateMachine(IAsyncStateMachine)" attrs="486">
<size>13</size>
</method>
</type>
<type name="A+&lt;CastTest&gt;c__async3">
<method name="Void MoveNext()" attrs="486">
<size>285</size>
</method>
<method name="Void SetStateMachine(IAsyncStateMachine)" attrs="486">
<size>13</size>
</method>
</type>
<type name="A+async&gt;c__async0">
<method name="Void MoveNext()" attrs="486">
<size>31</size>
</method>
<method name="Void SetStateMachine(IAsyncStateMachine)" attrs="486">
<size>13</size>
</method>
</type>
</test>
<test name="test-async-23.cs">
<type name="MyContext">
@@ -60320,6 +60385,48 @@
</method>
</type>
</test>
<test name="test-debug-27.cs">
<type name="S">
<method name="Int32 op_Implicit(S)" attrs="2198">
<size>10</size>
</method>
<method name="Void .ctor(Int32)" attrs="6278">
<size>2</size>
</method>
</type>
<type name="C">
<method name="Int32 A()" attrs="150">
<size>10</size>
</method>
<method name="Int32 B(C)" attrs="150">
<size>10</size>
</method>
<method name="C Test()" attrs="150">
<size>14</size>
</method>
<method name="System.String Foo()" attrs="134">
<size>10</size>
</method>
<method name="Void Test_1()" attrs="129">
<size>46</size>
</method>
<method name="Void Test_2()" attrs="129">
<size>10</size>
</method>
<method name="Void Test_3()" attrs="129">
<size>32</size>
</method>
<method name="Void Test_4()" attrs="129">
<size>13</size>
</method>
<method name="Int32 Main()" attrs="145">
<size>10</size>
</method>
<method name="Void .ctor()" attrs="6278">
<size>7</size>
</method>
</type>
</test>
<test name="test-externalias-01.cs">
<type name="Test">
<method name="Int32 Main()" attrs="150">
+1
View File
@@ -68,6 +68,7 @@ namespace Mono {
eval.InteractiveBaseClass = typeof (InteractiveBaseShell);
eval.DescribeTypeExpressions = true;
eval.WaitOnTask = true;
CSharpShell shell;
#if !ON_DOTNET
+21 -4
View File
@@ -122,9 +122,14 @@ mono_string_from_byvalwstr (gunichar2 *data, int len);
static void
mono_byvalarray_to_array (MonoArray *arr, gpointer native_arr, MonoClass *eltype, guint32 elnum);
static void
mono_byvalarray_to_byte_array (MonoArray *arr, gpointer native_arr, guint32 elnum);
static void
mono_array_to_byvalarray (gpointer native_arr, MonoArray *arr, MonoClass *eltype, guint32 elnum);
static void
mono_array_to_byte_byvalarray (gpointer native_arr, MonoArray *arr, guint32 elnum);
static MonoAsyncResult *
mono_delegate_begin_invoke (MonoDelegate *delegate, gpointer *params);
@@ -239,7 +244,9 @@ mono_marshal_init (void)
register_icall (mono_array_to_lparray, "mono_array_to_lparray", "ptr object", FALSE);
register_icall (mono_free_lparray, "mono_free_lparray", "void object ptr", FALSE);
register_icall (mono_byvalarray_to_array, "mono_byvalarray_to_array", "void object ptr ptr int32", FALSE);
register_icall (mono_byvalarray_to_byte_array, "mono_byvalarray_to_byte_array", "void object ptr int32", FALSE);
register_icall (mono_array_to_byvalarray, "mono_array_to_byvalarray", "void ptr object ptr int32", FALSE);
register_icall (mono_array_to_byte_byvalarray, "mono_array_to_byte_byvalarray", "void ptr object int32", FALSE);
register_icall (mono_delegate_to_ftnptr, "mono_delegate_to_ftnptr", "ptr object", FALSE);
register_icall (mono_ftnptr_to_delegate, "mono_ftnptr_to_delegate", "object ptr ptr", FALSE);
register_icall (mono_marshal_asany, "mono_marshal_asany", "ptr object int32 int32", FALSE);
@@ -692,6 +699,12 @@ mono_byvalarray_to_array (MonoArray *arr, gpointer native_arr, MonoClass *elclas
g_assert_not_reached ();
}
static void
mono_byvalarray_to_byte_array (MonoArray *arr, gpointer native_arr, guint32 elnum)
{
mono_byvalarray_to_array (arr, native_arr, mono_defaults.byte_class, elnum);
}
static void
mono_array_to_byvalarray (gpointer native_arr, MonoArray *arr, MonoClass *elclass, guint32 elnum)
{
@@ -715,6 +728,12 @@ mono_array_to_byvalarray (gpointer native_arr, MonoArray *arr, MonoClass *elclas
}
}
static void
mono_array_to_byte_byvalarray (gpointer native_arr, MonoArray *arr, guint32 elnum)
{
mono_array_to_byvalarray (native_arr, arr, mono_defaults.byte_class, elnum);
}
void
mono_string_utf8_to_builder (MonoStringBuilder *sb, char *text)
{
@@ -1346,9 +1365,8 @@ emit_ptr_to_object_conv (MonoMethodBuilder *mb, MonoType *type, MonoMarshalConv
mono_mb_emit_ldloc (mb, 1);
mono_mb_emit_byte (mb, CEE_LDIND_REF);
mono_mb_emit_ldloc (mb, 0);
mono_mb_emit_ptr (mb, mono_defaults.byte_class);
mono_mb_emit_icon (mb, mspec->data.array_data.num_elem);
mono_mb_emit_icall (mb, mono_byvalarray_to_array);
mono_mb_emit_icall (mb, mono_byvalarray_to_byte_array);
break;
}
case MONO_MARSHAL_CONV_STR_BYVALSTR:
@@ -1721,9 +1739,8 @@ emit_object_to_ptr_conv (MonoMethodBuilder *mb, MonoType *type, MonoMarshalConv
mono_mb_emit_ldloc (mb, 1);
mono_mb_emit_ldloc (mb, 0);
mono_mb_emit_byte (mb, CEE_LDIND_REF);
mono_mb_emit_ptr (mb, mono_defaults.byte_class);
mono_mb_emit_icon (mb, mspec->data.array_data.num_elem);
mono_mb_emit_icall (mb, mono_array_to_byvalarray);
mono_mb_emit_icall (mb, mono_array_to_byte_byvalarray);
mono_mb_patch_short_branch (mb, pos);
break;
}
+1 -1
View File
@@ -118,7 +118,7 @@ mono: mono-$(mono_bin_suffix)
ln -sf $< $@
install-exec-hook:
ln -sf $(DESTDIR)$(bindir)/mono-$(libmono_suffix) $(DESTDIR)$(bindir)/mono
ln -sf $(DESTDIR)$(bindir)/mono-$(mono_bin_suffix) $(DESTDIR)$(bindir)/mono
(cd $(DESTDIR)$(libdir); for i in libmono$(libmono_suffix)*; do ln -sf $$i `echo $$i | sed s/$(libmono_suffix)//` ; done)
endif
+6 -3
View File
@@ -4365,7 +4365,7 @@ get_file_index (MonoAotCompile *acfg, const char *source_file)
findex = g_hash_table_size (acfg->dwarf_ln_filenames) + 1;
g_hash_table_insert (acfg->dwarf_ln_filenames, g_strdup (source_file), GINT_TO_POINTER (findex));
emit_unset_mode (acfg);
fprintf (acfg->fp, ".file %d \"%s\"\n", findex, source_file);
fprintf (acfg->fp, ".file %d \"%s\"\n", findex, mono_dwarf_escape_path (source_file));
}
return findex;
}
@@ -6938,7 +6938,7 @@ emit_code (MonoAotCompile *acfg)
* This is PIE code, and the linker can update it if needed.
*/
sprintf (symbol, "method_addresses");
emit_section_change (acfg, RODATA_SECT, 1);
emit_section_change (acfg, ".text", 1);
emit_alignment (acfg, 8);
emit_label (acfg, symbol);
emit_local_symbol (acfg, symbol, "method_addresses_end", TRUE);
@@ -7004,7 +7004,10 @@ emit_code (MonoAotCompile *acfg)
/* Emit a sorted table mapping methods to their unbox trampolines */
sprintf (symbol, "unbox_trampolines");
emit_section_change (acfg, RODATA_SECT, 1);
if (acfg->direct_method_addresses)
emit_section_change (acfg, ".text", 0);
else
emit_section_change (acfg, RODATA_SECT, 0);
emit_alignment (acfg, 8);
emit_label (acfg, symbol);
+6 -4
View File
@@ -2186,11 +2186,13 @@ decode_llvm_mono_eh_frame (MonoAotModule *amodule, MonoDomain *domain,
}
code_start = amodule->code + amodule->code_offsets [table [(pos * 2)]];
if (pos + 1 == fde_count)
/* End of table */
code_end = amodule->code_end;
else
if (pos + 1 == fde_count) {
/* The +1 entry in the table contains the length of the last method */
int len = table [(pos + 1) * 2];
code_end = code_start + len;
} else {
code_end = amodule->code + amodule->code_offsets [table [(pos + 1) * 2]];
}
code_len = code_end - code_start;
g_assert (code >= code_start && code < code_end);
+4 -4
View File
@@ -742,8 +742,8 @@ emit_line_number_info_begin (MonoDwarfWriter *w)
emit_label (w, ".Ldebug_line_end");
}
static char *
escape_path (char *name)
char *
mono_dwarf_escape_path (char *name)
{
if (strchr (name, '\\')) {
char *s = g_malloc (strlen (name) * 2);
@@ -852,7 +852,7 @@ emit_all_line_number_info (MonoDwarfWriter *w)
for (i = 0; i < w->line_number_dir_index; ++i) {
char *dir = g_hash_table_lookup (index_to_dir, GUINT_TO_POINTER (i + 1));
emit_string (w, escape_path (dir));
emit_string (w, mono_dwarf_escape_path (dir));
}
/* End of Includes */
emit_byte (w, 0);
@@ -873,7 +873,7 @@ emit_all_line_number_info (MonoDwarfWriter *w)
if (basename)
emit_string (w, basename);
else
emit_string (w, escape_path (name));
emit_string (w, mono_dwarf_escape_path (name));
emit_uleb128 (w, dir_index);
emit_byte (w, 0);
emit_byte (w, 0);
+3
View File
@@ -35,4 +35,7 @@ void mono_dwarf_writer_emit_trampoline (MonoDwarfWriter *w, const char *tramp_na
void
mono_dwarf_writer_emit_method (MonoDwarfWriter *w, MonoCompile *cfg, MonoMethod *method, char *start_symbol, char *end_symbol, guint8 *code, guint32 code_size, MonoInst **args, MonoInst **locals, GSList *unwind_info, MonoDebugMethodJitInfo *debug_info) MONO_INTERNAL;
char *
mono_dwarf_escape_path (char *name);
#endif
+28 -9
View File
@@ -16,13 +16,24 @@
#include <glib.h>
#include <pthread.h>
#include "utils/mono-sigcontext.h"
#include "utils/mono-compiler.h"
#include "mach-support.h"
/* Known offsets used for TLS storage*/
/*Found on iOS 6 */
#define TLS_VECTOR_OFFSET_0 0x48
#define TLS_VECTOR_OFFSET_1 0xA8
static const int known_tls_offsets[] = {
0x48, /*Found on iOS 6 */
0xA4,
0xA8,
};
#define TLS_PROBE_COUNT (sizeof (known_tls_offsets) / sizeof (int))
/* This is 2 slots less than the known low */
#define TLS_PROBE_LOW_WATERMARK 0x40
/* This is 24 slots above the know high, which is the same diff as the knowns high-low*/
#define TLS_PROBE_HIGH_WATERMARK 0x108
static int tls_vector_offset;
@@ -113,6 +124,7 @@ mono_mach_arch_get_tls_value_from_thread (pthread_t thread, guint32 key)
void
mono_mach_init (pthread_key_t key)
{
int i;
void *old_value = pthread_getspecific (key);
void *canary = (void*)0xDEADBEEFu;
@@ -122,13 +134,20 @@ mono_mach_init (pthread_key_t key)
pthread_setspecific (key, canary);
/*First we probe for cats*/
tls_vector_offset = TLS_VECTOR_OFFSET_0;
if (mono_mach_arch_get_tls_value_from_thread (pthread_self (), key) == canary)
goto ok;
for (i = 0; i < TLS_PROBE_COUNT; ++i) {
tls_vector_offset = known_tls_offsets [i];
if (mono_mach_arch_get_tls_value_from_thread (pthread_self (), key) == canary)
goto ok;
}
tls_vector_offset = TLS_VECTOR_OFFSET_1;
if (mono_mach_arch_get_tls_value_from_thread (pthread_self (), key) == canary)
goto ok;
/*Fallback to scanning a large range of offsets*/
for (i = TLS_PROBE_LOW_WATERMARK; i <= TLS_PROBE_HIGH_WATERMARK; i += 4) {
tls_vector_offset = i;
if (mono_mach_arch_get_tls_value_from_thread (pthread_self (), key) == canary) {
g_warning ("Found new TLS offset at %d", i);
goto ok;
}
}
g_error ("could not discover the mach TLS offset");
ok: