GSYMS
GTAGS
+# Doxygen
+docs/doxygen*
+docs/perlmod*
+
##############################################################################
# Mono-specific patterns
-Subproject commit 5661f22d9630849d04de94f6dd2e72bca484f85f
+Subproject commit b23609f81a95b384538dba01a1cbf49fe2a9b95a
Log.LogMessage ("Copying failed. Retries left: {0}.", i);
if (i == 0)
- throw ex;
+ throw;
Thread.Sleep (retryDelayMilliseconds);
}
string [] parameters = Uri.UnescapeDataString (candidate.Query.Substring (1)).Split ('&'); // chop first '?'
foreach (string parameter in parameters) {
string [] pair = parameter.Split ('=');
- m.QueryParameters.Add (pair [0], pair [1]);
- if (!query_params.ContainsKey (pair [0]))
- continue;
- string templateName = query_params [pair [0]];
- vc.Add (templateName, pair [1]);
+ if (pair.Length > 0) {
+ m.QueryParameters.Add (pair [0], pair.Length == 2 ? pair [1] : null);
+ if (!query_params.ContainsKey (pair [0]))
+ continue;
+ if (pair.Length > 1) {
+ string templateName = query_params [pair [0]];
+ vc.Add (templateName, pair [1]);
+ }
+ }
}
return m;
Assert.AreEqual ("qqq", m.WildcardPathSegments [2], "#5");
}
+ [Test]
+ public void MatchIgnoreQueryParamNoValue ()
+ {
+ var t = new UriTemplate ("/{a}/*", true);
+ var m = t.Match (new Uri ("http://s"), new Uri ("http://s/a/b?foo"));
+ Assert.AreEqual (1, m.QueryParameters.Keys.Count, "#1");
+ }
+
[Test]
public void IgnoreTrailingSlash ()
{
using System.Collections.Generic;
using System.IO;
using System.Net;
+using System.Net.Sockets;
using System.Net.Security;
using System.ServiceModel;
using System.ServiceModel.Description;
using System.ServiceModel.Security;
using System.Threading;
+using System.Xml;
namespace System.ServiceModel.Channels
{
}
try {
return TryReceiveRequest (tout, out ctx);
+ } catch (XmlException ex) {
+ Console.WriteLine ("Xml Exception (Dropped Connection?):" + ex.Message);
+ //on dropped connection,
+ //whatever you do don't crash
+ //the whole app. Ignore for now
+ } catch (SocketException ex) {
+ Console.WriteLine ("Socket Exception (Dropped Connection?):" + ex.Message);
+ //on dropped connection,
+ //whatever you do don't crash
+ //the whole app. Ignore for now
+ } catch (IOException ex) {
+ Console.WriteLine ("I/O Exception (Dropped Connection?):" + ex.Message);
+ //on dropped connection,
+ //whatever you do don't crash
+ //the whole app. Ignore for now
} finally {
lock (async_result_lock) {
CurrentAsyncResult = null;
CurrentAsyncThread = null;
}
}
+ ctx = null;
+ return false;
});
RequestContext dummy;
IAsyncResult result;
using System.ServiceModel.Security;
using System.ServiceModel.Security.Tokens;
using System.Text;
+using System.IO;
+using System.Xml;
+using System.Net.Sockets;
namespace System.ServiceModel.Dispatcher
{
using (new OperationContextScope (mrc.OperationContext)) {
try {
process_handlers_chain.ProcessRequestChain (mrc);
- }
- catch (Exception e) {
+ } catch (IOException e) {
+ // FIXME?: On dropped connection do not
+ // dump a stacktrace, but should be safe
+ // to dump a console message as in
+ // default exception handler and
+ // call error_handlers_chain
+ Console.WriteLine ("I/O Error (Dropped Connection?): " + e.Message);
+ mrc.ProcessingException = e;
+ error_handlers_chain.ProcessRequestChain (mrc);
+ } catch (SocketException e) {
+ // FIXME?: On dropped connection do not
+ // dump a stacktrace, but should be safe
+ // to dump a console message as in
+ // default exception handler and
+ // call error_handlers_chain
+ Console.WriteLine ("SocketExcpetion (Dropped Connection?): " + e.Message);
+ mrc.ProcessingException = e;
+ error_handlers_chain.ProcessRequestChain (mrc);
+ } catch (XmlException e) {
+ // FIXME?: On dropped connection do not
+ // dump a stacktrace, but should be safe
+ // to dump a console message as in
+ // default exception handler and
+ // call error_handlers_chain
+ Console.WriteLine ("XmlException (Dropped Connection?): " + e.Message);
+ mrc.ProcessingException = e;
+ error_handlers_chain.ProcessRequestChain (mrc);
+ } catch (Exception e) {
// FIXME: this is not really expected use of ChannelDispatcher.ErrorHandlers.
// They are now correctly used in process_handler_chain (namely OperationInvokerHandler).
// For this kind of "outsider" exceptions are actually left thrown
using System.Transactions;
using System.ServiceModel;
using System.ServiceModel.Description;
+using System.Net.Sockets;
+using System.Xml;
+using System.IO;
namespace System.ServiceModel.Dispatcher
{
if (ProcessErrorWithHandlers (reply, ex, out res))
return;
- rc.Reply (res);
+ if ((!(ex is SocketException)) &&
+ (!(ex is XmlException)) &&
+ (!(ex is IOException)))
+ rc.Reply (res);
reply.Close (owner.DefaultCloseTimeout); // close the channel
} finally {
+++ /dev/null
-// CS0135: `i' conflicts with a declaration in a child block
-// Line: 10
-
-delegate int F (int i);
-class Foo {
- static int i;
- static void Main ()
- {
- F f = delegate (int i) { return i; };
- i = 0;
- }
-}
+++ /dev/null
-// CS0135: `i' conflicts with a declaration in a child block
-// Line: 9
-
-delegate int F (int i);
-class Foo {
- static int i;
- static void Main ()
- {
- i = 0;
- F f = delegate (int i) { return i; };
- }
-}
+++ /dev/null
-// CS0135: `test' conflicts with a declaration in a child block
-// Line: 13
-
-class ClassMain
-{
- static bool test = true;
-
- public static void Main ()
- {
- if (true) {
- const bool test = false;
- }
- test = false;
- }
-}
-
+++ /dev/null
-// CS0135: `bar' conflicts with a declaration in a child block
-// Line: 13
-
-public class Foo
-{
- public static class Nested
- {
- static int bar ()
- {
- return 0;
- }
-
- public static void Bar ()
- {
- var i = bar ();
- {
- bool bar = false;
- }
- }
- }
-}
-
+++ /dev/null
-// CS0135: `bar' conflicts with a declaration in a child block
-// Line: 13
-
-public class Foo
-{
- public static class Nested
- {
- class bar
- {
- public static int value;
- }
-
- public static void Bar ()
- {
- {
- bool bar = false;
- }
-
- var i = bar.value;
- }
- }
-}
-
+++ /dev/null
-// CS0135: `x' conflicts with a declaration in a child block
-// Line: 18
-
-public class Test
-{
- Test x;
-
- void Foo ()
- {
- {
- string x = "dd";
- }
-
- {
- x = null;
- }
-
- x = new Test ();
- }
-
- public static void Main () { }
-}
\ No newline at end of file
+++ /dev/null
-// CS0135: `test' conflicts with a declaration in a child block
-// Line: 11
-
-class ClassMain {
- static bool test = true;
-
- public static void Main() {
- if (true) {
- bool test = false;
- }
- test = false;
- }
-}
-
--- /dev/null
+// CS0573: 'S': Structs cannot have instance property or field initializers
+// Line: 8
+
+using System;
+
+struct S
+{
+ event Action E = null;
+}
\ No newline at end of file
lbag.AddLocation ($$, GetLocation ($3));
}
- | OPEN_BRACKET_EXPR expression_list CLOSE_BRACKET ASSIGN initializer_value
+ | OPEN_BRACKET_EXPR argument_list CLOSE_BRACKET ASSIGN initializer_value
{
if (lang_version < LanguageVersion.V_6)
FeatureIsNotAvailable (GetLocation ($1), "dictionary initializer");
- $$ = new DictionaryElementInitializer ((List<Expression>)$2, (Expression) $5, GetLocation ($1));
+ $$ = new DictionaryElementInitializer ((Arguments)$2, (Expression) $5, GetLocation ($1));
lbag.AddLocation ($$, GetLocation ($3), GetLocation ($4));
}
| OPEN_BRACE CLOSE_BRACE
return members;
}
+ protected static void Error_NamedArgument (NamedArgument na, Report Report)
+ {
+ Report.Error (1742, na.Location, "An element access expression cannot use named argument");
+ }
+
protected virtual void Error_NegativeArrayIndex (ResolveContext ec, Location loc)
{
throw new NotImplementedException ();
if (source.type.BuiltinType == BuiltinTypeSpec.Type.Dynamic) {
Arguments args = new Arguments (1);
args.Add (new Argument (source));
- return new DynamicConversion (btypes.Int, CSharpBinderFlags.ConvertArrayIndex, args, loc).Resolve (ec);
+ return new DynamicConversion (btypes.Int, CSharpBinderFlags.ConvertArrayIndex, args, source.loc).Resolve (ec);
}
Expression converted;
return new ArrayIndexCast (converted, btypes.Int).Resolve (ec);
}
+ public Expression MakePointerAccess (ResolveContext rc, TypeSpec type, Arguments args)
+ {
+ if (args.Count != 1){
+ rc.Report.Error (196, loc, "A pointer must be indexed by only one value");
+ return null;
+ }
+
+ var arg = args [0];
+ if (arg is NamedArgument)
+ Error_NamedArgument ((NamedArgument) arg, rc.Report);
+
+ var index = arg.Expr.Resolve (rc);
+ if (index == null)
+ return null;
+
+ index = ConvertExpressionToArrayIndex (rc, index, true);
+
+ Expression p = new PointerArithmetic (Binary.Operator.Addition, this, index, type, loc);
+ return new Indirection (p, loc);
+ }
+
//
// Derived classes implement this method by cloning the fields that
// could become altered during the Resolve stage
ErrorIsInaccesible (rc, me.GetSignatureForError (), loc);
}
} else {
- // LAMESPEC: again, ignores InvocableOnly
- if (variable != null) {
- rc.Report.SymbolRelatedToPreviousError (variable.Location, Name);
- rc.Report.Error (135, loc, "`{0}' conflicts with a declaration in a child block", Name);
- }
-
//
// MemberLookup does not check accessors availability, this is actually needed for properties only
//
//
if ((restrictions & MemberLookupRestrictions.InvocableOnly) == 0 && !variable_found) {
if (IsPossibleTypeOrNamespace (rc)) {
- if (variable != null) {
- rc.Report.SymbolRelatedToPreviousError (variable.Location, Name);
- rc.Report.Error (135, loc, "`{0}' conflicts with a declaration in a child block", Name);
- }
-
return ResolveAsTypeOrNamespace (rc, false);
}
}
};
if (type.IsPointer)
- return MakePointerAccess (ec, type);
+ return Expr.MakePointerAccess (ec, type, Arguments);
FieldExpr fe = Expr as FieldExpr;
if (fe != null) {
var ff = fe.Spec as FixedFieldSpec;
if (ff != null) {
- return MakePointerAccess (ec, ff.ElementType);
+ return Expr.MakePointerAccess (ec, ff.ElementType, Arguments);
}
}
return ConditionalAccess || Expr.HasConditionalAccess ();
}
- Expression MakePointerAccess (ResolveContext rc, TypeSpec type)
- {
- if (Arguments.Count != 1){
- rc.Report.Error (196, loc, "A pointer must be indexed by only one value");
- return null;
- }
-
- var arg = Arguments[0];
- if (arg is NamedArgument)
- Error_NamedArgument ((NamedArgument) arg, rc.Report);
-
- var index = arg.Expr.Resolve (rc);
- if (index == null)
- return null;
-
- index = ConvertExpressionToArrayIndex (rc, index, true);
-
- Expression p = new PointerArithmetic (Binary.Operator.Addition, Expr, index, type, loc);
- return new Indirection (p, loc);
- }
-
protected override Expression DoResolve (ResolveContext rc)
{
Expression expr;
throw new Exception ("Should never be reached");
}
- public static void Error_NamedArgument (NamedArgument na, Report Report)
- {
- Report.Error (1742, na.Location, "An element access expression cannot use named argument");
- }
-
public override void FlowAnalysis (FlowAnalysisContext fc)
{
Expr.FlowAnalysis (fc);
{
readonly Arguments args;
- public DictionaryElementInitializer (List<Expression> arguments, Expression initializer, Location loc)
+ public DictionaryElementInitializer (Arguments arguments, Expression initializer, Location loc)
: base (null, initializer, loc)
{
- this.args = new Arguments (arguments.Count);
- foreach (var arg in arguments)
- this.args.Add (new Argument (arg));
+ this.args = arguments;
}
public override Expression CreateExpressionTree (ResolveContext ec)
return true;
}
+ if (type.IsPointer) {
+ target = init.MakePointerAccess (rc, type, args);
+ return true;
+ }
+
var indexers = MemberCache.FindMembers (type, MemberCache.IndexerNameAlias, false);
if (indexers == null && type.BuiltinType != BuiltinTypeSpec.Type.Dynamic) {
ElementAccess.Error_CannotApplyIndexing (rc, type, loc);
BACKING_FIELD = 0x200000,
DEBUGGER_HIDDEN = 0x400000,
DEBUGGER_STEP_THROUGH = 0x800000,
+ AutoProperty = 0x1000000,
AccessibilityMask = PUBLIC | PROTECTED | INTERNAL | PRIVATE,
AllowedExplicitImplFlags = UNSAFE | EXTERN,
ok = false;
}
- if (Get.IsCompilerGenerated) {
+ if ((ModFlags & Modifiers.AutoProperty) != 0) {
Report.Error (8080, Location, "`{0}': Auto-implemented properties must override all accessors of the overridden property",
GetSignatureForError ());
ok = false;
}
if (auto) {
+ ModFlags |= Modifiers.AutoProperty;
if (Get == null) {
Report.Error (8051, Location, "Auto-implemented property `{0}' must have get accessor",
GetSignatureForError ());
--- /dev/null
+abstract class A
+{
+ public abstract int Foo { get; }
+}
+
+class B : A
+{
+ public override int Foo => 1;
+
+ public static void Main ()
+ {
+ }
+}
\ No newline at end of file
--- /dev/null
+// CS0135: `test' conflicts with a declaration in a child block
+// Line: 11
+
+class ClassMain {
+ static bool test = true;
+
+ public static void Main() {
+ if (true) {
+ bool test = false;
+ }
+ test = false;
+ }
+}
+
--- /dev/null
+class ClassMain
+{
+ static bool test = true;
+
+ public static void Main ()
+ {
+ if (true) {
+ const int test = 0;
+ }
+ test = false;
+ }
+}
+
--- /dev/null
+public class Foo
+{
+ public static class Nested
+ {
+ static int bar ()
+ {
+ return 0;
+ }
+
+ public static void Main ()
+ {
+ var i = bar ();
+ {
+ bool bar = false;
+ }
+ }
+ }
+}
+
--- /dev/null
+public class Foo
+{
+ public static class Nested
+ {
+ class bar
+ {
+ public static int value;
+ }
+
+ public static void Main ()
+ {
+ {
+ bool bar = false;
+ }
+
+ var i = bar.value;
+ }
+ }
+}
+
--- /dev/null
+public class Test
+{
+ Test x;
+
+ void Foo ()
+ {
+ {
+ string x = "dd";
+ }
+
+ {
+ x = null;
+ }
+
+ x = new Test ();
+ }
+
+ public static void Main () { }
+}
\ No newline at end of file
--- /dev/null
+delegate int F (int i);
+class Foo {
+ static int i;
+ static void Main ()
+ {
+ F f = delegate (int i) { return i; };
+ i = 0;
+ }
+}
--- /dev/null
+delegate int F (int i);
+class Foo {
+ static int i;
+ static void Main ()
+ {
+ i = 0;
+ F f = delegate (int i) { return i; };
+ }
+}
--- /dev/null
+// Compiler options: -unsafe
+
+unsafe class C
+{
+ int* X;
+
+ static int Main()
+ {
+ var ptrs = new[] { 0 };
+
+ fixed (int* p = ptrs) {
+ new C (p) {
+ X = {
+ [0] = 1
+ }
+ };
+ }
+
+ if (ptrs [0] != 1)
+ return 1;
+
+ return 0;
+ }
+
+ C (int* x)
+ {
+ X = x;
+ }
+}
\ No newline at end of file
</method>\r
</type>\r
</test>\r
+ <test name="gtest-autoproperty-16.cs">\r
+ <type name="A">\r
+ <method name="Int32 get_Foo()" attrs="3526">\r
+ <size>0</size>\r
+ </method>\r
+ <method name="Void .ctor()" attrs="6276">\r
+ <size>7</size>\r
+ </method>\r
+ </type>\r
+ <type name="B">\r
+ <method name="Int32 get_Foo()" attrs="2246">\r
+ <size>9</size>\r
+ </method>\r
+ <method name="Void Main()" attrs="150">\r
+ <size>2</size>\r
+ </method>\r
+ <method name="Void .ctor()" attrs="6278">\r
+ <size>7</size>\r
+ </method>\r
+ </type>\r
+ </test>\r
<test name="gtest-collectioninit-01.cs">\r
<type name="Test">\r
<method name="Void TestList(System.Collections.Generic.List`1[System.Int32], Int32)" attrs="145">\r
</method>\r
</type>\r
</test>\r
+ <test name="test-914.cs">\r
+ <type name="ClassMain">\r
+ <method name="Void Main()" attrs="150">\r
+ <size>12</size>\r
+ </method>\r
+ <method name="Void .ctor()" attrs="6278">\r
+ <size>7</size>\r
+ </method>\r
+ <method name="Void .cctor()" attrs="6289">\r
+ <size>7</size>\r
+ </method>\r
+ </type>\r
+ </test>\r
+ <test name="test-915.cs">\r
+ <type name="ClassMain">\r
+ <method name="Void Main()" attrs="150">\r
+ <size>10</size>\r
+ </method>\r
+ <method name="Void .ctor()" attrs="6278">\r
+ <size>7</size>\r
+ </method>\r
+ <method name="Void .cctor()" attrs="6289">\r
+ <size>7</size>\r
+ </method>\r
+ </type>\r
+ </test>\r
+ <test name="test-916.cs">\r
+ <type name="Foo">\r
+ <method name="Void .ctor()" attrs="6278">\r
+ <size>7</size>\r
+ </method>\r
+ </type>\r
+ <type name="Foo+Nested">\r
+ <method name="Int32 bar()" attrs="145">\r
+ <size>10</size>\r
+ </method>\r
+ <method name="Void Main()" attrs="150">\r
+ <size>12</size>\r
+ </method>\r
+ </type>\r
+ </test>\r
+ <test name="test-917.cs">\r
+ <type name="Foo">\r
+ <method name="Void .ctor()" attrs="6278">\r
+ <size>7</size>\r
+ </method>\r
+ </type>\r
+ <type name="Foo+Nested">\r
+ <method name="Void Main()" attrs="150">\r
+ <size>12</size>\r
+ </method>\r
+ </type>\r
+ <type name="Foo+Nested+bar">\r
+ <method name="Void .ctor()" attrs="6278">\r
+ <size>7</size>\r
+ </method>\r
+ </type>\r
+ </test>\r
+ <test name="test-918.cs">\r
+ <type name="Test">\r
+ <method name="Void Foo()" attrs="129">\r
+ <size>30</size>\r
+ </method>\r
+ <method name="Void Main()" attrs="150">\r
+ <size>2</size>\r
+ </method>\r
+ <method name="Void .ctor()" attrs="6278">\r
+ <size>7</size>\r
+ </method>\r
+ </type>\r
+ </test>\r
<test name="test-92.cs">\r
<type name="Outer">\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
</test>\r
+ <test name="test-anon-174.cs">\r
+ <type name="F">\r
+ <method name="Int32 Invoke(Int32)" attrs="454">\r
+ <size>0</size>\r
+ </method>\r
+ <method name="System.IAsyncResult BeginInvoke(Int32, System.AsyncCallback, System.Object)" attrs="454">\r
+ <size>0</size>\r
+ </method>\r
+ <method name="Int32 EndInvoke(System.IAsyncResult)" attrs="454">\r
+ <size>0</size>\r
+ </method>\r
+ <method name="Void .ctor(Object, IntPtr)" attrs="6278">\r
+ <size>0</size>\r
+ </method>\r
+ </type>\r
+ <type name="Foo">\r
+ <method name="Void Main()" attrs="145">\r
+ <size>38</size>\r
+ </method>\r
+ <method name="Int32 <Main>m__0(Int32)" attrs="145">\r
+ <size>10</size>\r
+ </method>\r
+ <method name="Void .ctor()" attrs="6278">\r
+ <size>7</size>\r
+ </method>\r
+ </type>\r
+ </test>\r
+ <test name="test-anon-175.cs">\r
+ <type name="F">\r
+ <method name="Int32 Invoke(Int32)" attrs="454">\r
+ <size>0</size>\r
+ </method>\r
+ <method name="System.IAsyncResult BeginInvoke(Int32, System.AsyncCallback, System.Object)" attrs="454">\r
+ <size>0</size>\r
+ </method>\r
+ <method name="Int32 EndInvoke(System.IAsyncResult)" attrs="454">\r
+ <size>0</size>\r
+ </method>\r
+ <method name="Void .ctor(Object, IntPtr)" attrs="6278">\r
+ <size>0</size>\r
+ </method>\r
+ </type>\r
+ <type name="Foo">\r
+ <method name="Void Main()" attrs="145">\r
+ <size>38</size>\r
+ </method>\r
+ <method name="Int32 <Main>m__0(Int32)" attrs="145">\r
+ <size>10</size>\r
+ </method>\r
+ <method name="Void .ctor()" attrs="6278">\r
+ <size>7</size>\r
+ </method>\r
+ </type>\r
+ </test>\r
<test name="test-anon-18.cs">\r
<type name="A">\r
<method name="Void Invoke()" attrs="454">\r
</method>\r
</type>\r
</test>\r
+ <test name="test-dictinit-04.cs">\r
+ <type name="C">\r
+ <method name="Int32 Main()" attrs="145">\r
+ <size>84</size>\r
+ </method>\r
+ <method name="Void .ctor(Int32*)" attrs="6273">\r
+ <size>15</size>\r
+ </method>\r
+ </type>\r
+ </test>\r
<test name="test-ex-filter-01.cs">\r
<type name="X">\r
<method name="Int32 Main()" attrs="150">\r
endif
runtime_lib= \
- ../mini/$(LIBMONO_LA) \
+ $(metadata_lib) \
$(top_builddir)/mono/io-layer/libwapi.la \
$(top_builddir)/mono/utils/libmonoutils.la \
$(GLIB_LIBS) $(LIBICONV) \
* @rank: rank of the array type
* @elem_size: size in bytes of an element of an array.
*
- * Returns a MonoMethd that implements the code to get the address
+ * Returns a MonoMethod that implements the code to get the address
* of an element in a multi-dimenasional array of @rank dimensions.
* The returned method takes an array as the first argument and then
* @rank indexes for the @rank dimensions.
+ * If ELEM_SIZE is 0, read the array size from the array object.
*/
MonoMethod*
mono_marshal_get_array_address (int rank, int elem_size)
MonoMethodBuilder *mb;
MonoMethodSignature *sig;
WrapperInfo *info;
+ char *name;
int i, bounds, ind, realidx;
int branch_pos, *branch_positions;
int cached;
sig->params [i + 1] = &mono_defaults.int32_class->byval_arg;
}
- mb = mono_mb_new (mono_defaults.object_class, "ElementAddr", MONO_WRAPPER_MANAGED_TO_MANAGED);
+ name = g_strdup_printf ("ElementAddr_%d", elem_size);
+ mb = mono_mb_new (mono_defaults.object_class, name, MONO_WRAPPER_MANAGED_TO_MANAGED);
+ g_free (name);
#ifndef DISABLE_JIT
bounds = mono_mb_add_local (mb, &mono_defaults.int_class->byval_arg);
mono_mb_emit_ldarg (mb, 0);
mono_mb_emit_ldflda (mb, MONO_STRUCT_OFFSET (MonoArray, vector));
mono_mb_emit_ldloc (mb, ind);
- mono_mb_emit_icon (mb, elem_size);
- mono_mb_emit_byte (mb, CEE_MUL);
+ if (elem_size) {
+ mono_mb_emit_icon (mb, elem_size);
+ } else {
+ /* Load arr->vtable->klass->sizes.element_class */
+ mono_mb_emit_ldarg (mb, 0);
+ mono_mb_emit_byte (mb, CEE_CONV_I);
+ mono_mb_emit_icon (mb, MONO_STRUCT_OFFSET (MonoObject, vtable));
+ mono_mb_emit_byte (mb, CEE_ADD);
+ mono_mb_emit_byte (mb, CEE_LDIND_I);
+ mono_mb_emit_icon (mb, MONO_STRUCT_OFFSET (MonoVTable, klass));
+ mono_mb_emit_byte (mb, CEE_ADD);
+ mono_mb_emit_byte (mb, CEE_LDIND_I);
+ /* sizes is an union, so this reads sizes.element_size */
+ mono_mb_emit_icon (mb, MONO_STRUCT_OFFSET (MonoClass, sizes));
+ mono_mb_emit_byte (mb, CEE_ADD);
+ mono_mb_emit_byte (mb, CEE_LDIND_I4);
+ }
+ mono_mb_emit_byte (mb, CEE_MUL);
mono_mb_emit_byte (mb, CEE_ADD);
mono_mb_emit_byte (mb, CEE_RET);
#elif defined(TARGET_ARM64)
DECL_OFFSET(MonoLMF, pc)
DECL_OFFSET(MonoLMF, gregs)
+DECL_OFFSET(DynCallArgs, fpregs)
+DECL_OFFSET(DynCallArgs, n_fpargs)
+DECL_OFFSET(DynCallArgs, n_fpret)
#endif
#ifdef TARGET_AMD64
CloseHandle (handle);
+#if !defined(MONO_CROSS_COMPILE)
#ifdef USE_MONO_CTX
memset (&info->ctx, 0, sizeof (MonoContext));
#ifdef TARGET_AMD64
info->regs [7] = context.Esp;
info->stopped_ip = (gpointer)context.Eip;
info->stack_start = (char*)context.Esp - REDZONE_SIZE;
+#endif
#endif
/* Notify the JIT */
#include <mono/utils/mono-compiler.h>
#include <mono/utils/mono-time.h>
#include <mono/utils/mono-mmap.h>
+#include <mono/utils/json.h>
#include "mini.h"
#include "seq-points.h"
}
add_generic_class_with_depth (acfg, m->klass, depth + 5, "method");
}
- if (m->wrapper_type == MONO_WRAPPER_MANAGED_TO_MANAGED && !strcmp (m->name, "ElementAddr"))
- add_extra_method_with_depth (acfg, m, depth + 1);
+ if (m->wrapper_type == MONO_WRAPPER_MANAGED_TO_MANAGED) {
+ WrapperInfo *info = mono_marshal_get_wrapper_info (m);
+
+ if (info && info->subtype == WRAPPER_SUBTYPE_ELEMENT_ADDR)
+ add_extra_method_with_depth (acfg, m, depth + 1);
+ }
break;
}
case MONO_PATCH_INFO_VTABLE: {
g_free (acfg);
}
-#include "aot_dump.c"
+#define WRAPPER(e,n) n,
+static const char* const
+wrapper_type_names [MONO_WRAPPER_NUM + 1] = {
+#include "mono/metadata/wrapper-types.h"
+ NULL
+};
+
+static G_GNUC_UNUSED const char*
+get_wrapper_type_name (int type)
+{
+ return wrapper_type_names [type];
+}
+
+//#define DUMP_PLT
+//#define DUMP_GOT
+
+static void aot_dump (MonoAotCompile *acfg)
+{
+ FILE *dumpfile;
+ char * dumpname;
+
+ JsonWriter writer;
+ json_writer_init (&writer);
+
+ json_writer_object_begin(&writer);
+
+ // Methods
+ json_writer_indent (&writer);
+ json_writer_object_key(&writer, "methods");
+ json_writer_array_begin (&writer);
+
+ int i;
+ for (i = 0; i < acfg->nmethods; ++i) {
+ MonoCompile *cfg;
+ MonoMethod *method;
+ MonoClass *klass;
+
+ cfg = acfg->cfgs [i];
+ if (!cfg)
+ continue;
+
+ method = cfg->orig_method;
+
+ json_writer_indent (&writer);
+ json_writer_object_begin(&writer);
+
+ json_writer_indent (&writer);
+ json_writer_object_key(&writer, "name");
+ json_writer_printf (&writer, "\"%s\",\n", method->name);
+
+ json_writer_indent (&writer);
+ json_writer_object_key(&writer, "signature");
+ json_writer_printf (&writer, "\"%s\",\n", mono_method_full_name (method,
+ /*signature=*/TRUE));
+
+ json_writer_indent (&writer);
+ json_writer_object_key(&writer, "code_size");
+ json_writer_printf (&writer, "\"%d\",\n", cfg->code_size);
+
+ klass = method->klass;
+
+ json_writer_indent (&writer);
+ json_writer_object_key(&writer, "class");
+ json_writer_printf (&writer, "\"%s\",\n", klass->name);
+
+ json_writer_indent (&writer);
+ json_writer_object_key(&writer, "namespace");
+ json_writer_printf (&writer, "\"%s\",\n", klass->name_space);
+
+ json_writer_indent (&writer);
+ json_writer_object_key(&writer, "wrapper_type");
+ json_writer_printf (&writer, "\"%s\",\n", get_wrapper_type_name(method->wrapper_type));
+
+ json_writer_indent_pop (&writer);
+ json_writer_indent (&writer);
+ json_writer_object_end (&writer);
+ json_writer_printf (&writer, ",\n");
+ }
+
+ json_writer_indent_pop (&writer);
+ json_writer_indent (&writer);
+ json_writer_array_end (&writer);
+ json_writer_printf (&writer, ",\n");
+
+ // PLT entries
+#ifdef DUMP_PLT
+ json_writer_indent_push (&writer);
+ json_writer_indent (&writer);
+ json_writer_object_key(&writer, "plt");
+ json_writer_array_begin (&writer);
+
+ for (i = 0; i < acfg->plt_offset; ++i) {
+ MonoPltEntry *plt_entry = NULL;
+ MonoJumpInfo *ji;
+
+ if (i == 0)
+ /*
+ * The first plt entry is unused.
+ */
+ continue;
+
+ plt_entry = g_hash_table_lookup (acfg->plt_offset_to_entry, GUINT_TO_POINTER (i));
+ ji = plt_entry->ji;
+
+ json_writer_indent (&writer);
+ json_writer_printf (&writer, "{ ");
+ json_writer_object_key(&writer, "symbol");
+ json_writer_printf (&writer, "\"%s\" },\n", plt_entry->symbol);
+ }
+
+ json_writer_indent_pop (&writer);
+ json_writer_indent (&writer);
+ json_writer_array_end (&writer);
+ json_writer_printf (&writer, ",\n");
+#endif
+
+ // GOT entries
+#ifdef DUMP_GOT
+ json_writer_indent_push (&writer);
+ json_writer_indent (&writer);
+ json_writer_object_key(&writer, "got");
+ json_writer_array_begin (&writer);
+
+ json_writer_indent_push (&writer);
+ for (i = 0; i < acfg->got_info.got_patches->len; ++i) {
+ MonoJumpInfo *ji = g_ptr_array_index (acfg->got_info.got_patches, i);
+
+ json_writer_indent (&writer);
+ json_writer_printf (&writer, "{ ");
+ json_writer_object_key(&writer, "patch_name");
+ json_writer_printf (&writer, "\"%s\" },\n", get_patch_name (ji->type));
+ }
+
+ json_writer_indent_pop (&writer);
+ json_writer_indent (&writer);
+ json_writer_array_end (&writer);
+ json_writer_printf (&writer, ",\n");
+#endif
+
+ json_writer_indent_pop (&writer);
+ json_writer_indent (&writer);
+ json_writer_object_end (&writer);
+
+ dumpname = g_strdup_printf ("%s.json", g_path_get_basename (acfg->image->name));
+ dumpfile = fopen (dumpname, "w+");
+ g_free (dumpname);
+
+ fprintf (dumpfile, "%s", writer.text->str);
+ fclose (dumpfile);
+
+ json_writer_destroy (&writer);
+}
int
mono_compile_assembly (MonoAssembly *ass, guint32 opts, const char *aot_options)
+++ /dev/null
-/*
- * aot-dump.c: mono Ahead of Time compiler JSON dumping
- *
- * Author:
- * Joao Matos (joao.matos@xamarin.com)
- *
- * Copyright 2015 Xamarin Inc (http://www.xamarin.com)
- */
-
-#ifndef MONO_SMALL_CONFIG
-
-#define JSON_INDENT_VALUE 2
-
-typedef struct JsonWriter {
- GString* text;
- int indent;
-} JsonWriter;
-
-static void json_writer_init (JsonWriter* writer) MONO_INTERNAL;
-static void json_writer_destroy (JsonWriter* writer);
-static void json_writer_indent(JsonWriter* writer);
-static void json_writer_indent_push(JsonWriter* writer);
-static void json_writer_indent_pop(JsonWriter* writer);
-static void json_writer_vprintf(JsonWriter* writer, const gchar *format, va_list args);
-static void json_writer_printf(JsonWriter* writer, const gchar *format, ...);
-static void json_writer_array_begin(JsonWriter* writer);
-static void json_writer_array_end(JsonWriter* writer);
-static void json_writer_object_begin(JsonWriter* writer);
-static void json_writer_object_end(JsonWriter* writer);
-static void json_writer_object_key(JsonWriter* writer, const gchar* format, ...);
-
-static void json_writer_init (JsonWriter* writer)
-{
- g_assert (writer && "Expected a valid JSON writer instance");
-
- writer->text = g_string_new ("");
- writer->indent = 0;
-}
-
-static void json_writer_destroy (JsonWriter* writer)
-{
- g_assert (writer && "Expected a valid JSON writer instance");
- g_string_free (writer->text, /*free_segment=*/TRUE);
-}
-
-static void json_writer_indent_push(JsonWriter* writer)
-{
- g_assert (writer && "Expected a valid JSON writer instance");
- writer->indent += JSON_INDENT_VALUE;
-}
-
-static void json_writer_indent_pop(JsonWriter* writer)
-{
- g_assert (writer && "Expected a valid JSON writer instance");
- writer->indent -= JSON_INDENT_VALUE;
-}
-
-static void json_writer_indent(JsonWriter* writer)
-{
- g_assert (writer && "Expected a valid JSON writer instance");
-
- int i = 0;
- for (i = 0; i < writer->indent; ++i)
- g_string_append_c (writer->text, ' ');
-}
-
-static void json_writer_vprintf(JsonWriter* writer, const gchar *format, va_list args)
-{
- g_assert (writer && "Expected a valid JSON writer instance");
- g_string_append_vprintf (writer->text, format, args);
-}
-
-static void json_writer_printf(JsonWriter* writer, const gchar *format, ...)
-{
- g_assert (writer && "Expected a valid JSON writer instance");
-
- va_list args;
- va_start (args, format);
-
- g_string_append_vprintf (writer->text, format, args);
-
- va_end (args);
-}
-
-static void json_writer_array_begin(JsonWriter* writer)
-{
- g_assert (writer && "Expected a valid JSON writer instance");
- g_string_append_printf (writer->text, "[\n");
- writer->indent += JSON_INDENT_VALUE;
-}
-
-static void json_writer_array_end(JsonWriter* writer)
-{
- g_assert (writer && "Expected a valid JSON writer instance");
- g_string_append_printf (writer->text, "]");
- writer->indent -= JSON_INDENT_VALUE;
-}
-
-static void json_writer_object_begin(JsonWriter* writer)
-{
- g_assert (writer && "Expected a valid JSON writer instance");
- json_writer_printf (writer, "{\n");
- writer->indent += JSON_INDENT_VALUE;
-}
-
-static void json_writer_object_end(JsonWriter* writer)
-{
- g_assert (writer && "Expected a valid JSON writer instance");
- json_writer_printf (writer, "}");
-}
-
-static void json_writer_object_key(JsonWriter* writer, const gchar* format, ...)
-{
- g_assert (writer && "Expected a valid JSON writer instance");
-
- va_list args;
- va_start (args, format);
-
- g_string_append_printf (writer->text, "\"");
- json_writer_vprintf (writer, format, args);
- g_string_append_printf (writer->text, "\" : ");
-
- va_end (args);
-}
-
-#define WRAPPER(e,n) n,
-static const char* const
-wrapper_type_names [MONO_WRAPPER_NUM + 1] = {
-#include "mono/metadata/wrapper-types.h"
- NULL
-};
-
-static G_GNUC_UNUSED const char*
-get_wrapper_type_name (int type)
-{
- return wrapper_type_names [type];
-}
-
-//#define DUMP_PLT
-//#define DUMP_GOT
-
-static void aot_dump (MonoAotCompile *acfg)
-{
- FILE *dumpfile;
- char * dumpname;
-
- JsonWriter writer;
- json_writer_init (&writer);
-
- json_writer_object_begin(&writer);
-
- // Methods
- json_writer_indent (&writer);
- json_writer_object_key(&writer, "methods");
- json_writer_array_begin (&writer);
-
- int i;
- for (i = 0; i < acfg->nmethods; ++i) {
- MonoCompile *cfg;
- MonoMethod *method;
- MonoClass *klass;
- int index;
-
- cfg = acfg->cfgs [i];
- if (!cfg)
- continue;
-
- method = cfg->orig_method;
-
- json_writer_indent (&writer);
- json_writer_object_begin(&writer);
-
- json_writer_indent (&writer);
- json_writer_object_key(&writer, "name");
- json_writer_printf (&writer, "\"%s\",\n", method->name);
-
- json_writer_indent (&writer);
- json_writer_object_key(&writer, "signature");
- json_writer_printf (&writer, "\"%s\",\n", mono_method_full_name (method,
- /*signature=*/TRUE));
-
- json_writer_indent (&writer);
- json_writer_object_key(&writer, "code_size");
- json_writer_printf (&writer, "\"%d\",\n", cfg->code_size);
-
- klass = method->klass;
-
- json_writer_indent (&writer);
- json_writer_object_key(&writer, "class");
- json_writer_printf (&writer, "\"%s\",\n", klass->name);
-
- json_writer_indent (&writer);
- json_writer_object_key(&writer, "namespace");
- json_writer_printf (&writer, "\"%s\",\n", klass->name_space);
-
- json_writer_indent (&writer);
- json_writer_object_key(&writer, "wrapper_type");
- json_writer_printf (&writer, "\"%s\",\n", get_wrapper_type_name(method->wrapper_type));
-
- json_writer_indent_pop (&writer);
- json_writer_indent (&writer);
- json_writer_object_end (&writer);
- json_writer_printf (&writer, ",\n");
- }
-
- json_writer_indent_pop (&writer);
- json_writer_indent (&writer);
- json_writer_array_end (&writer);
- json_writer_printf (&writer, ",\n");
-
- // PLT entries
-#ifdef DUMP_PLT
- json_writer_indent_push (&writer);
- json_writer_indent (&writer);
- json_writer_object_key(&writer, "plt");
- json_writer_array_begin (&writer);
-
- for (i = 0; i < acfg->plt_offset; ++i) {
- MonoPltEntry *plt_entry = NULL;
- MonoJumpInfo *ji;
-
- if (i == 0)
- /*
- * The first plt entry is unused.
- */
- continue;
-
- plt_entry = g_hash_table_lookup (acfg->plt_offset_to_entry, GUINT_TO_POINTER (i));
- ji = plt_entry->ji;
-
- json_writer_indent (&writer);
- json_writer_printf (&writer, "{ ");
- json_writer_object_key(&writer, "symbol");
- json_writer_printf (&writer, "\"%s\" },\n", plt_entry->symbol);
- }
-
- json_writer_indent_pop (&writer);
- json_writer_indent (&writer);
- json_writer_array_end (&writer);
- json_writer_printf (&writer, ",\n");
-#endif
-
- // GOT entries
-#ifdef DUMP_GOT
- json_writer_indent_push (&writer);
- json_writer_indent (&writer);
- json_writer_object_key(&writer, "got");
- json_writer_array_begin (&writer);
-
- json_writer_indent_push (&writer);
- for (i = 0; i < acfg->got_info.got_patches->len; ++i) {
- MonoJumpInfo *ji = g_ptr_array_index (acfg->got_info.got_patches, i);
-
- json_writer_indent (&writer);
- json_writer_printf (&writer, "{ ");
- json_writer_object_key(&writer, "patch_name");
- json_writer_printf (&writer, "\"%s\" },\n", get_patch_name (ji->type));
- }
-
- json_writer_indent_pop (&writer);
- json_writer_indent (&writer);
- json_writer_array_end (&writer);
- json_writer_printf (&writer, ",\n");
-#endif
-
- json_writer_indent_pop (&writer);
- json_writer_indent (&writer);
- json_writer_object_end (&writer);
-
- dumpname = g_strdup_printf ("%s.json", g_path_get_basename (acfg->image->name));
- dumpfile = fopen (dumpname, "w+");
- g_free (dumpname);
-
- fprintf (dumpfile, "%s", writer.text->str);
- fclose (dumpfile);
-
- json_writer_destroy (&writer);
-}
-
-#else
-
-static void aot_dump (MonoAotCompile *acfg)
-{
-
-}
-
-#endif
\ No newline at end of file
fprintf (stderr, "This mono runtime is compiled for cross-compiling. Only the --aot option is supported.\n");
exit (1);
}
-#if SIZEOF_VOID_P == 8 && defined(TARGET_ARM)
- fprintf (stderr, "Can't cross-compile on 64 bit platforms to arm.\n");
+#if SIZEOF_VOID_P == 8 && (defined(TARGET_ARM) || defined(TARGET_X86))
+ fprintf (stderr, "Can't cross-compile on 64-bit platforms to 32-bit architecture.\n");
+ exit (1);
+#elif SIZEOF_VOID_P == 4 && (defined(TARGET_ARM64) || defined(TARGET_AMD64))
+ fprintf (stderr, "Can't cross-compile on 32-bit platforms to 64-bit architecture.\n");
exit (1);
#endif
#endif
return 1;
return 0;
}
+
+ struct EmptyStruct {
+ }
+
+ public struct BStruct {
+ public int a, b, c, d;
+ }
+
+ interface IFoo3<T> {
+ int Bytes (T t, int dummy1, int a2, int a3, int a4, int a5, int a6, int a7, int dummy8,
+ byte b1, byte b2, byte b3, byte b4, byte b5, byte b6, byte b7, byte b8);
+ int SBytes (T t, int dummy1, int a2, int a3, int a4, int a5, int a6, int a7, int dummy8,
+ sbyte b1, sbyte b2, sbyte b3, sbyte b4);
+ int Shorts (T t, int dummy1, int a2, int a3, int a4, int a5, int a6, int a7, int dummy8,
+ short b1, short b2, short b3, short b4);
+ int UShorts (T t, int dummy1, int a2, int a3, int a4, int a5, int a6, int a7, int dummy8,
+ ushort b1, ushort b2, ushort b3, ushort b4);
+ int Ints (T t, int dummy1, int a2, int a3, int a4, int a5, int a6, int a7, int dummy8,
+ int i1, int i2, int i3, int i4);
+ int UInts (T t, int dummy1, int a2, int a3, int a4, int a5, int a6, int a7, int dummy8,
+ uint i1, uint i2, uint i3, uint i4);
+ int Structs (T t, int dummy1, int a2, int a3, int a4, int a5, int a6, int a7, int dummy8,
+ BStruct s);
+ }
+
+ class Foo3<T> : IFoo3<T> {
+ public int Bytes (T t, int dummy1, int a2, int a3, int a4, int a5, int a6, int a7, int dummy8,
+ byte b1, byte b2, byte b3, byte b4, byte b5, byte b6, byte b7, byte b8) {
+ return b1 + b2 + b3 + b4 + b5 + b6 + b7 + b8;
+ }
+ public int SBytes (T t, int dummy1, int a2, int a3, int a4, int a5, int a6, int a7, int dummy8,
+ sbyte b1, sbyte b2, sbyte b3, sbyte b4) {
+ return b1 + b2 + b3 + b4;
+ }
+ public int Shorts (T t, int dummy1, int a2, int a3, int a4, int a5, int a6, int a7, int dummy8,
+ short b1, short b2, short b3, short b4) {
+ return b1 + b2 + b3 + b4;
+ }
+ public int UShorts (T t, int dummy1, int a2, int a3, int a4, int a5, int a6, int a7, int dummy8,
+ ushort b1, ushort b2, ushort b3, ushort b4) {
+ return b1 + b2 + b3 + b4;
+ }
+ public int Ints (T t, int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8,
+ int i1, int i2, int i3, int i4) {
+ return i1 + i2 + i3 + i4;
+ }
+ public int UInts (T t, int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8,
+ uint i1, uint i2, uint i3, uint i4) {
+ return (int)(i1 + i2 + i3 + i4);
+ }
+ public int Structs (T t, int dummy1, int a2, int a3, int a4, int a5, int a6, int a7, int dummy8,
+ BStruct s) {
+ return s.a + s.b + s.c + s.d;
+ }
+ }
+
+ // Passing small normal arguments on the stack
+ public static int test_0_arm64_small_stack_args () {
+ IFoo3<EmptyStruct> o = (IFoo3<EmptyStruct>)Activator.CreateInstance (typeof (Foo3<>).MakeGenericType (new Type [] { typeof (EmptyStruct) }));
+ int res = o.Bytes (new EmptyStruct (), 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 6, 7, 8);
+ if (res != 36)
+ return 1;
+ int res2 = o.SBytes (new EmptyStruct (), 1, 2, 3, 4, 5, 6, 7, 8, -1, -2, -3, -4);
+ if (res2 != -10)
+ return 2;
+ int res3 = o.Shorts (new EmptyStruct (), 1, 2, 3, 4, 5, 6, 7, 8, -1, -2, -3, -4);
+ if (res3 != -10)
+ return 3;
+ int res4 = o.UShorts (new EmptyStruct (), 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4);
+ if (res4 != 10)
+ return 4;
+ int res5 = o.Ints (new EmptyStruct (), 1, 2, 3, 4, 5, 6, 7, 8, -1, -2, -3, -4);
+ if (res5 != -10)
+ return 5;
+ int res6 = o.UInts (new EmptyStruct (), 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4);
+ if (res6 != 10)
+ return 6;
+ return 0;
+ }
+
+ // Passing vtype normal arguments on the stack
+ public static int test_0_arm64_vtype_stack_args () {
+ IFoo3<EmptyStruct> o = (IFoo3<EmptyStruct>)Activator.CreateInstance (typeof (Foo3<>).MakeGenericType (new Type [] { typeof (EmptyStruct) }));
+ int res = o.Structs (new EmptyStruct (), 1, 2, 3, 4, 5, 6, 7, 8, new BStruct () { a = 1, b = 2, c = 3, d = 4 });
+ if (res != 10)
+ return 1;
+ return 0;
+ }
+
+ interface IFoo4<T> {
+ T Get(T[,] arr, T t);
+ }
+
+ class Foo4<T> : IFoo4<T> {
+ public T Get(T[,] arr, T t) {
+ arr [1, 1] = t;
+ return arr [1, 1];
+ }
+ }
+
+ struct AStruct {
+ public int a, b;
+ }
+
+ public static int test_0_multi_dim_arrays_2 () {
+ IFoo4<int> foo = new Foo4<int> ();
+ var arr = new int [10, 10];
+ int res = foo.Get (arr, 10);
+ if (res != 10)
+ return 1;
+
+ IFoo4<AStruct> foo2 = new Foo4<AStruct> ();
+ var arr2 = new AStruct [10, 10];
+ var res2 = foo2.Get (arr2, new AStruct () { a = 1, b = 2 });
+ if (res2.a != 1 || res2.b != 2)
+ return 2;
+ return 0;
+ }
}
// #13191
MonoInst *addr;
MonoMethod *addr_method;
int element_size;
+ MonoClass *eclass = cmethod->klass->element_class;
rank = mono_method_signature (cmethod)->param_count - (is_set? 1: 0);
if (rank == 1)
- return mini_emit_ldelema_1_ins (cfg, cmethod->klass->element_class, sp [0], sp [1], TRUE);
+ return mini_emit_ldelema_1_ins (cfg, eclass, sp [0], sp [1], TRUE);
#ifndef MONO_ARCH_EMULATE_MUL_DIV
/* emit_ldelema_2 depends on OP_LMUL */
- if (rank == 2 && (cfg->opt & MONO_OPT_INTRINS)) {
- return mini_emit_ldelema_2_ins (cfg, cmethod->klass->element_class, sp [0], sp [1], sp [2]);
+ if (rank == 2 && (cfg->opt & MONO_OPT_INTRINS) && !mini_is_gsharedvt_variable_klass (cfg, eclass)) {
+ return mini_emit_ldelema_2_ins (cfg, eclass, sp [0], sp [1], sp [2]);
}
#endif
- element_size = mono_class_array_element_size (cmethod->klass->element_class);
+ if (mini_is_gsharedvt_variable_klass (cfg, eclass))
+ element_size = 0;
+ else
+ element_size = mono_class_array_element_size (eclass);
addr_method = mono_marshal_get_array_address (rank, element_size);
addr = mono_emit_method_call (cfg, addr_method, sp, NULL);
* This needs to be used for all generic calls, not just ones with a gsharedvt signature, to avoid
* patching gshared method addresses into a gsharedvt method.
*/
- if (cmethod && cfg->gsharedvt && (mini_is_gsharedvt_signature (cfg, fsig) || cmethod->is_inflated || cmethod->klass->generic_class)) {
+ if (cmethod && cfg->gsharedvt && (mini_is_gsharedvt_signature (cfg, fsig) || cmethod->is_inflated || cmethod->klass->generic_class) &&
+ !(cmethod->klass->rank && cmethod->klass->byval_arg.type != MONO_TYPE_SZARRAY)) {
MonoRgctxInfoType info_type;
if (virtual) {
}
}
- if (cmethod->klass->rank && cmethod->klass->byval_arg.type != MONO_TYPE_SZARRAY)
- /* test_0_multi_dim_arrays () in gshared.cs */
- GSHAREDVT_FAILURE (*ip);
-
if ((cmethod->klass->parent == mono_defaults.multicastdelegate_class) && (!strcmp (cmethod->name, "Invoke")))
keep_this_alive = sp [0];
EMIT_NEW_STORE_MEMBASE_TYPE (cfg, ins, fsig->params [fsig->param_count - 1], addr->dreg, 0, val->dreg);
if (cfg->gen_write_barriers && val->type == STACK_OBJ && !(val->opcode == OP_PCONST && val->inst_c0 == 0))
emit_write_barrier (cfg, addr, val);
+ if (cfg->gen_write_barriers && mini_is_gsharedvt_klass (cfg, cmethod->klass))
+ GSHAREDVT_FAILURE (*ip);
} else if (strcmp (cmethod->name, "Get") == 0) { /* array Get */
addr = mini_emit_ldelema_ins (cfg, cmethod, sp, ip, FALSE);
*/
const char *soft = g_getenv ("MONO_ARM_FORCE_SOFT_FLOAT");
- if (!strncmp (soft, "1", 1))
+ if (soft && !strncmp (soft, "1", 1))
arm_fpu = MONO_ARM_FPU_NONE;
#endif
#endif
case OP_IOR_IMM:
case OP_IXOR_IMM:
case OP_SUB_IMM:
+ case OP_STORE_MEMBASE_IMM:
printf (" [%d]", (int)ins->inst_imm);
break;
case OP_ADD_IMM:
mono-conc-hashtable.c \
sha1.h \
sha1.c \
+ json.h \
+ json.c \
networking.c \
networking-posix.c \
networking-fallback.c \
--- /dev/null
+/*
+ * json.c: JSON writer
+ *
+ * Author:
+ * Joao Matos (joao.matos@xamarin.com)
+ *
+ * Copyright 2015 Xamarin Inc (http://www.xamarin.com)
+ */
+
+#include <mono/utils/json.h>
+
+void json_writer_init (JsonWriter* writer)
+{
+ g_assert (writer && "Expected a valid JSON writer instance");
+
+ writer->text = g_string_new ("");
+ writer->indent = 0;
+}
+
+void json_writer_destroy (JsonWriter* writer)
+{
+ g_assert (writer && "Expected a valid JSON writer instance");
+ g_string_free (writer->text, /*free_segment=*/TRUE);
+}
+
+void json_writer_indent_push(JsonWriter* writer)
+{
+ g_assert (writer && "Expected a valid JSON writer instance");
+ writer->indent += JSON_INDENT_VALUE;
+}
+
+void json_writer_indent_pop(JsonWriter* writer)
+{
+ g_assert (writer && "Expected a valid JSON writer instance");
+ writer->indent -= JSON_INDENT_VALUE;
+}
+
+void json_writer_indent(JsonWriter* writer)
+{
+ g_assert (writer && "Expected a valid JSON writer instance");
+
+ int i = 0;
+ for (i = 0; i < writer->indent; ++i)
+ g_string_append_c (writer->text, ' ');
+}
+
+void json_writer_vprintf(JsonWriter* writer, const gchar *format, va_list args)
+{
+ g_assert (writer && "Expected a valid JSON writer instance");
+ g_string_append_vprintf (writer->text, format, args);
+}
+
+void json_writer_printf(JsonWriter* writer, const gchar *format, ...)
+{
+ g_assert (writer && "Expected a valid JSON writer instance");
+
+ va_list args;
+ va_start (args, format);
+
+ g_string_append_vprintf (writer->text, format, args);
+
+ va_end (args);
+}
+
+void json_writer_array_begin(JsonWriter* writer)
+{
+ g_assert (writer && "Expected a valid JSON writer instance");
+ g_string_append_printf (writer->text, "[\n");
+ writer->indent += JSON_INDENT_VALUE;
+}
+
+void json_writer_array_end(JsonWriter* writer)
+{
+ g_assert (writer && "Expected a valid JSON writer instance");
+ g_string_append_printf (writer->text, "]");
+ writer->indent -= JSON_INDENT_VALUE;
+}
+
+void json_writer_object_begin(JsonWriter* writer)
+{
+ g_assert (writer && "Expected a valid JSON writer instance");
+ json_writer_printf (writer, "{\n");
+ writer->indent += JSON_INDENT_VALUE;
+}
+
+void json_writer_object_end(JsonWriter* writer)
+{
+ g_assert (writer && "Expected a valid JSON writer instance");
+ json_writer_printf (writer, "}");
+}
+
+void json_writer_object_key(JsonWriter* writer, const gchar* format, ...)
+{
+ g_assert (writer && "Expected a valid JSON writer instance");
+
+ va_list args;
+ va_start (args, format);
+
+ g_string_append_printf (writer->text, "\"");
+ json_writer_vprintf (writer, format, args);
+ g_string_append_printf (writer->text, "\" : ");
+
+ va_end (args);
+}
--- /dev/null
+/*
+ * json.h: JSON writer
+ *
+ * Author:
+ * Joao Matos (joao.matos@xamarin.com)
+ *
+ * Copyright 2015 Xamarin Inc (http://www.xamarin.com)
+ */
+
+#ifndef __MONO_UTILS_JSON_H__
+#define __MONO_UTILS_JSON_H__
+
+ #include <glib.h>
+
+#define JSON_INDENT_VALUE 2
+
+typedef struct JsonWriter {
+ GString* text;
+ int indent;
+} JsonWriter;
+
+void json_writer_init (JsonWriter* writer);
+void json_writer_destroy (JsonWriter* writer);
+void json_writer_indent(JsonWriter* writer);
+void json_writer_indent_push(JsonWriter* writer);
+void json_writer_indent_pop(JsonWriter* writer);
+void json_writer_vprintf(JsonWriter* writer, const gchar *format, va_list args);
+void json_writer_printf(JsonWriter* writer, const gchar *format, ...);
+void json_writer_array_begin(JsonWriter* writer);
+void json_writer_array_end(JsonWriter* writer);
+void json_writer_object_begin(JsonWriter* writer);
+void json_writer_object_end(JsonWriter* writer);
+void json_writer_object_key(JsonWriter* writer, const gchar* format, ...);
+
+#endif
<ClCompile Include="..\mono\utils\mono-hwcap.c" />\r
<ClCompile Include="..\mono\utils\mono-hwcap-x86.c" />\r
<ClCompile Include="..\mono\utils\bsearch.c" />\r
+ <ClInclude Include="..\mono\utils\json.c" /> \r
</ItemGroup>\r
<ItemGroup>\r
<ClInclude Include="..\mono\utils\dlmalloc.h" />\r
<ClInclude Include="..\mono\utils\mono-hwcap.h" />\r
<ClInclude Include="..\mono\utils\mono-hwcap-x86.h" />\r
<ClInclude Include="..\mono\utils\bsearch.h" />\r
+ <ClInclude Include="..\mono\utils\json.h" />\r
</ItemGroup>\r
<ItemGroup>\r
<MASM Include="..\mono\utils\win64.asm">\r