diff options
60 files changed, 1048 insertions, 330 deletions
diff --git a/ChangeLog b/ChangeLog index 1fb8a9d8faf..cd83c2e4c33 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,8 +1,26 @@ +2004-07-27 John Merryweather Cooper <john_m_cooper@yahoo.com> + * configure.in: Disable __thread test (TLS) for FreeBSD as + it succeeds on FreeBSD 5.x when it should fail. Fix pthread + library detection for FreeBSD 4.x since pthread is embedded + in libc_r on this platform. Fix some typos in my host + regexes for freebsd. + +2004-07-23 Dick Porter <dick@ximian.com> + + * configure.in: Changes for FreeBSD thread support by John + Merryweather Cooper <john_m_cooper@yahoo.com>. + 2004-07-03 Zoltan Varga <vargaz@freemail.hu> + + * configure.in: Add --with-tls option to replace the misnamed + --with-nptl option. + +2004-06-30 Zoltan Varga <vargaz@freemail.hu> + + * configure.in: Fix trunc check + add SPARC64 defines. * marshal.c (mono_marshal_get_managed_wrapper): Handle returning - delegates from a delegate. Fixes #61033. - + delegates from a delegate. Fixes #61033. 2004-06-29 Jackson Harper <jackson@ximian.com> diff --git a/configure.in b/configure.in index 248763c5a0d..9e5f7d431e8 100644 --- a/configure.in +++ b/configure.in @@ -67,7 +67,62 @@ case "$host" in libdl= libgc_threads=no ;; - *-*-*freebsd*|*-*-*openbsd*) +# these flags will work for all versions of -STABLE +# + *-*-*freebsd4*) + platform_win32=no + if test "x$PTHREAD_CFLAGS" = "x"; then + CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE -DGC_FREEBSD_THREADS" + libmono_cflags="-D_THREAD_SAFE" + else + CPPFLAGS="$CPPFLAGS $PTHREAD_CFLAGS -DGC_FREEBSD_THREADS" + libmono_cflags="$PTHREAD_CFLAGS" + fi + if test "x$PTHREAD_LIBS" = "x"; then + LDFLAGS="$LDFLAGS -pthread" + libmono_ldflags="-pthread" + else + LDFLAGS="$LDFLAGS $PTHREAD_LIBS" + libmono_ldflags="$PTHREAD_LIBS" + fi + need_link_unlink=yes + AC_DEFINE(PTHREAD_POINTER_ID) + libdl= + libgc_threads=pthreads +# TLS isn't implemented at all on -STABLE + with_nptl=no + with_tls=pthread + ;; +# older versions of -CURRENT will break with these flags but testing +# indicates these older versions won't run Mono anyway +# + *-*-*freebsd5*) + platform_win32=no + if test "x$PTHREAD_CFLAGS" = "x"; then + CPPFLAGS="$CPPFLAGS -DGC_FREEBSD_THREADS" + libmono_cflags= + else + CPPFLAGS="$CPPFLAGS $PTHREAD_CFLAGS -DGC_FREEBSD_THREADS" + libmono_cflags="$PTHREAD_CFLAGS" + fi + if test "x$PTHREAD_LIBS" = "x"; then + LDFLAGS="$LDFLAGS -lpthread" + libmono_ldflags="-lpthread" + else + LDFLAGS="$LDFLAGS $PTHREAD_LIBS" + libmono_ldflags="$PTHREAD_LIBS" + fi + need_link_unlink=yes + AC_DEFINE(PTHREAD_POINTER_ID) + libdl= + libgc_threads=pthreads +# TLS is only partially implemented on -CURRENT (compiler support +# but NOT library support) +# + with_nptl=no + with_tls=pthread + ;; + *-*-*openbsd*) platform_win32=no CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE -DGC_FREEBSD_THREADS" libmono_cflags="-D_THREAD_SAFE" @@ -248,9 +303,21 @@ AC_ARG_WITH(gc, [ --with-gc=boehm,included,none],[gc=$with_gc],[gc=$gc_default] # Enable support for fast thread-local storage # Some systems have broken support, so we allow to disable it. -# This is misnamed: __thread support has no relation to NPTL, -# but people already use it... -AC_ARG_WITH(nptl, [ --with-nptl=yes,no enable/disable support for __thread support],[],[with_nptl=yes]) +AC_ARG_WITH(tls, [ --with-tls=__thread,pthread select Thread Local Storage implementation],[],[with_tls=__thread]) + +# Kept for compatibility +AC_ARG_WITH(nptl, [ --with-nptl=yes,no deprecated, use --with-tls instead],[],[with_nptl=default]) + +if test "x$with_nptl" != "xdefault"; then + if test "x$with_nptl" = "xyes"; then + AC_MSG_WARN([--with-nptl=yes is deprecated, use --with-tls=__thread option instead.]) + with_tls=__thread + fi + if test "x$with_nptl" = "xno"; then + AC_MSG_WARN([--with-nptl=no is deprecated, use --with-tls=pthread option instead.]) + with_tls=pthread + fi +fi # Enable support for using sigaltstack for SIGSEGV and stack overflow handling # This does not work on some platforms (bug #55253) @@ -641,7 +708,17 @@ if test x$platform_win32 = xno; then dnl ***************************** dnl *** Checks for libpthread *** dnl ***************************** - AC_CHECK_LIB(pthread, main, LIBS="$LIBS -lpthread") +# on FreeBSD -STABLE, the pthreads functions all reside in libc_r +# and libpthread does not exist +# + case "${host}" in + *-*-*freebsd4*) + AC_CHECK_LIB(pthread, main, LIBS="$LIBS -pthread") + ;; + *) + AC_CHECK_LIB(pthread, main, LIBS="$LIBS -lpthread") + ;; + esac AC_CHECK_HEADERS(pthread.h) AC_CHECK_FUNCS(pthread_mutex_timedlock) AC_CHECK_FUNCS(pthread_getattr_np pthread_attr_get_np) @@ -662,7 +739,7 @@ if test x$platform_win32 = xno; then dnl *** Checks for working __thread *** dnl *********************************** AC_MSG_CHECKING(for working __thread) - if test "x$with_nptl" != "xyes"; then + if test "x$with_tls" != "x__thread"; then AC_MSG_RESULT(disabled) else AC_TRY_RUN([ @@ -954,8 +1031,9 @@ ac_cv_c_socklen_t=yes ]) AC_CHECK_FUNCS(trunc, , AC_MSG_CHECKING(for trunc in math.h) + # Simply calling trunc (0.0) is no good since gcc will optimize the call away AC_TRY_LINK([#include <math.h>], - [ trunc(0.0); ], + [ static void *p = &trunc; ], [ AC_DEFINE(HAVE_TRUNC) AC_MSG_RESULT(yes) @@ -1096,7 +1174,11 @@ case "$host" in JIT_SUPPORTED=no ;; sparc*-*-*) - TARGET=SPARC; + if test "x$ac_cv_sizeof_void_p" = "x8"; then + TARGET=SPARC64 + else + TARGET=SPARC + fi arch_target=sparc; JIT_SUPPORTED=yes ACCESS_UNALIGNED="no" @@ -1227,6 +1309,7 @@ AM_CONDITIONAL(INSTALL_2_0, test x$PREVIEW = xyes) AM_CONDITIONAL(MIPS_GCC, test ${TARGET}${ac_cv_prog_gcc} = MIPSyes) AM_CONDITIONAL(MIPS_SGI, test ${TARGET}${ac_cv_prog_gcc} = MIPSno) AM_CONDITIONAL(SPARC, test x$TARGET = xSPARC) +AM_CONDITIONAL(SPARC64, test x$TARGET = xSPARC64) AM_CONDITIONAL(X86, test x$TARGET = xX86) AM_CONDITIONAL(AMD64, test x$TARGET = xAMD64) AM_CONDITIONAL(ALPHA, test x$TARGET = xALPHA) @@ -1299,7 +1382,7 @@ echo " GC: $gc ICU: $enable_icu - __thread: $with_nptl + TLS: $with_tls SIGALTSTACK: $with_sigaltstack Engine: $jit_status 2.0 Alpha: $PREVIEW diff --git a/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/ChangeLog b/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/ChangeLog index bcf7dd8b1f8..42df9e1632a 100644 --- a/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/ChangeLog +++ b/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/ChangeLog @@ -1,3 +1,7 @@ +2004-06-30 Umadevi S <sumadevi@novell.com> + * Tds.cs - In the NextResult method handling TdsPacketSubType. TableName. + + 2004-04-22 Sebastien Pouliot <sebastien@ximian.com> * Tds70.cs: Updated to match changes in Mono.Security.dll. diff --git a/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/Tds.cs b/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/Tds.cs index 1a917399a3f..e1cf4697ee7 100644 --- a/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/Tds.cs +++ b/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/Tds.cs @@ -293,6 +293,12 @@ namespace Mono.Data.Tds.Protocol { break; case TdsPacketSubType.TableName: + // done = true; + peek = Comm.Peek (); + done = (peek != (byte) TdsPacketSubType.ColumnDetail); + + break; + case TdsPacketSubType.ColumnDetail: done = true; break; default: diff --git a/mcs/class/System.Data/System.Data.Odbc/ChangeLog b/mcs/class/System.Data/System.Data.Odbc/ChangeLog index 91adfefb77e..d8581c1975b 100644 --- a/mcs/class/System.Data/System.Data.Odbc/ChangeLog +++ b/mcs/class/System.Data/System.Data.Odbc/ChangeLog @@ -1,6 +1,3 @@ -2004-07-01 Sureshkumar T (tsureshkumar@novell.com) - * OdbcCommand.cs : fixed reader problem with ExecuteScalar - 2004-06-23 Sureshkumar T (tsureshkumar@novell.com) * OdbcConnection.cs: Fix: Moved env allocation to Open method. Disconnection & freeing handles are done in Close diff --git a/mcs/class/System.Data/System.Data.Odbc/OdbcCommand.cs b/mcs/class/System.Data/System.Data.Odbc/OdbcCommand.cs index e21349af2a9..fe242f3bf8f 100644 --- a/mcs/class/System.Data/System.Data.Odbc/OdbcCommand.cs +++ b/mcs/class/System.Data/System.Data.Odbc/OdbcCommand.cs @@ -342,12 +342,11 @@ namespace System.Data.Odbc public object ExecuteScalar ()
{
- object val = null;
+ object val;
OdbcDataReader reader=ExecuteReader();
try
{
- if (reader.Read ())
- val=reader[0];
+ val=reader[0];
}
finally
{
diff --git a/mcs/class/System.Data/System.Data.SqlClient/ChangeLog b/mcs/class/System.Data/System.Data.SqlClient/ChangeLog index 14efc7d3b1e..5576c7f7c6b 100755 --- a/mcs/class/System.Data/System.Data.SqlClient/ChangeLog +++ b/mcs/class/System.Data/System.Data.SqlClient/ChangeLog @@ -1,3 +1,7 @@ +2004-06-30 Umadevi S <sumadevi@novell.com> + * SqlCommand.cs : In the Execute Method the commandbehavior parameters were ignored correct +these + 2004-06-22 Atsushi Enomoto <atsushi@ximian.com> * SqlCommandBuilder.cs : Avoid cast exception caused by DbNull. diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlCommand.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlCommand.cs index 366b381b54d..21978c14cf2 100644 --- a/mcs/class/System.Data/System.Data.SqlClient/SqlCommand.cs +++ b/mcs/class/System.Data/System.Data.SqlClient/SqlCommand.cs @@ -268,8 +268,8 @@ namespace System.Data.SqlClient { { TdsMetaParameterCollection parms = Parameters.MetaParameters; if (preparedStatement == null) { - bool schemaOnly = ((CommandBehavior & CommandBehavior.SchemaOnly) > 0); - bool keyInfo = ((CommandBehavior & CommandBehavior.KeyInfo) > 0); + bool schemaOnly = ((behavior & CommandBehavior.SchemaOnly) > 0); + bool keyInfo = ((behavior & CommandBehavior.KeyInfo) > 0); StringBuilder sql1 = new StringBuilder (); StringBuilder sql2 = new StringBuilder (); diff --git a/mcs/class/System.Data/Test/System.Data.Odbc/ChangeLog b/mcs/class/System.Data/Test/System.Data.Odbc/ChangeLog index 8df7a0151f2..bd7b77d4f19 100644 --- a/mcs/class/System.Data/Test/System.Data.Odbc/ChangeLog +++ b/mcs/class/System.Data/Test/System.Data.Odbc/ChangeLog @@ -1,8 +1,3 @@ -2004-07-01 Sureshkumar T <tsureshkumar@novell.com> - * Added test case for OdbcCommand.ExecuteScalar Method - * New files: - OdbcCommandTest.cs - test suite for OdbcCommand class. - 2004-06-23 Sureshkumar T <TSureshkumar@novell.com> * Added test to check whether the OdbcConnection.Close method closes all the handles. diff --git a/mcs/class/System.Data/Test/System.Data.Odbc/OdbcCommandTest.cs b/mcs/class/System.Data/Test/System.Data.Odbc/OdbcCommandTest.cs deleted file mode 100644 index 8b3968c7062..00000000000 --- a/mcs/class/System.Data/Test/System.Data.Odbc/OdbcCommandTest.cs +++ /dev/null @@ -1,70 +0,0 @@ -//
-// OdbcCommandTest.cs - NUnit Test Cases for testing the
-// OdbcCommand class
-//
-// Author:
-// Sureshkumar T (TSureshkumar@novell.com)
-//
-// Copyright (c) 2004 Novell Inc., and the individuals listed
-// on the ChangeLog entries.
-//
-// 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.
-//
-
-
-using System;
-using System.Data;
-using System.Data.Odbc;
-
-using NUnit.Framework;
-
-namespace MonoTests.System.Data.Odbc
-{
-
- [TestFixture]
- public class OdbcCommandTest : MySqlOdbcBaseClient
- {
-
- [SetUp]
- public void GetReady () {
- OpenConnection ();
- CreateTestSetup (); // create database & test tables
- }
-
- [TearDown]
- public void Clean () {
- CleanTestSetup (); // clean test database;
- CloseConnection ();
- }
-
- /// <summary>
- /// Test Execute Scalar Method
- /// </summary>
- [Test]
- public void ExecuteScalarTest ()
- {
- OdbcCommand cmd = conn.CreateCommand ();
- string query = "select count(*) from test order by col_int;";
- cmd.CommandText = query;
- object objCount = cmd.ExecuteScalar ();
- Assertion.AssertEquals( "ExecuteScalar does not return int type", 5, Convert.ToInt32(objCount));
- }
- }
-}
diff --git a/mcs/class/System.Drawing/System.Drawing/ChangeLog b/mcs/class/System.Drawing/System.Drawing/ChangeLog index ee4e72e3e57..941f5db4a6c 100644 --- a/mcs/class/System.Drawing/System.Drawing/ChangeLog +++ b/mcs/class/System.Drawing/System.Drawing/ChangeLog @@ -1,7 +1,3 @@ -2004-07-02 Jordi Mas i Hernandez <jordi@ximian.com> - - * gdipFunctions.cs: fixes bug 61050 - 2004-06-24 Sanjay Gupta <gsanjay@novell.com> * ImageAnimator.cs: Rewrote complete implementation. diff --git a/mcs/class/System.Drawing/System.Drawing/gdipFunctions.cs b/mcs/class/System.Drawing/System.Drawing/gdipFunctions.cs index 5244cd50235..8db7223a85c 100644 --- a/mcs/class/System.Drawing/System.Drawing/gdipFunctions.cs +++ b/mcs/class/System.Drawing/System.Drawing/gdipFunctions.cs @@ -1418,11 +1418,7 @@ namespace System.Drawing { public Stream stream; - public GdiPlusStreamHelper (Stream s) - { - stream = s; - stream.Seek(0, SeekOrigin.Begin); - } + public GdiPlusStreamHelper (Stream s) { stream = s; } public int StreamGetBytesImpl (IntPtr buf, int bufsz, bool peek) { diff --git a/mcs/class/System.Web/System.Web.Handlers/ChangeLog b/mcs/class/System.Web/System.Web.Handlers/ChangeLog index 50459bd9024..ebddbc1e4ba 100644 --- a/mcs/class/System.Web/System.Web.Handlers/ChangeLog +++ b/mcs/class/System.Web/System.Web.Handlers/ChangeLog @@ -1,7 +1,3 @@ -2004-07-02 Gonzalo Paniagua Javier <gonzalo@ximian.com> - - * TraceHandler.cs: check that trace is enabled or throw. - 2004-06-03 Gonzalo Paniagua Javier <gonzalo@ximian.com> * TraceHandler.cs: Added protected missing members and attributes. diff --git a/mcs/class/System.Web/System.Web.Handlers/TraceHandler.cs b/mcs/class/System.Web/System.Web.Handlers/TraceHandler.cs index 343aa5957a7..33385dbf5fb 100644 --- a/mcs/class/System.Web/System.Web.Handlers/TraceHandler.cs +++ b/mcs/class/System.Web/System.Web.Handlers/TraceHandler.cs @@ -39,27 +39,16 @@ using System.Web.UI.WebControls; namespace System.Web.Handlers { -#if NET_2_0 - [Serializable] -#endif - class TraceNotAvailableException : HttpException - { - public TraceNotAvailableException () : - base ("Trace Error") {} - - internal override string Description { - get { return "Trace.axd is not enabled in the configuration file for this application."; } - } - } - public class TraceHandler : IHttpHandler { void IHttpHandler.ProcessRequest (HttpContext context) { TraceManager manager = HttpRuntime.TraceManager; - if (!manager.Enabled || manager.LocalOnly && !context.Request.IsLocal) { - throw new TraceNotAvailableException (); + if (manager.LocalOnly && !context.Request.IsLocal) { + // Need to figure out the error message that goes here + // but I only have cassini for testing + return; } HtmlTextWriter output = new HtmlTextWriter (context.Response.Output); diff --git a/mcs/class/System.Web/System.Web.UI/ChangeLog b/mcs/class/System.Web/System.Web.UI/ChangeLog index ec02b96092f..07d62fd2c33 100644 --- a/mcs/class/System.Web/System.Web.UI/ChangeLog +++ b/mcs/class/System.Web/System.Web.UI/ChangeLog @@ -1,10 +1,3 @@ -2004-07-02 Gonzalo Paniagua Javier <gonzalo@ximian.com> - - * Page.cs: added additional checks for saving/displaying trace data. - - * PageParser.cs: removed checks for trace enabled in configuration - files. - 2004-06-29 Gonzalo Paniagua Javier <gonzalo@ximian.com> * ControlCollection.cs: when clearing the control collection, tell the diff --git a/mcs/class/System.Web/System.Web.UI/Page.cs b/mcs/class/System.Web/System.Web.UI/Page.cs index 79a68d2e233..3887c9c35e0 100755 --- a/mcs/class/System.Web/System.Web.UI/Page.cs +++ b/mcs/class/System.Web/System.Web.UI/Page.cs @@ -769,18 +769,11 @@ public class Page : TemplateControl, IHttpHandler private void RenderTrace (HtmlTextWriter output) { - TraceManager traceManager = HttpRuntime.TraceManager; - - if (Trace.HaveTrace && !Trace.IsEnabled || !Trace.HaveTrace && !traceManager.Enabled) + if (!Trace.IsEnabled) return; Trace.SaveData (); - - if (!Trace.HaveTrace && traceManager.Enabled && !traceManager.PageOutput) - return; - - if (!traceManager.LocalOnly || Context.Request.IsLocal) - Trace.Render (output); + Trace.Render (output); } internal void RaisePostBackEvents () diff --git a/mcs/class/System.Web/System.Web.UI/PageParser.cs b/mcs/class/System.Web/System.Web.UI/PageParser.cs index 571edf2997a..816d83c0bc8 100644 --- a/mcs/class/System.Web/System.Web.UI/PageParser.cs +++ b/mcs/class/System.Web/System.Web.UI/PageParser.cs @@ -199,6 +199,13 @@ namespace System.Web.UI } } + TraceConfig traceConfig = (TraceConfig) Context.GetConfig ("system.web/trace"); + if (traceConfig != null) { + trace = traceConfig.Enabled; + if (trace) + haveTrace = true; + } + string tracestr = GetString (atts, "Trace", null); if (tracestr != null) { haveTrace = true; @@ -220,6 +227,13 @@ namespace System.Web.UI "one of the following values: SortByTime, SortByCategory."); } + if (traceConfig != null) { + if (traceConfig.LocalOnly && !Context.Request.IsLocal) { + haveTrace = false; + trace = false; + } + } + errorPage = GetString (atts, "ErrorPage", null); validateRequest = GetBool (atts, "ValidateRequest", PagesConfig.ValidateRequest); clientTarget = GetString (atts, "ClientTarget", null); diff --git a/mcs/class/System.Web/System.Web/ChangeLog b/mcs/class/System.Web/System.Web/ChangeLog index 7be6f4e6a5f..93cc846bb86 100644 --- a/mcs/class/System.Web/System.Web/ChangeLog +++ b/mcs/class/System.Web/System.Web/ChangeLog @@ -1,8 +1,3 @@ -2004-07-02 Gonzalo Paniagua Javier <gonzalo@ximian.com> - - * TraceContext.cs: added internal HaveTrace property whose - value is true when the page has a Trace attribute. - 2004-06-15 Gonzalo Paniagua Javier <gonzalo@ximian.com> * TraceData.cs: fixed <br> output. Closes bug #60181. diff --git a/mcs/class/System.Web/System.Web/TraceContext.cs b/mcs/class/System.Web/System.Web/TraceContext.cs index f939add498b..6d7a7c68608 100644 --- a/mcs/class/System.Web/System.Web/TraceContext.cs +++ b/mcs/class/System.Web/System.Web/TraceContext.cs @@ -42,19 +42,11 @@ namespace System.Web { private TraceMode _Mode;
private TraceData data;
private bool data_saved;
- private bool _haveTrace = false; public TraceContext(HttpContext Context) {
_Context = Context;
_Enabled = false;
}
- - - internal bool HaveTrace { - get { - return _haveTrace; - } - } public bool IsEnabled {
get {
@@ -64,7 +56,6 @@ namespace System.Web { set {
if (value && data == null)
data = new TraceData ();
- _haveTrace = true; _Enabled = value;
}
}
diff --git a/mcs/class/corlib/System.Globalization/ChangeLog b/mcs/class/corlib/System.Globalization/ChangeLog index 95392d51e96..533cc9d4dc7 100644 --- a/mcs/class/corlib/System.Globalization/ChangeLog +++ b/mcs/class/corlib/System.Globalization/ChangeLog @@ -1,3 +1,8 @@ + +Wed Jun 30 17:06:43 CEST 2004 Paolo Molaro <lupus@ximian.com> + + * NumberFormatInfo.cs: workaround for bug 55978. + 2004-06-17 Atsushi Enomoto <atsushi@ximian.com> * DateTimeFormatInfo.cs : check if pattern array is empty or not. Now diff --git a/mcs/class/corlib/System.Globalization/NumberFormatInfo.cs b/mcs/class/corlib/System.Globalization/NumberFormatInfo.cs index 169ad6c2f9e..e884daad5a7 100644 --- a/mcs/class/corlib/System.Globalization/NumberFormatInfo.cs +++ b/mcs/class/corlib/System.Globalization/NumberFormatInfo.cs @@ -851,7 +851,10 @@ throw new Exception ("HERE the value was modified"); public object GetFormat (Type formatType) { - return (formatType == typeof (NumberFormatInfo)) ? this : null; + // work around http://bugzilla.ximian.com/show_bug.cgi?id=55978 + // the comparison fails because formatType likely comes from another domain + //return (formatType == typeof (NumberFormatInfo)) ? this : null; + return this; } public object Clone () diff --git a/mcs/class/corlib/System.Reflection/common.src b/mcs/class/corlib/System.Reflection/common.src new file mode 100644 index 00000000000..022b6768fcc --- /dev/null +++ b/mcs/class/corlib/System.Reflection/common.src @@ -0,0 +1,25 @@ +Assembly.cs +AssemblyNameFlags.cs +BindingFlags.cs +CallingConventions.cs +ConstructorInfo.cs +DefaultMemberAttribute.cs +EventAttributes.cs +EventInfo.cs +FieldAttributes.cs +FieldInfo.cs +ICustomAttributeProvider.cs +MemberFilter.cs +MemberInfo.cs +MemberTypes.cs +MethodAttributes.cs +MethodBase.cs +MethodImplAttributes.cs +MethodInfo.cs +Module.cs +ParameterAttributes.cs +PropertyAttributes.cs +PropertyInfo.cs +ResourceAttributes.cs +ResourceLocation.cs +TypeAttributes.cs diff --git a/mcs/errors/cs0502.cs b/mcs/errors/cs0502.cs index e2232ec0c29..b589cba2f75 100644 --- a/mcs/errors/cs0502.cs +++ b/mcs/errors/cs0502.cs @@ -1,6 +1,5 @@ -// cs0502.cs: The class 'Sample' is abstract and sealed
-// Line: 4
-
-abstract sealed class Sample {
-}
-
+// cs0502.cs: 'Sample' cannot be both abstract and sealed +// Line: 4 + +abstract sealed class Sample { +} diff --git a/mono/interpreter/ChangeLog b/mono/interpreter/ChangeLog index 2c2d176ef2f..088f0756976 100644 --- a/mono/interpreter/ChangeLog +++ b/mono/interpreter/ChangeLog @@ -1,3 +1,9 @@ +2004-07-05 Zoltan Varga <vargaz@freemail.hu> + + * mintops.h: Applied patch from Marcin Krzyzanowski (krzak@pld-linux.org). Add support for unaligned access on little endian machines. + + * interp.c:Applied patch from Marcin Krzyzanowski (krzak@pld-linux.org). Fix crash seen on amd64. + 2004-06-24 David Waite <mass@akuma.org> * interp.c: change to C90-style comments from C99/C++-style diff --git a/mono/interpreter/interp.c b/mono/interpreter/interp.c index 872fad14aae..3f7ad24660d 100644 --- a/mono/interpreter/interp.c +++ b/mono/interpreter/interp.c @@ -1164,7 +1164,7 @@ handle_enum: } } - if (method->klass->valuetype) + if (method->klass->valuetype && obj) /* Unbox the instance, since valuetype methods expect an interior pointer. */ obj = mono_object_unbox (obj); diff --git a/mono/interpreter/mintops.h b/mono/interpreter/mintops.h index ab559de7ac6..e787526e2fe 100644 --- a/mono/interpreter/mintops.h +++ b/mono/interpreter/mintops.h @@ -1,6 +1,8 @@ #ifndef __INTERPRETER_MINTOPS_H #define __INTERPRETER_MINTOPS_H +#include <glib.h> + typedef enum { MintOpNoArgs, @@ -29,11 +31,19 @@ enum { #undef OPDEF #if NO_UNALIGNED_ACCESS +# if G_BYTE_ORDER == G_LITTLE_ENDIAN +#define READ32(x) (((guint16 *)(x)) [0] | ((guint16 *)(x)) [1] << 16) +#define READ64(x) ((guint64)((guint16 *)(x)) [0] | \ + (guint64)((guint16 *)(x)) [1] << 16 | \ + (guint64)((guint16 *)(x)) [2] << 32 | \ + (guint64)((guint16 *)(x)) [3] << 48) +# else #define READ32(x) (((guint16 *)(x)) [0] << 16 | ((guint16 *)(x)) [1]) #define READ64(x) ((guint64)((guint16 *)(x)) [0] << 48 | \ (guint64)((guint16 *)(x)) [1] << 32 | \ (guint64)((guint16 *)(x)) [2] << 16 | \ (guint64)((guint16 *)(x)) [3]) +# endif #else /* unaligned access OK */ #define READ32(x) (*(guint32 *)(x)) #define READ64(x) (*(guint64 *)(x)) diff --git a/mono/io-layer/ChangeLog b/mono/io-layer/ChangeLog index 5b19c8ceadf..fec9ca9fbe0 100644 --- a/mono/io-layer/ChangeLog +++ b/mono/io-layer/ChangeLog @@ -1,3 +1,37 @@ +2004-07-22 Dick Porter <dick@ximian.com> + + * timed-thread.c: + * threads.c: Move the destruction of the internal thread data to + after the thread has been joined. Fixes bug 61418. + +2004-07-14 Dick Porter <dick@ximian.com> + + * wait.c (test_and_own): When not waiting for all handles to + become signalled, only own and return the lowest. All the + documentation suggests that the old way was correct, but + experimentation shows it actually works like this. Patch by + Sébastien Robitaille + (sebastien.robitaille@croesus.com), fixes bug 61511. + +2004-07-08 Dick Porter <dick@ximian.com> + + * io.c (file_seek): If there is a high 32bit offset part, make + sure the low part isn't sign-extended. Set error codes when + returning failure. Fixes bug 61131. + +2004-07-06 Dick Porter <dick@ximian.com> + + * io.c (file_setfiletime): Check for underflow when converting to + time_t values. Set error codes when returning failure. Fixes bug + 60970. + +2004-07-05 Dick Porter <dick@ximian.com> + + * mutexes.c (mutex_ops_init): Make the named mutex mutex sharable. + + * daemon.c (unref_handle): Only destroy a handle if all processes + have released it, not just the current one. Fixes bug 60887. + 2004-06-24 Dick Porter <dick@ximian.com> * mutexes.c: Indicate when a named mutex was reused diff --git a/mono/io-layer/daemon.c b/mono/io-layer/daemon.c index 746fba49d17..62aa75ce1f3 100644 --- a/mono/io-layer/daemon.c +++ b/mono/io-layer/daemon.c @@ -340,16 +340,14 @@ static gboolean unref_handle (ChannelData *channel_data, guint32 handle) channel_data->open_handles[handle]); #endif - if(channel_data->open_handles[handle]==0) { - /* This client has released the handle */ - destroy=TRUE; - } - - if(_wapi_shared_data[segment]->handles[idx].ref==0) { + if (_wapi_shared_data[segment]->handles[idx].ref == 0) { gboolean was_file; dev_t device = 0; ino_t inode = 0; + /* This client has released the handle */ + destroy=TRUE; + if (channel_data->open_handles[handle]!=0) { g_warning (G_GNUC_PRETTY_FUNCTION ": per-process open_handles mismatch, set to %d, should be 0", channel_data->open_handles[handle]); diff --git a/mono/io-layer/io.c b/mono/io-layer/io.c index e0436186ee0..cdc616743fa 100644 --- a/mono/io-layer/io.c +++ b/mono/io-layer/io.c @@ -617,6 +617,7 @@ static guint32 file_seek(gpointer handle, gint32 movedistance, if(ok==FALSE) { g_warning (G_GNUC_PRETTY_FUNCTION ": error looking up file handle %p", handle); + SetLastError (ERROR_INVALID_HANDLE); return(INVALID_SET_FILE_POINTER); } @@ -627,6 +628,7 @@ static guint32 file_seek(gpointer handle, gint32 movedistance, g_message(G_GNUC_PRETTY_FUNCTION ": handle %p fd %d doesn't have GENERIC_READ or GENERIC_WRITE access: %u", handle, file_private_handle->fd, file_handle->fileaccess); #endif + SetLastError (ERROR_ACCESS_DENIED); return(INVALID_SET_FILE_POINTER); } @@ -646,6 +648,7 @@ static guint32 file_seek(gpointer handle, gint32 movedistance, method); #endif + SetLastError (ERROR_INVALID_PARAMETER); return(INVALID_SET_FILE_POINTER); } @@ -658,7 +661,7 @@ static guint32 file_seek(gpointer handle, gint32 movedistance, movedistance); #endif } else { - offset=((gint64) *highmovedistance << 32) | movedistance; + offset=((gint64) *highmovedistance << 32) | (unsigned long)movedistance; #ifdef DEBUG g_message(G_GNUC_PRETTY_FUNCTION ": setting offset to %lld 0x%llx (high %d 0x%x, low %d 0x%x)", offset, offset, *highmovedistance, *highmovedistance, movedistance, movedistance); @@ -688,6 +691,7 @@ static guint32 file_seek(gpointer handle, gint32 movedistance, handle, file_private_handle->fd, strerror(errno)); #endif + _wapi_set_last_error_from_errno (); return(INVALID_SET_FILE_POINTER); } @@ -986,6 +990,7 @@ static gboolean file_setfiletime(gpointer handle, if(ok==FALSE) { g_warning (G_GNUC_PRETTY_FUNCTION ": error looking up file handle %p", handle); + SetLastError (ERROR_INVALID_HANDLE); return(FALSE); } @@ -995,6 +1000,7 @@ static gboolean file_setfiletime(gpointer handle, g_message(G_GNUC_PRETTY_FUNCTION ": handle %p fd %d doesn't have GENERIC_WRITE access: %u", handle, file_private_handle->fd, file_handle->fileaccess); #endif + SetLastError (ERROR_ACCESS_DENIED); return(FALSE); } @@ -1005,6 +1011,7 @@ static gboolean file_setfiletime(gpointer handle, file_private_handle->fd); #endif + SetLastError (ERROR_INVALID_HANDLE); return(FALSE); } @@ -1019,12 +1026,25 @@ static gboolean file_setfiletime(gpointer handle, file_private_handle->fd, strerror(errno)); #endif + SetLastError (ERROR_INVALID_PARAMETER); return(FALSE); } if(last_access!=NULL) { access_ticks=((guint64)last_access->dwHighDateTime << 32) + last_access->dwLowDateTime; + /* This is (time_t)0. We can actually go to INT_MIN, + * but this will do for now. + */ + if (access_ticks < 116444736000000000ULL) { +#ifdef DEBUG + g_message (G_GNUC_PRETTY_FUNCTION + ": attempt to set access time too early"); +#endif + SetLastError (ERROR_INVALID_PARAMETER); + return(FALSE); + } + utbuf.actime=(access_ticks - 116444736000000000ULL) / 10000000; } else { utbuf.actime=statbuf.st_atime; @@ -1033,6 +1053,18 @@ static gboolean file_setfiletime(gpointer handle, if(last_write!=NULL) { write_ticks=((guint64)last_write->dwHighDateTime << 32) + last_write->dwLowDateTime; + /* This is (time_t)0. We can actually go to INT_MIN, + * but this will do for now. + */ + if (write_ticks < 116444736000000000ULL) { +#ifdef DEBUG + g_message (G_GNUC_PRETTY_FUNCTION + ": attempt to set write time too early"); +#endif + SetLastError (ERROR_INVALID_PARAMETER); + return(FALSE); + } + utbuf.modtime=(write_ticks - 116444736000000000ULL) / 10000000; } else { utbuf.modtime=statbuf.st_mtime; @@ -1055,6 +1087,7 @@ static gboolean file_setfiletime(gpointer handle, #endif g_free (name); + SetLastError (ERROR_INVALID_PARAMETER); return(FALSE); } diff --git a/mono/io-layer/mutexes.c b/mono/io-layer/mutexes.c index ee736aac2c2..ee10921578a 100644 --- a/mono/io-layer/mutexes.c +++ b/mono/io-layer/mutexes.c @@ -23,9 +23,8 @@ #undef DEBUG /* This is used to serialise mutex creation when names are given - * (FIXME: make it process-shared) */ -static mono_mutex_t named_mutex_mutex = MONO_MUTEX_INITIALIZER; +static mono_mutex_t named_mutex_mutex; static void mutex_close_shared (gpointer handle); static void mutex_signal(gpointer handle); @@ -44,6 +43,23 @@ static mono_once_t mutex_ops_once=MONO_ONCE_INIT; static void mutex_ops_init (void) { + int thr_ret; +#if defined(_POSIX_THREAD_PROCESS_SHARED) && _POSIX_THREAD_PROCESS_SHARED != -1 + pthread_mutexattr_t mutex_shared_attr; + + thr_ret = mono_mutexattr_init (&mutex_shared_attr); + g_assert (thr_ret == 0); + + thr_ret = mono_mutexattr_setpshared (&mutex_shared_attr, + PTHREAD_PROCESS_SHARED); + g_assert (thr_ret == 0); + + thr_ret = mono_mutex_init (&named_mutex_mutex, &mutex_shared_attr); + g_assert (thr_ret == 0); +#else + thr_ret = mono_mutex_init (&named_mutex_mutex, NULL); +#endif + _wapi_handle_register_capabilities (WAPI_HANDLE_MUTEX, WAPI_HANDLE_CAP_WAIT | WAPI_HANDLE_CAP_SIGNAL | diff --git a/mono/io-layer/threads.c b/mono/io-layer/threads.c index b9ddc6aa3dc..31c1176a12c 100644 --- a/mono/io-layer/threads.c +++ b/mono/io-layer/threads.c @@ -99,9 +99,7 @@ static void thread_close_private (gpointer handle) thread_handle->thread->id); #endif - if(thread_handle->thread!=NULL) { - _wapi_timed_thread_destroy (thread_handle->thread); - } + thread_handle->thread=NULL; } static void thread_own (gpointer handle) @@ -628,6 +626,10 @@ guint32 ResumeThread(gpointer handle) return(0xFFFFFFFF); } + if (thread_private_handle->thread == NULL) { + return(0xFFFFFFFF); + } + #ifdef WITH_INCLUDED_LIBGC if (thread_private_handle->thread->suspend_count <= 1) _wapi_timed_thread_resume (thread_private_handle->thread); @@ -670,6 +672,10 @@ guint32 SuspendThread(gpointer handle) return(0xFFFFFFFF); } + if (thread_private_handle->thread == NULL) { + return(0xFFFFFFFF); + } + if (!thread_private_handle->thread->suspend_count) { if (handle == current) _wapi_timed_thread_suspend (thread_private_handle->thread); diff --git a/mono/io-layer/timed-thread.c b/mono/io-layer/timed-thread.c index c0d737862a2..6599e0660f3 100644 --- a/mono/io-layer/timed-thread.c +++ b/mono/io-layer/timed-thread.c @@ -254,6 +254,8 @@ int _wapi_timed_thread_join(TimedThread *thread, struct timespec *timeout, if(exitstatus!=NULL) { *exitstatus = thread->exitstatus; } + + _wapi_timed_thread_destroy (thread); } return(result); } diff --git a/mono/io-layer/wait.c b/mono/io-layer/wait.c index e3d07b3a255..a236d17ed3e 100644 --- a/mono/io-layer/wait.c +++ b/mono/io-layer/wait.c @@ -354,9 +354,15 @@ static gboolean test_and_own (guint32 numobjects, gpointer *handles, done = _wapi_handle_count_signalled_handles (numobjects, handles, waitall, count, lowest); if (done == TRUE) { - for (i = 0; i < numobjects; i++) { - if (_wapi_handle_issignalled (handles[i])) { - _wapi_handle_ops_own (handles[i]); + if (waitall == TRUE) { + for (i = 0; i < numobjects; i++) { + if (_wapi_handle_issignalled (handles[i])) { + _wapi_handle_ops_own (handles[i]); + } + } + } else { + if (_wapi_handle_issignalled (handles[*lowest])) { + _wapi_handle_ops_own (handles[*lowest]); } } } diff --git a/mono/metadata/ChangeLog b/mono/metadata/ChangeLog index 03869d5b735..4aad6add664 100644 --- a/mono/metadata/ChangeLog +++ b/mono/metadata/ChangeLog @@ -1,3 +1,86 @@ + +Tue Aug 3 17:54:17 CEST 2004 Paolo Molaro <lupus@ximian.com> + + * gc.c: make GC warning messages use the trace API, they are just + noise to most of the users. + +Tue Aug 3 16:40:17 CEST 2004 Paolo Molaro <lupus@ximian.com> + + * gc.c, object.h: mono_gc_handle_*() interface and + AddrOfPinnedObject fixes. GC handle support even without GC. + +Fri Jul 30 16:49:05 CEST 2004 Paolo Molaro <lupus@ximian.com> + + * object.c: always create an object if null is passed + to Invoke() where a valuetype is expected. + +2004-07-29 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * appdomain.c: hack to build correctly the private bin path on windows. + Fixes bug #61991. + +2004-07-28 Dick Porter <dick@ximian.com> + + * socket-io.c + (ves_icall_System_Net_Sockets_Socket_RecvFrom_internal): Check + returned sockaddr size before creating the remote address object. + Patch by Nick Vaughan (dev@6wardlaw.freeserve.co.uk), fixes bug + 61608. + +2004-07-28 Dick Porter <dick@ximian.com> + + * locales.c (string_invariant_compare_char): Fix invariant char + compares between upper and lower cases. Fixes bug 61458. + +Tue Jul 27 15:58:19 CEST 2004 Paolo Molaro <lupus@ximian.com> + + * debug-mono-symfile.c: fix one more endianess issue, from a patch + by Geoff Norton (<gnorton@customerdna.com>). + +Tue Jul 27 15:47:17 CEST 2004 Paolo Molaro <lupus@ximian.com> + + * class.c: fix class loads for pointer types (typeof(int) != + typeof(int*)). + +2004-07-24 Martin Baulig <martin@ximian.com> + + * reflection.c (mono_image_get_type_info): Only write a class + layout entry if we actually have a size or a packing size. + +2004-07-13 Peter Williams <peter@newton.cx> + + * process.c (complete_path): Make sure we don't attempt to execute + directories. + +2004-07-11 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * debug-helpers.c: undo my previous patch and fixed the real issue in + ../mini/exceptions-x86.c + +2004-07-11 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * debug-helpers.c: prevent SIGSEGV. It happened running xsp on monodoc + when no HOME env. variable was set and a NullRef was thrown in a .cctor + called from other .cctors. + +2004-07-09 Dick Porter <dick@ximian.com> + + * locales.c (ves_icall_System_String_InternalReplace_Str_Comp): + Don't do any more processing if the matched length was 0. It was + increasing the size of the string before. Fixes bug 61167. + +2004-07-09 Dick Porter <dick@ximian.com> + + * socket-io.h: + * socket-io.c + (ves_icall_System_Net_Sockets_Socket_GetSocketOption_obj_internal): + Add support for SO_PEERCRED if its available. + +2004-07-03 Zoltan Varga <vargaz@freemail.hu> + + * marshal.c: Fix managed->native stringbuilder marshalling. Implement + marshalling of stringbuilder arrays. Fixes #59900. + 2004-06-29 Martin Baulig <martin@ximian.com> * mono-debug.c (mono_debug_add_method): Protect the whole function diff --git a/mono/metadata/appdomain.c b/mono/metadata/appdomain.c index a917a9ecd19..af00a3510d2 100644 --- a/mono/metadata/appdomain.c +++ b/mono/metadata/appdomain.c @@ -547,9 +547,17 @@ reduce_path (const gchar *dirname) for (tmp = list; tmp; tmp = tmp->next) { gchar *data = (gchar *) tmp->data; - if (data && *data) - g_string_append_printf (result, "%c%s", G_DIR_SEPARATOR, - (char *) tmp->data); + if (data && *data) { +#ifdef PLATFORM_WIN32 + if (result->len == 0) + g_string_append_printf (result, "%s\\", data); + else if (result->str [result->len - 1] == '\\') + g_string_append_printf (result, "%s", data); + else +#endif + g_string_append_printf (result, "%c%s", + G_DIR_SEPARATOR, data); + } } res = result->str; diff --git a/mono/metadata/class.c b/mono/metadata/class.c index 7f434b5c734..2814e47d255 100644 --- a/mono/metadata/class.c +++ b/mono/metadata/class.c @@ -2124,7 +2124,7 @@ mono_class_create_from_typespec (MonoImage *image, guint32 type_spec, class = mono_array_class_get (type->data.klass, 1); break; case MONO_TYPE_PTR: - class = mono_class_from_mono_type (type->data.type); + class = mono_ptr_class_get (type->data.type); break; case MONO_TYPE_GENERICINST: g_assert (type->data.generic_inst->klass); diff --git a/mono/metadata/debug-mono-symfile.c b/mono/metadata/debug-mono-symfile.c index 4f39e6827f1..612eb39babf 100644 --- a/mono/metadata/debug-mono-symfile.c +++ b/mono/metadata/debug-mono-symfile.c @@ -136,7 +136,7 @@ mono_debug_close_mono_symbol_file (MonoSymbolFile *symfile) static gchar * read_string (const char *ptr) { - int len = *((guint32 *) ptr); + int len = read32 (ptr); ptr += sizeof(guint32); return g_filename_from_utf8 (ptr, len, NULL, NULL, NULL); } diff --git a/mono/metadata/gc.c b/mono/metadata/gc.c index 4695c8c1a2a..73167d0e9dc 100644 --- a/mono/metadata/gc.c +++ b/mono/metadata/gc.c @@ -16,6 +16,7 @@ #include <mono/metadata/exception.h> #include <mono/metadata/domain-internals.h> #include <mono/metadata/class-internals.h> +#include <mono/utils/mono-logger.h> #define GC_I_HIDE_POINTERS #include <mono/os/gc_wrapper.h> @@ -347,13 +348,17 @@ ves_icall_System_GCHandle_GetTargetHandle (MonoObject *obj, guint32 handle, gint /* Indexes start from 1 since 0 means the handle is not allocated */ idx = ++next_handle; if (idx >= array_size) { -#if HAVE_BOEHM_GC gpointer *new_array; guint8 *new_type_array; if (!array_size) array_size = 16; +#if HAVE_BOEHM_GC new_array = GC_MALLOC (sizeof (gpointer) * (array_size * 2)); new_type_array = GC_MALLOC (sizeof (guint8) * (array_size * 2)); +#else + new_array = g_malloc0 (sizeof (gpointer) * (array_size * 2)); + new_type_array = g_malloc0 (sizeof (guint8) * (array_size * 2)); +#endif if (gc_handles) { int i; memcpy (new_array, gc_handles, sizeof (gpointer) * array_size); @@ -370,20 +375,22 @@ ves_icall_System_GCHandle_GetTargetHandle (MonoObject *obj, guint32 handle, gint #else if (((gulong)new_array [i]) & 0x1) { #endif +#if HAVE_BOEHM_GC if (gc_handles [i] != (gpointer)-1) GC_unregister_disappearing_link (&(gc_handles [i])); if (new_array [i] != (gpointer)-1) GC_GENERAL_REGISTER_DISAPPEARING_LINK (&(new_array [i]), REVEAL_POINTER (new_array [i])); +#endif } } } array_size *= 2; +#ifndef HAVE_BOEHM_GC + g_free (gc_handles); + g_free (gc_handle_types); +#endif gc_handles = new_array; gc_handle_types = new_type_array; -#else - LeaveCriticalSection (&handle_section); - mono_raise_exception (mono_get_exception_execution_engine ("No GCHandle support built-in")); -#endif } /* resuse the type from the old target */ @@ -399,9 +406,6 @@ ves_icall_System_GCHandle_GetTargetHandle (MonoObject *obj, guint32 handle, gint #if HAVE_BOEHM_GC if (gc_handles [idx] != (gpointer)-1) GC_GENERAL_REGISTER_DISAPPEARING_LINK (&(gc_handles [idx]), obj); -#else - LeaveCriticalSection (&handle_section); - mono_raise_exception (mono_get_exception_execution_engine ("No weakref support")); #endif break; default: @@ -429,9 +433,6 @@ ves_icall_System_GCHandle_FreeHandle (guint32 handle) if (gc_handles [idx] != (gpointer)-1) GC_unregister_disappearing_link (&(gc_handles [idx])); } -#else - LeaveCriticalSection (&handle_section); - mono_raise_exception (mono_get_exception_execution_engine ("No GCHandle support")); #endif gc_handles [idx] = (gpointer)-1; @@ -457,11 +458,50 @@ ves_icall_System_GCHandle_GetAddrOfPinnedObject (guint32 handle) if (obj == (MonoObject *) -1) return NULL; } - return obj; + if (obj) { + MonoClass *klass = mono_object_class (obj); + if (klass == mono_defaults.string_class) { + return mono_string_chars ((MonoString*)obj); + } else if (klass->rank) { + return mono_array_addr ((MonoArray*)obj, char, 0); + } else { + /* the C# code will check and throw the exception */ + /* FIXME: missing !klass->blittable test, see bug #61134, + * disabled in 1.0 untill the blittable-using code is audited. + if ((klass->flags & TYPE_ATTRIBUTE_LAYOUT_MASK) == TYPE_ATTRIBUTE_AUTO_LAYOUT) + return (gpointer)-1; */ + return (char*)obj + sizeof (MonoObject); + } + } } return NULL; } +guint32 +mono_gchandle_new (MonoObject *obj, gboolean pinned) +{ + return ves_icall_System_GCHandle_GetTargetHandle (obj, 0, pinned? HANDLE_PINNED: HANDLE_NORMAL); +} + +guint32 +mono_gchandle_new_weakref (MonoObject *obj, gboolean track_resurrection) +{ + return ves_icall_System_GCHandle_GetTargetHandle (obj, 0, track_resurrection? HANDLE_WEAK_TRACK: HANDLE_WEAK); +} + +/* This will return NULL for a collected object if using a weakref handle */ +MonoObject* +mono_gchandle_get_target (guint32 gchandle) +{ + return ves_icall_System_GCHandle_GetTarget (gchandle); +} + +void +mono_gchandle_free (guint32 gchandle) +{ + ves_icall_System_GCHandle_FreeHandle (gchandle); +} + #if HAVE_BOEHM_GC static HANDLE finalizer_event; @@ -606,6 +646,12 @@ static GCThreadFunctions mono_gc_thread_vtable = { }; #endif /* WITH_INCLUDED_LIBGC */ +static void +mono_gc_warning (char *msg, GC_word arg) +{ + mono_trace (G_LOG_LEVEL_WARNING, MONO_TRACE_GC, msg, (unsigned long)arg); +} + void mono_gc_init (void) { InitializeCriticalSection (&handle_section); diff --git a/mono/metadata/locales.c b/mono/metadata/locales.c index 7c10529f3f3..1210965a70a 100644 --- a/mono/metadata/locales.c +++ b/mono/metadata/locales.c @@ -25,7 +25,7 @@ #include <locale.h> -//#undef DEBUG +#undef DEBUG static gint32 string_invariant_compare_char (gunichar2 c1, gunichar2 c2, gint32 options); @@ -1431,6 +1431,11 @@ MonoString *ves_icall_System_String_InternalReplace_Str_Comp (MonoString *this, * does match properly... */ match_len = usearch_getMatchedLength (search); + + if(match_len == 0) { + continue; + } + match=(UChar *)g_malloc0 (sizeof(UChar) * (match_len + 1)); usearch_getMatchedText (search, match, match_len, &ec); @@ -1467,6 +1472,11 @@ MonoString *ves_icall_System_String_InternalReplace_Str_Comp (MonoString *this, pos!=USEARCH_DONE; pos=usearch_next (search, &ec)) { match_len = usearch_getMatchedLength (search); + + if (match_len == 0) { + continue; + } + match=(UChar *)g_malloc0 (sizeof(UChar) * (match_len + 1)); usearch_getMatchedText (search, match, match_len, &ec); @@ -1865,15 +1875,6 @@ static gint32 string_invariant_compare_char (gunichar2 c1, gunichar2 c2, /* No options. Kana, symbol and spacing options don't * apply to the invariant culture. */ - if (c1type == G_UNICODE_UPPERCASE_LETTER && - c2type == G_UNICODE_LOWERCASE_LETTER) { - return(1); - } - - if (c1type == G_UNICODE_LOWERCASE_LETTER && - c2type == G_UNICODE_UPPERCASE_LETTER) { - return(-1); - } result = (gint32) c1 - c2; } diff --git a/mono/metadata/marshal.c b/mono/metadata/marshal.c index f15938d29c5..2892d81e88b 100644 --- a/mono/metadata/marshal.c +++ b/mono/metadata/marshal.c @@ -45,9 +45,6 @@ struct _MonoMethodBuilder { static void emit_struct_conv (MonoMethodBuilder *mb, MonoClass *klass, gboolean to_object); -static gint -mono_marshal_runtime_glist_find_klass (gconstpointer a, gconstpointer b); - static MonoMethod * mono_find_method_by_name (MonoClass *klass, const char *name, int param_count) { @@ -224,17 +221,20 @@ mono_string_builder_to_utf8 (MonoStringBuilder *sb) { GError *error = NULL; glong *res; + gchar *tmp; if (!sb) return NULL; res = g_malloc0 (mono_stringbuilder_capacity (sb) + 1); - g_utf16_to_utf8 (mono_string_chars (sb->str), sb->length, NULL, res, &error); + tmp = g_utf16_to_utf8 (mono_string_chars (sb->str), sb->length, NULL, res, &error); if (error) { g_error_free (error); mono_raise_exception (mono_get_exception_execution_engine ("Failed to convert StringBuilder from utf16 to utf8")); } + else + memcpy (res, tmp, sb->length + 1); return res; } @@ -1270,6 +1270,52 @@ mono_marshal_get_string_encoding (MonoMethodPInvoke *piinfo, MonoMarshalSpec *sp } } +static MonoMarshalNative +mono_marshal_get_stringbuilder_to_ptr_encoding (MonoMethodPInvoke *piinfo, MonoMarshalSpec *spec) +{ + MonoMarshalNative encoding = mono_marshal_get_string_encoding (piinfo, spec); + + switch (encoding) { + case MONO_NATIVE_LPWSTR: + return MONO_MARSHAL_CONV_SB_LPWSTR; + break; + case MONO_NATIVE_LPSTR: + return MONO_MARSHAL_CONV_SB_LPSTR; + break; + case MONO_NATIVE_LPTSTR: + return MONO_MARSHAL_CONV_SB_LPTSTR; + break; + default: + return -1; + } +} + +static MonoMarshalNative +mono_marshal_get_ptr_to_stringbuilder_encoding (MonoMethodPInvoke *piinfo, MonoMarshalSpec *spec, gboolean *need_free) +{ + MonoMarshalNative encoding = mono_marshal_get_string_encoding (piinfo, spec); + + *need_free = TRUE; + + switch (encoding) { + case MONO_NATIVE_LPWSTR: + /* + * mono_string_builder_to_utf16 does not allocate a + * new buffer, so no need to free it. + */ + *need_free = FALSE; + return MONO_MARSHAL_CONV_LPWSTR_SB; + case MONO_NATIVE_LPSTR: + return MONO_MARSHAL_CONV_LPSTR_SB; + break; + case MONO_NATIVE_LPTSTR: + return MONO_MARSHAL_CONV_LPTSTR_SB; + break; + default: + return -1; + } +} + static inline MonoMethod* mono_marshal_find_in_cache (GHashTable *cache, gpointer key) { @@ -1619,7 +1665,7 @@ mono_remoting_wrapper (MonoMethod *method, gpointer *params) } } - return mono_runtime_invoke (method, method->klass->valuetype? mono_object_unbox (this): this, mparams, NULL); + return mono_runtime_invoke (method, method->klass->valuetype? mono_object_unbox ((MonoObject*)this): this, mparams, NULL); } msg = mono_method_call_message_new (method, params, NULL, NULL, NULL); @@ -3392,31 +3438,22 @@ mono_marshal_get_native_wrapper (MonoMethod *method) mono_mb_emit_byte (mb, MONO_MARSHAL_CONV_DEL_FTN); mono_mb_emit_stloc (mb, tmp_locals [i]); } else if (klass == mono_defaults.stringbuilder_class) { - MonoMarshalNative encoding = mono_marshal_get_string_encoding (piinfo, spec); + MonoMarshalNative encoding = mono_marshal_get_stringbuilder_to_ptr_encoding (piinfo, spec); g_assert (!t->byref); mono_mb_emit_ldarg (mb, argnum); mono_mb_emit_byte (mb, MONO_CUSTOM_PREFIX); mono_mb_emit_byte (mb, CEE_MONO_FUNC1); - switch (encoding) { - case MONO_NATIVE_LPWSTR: - mono_mb_emit_byte (mb, MONO_MARSHAL_CONV_SB_LPWSTR); - break; - case MONO_NATIVE_LPSTR: - mono_mb_emit_byte (mb, MONO_MARSHAL_CONV_SB_LPSTR); - break; - case MONO_NATIVE_LPTSTR: - mono_mb_emit_byte (mb, MONO_MARSHAL_CONV_SB_LPTSTR); - break; - default: { + if (encoding != -1) + mono_mb_emit_byte (mb, encoding); + else { char *msg = g_strdup_printf ("stringbuilder marshalling conversion %d not implemented", encoding); MonoException *exc = mono_get_exception_not_implemented (msg); g_warning (msg); g_free (msg); mono_raise_exception (exc); } - } mono_mb_emit_stloc (mb, tmp_locals [i]); } else { @@ -3512,10 +3549,13 @@ mono_marshal_get_native_wrapper (MonoMethod *method) else { MonoClass *eklass; guint32 label1, label2, label3; - int index_var, dest_ptr; + int index_var, dest_ptr, esize; + MonoMarshalNative encoding = mono_marshal_get_stringbuilder_to_ptr_encoding (piinfo, spec); dest_ptr = mono_mb_add_local (mb, &mono_defaults.int_class->byval_arg); + eklass = klass->element_class; + /* Check null */ mono_mb_emit_ldarg (mb, argnum); mono_mb_emit_stloc (mb, tmp_locals [i]); @@ -3524,9 +3564,23 @@ mono_marshal_get_native_wrapper (MonoMethod *method) label1 = mb->pos; mono_mb_emit_i4 (mb, 0); + if (eklass == mono_defaults.stringbuilder_class) { + if (encoding == -1) { + char *msg = g_strdup_printf ("stringbuilder marshalling conversion %d not implemented", encoding); + MonoException *exc = mono_get_exception_not_implemented (msg); + g_warning (msg); + g_free (msg); + mono_raise_exception (exc); + } + } + + if (eklass == mono_defaults.stringbuilder_class) + esize = sizeof (gpointer); + else + esize = mono_class_native_size (eklass, NULL); + /* allocate space for the native struct and store the address */ - eklass = klass->element_class; - mono_mb_emit_icon (mb, mono_class_native_size (eklass, NULL)); + mono_mb_emit_icon (mb, esize); mono_mb_emit_ldarg (mb, argnum); mono_mb_emit_byte (mb, CEE_LDLEN); mono_mb_emit_byte (mb, CEE_MUL); @@ -3551,22 +3605,34 @@ mono_marshal_get_native_wrapper (MonoMethod *method) /* Emit marshalling code */ - /* set the src_ptr */ - mono_mb_emit_ldarg (mb, argnum); - mono_mb_emit_ldloc (mb, index_var); - mono_mb_emit_byte (mb, CEE_LDELEMA); - mono_mb_emit_i4 (mb, mono_mb_add_data (mb, eklass)); - mono_mb_emit_byte (mb, CEE_STLOC_0); + if (eklass == mono_defaults.stringbuilder_class) { + mono_mb_emit_ldloc (mb, dest_ptr); + mono_mb_emit_ldarg (mb, argnum); + mono_mb_emit_ldloc (mb, index_var); + mono_mb_emit_byte (mb, CEE_LDELEM_REF); + mono_mb_emit_byte (mb, MONO_CUSTOM_PREFIX); + mono_mb_emit_byte (mb, CEE_MONO_FUNC1); + mono_mb_emit_byte (mb, encoding); + mono_mb_emit_byte (mb, CEE_STIND_I); + } + else { + /* set the src_ptr */ + mono_mb_emit_ldarg (mb, argnum); + mono_mb_emit_ldloc (mb, index_var); + mono_mb_emit_byte (mb, CEE_LDELEMA); + mono_mb_emit_i4 (mb, mono_mb_add_data (mb, eklass)); + mono_mb_emit_byte (mb, CEE_STLOC_0); - /* set dst_ptr */ - mono_mb_emit_ldloc (mb, dest_ptr); - mono_mb_emit_byte (mb, CEE_STLOC_1); + /* set dst_ptr */ + mono_mb_emit_ldloc (mb, dest_ptr); + mono_mb_emit_byte (mb, CEE_STLOC_1); - /* emit valuetype conversion code */ - emit_struct_conv (mb, eklass, FALSE); + /* emit valuetype conversion code */ + emit_struct_conv (mb, eklass, FALSE); + } mono_mb_emit_add_to_local (mb, index_var, 1); - mono_mb_emit_add_to_local (mb, dest_ptr, mono_class_native_size (eklass, NULL)); + mono_mb_emit_add_to_local (mb, dest_ptr, esize); mono_mb_emit_byte (mb, CEE_BR); mono_mb_emit_i4 (mb, label2 - (mb->pos + 4)); @@ -3993,33 +4059,20 @@ mono_marshal_get_native_wrapper (MonoMethod *method) case MONO_TYPE_CLASS: case MONO_TYPE_OBJECT: if (t->data.klass == mono_defaults.stringbuilder_class) { - MonoMarshalNative encoding = mono_marshal_get_string_encoding (piinfo, spec); - gboolean need_free = TRUE; + gboolean need_free; + MonoMarshalNative encoding; + + encoding = mono_marshal_get_ptr_to_stringbuilder_encoding (piinfo, spec, &need_free); g_assert (!t->byref); + g_assert (encoding != -1); + mono_mb_emit_ldarg (mb, argnum); mono_mb_emit_ldloc (mb, tmp_locals [i]); mono_mb_emit_byte (mb, MONO_CUSTOM_PREFIX); mono_mb_emit_byte (mb, CEE_MONO_PROC2); - switch (encoding) { - case MONO_NATIVE_LPWSTR: - mono_mb_emit_byte (mb, MONO_MARSHAL_CONV_LPWSTR_SB); - /* - * mono_string_builder_to_utf16 does not allocate a - * new buffer, so no need to free it. - */ - need_free = FALSE; - break; - case MONO_NATIVE_LPSTR: - mono_mb_emit_byte (mb, MONO_MARSHAL_CONV_LPSTR_SB); - break; - case MONO_NATIVE_LPTSTR: - mono_mb_emit_byte (mb, MONO_MARSHAL_CONV_LPTSTR_SB); - break; - default: - g_assert_not_reached (); - } + mono_mb_emit_byte (mb, encoding); if (need_free) { mono_mb_emit_ldloc (mb, tmp_locals [i]); @@ -4134,13 +4187,17 @@ mono_marshal_get_native_wrapper (MonoMethod *method) } /* Character arrays are implicitly marshalled as [Out] */ - if ((klass->element_class == mono_defaults.char_class) || (t->attrs & PARAM_ATTRIBUTE_OUT)) { + if ((klass->element_class == mono_defaults.char_class) || (klass->element_class == mono_defaults.stringbuilder_class) || (t->attrs & PARAM_ATTRIBUTE_OUT)) { /* FIXME: Optimize blittable case */ MonoClass *eklass; guint32 label1, label2, label3; - int index_var, src_ptr; + int index_var, src_ptr, esize; eklass = klass->element_class; + if (eklass == mono_defaults.stringbuilder_class) + esize = sizeof (gpointer); + else + esize = mono_class_native_size (eklass, NULL); src_ptr = mono_mb_add_local (mb, &mono_defaults.int_class->byval_arg); /* Check null */ @@ -4166,22 +4223,53 @@ mono_marshal_get_native_wrapper (MonoMethod *method) /* Emit marshalling code */ - /* set the src_ptr */ - mono_mb_emit_ldloc (mb, src_ptr); - mono_mb_emit_byte (mb, CEE_STLOC_0); + if (eklass == mono_defaults.stringbuilder_class) { + gboolean need_free; + MonoMarshalNative encoding = mono_marshal_get_ptr_to_stringbuilder_encoding (piinfo, spec, &need_free); - /* set dst_ptr */ - mono_mb_emit_ldarg (mb, argnum); - mono_mb_emit_ldloc (mb, index_var); - mono_mb_emit_byte (mb, CEE_LDELEMA); - mono_mb_emit_i4 (mb, mono_mb_add_data (mb, eklass)); - mono_mb_emit_byte (mb, CEE_STLOC_1); + g_assert (encoding != -1); - /* emit valuetype conversion code */ - emit_struct_conv (mb, eklass, TRUE); + /* dest */ + mono_mb_emit_ldarg (mb, argnum); + mono_mb_emit_ldloc (mb, index_var); + mono_mb_emit_byte (mb, CEE_LDELEM_REF); + + /* src */ + mono_mb_emit_ldloc (mb, src_ptr); + mono_mb_emit_byte (mb, CEE_LDIND_I); + + mono_mb_emit_byte (mb, MONO_CUSTOM_PREFIX); + mono_mb_emit_byte (mb, CEE_MONO_PROC2); + + mono_mb_emit_byte (mb, encoding); + + if (need_free) { + /* src */ + mono_mb_emit_ldloc (mb, src_ptr); + mono_mb_emit_byte (mb, CEE_LDIND_I); + + mono_mb_emit_byte (mb, MONO_CUSTOM_PREFIX); + mono_mb_emit_byte (mb, CEE_MONO_FREE); + } + } + else { + /* set the src_ptr */ + mono_mb_emit_ldloc (mb, src_ptr); + mono_mb_emit_byte (mb, CEE_STLOC_0); + + /* set dst_ptr */ + mono_mb_emit_ldarg (mb, argnum); + mono_mb_emit_ldloc (mb, index_var); + mono_mb_emit_byte (mb, CEE_LDELEMA); + mono_mb_emit_i4 (mb, mono_mb_add_data (mb, eklass)); + mono_mb_emit_byte (mb, CEE_STLOC_1); + + /* emit valuetype conversion code */ + emit_struct_conv (mb, eklass, TRUE); + } mono_mb_emit_add_to_local (mb, index_var, 1); - mono_mb_emit_add_to_local (mb, src_ptr, mono_class_native_size (eklass, NULL)); + mono_mb_emit_add_to_local (mb, src_ptr, esize); mono_mb_emit_byte (mb, CEE_BR); mono_mb_emit_i4 (mb, label2 - (mb->pos + 4)); diff --git a/mono/metadata/object.c b/mono/metadata/object.c index bdf832baa6d..65176ce2435 100644 --- a/mono/metadata/object.c +++ b/mono/metadata/object.c @@ -1586,13 +1586,9 @@ mono_runtime_invoke_array (MonoMethod *method, void *obj, MonoArray *params, case MONO_TYPE_R4: case MONO_TYPE_R8: case MONO_TYPE_VALUETYPE: - if (sig->params [i]->byref) { - /* MS seems to create the objects if a null is passed in */ - if (! ((gpointer *)params->vector)[i]) - ((gpointer*)params->vector)[i] = mono_object_new (mono_domain_get (), mono_class_from_mono_type (sig->params [i])); - } - else - g_assert (((gpointer*)params->vector) [i]); + /* MS seems to create the objects if a null is passed in */ + if (! ((gpointer *)params->vector)[i]) + ((gpointer*)params->vector)[i] = mono_object_new (mono_domain_get (), mono_class_from_mono_type (sig->params [i])); pa [i] = (char *)(((gpointer *)params->vector)[i]) + sizeof (MonoObject); break; case MONO_TYPE_STRING: diff --git a/mono/metadata/object.h b/mono/metadata/object.h index c1ffc3c4c2d..2413cc7a346 100644 --- a/mono/metadata/object.h +++ b/mono/metadata/object.h @@ -252,5 +252,11 @@ mono_property_set_value (MonoProperty *prop, void *obj, void **params, MonoObjec MonoObject* mono_property_get_value (MonoProperty *prop, void *obj, void **params, MonoObject **exc); +/* GC handles support */ +guint32 mono_gchandle_new (MonoObject *obj, gboolean pinned); +guint32 mono_gchandle_new_weakref (MonoObject *obj, gboolean track_resurrection); +MonoObject* mono_gchandle_get_target (guint32 gchandle); +void mono_gchandle_free (guint32 gchandle); + #endif diff --git a/mono/metadata/process.c b/mono/metadata/process.c index 5e7cce9de7b..90edc4023e5 100644 --- a/mono/metadata/process.c +++ b/mono/metadata/process.c @@ -738,7 +738,7 @@ complete_path (const gunichar2 *appname, gunichar2 **completed) return FALSE; } - if (g_file_test (utf8app, G_FILE_TEST_IS_EXECUTABLE)) { + if (g_file_test (utf8app, G_FILE_TEST_IS_EXECUTABLE) && !g_file_test (utf8app, G_FILE_TEST_IS_DIR)) { g_free (utf8app); return FALSE; } diff --git a/mono/metadata/reflection.c b/mono/metadata/reflection.c index 9640136c0eb..f47150bd1ef 100644 --- a/mono/metadata/reflection.c +++ b/mono/metadata/reflection.c @@ -2716,7 +2716,8 @@ mono_image_get_type_info (MonoDomain *domain, MonoReflectionTypeBuilder *tb, Mon * if we have explicitlayout or sequentiallayouts, output data in the * ClassLayout table. */ - if (((tb->attrs & TYPE_ATTRIBUTE_LAYOUT_MASK) != TYPE_ATTRIBUTE_AUTO_LAYOUT) && (tb->class_size != -1)) { + if (((tb->attrs & TYPE_ATTRIBUTE_LAYOUT_MASK) != TYPE_ATTRIBUTE_AUTO_LAYOUT) && + ((tb->class_size > 0) || (tb->packing_size > 0))) { table = &assembly->tables [MONO_TABLE_CLASSLAYOUT]; table->rows++; alloc_table (table, table->rows); diff --git a/mono/metadata/socket-io.c b/mono/metadata/socket-io.c index c2b129984e7..1ef49278ea9 100644 --- a/mono/metadata/socket-io.c +++ b/mono/metadata/socket-io.c @@ -330,6 +330,11 @@ static gint32 convert_sockopt_level_and_name(MonoSocketOptionLevel mono_level, case SocketOptionName_Type: *system_name = SO_TYPE; break; +#ifdef SO_PEERCRED + case SocketOptionName_PeerCred: + *system_name = SO_PEERCRED; + break; +#endif case SocketOptionName_ExclusiveAddressUse: case SocketOptionName_UseLoopback: case SocketOptionName_MaxConnections: @@ -1155,7 +1160,15 @@ gint32 ves_icall_System_Net_Sockets_Socket_RecvFrom_internal(SOCKET sock, MonoAr return(0); } - *sockaddr=create_object_from_sockaddr(sa, sa_size, error); + /* If we didn't get a socket size, then we're probably a + * connected connection-oriented socket and the stack hasn't + * returned the remote address. All we can do is return null. + */ + if ( sa_size != 0 ) + *sockaddr=create_object_from_sockaddr(sa, sa_size, error); + else + *sockaddr=NULL; + g_free(sa); return(ret); @@ -1428,6 +1441,10 @@ void ves_icall_System_Net_Sockets_Socket_GetSocketOption_obj_internal(SOCKET soc int lingersize=sizeof(linger); struct timeval tv; int tvsize=sizeof(tv); +#ifdef SO_PEERCRED + struct ucred cred; + int credsize = sizeof(cred); +#endif MonoDomain *domain=mono_domain_get(); MonoObject *obj; MonoClass *obj_class; @@ -1461,6 +1478,13 @@ void ves_icall_System_Net_Sockets_Socket_GetSocketOption_obj_internal(SOCKET soc &tvsize); break; +#ifdef SO_PEERCRED + case SocketOptionName_PeerCred: + ret = _wapi_getsockopt (sock, system_level, system_name, &cred, + &credsize); + break; +#endif + default: ret = _wapi_getsockopt (sock, system_level, system_name, &val, &valsize); @@ -1500,6 +1524,32 @@ void ves_icall_System_Net_Sockets_Socket_GetSocketOption_obj_internal(SOCKET soc obj = int_to_object (domain, (tv.tv_sec * 1000) + (tv.tv_usec / 1000)); break; +#ifdef SO_PEERCRED + case SocketOptionName_PeerCred: + { + /* build a Mono.Posix.PeerCred+PeerCredData if + * possible + */ + MonoImage *mono_posix_image = mono_image_loaded ("Mono.Posix"); + MonoPeerCredData *cred_data; + + if (mono_posix_image == NULL) { + *error = WSAENOPROTOOPT; + return; + } + + obj_class = mono_class_from_name(mono_posix_image, + "Mono.Posix", + "PeerCred/PeerCredData"); + obj = mono_object_new(domain, obj_class); + cred_data = (MonoPeerCredData *)obj; + cred_data->pid = cred.pid; + cred_data->uid = cred.uid; + cred_data->gid = cred.gid; + break; + } +#endif + default: obj = int_to_object (domain, val); } diff --git a/mono/metadata/socket-io.h b/mono/metadata/socket-io.h index 3540882f105..5c2ee72181a 100644 --- a/mono/metadata/socket-io.h +++ b/mono/metadata/socket-io.h @@ -130,7 +130,12 @@ typedef enum { SocketOptionName_BsdUrgent=2, SocketOptionName_Expedited=2, SocketOptionName_NoChecksum=1, - SocketOptionName_ChecksumCoverage=20 + SocketOptionName_ChecksumCoverage=20, + + /* This is Mono-specific, keep it in sync with + * Mono.Posix/PeerCred.cs + */ + SocketOptionName_PeerCred=10001 } MonoSocketOptionName; typedef struct _MonoSocketAsyncResult { @@ -154,6 +159,14 @@ typedef struct _MonoSocketAsyncResult { gint error; } MonoSocketAsyncResult; +typedef struct +{ + MonoObject obj; + gint pid; + gint uid; + gint gid; +} MonoPeerCredData; + extern gpointer ves_icall_System_Net_Sockets_Socket_Socket_internal(MonoObject *this, gint32 family, gint32 type, gint32 proto, gint32 *error); extern void ves_icall_System_Net_Sockets_Socket_Close_internal(SOCKET sock, gint32 *error); extern gint32 ves_icall_System_Net_Sockets_SocketException_WSAGetLastError_internal(void); diff --git a/mono/mini/ChangeLog b/mono/mini/ChangeLog index b7210c3fe9c..bd12b2ad5e5 100644 --- a/mono/mini/ChangeLog +++ b/mono/mini/ChangeLog @@ -1,4 +1,44 @@ +Tue Aug 3 11:20:09 CEST 2004 Paolo Molaro <lupus@ximian.com> + + * mini-ppc.c: mul.ovf.un exception name fix. + +Tue Aug 3 11:19:07 CEST 2004 Paolo Molaro <lupus@ximian.com> + + * mini-ppc.c: reg allocator fix. + +Tue Aug 3 11:17:07 CEST 2004 Paolo Molaro <lupus@ximian.com> + + * mini-ppc.c: make sure temp regs are not used for global reg + allocation. + +Tue Jul 27 16:05:19 CEST 2004 Paolo Molaro <lupus@ximian.com> + + * mini-ppc.c, mini-sparc.c, mini-s390.c: keep track of line + numbers in the debug info (spotted by Geoff Norton, + <gnorton@customerdna.com>). + +Mon Jul 12 17:47:00 CEST 2004 Paolo Molaro <lupus@ximian.com> + + * inssel-ppc.brg: arguments on the stack are always + relative to the stack pointer (spotted by Neale Ferguson). + +2004-07-11 Gonzalo Paniagua Javier <gonzalo@ximian.com> + + * exceptions-x86.c: delay appending the method name to the trace until + after mono_jit_info_table_find is called, as this gets the real + MonoMethod. + +2004-07-08 Zoltan Varga <vargaz@freemail.hu> + + * mini.c (handle_stack_args): Handle some corner cases. Fixes + 58863. + +2004-07-05 Zoltan Varga <vargaz@freemail.hu> + + * mini.c (optimize_branches): Fix linking of bblocks in branch->branch + optimization. + Mon Jun 28 18:05:09 CEST 2004 Paolo Molaro <lupus@ximian.com> * mini.c: reinstated mono_compile_get_interface_var() diff --git a/mono/mini/exceptions-x86.c b/mono/mini/exceptions-x86.c index b0783ae39b1..c0961c485d2 100644 --- a/mono/mini/exceptions-x86.c +++ b/mono/mini/exceptions-x86.c @@ -462,9 +462,6 @@ mono_arch_find_jit_info (MonoDomain *domain, MonoJitTlsData *jit_tls, MonoJitInf if (!(*lmf)->method) return (gpointer)-1; - if (trace) - *trace = g_strdup_printf ("in (unmanaged) %s", mono_method_full_name ((*lmf)->method, TRUE)); - if ((ji = mono_jit_info_table_find (domain, (gpointer)(*lmf)->eip))) { *res = *ji; } else { @@ -472,6 +469,9 @@ mono_arch_find_jit_info (MonoDomain *domain, MonoJitTlsData *jit_tls, MonoJitInf res->method = (*lmf)->method; } + if (trace) + *trace = g_strdup_printf ("in (unmanaged) %s", mono_method_full_name (res->method, TRUE)); + new_ctx->SC_ESI = (*lmf)->esi; new_ctx->SC_EDI = (*lmf)->edi; new_ctx->SC_EBX = (*lmf)->ebx; diff --git a/mono/mini/inssel-ppc.brg b/mono/mini/inssel-ppc.brg index a4043e1d797..38eced8c0dc 100644 --- a/mono/mini/inssel-ppc.brg +++ b/mono/mini/inssel-ppc.brg @@ -131,7 +131,7 @@ stmt: OP_SETRET (OP_ICONST) { stmt: OP_OUTARG (reg) { if (tree->inst_imm) { - MONO_EMIT_NEW_STORE_MEMBASE (s, OP_STORE_MEMBASE_REG, s->frame_reg, tree->inst_imm, state->left->reg1); + MONO_EMIT_NEW_STORE_MEMBASE (s, OP_STORE_MEMBASE_REG, ppc_r1, tree->inst_imm, state->left->reg1); return; } tree->opcode = OP_SETREG; @@ -142,7 +142,7 @@ stmt: OP_OUTARG (reg) { stmt: OP_OUTARG (OP_REGVAR) { if (tree->inst_imm) { - MONO_EMIT_NEW_STORE_MEMBASE (s, OP_STORE_MEMBASE_REG, s->frame_reg, tree->inst_imm, state->left->tree->dreg); + MONO_EMIT_NEW_STORE_MEMBASE (s, OP_STORE_MEMBASE_REG, ppc_r1, tree->inst_imm, state->left->tree->dreg); return; } tree->opcode = OP_SETREG; @@ -153,8 +153,8 @@ stmt: OP_OUTARG (OP_REGVAR) { stmt: OP_OUTARG (lreg) { if (tree->inst_imm) { - MONO_EMIT_NEW_STORE_MEMBASE (s, OP_STORE_MEMBASE_REG, s->frame_reg, tree->inst_imm, state->left->reg2); - MONO_EMIT_NEW_STORE_MEMBASE (s, OP_STORE_MEMBASE_REG, s->frame_reg, tree->inst_imm + 4, state->left->reg1); + MONO_EMIT_NEW_STORE_MEMBASE (s, OP_STORE_MEMBASE_REG, ppc_r1, tree->inst_imm, state->left->reg2); + MONO_EMIT_NEW_STORE_MEMBASE (s, OP_STORE_MEMBASE_REG, ppc_r1, tree->inst_imm + 4, state->left->reg1); return; } MONO_EMIT_NEW_UNALU (s, OP_SETREG, tree->unused, state->left->reg2); @@ -166,7 +166,7 @@ stmt: OP_OUTARG (lreg) { stmt: OP_OUTARG (OP_ICONST) { if (tree->inst_imm) { - MONO_EMIT_NEW_STORE_MEMBASE_IMM (s, OP_STORE_MEMBASE_IMM, s->frame_reg, tree->inst_imm, state->left->tree->inst_c0); + MONO_EMIT_NEW_STORE_MEMBASE_IMM (s, OP_STORE_MEMBASE_IMM, ppc_r1, tree->inst_imm, state->left->tree->inst_c0); return; } tree->opcode = OP_SETREGIMM; @@ -205,7 +205,7 @@ stmt: OP_OUTARG (OP_ICONST) { stmt: OP_OUTARG (CEE_LDIND_REF (OP_REGVAR)) { if (tree->inst_imm) { - MONO_EMIT_NEW_STORE_MEMBASE (s, OP_STORE_MEMBASE_REG, s->frame_reg, tree->inst_imm, state->left->left->tree->dreg); + MONO_EMIT_NEW_STORE_MEMBASE (s, OP_STORE_MEMBASE_REG, ppc_r1, tree->inst_imm, state->left->left->tree->dreg); return; } tree->opcode = OP_SETREG; @@ -223,7 +223,7 @@ stmt: OP_OUTARG (CEE_LDIND_REF (OP_REGVAR)) { stmt: OP_OUTARG (freg) { if (tree->inst_imm) { int opcode = (tree->unused & 0xff00) == 0x0400? OP_STORER4_MEMBASE_REG: OP_STORER8_MEMBASE_REG; - MONO_EMIT_NEW_STORE_MEMBASE (s, opcode, s->frame_reg, tree->inst_imm, state->left->reg1); + MONO_EMIT_NEW_STORE_MEMBASE (s, opcode, ppc_r1, tree->inst_imm, state->left->reg1); return; } tree->opcode = OP_SETFREG; @@ -234,7 +234,7 @@ stmt: OP_OUTARG (freg) { stmt: OP_OUTARG_R4 (freg) { if (tree->inst_imm) { - MONO_EMIT_NEW_STORE_MEMBASE (s, OP_STORER4_MEMBASE_REG, s->frame_reg, tree->inst_imm, state->left->reg1); + MONO_EMIT_NEW_STORE_MEMBASE (s, OP_STORER4_MEMBASE_REG, ppc_r1, tree->inst_imm, state->left->reg1); return; } tree->opcode = OP_SETFREG; @@ -245,7 +245,7 @@ stmt: OP_OUTARG_R4 (freg) { stmt: OP_OUTARG_R8 (freg) { if (tree->inst_imm) { - MONO_EMIT_NEW_STORE_MEMBASE (s, OP_STORER8_MEMBASE_REG, s->frame_reg, tree->inst_imm, state->left->reg1); + MONO_EMIT_NEW_STORE_MEMBASE (s, OP_STORER8_MEMBASE_REG, ppc_r1, tree->inst_imm, state->left->reg1); return; } tree->opcode = OP_SETFREG; @@ -269,7 +269,7 @@ stmt: OP_OUTARG_VT (CEE_LDOBJ (base)) { } //g_print ("vt size: %d at R%d + %d\n", tree->inst_imm, vt->inst_basereg, vt->inst_offset); if (ovf_size != 0) { - mini_emit_memcpy (s, s->frame_reg, tree->inst_imm + (soffset - vt->inst_offset), vt->inst_basereg, soffset, ovf_size * sizeof (gpointer), 0); + mini_emit_memcpy (s, ppc_r1, tree->inst_imm + (soffset - vt->inst_offset), vt->inst_basereg, soffset, ovf_size * sizeof (gpointer), 0); } } diff --git a/mono/mini/mini-ppc.c b/mono/mini/mini-ppc.c index a62d49bd453..537cefb50a7 100644 --- a/mono/mini/mini-ppc.c +++ b/mono/mini/mini-ppc.c @@ -209,7 +209,7 @@ mono_arch_get_global_int_regs (MonoCompile *cfg) if (cfg->frame_reg != ppc_sp) top = 31; #if USE_EXTRA_TEMPS - top -= 2; + top = 29; #endif for (i = 13; i < top; ++i) regs = g_list_prepend (regs, GUINT_TO_POINTER (i)); @@ -1296,7 +1296,11 @@ mono_spillvar_offset_float (MonoCompile *cfg, int spillvar) #undef DEBUG #define DEBUG(a) if (cfg->verbose_level > 1) a //#define DEBUG(a) -#define reg_is_freeable(r) ((r) >= 3 && (r) <= 10) +/* use ppc_r3-ppc_10,ppc_r12 as temp registers, f1-f13 for FP registers */ +#define PPC_CALLER_REGS ((0xff<<3) | (1<<12) | USE_EXTRA_TEMPS) +#define PPC_CALLER_FREGS (0x3ffe) + +#define reg_is_freeable(r) (PPC_CALLER_REGS & 1 << (r)) #define freg_is_freeable(r) ((r) >= 1 && (r) <= 13) typedef struct { @@ -1631,10 +1635,6 @@ alloc_int_reg (MonoCompile *cfg, InstList *curinst, MonoInst *ins, int sym_reg, return val; } -/* use ppc_r3-ppc_10,ppc_r12 as temp registers, f1-f13 for FP registers */ -#define PPC_CALLER_REGS ((0xff<<3) | (1<<12) | USE_EXTRA_TEMPS) -#define PPC_CALLER_FREGS (0x3ffe) - /* * Local register allocation. * We first scan the list of instructions and we save the liveness info of @@ -2275,6 +2275,7 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb) } // if (ins->cil_code) // g_print ("cil code\n"); + mono_debug_record_line_number (cfg, ins, offset); switch (ins->opcode) { case OP_BIGMUL: @@ -2686,7 +2687,7 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb) */ ppc_mulhwu (code, ppc_r0, ins->sreg1, ins->sreg2); ppc_cmpi (code, 0, 0, ppc_r0, 0); - EMIT_COND_SYSTEM_EXCEPTION (CEE_BNE_UN - CEE_BEQ, ins->inst_p1); + EMIT_COND_SYSTEM_EXCEPTION (CEE_BNE_UN - CEE_BEQ, "OverflowException"); ppc_mullw (code, ins->dreg, ins->sreg1, ins->sreg2); break; case OP_ICONST: @@ -3409,6 +3410,8 @@ mono_arch_emit_prolog (MonoCompile *cfg) ArgInfo *ainfo = cinfo->args + i; inst = cfg->varinfo [pos]; + if (cfg->verbose_level > 2) + g_print ("Saving argument %d (type: %d)\n", i, ainfo->regtype); if (inst->opcode == OP_REGVAR) { if (ainfo->regtype == RegTypeGeneral) ppc_mr (code, inst->dreg, ainfo->reg); diff --git a/mono/mini/mini-s390.c b/mono/mini/mini-s390.c index 101c5c7ec76..0a7db247fa2 100644 --- a/mono/mini/mini-s390.c +++ b/mono/mini/mini-s390.c @@ -2944,6 +2944,8 @@ guint8 cond; code = cfg->native_code + offset; } + mono_debug_record_line_number (cfg, ins, offset); + switch (ins->opcode) { case OP_STOREI1_MEMBASE_IMM: { s390_lhi (code, s390_r14, ins->inst_imm); diff --git a/mono/mini/mini-sparc.c b/mono/mini/mini-sparc.c index 54fd7fda138..d0f58dc84cf 100644 --- a/mono/mini/mini-sparc.c +++ b/mono/mini/mini-sparc.c @@ -2546,6 +2546,7 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb) code_start = (guint8*)code; // if (ins->cil_code) // g_print ("cil code\n"); + mono_debug_record_line_number (cfg, ins, offset); switch (ins->opcode) { case OP_STOREI1_MEMBASE_IMM: diff --git a/mono/mini/mini.c b/mono/mini/mini.c index 95a14efc341..14a32f6dd6c 100644 --- a/mono/mini/mini.c +++ b/mono/mini/mini.c @@ -1581,23 +1581,24 @@ mono_compile_get_interface_var (MonoCompile *cfg, int slot, MonoInst *ins) */ static int handle_stack_args (MonoCompile *cfg, MonoBasicBlock *bb, MonoInst **sp, int count) { - int i; + int i, bindex; MonoBasicBlock *outb; MonoInst *inst, **locals; + gboolean found; if (!count) return 0; if (cfg->verbose_level > 3) g_print ("%d item(s) on exit from B%d\n", count, bb->block_num); if (!bb->out_scount) { - int found = 0; bb->out_scount = count; //g_print ("bblock %d has out:", bb->block_num); + found = FALSE; for (i = 0; i < bb->out_count; ++i) { outb = bb->out_bb [i]; //g_print (" %d", outb->block_num); if (outb->in_stack) { - found = 1; + found = TRUE; bb->out_stack = outb->in_stack; break; } @@ -1606,19 +1607,34 @@ handle_stack_args (MonoCompile *cfg, MonoBasicBlock *bb, MonoInst **sp, int coun if (!found) { bb->out_stack = mono_mempool_alloc (cfg->mempool, sizeof (MonoInst*) * count); for (i = 0; i < count; ++i) { -/* see bug#58863, but removing this code causes regressions in gtk-sharp build - * (SEGV running Method::Initialize() in gapi_codegen.exe) - */ -#if 1 - /* try to reuse temps already allocated for this purpouse, if they occupy the same - * stack slot and if they are of the same type. */ - bb->out_stack [i] = mono_compile_get_interface_var (cfg, i, sp [i]); -#else - bb->out_stack [i] = mono_compile_create_var (cfg, type_from_stack_type (sp [i]), OP_LOCAL); -#endif + /* + * try to reuse temps already allocated for this purpouse, if they occupy the same + * stack slot and if they are of the same type. + * This won't cause conflicts since if 'local' is used to + * store one of the values in the in_stack of a bblock, then + * the same variable will be used for the same outgoing stack + * slot as well. + * This doesn't work when inlining methods, since the bblocks + * in the inlined methods do not inherit their in_stack from + * the bblock they are inlined to. See bug #58863 for an + * example. + */ + if (cfg->inlined_method) + bb->out_stack [i] = mono_compile_create_var (cfg, type_from_stack_type (sp [i]), OP_LOCAL); + else + bb->out_stack [i] = mono_compile_get_interface_var (cfg, i, sp [i]); } } } + + for (i = 0; i < bb->out_count; ++i) { + outb = bb->out_bb [i]; + if (outb->in_scount) + continue; /* check they are the same locals */ + outb->in_scount = count; + outb->in_stack = bb->out_stack; + } + locals = bb->out_stack; for (i = 0; i < count; ++i) { /* add store ops at the end of the bb, before the branch */ @@ -1633,14 +1649,36 @@ handle_stack_args (MonoCompile *cfg, MonoBasicBlock *bb, MonoInst **sp, int coun if (cfg->verbose_level > 3) g_print ("storing %d to temp %d\n", i, locals [i]->inst_c0); } - - for (i = 0; i < bb->out_count; ++i) { - outb = bb->out_bb [i]; - if (outb->in_scount) - continue; /* check they are the same locals */ - outb->in_scount = count; - outb->in_stack = locals; + + /* + * It is possible that the out bblocks already have in_stack assigned, and + * the in_stacks differ. In this case, we will store to all the different + * in_stacks. + */ + + found = TRUE; + bindex = 0; + while (found) { + /* Find a bblock which has a different in_stack */ + found = FALSE; + while (bindex < bb->out_count) { + outb = bb->out_bb [bindex]; + if (outb->in_stack != locals) { + /* + * Instead of storing sp [i] to locals [i], we need to store + * locals [i] to <new locals>[i], since the sp [i] tree can't + * be shared between trees. + */ + for (i = 0; i < count; ++i) + mono_add_varcopy_to_end (cfg, bb, locals [i]->inst_c0, outb->in_stack [i]->inst_c0); + locals = outb->in_stack; + found = TRUE; + break; + } + bindex ++; + } } + return 0; } @@ -2427,6 +2465,7 @@ inline_method (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsig, MonoMethodHeader *cheader; MonoBasicBlock *ebblock, *sbblock; int i, costs, new_locals_offset; + MonoMethod *prev_inlined_method; if (cfg->verbose_level > 2) g_print ("INLINE START %p %s -> %s\n", cmethod, mono_method_full_name (cfg->method, TRUE), mono_method_full_name (cmethod, TRUE)); @@ -2455,8 +2494,13 @@ inline_method (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsig, ebblock->block_num = cfg->num_bblocks++; ebblock->real_offset = real_offset; + prev_inlined_method = cfg->inlined_method; + cfg->inlined_method = cmethod; + costs = mono_method_to_ir (cfg, cmethod, sbblock, ebblock, new_locals_offset, rvar, dont_inline, sp, real_offset, *ip == CEE_CALLVIRT); + cfg->inlined_method = prev_inlined_method; + if ((costs >= 0 && costs < 60) || inline_allways) { if (cfg->verbose_level > 2) g_print ("INLINE END %s -> %s\n", mono_method_full_name (cfg->method, TRUE), mono_method_full_name (cmethod, TRUE)); @@ -7046,10 +7090,12 @@ optimize_branches (MonoCompile *cfg) bbn->code->inst_target_bb->region == bb->region) { if (cfg->verbose_level > 2) - g_print ("in %s branch to branch triggered %d -> %d\n", cfg->method->name, - bb->block_num, bbn->block_num); - - replace_basic_block (bb, bb->out_bb [0], bbn->code->inst_target_bb); + g_print ("in %s branch to branch triggered %d -> %d -> %d\n", cfg->method->name, + bb->block_num, bbn->block_num, bbn->code->inst_target_bb->block_num); + + replace_in_block (bbn, bb, NULL); + replace_out_block (bb, bbn, bbn->code->inst_target_bb); + link_bblock (cfg, bb, bbn->code->inst_target_bb); bb->last_ins->inst_target_bb = bbn->code->inst_target_bb; changed = TRUE; break; diff --git a/mono/mini/mini.h b/mono/mini/mini.h index adc1e9086b5..e62be1b95cb 100644 --- a/mono/mini/mini.h +++ b/mono/mini/mini.h @@ -492,6 +492,7 @@ typedef struct { MonoSpillInfo *spill_info_float; /* fp register spills */ gint spill_count; /* unsigned char *cil_code; */ + MonoMethod *inlined_method; /* the method which is currently inlined */ /* the exception object passed to catch/filter blocks */ MonoInst *exvar; diff --git a/mono/tests/Makefile.am b/mono/tests/Makefile.am index 23cc36cc3cc..2ac008e74c4 100644 --- a/mono/tests/Makefile.am +++ b/mono/tests/Makefile.am @@ -41,6 +41,7 @@ TEST_CS_SRC= \ exception16.cs \ struct.cs \ valuetype-gettype.cs \ + typeof-ptr.cs \ static-constructor.cs \ pinvoke.cs \ pinvoke1.cs \ diff --git a/mono/tests/libtest.c b/mono/tests/libtest.c index 1a2bcfb06e9..6a9bad00f5a 100644 --- a/mono/tests/libtest.c +++ b/mono/tests/libtest.c @@ -651,6 +651,9 @@ int mono_test_marshal_stringbuilder (char *s, int n) { const char m[] = "This is my message. Isn't it nice?"; + + if (strcmp (s, "ABCD") != 0) + return 1; strncpy(s, m, n); return 0; } @@ -698,6 +701,20 @@ mono_test_marshal_string_array (char **array) } int +mono_test_marshal_stringbuilder_array (char **array) +{ + if (strcmp (array [0], "ABC")) + return 1; + if (strcmp (array [1], "DEF")) + return 2; + + strcpy (array [0], "DEF"); + strcpy (array [1], "ABC"); + + return 0; +} + +int mono_test_marshal_unicode_string_array (gunichar2 **array, char **array2) { GError *error = NULL; @@ -1003,6 +1020,18 @@ mono_test_marshal_mixed_point (mixed_point pt) } int +mono_test_marshal_mixed_point_2 (mixed_point *pt) +{ + if (pt->x != 5 || pt->y != 6.75) + return 1; + + pt->x = 10; + pt->y = 12.35; + + return 0; +} + +int time_t_sizeof (void) { return sizeof (time_t); diff --git a/mono/tests/pinvoke2.cs b/mono/tests/pinvoke2.cs index 179f67d0f56..6dd5a7828a7 100755 --- a/mono/tests/pinvoke2.cs +++ b/mono/tests/pinvoke2.cs @@ -111,6 +111,9 @@ public class Tests { [DllImport ("libtest", EntryPoint="mono_test_marshal_unicode_string_array", CharSet=CharSet.Unicode)] public static extern int mono_test_marshal_unicode_string_array (string [] a1, [MarshalAs(UnmanagedType.LPArray, ArraySubType=UnmanagedType.LPStr)]string [] a2); + [DllImport ("libtest", EntryPoint="mono_test_marshal_stringbuilder_array")] + public static extern int mono_test_marshal_stringbuilder_array (StringBuilder [] a1); + [DllImport ("libtest", EntryPoint="mono_test_marshal_inout_array")] public static extern int mono_test_marshal_inout_array ([In, Out] int [] a1); @@ -413,6 +416,7 @@ public class Tests { static int test_0_marshal_stringbuilder () { StringBuilder sb = new StringBuilder(255); + sb.Append ("ABCD"); mono_test_marshal_stringbuilder (sb, sb.Capacity); String res = sb.ToString(); @@ -445,6 +449,20 @@ public class Tests { return mono_test_marshal_unicode_string_array (new String [] { "ABC", "DEF" }, new String [] { "ABC", "DEF" }); } + static int test_0_marshal_stringbuilder_array () { + StringBuilder sb1 = new StringBuilder ("ABC"); + StringBuilder sb2 = new StringBuilder ("DEF"); + + int res = mono_test_marshal_stringbuilder_array (new StringBuilder [] { sb1, sb2 }); + if (res != 0) + return res; + if (sb1.ToString () != "DEF") + return 5; + if (sb2.ToString () != "ABC") + return 6; + return 0; + } + static int test_0_last_error () { mono_test_last_error (5); if (Marshal.GetLastWin32Error () == 5) diff --git a/mono/tests/typeof-ptr.cs b/mono/tests/typeof-ptr.cs new file mode 100644 index 00000000000..eea3d1072db --- /dev/null +++ b/mono/tests/typeof-ptr.cs @@ -0,0 +1,20 @@ +using System; +using System.Reflection; + +class T { + public static unsafe void meth (int a, int* b) { + } + static int Main () { + ParameterInfo[] args = typeof (T).GetMethod ("meth").GetParameters (); + if (args[0].ParameterType == args[1].ParameterType) + return 1; + + if (typeof(int) == typeof (int*)) + return 2; + if (args[0].ParameterType != typeof(int)) + return 3; + if (args[1].ParameterType != typeof(int*)) + return 4; + return 0; + } +} diff --git a/web/download b/web/download index 6a9789d3744..3992312f61f 100644 --- a/web/download +++ b/web/download @@ -14,21 +14,123 @@ Online API documentation for Mono is available in the `monodoc' package. - Gtk-sharp is package to build GUI applications with the Gtk toolkit. - + Gtk# is package to build GUI applications with the Gtk+ toolkit. The software is also available on the `Mono' channel in <a href="http://www.ximian.com/products/redcarpet/">Red Carpet</a>. - Some useful links: the <a - href="http://www.go-mono.org/faq.html">FAQ</a>. - - Packages can find RPM Spec files and other resources in the <a + Packagers can find RPM Spec files and other resources in the <a href="http://www.go-mono.com/packagers/">packagers page</a>. <table> <tbody> <tr bgcolor="#DDDDDD"> <td> + <b>Mono 1.0</b><br> + <a href="archive/1.0/index.html">Release notes</a><br> + June 30th, 2004 + </td> + <td> + <table cellspacing="1" cellpadding="3"> + <tr bgcolor="#BBBBBB"> + <td> + <b>Source Code</b> + </td> + <td> + <ul> + <li><a href="archive/1.0/mono-1.0.tar.gz">Mono Runtime 1.0</a> + <li><a href="archive/1.0/mcs-1.0.tar.gz">Mono Class Libraries and C# Compiler 1.0</a> + <li><a href="archive/1.0/libgdiplus-1.0.tar.gz">libgdiplus 1.0</a> + <p> + <li><a href="archive/1.0/monodoc-1.0.tar.gz">MonoDoc 1.0</a> + <li><a href="archive/1.0/xsp-1.0.tar.gz">XSP web server 1.0</a> + <li><a href="archive/1.0/mod_mono-1.0.tar.gz">Apache Mono module 1.0</a> + <p> + <li><a href="archive/1.0/winelib-0.3.tar.gz">Winelib 0.3</a> + <p> + <li><a href="archive/1.0/gtk-sharp-1.0.tar.gz">Gtk# 1.0</a> + <li><a href="archive/1.0/gecko-sharp-0.5.tar.gz">Gecko# 0.5</a> + <li><a href="archive/1.0/gtksourceview-sharp-0.5.tar.gz">Gtk SourceView# 0.5</a> + <li><a href="archive/1.0/monodevelop-0.5.tar.gz">MonoDevelop IDE 0.5</a> + </ul> + </td> + </tr> + <tr bgcolor="#bbbbbb"> + <td bgcolor="#999999"> + <img src="images/redhat-36.gif"><b>Red Hat 9.0/x86</b><br> + </td> + <td> + <a href="archive/1.0/redhat-9-i386">Packages</a> + </td> + </tr> + <tr bgcolor="#bbbbbb"> + <td bgcolor="#999999"> + <img src="images/redhat-36.gif"><b>Fedora Core 1/x86</b><br> + </td> + <td> + <a href="archive/1.0/fedora-1-i386">Packages</a> + <p><a href="http://www.go-mono.com/archive/yum-repository/fedora-1-i386">YUM Repository</a> + </td> + </tr> + <tr bgcolor="#bbbbbb"> + <td bgcolor="#999999"> + <img src="images/redhat-36.gif"><b>Fedora Core 2/x86</b><br> + </td> + <td> + <a href="archive/1.0/fedora-2-i386">Packages</a> + <p><a href="http://www.go-mono.com/archive/yum-repository/fedora-2-i386">YUM Repository</a> + </td> + </tr> + <tr bgcolor="#bbbbbb"> + <td bgcolor="#999999"> + <img src="images/suse-36.gif"><b>SLES 8/x86</b><br> + </td> + <td> + <a href="archive/1.0/sles-8-i386/">Packages</a> + </td> + </tr> + <tr bgcolor="#bbbbbb"> + <td bgcolor="#999999"> + <img src="images/suse-36.gif"><b>SUSE 9/x86</b><br> + </td> + <td> + <a href="archive/1.0/suse-90-i586/">Packages</a> + </td> + </tr> + <tr bgcolor="#bbbbbb"> + <td bgcolor="#999999"> + <img src="images/suse-36.gif"><b>SUSE 9.1/x86</b><br> + </td> + <td> + <a href="archive/1.0/suse-91-i586/">Packages</a> + </td> + </tr> + <tr> + <td bgcolor="#999999"> + <div align="left"><img src="images/windows-36.gif"></div> + <div align="right"><b>Windows installer</b><br><small>Win2k and above</small></div> + </td> + <td> + <a href="archive/1.0/windows/mono-1.0-win32-1.exe">Mono Setup</a> + </td> + </tr> + <tr> + <td bgcolor="#999999"> + <img src="images/macos-36.gif"><b>Mac OS X package</b> + </td> + <td> + <a href="archive/1.0/macos/MonoFramework-1.0.dmg">MonoFramework-1.0.dmg</a> in /Library/Framework + </td> + </tr> + </table> + </td> + </table> + + <hr> + + <table> + <tbody> + <tr bgcolor="#DDDDDD"> + <td> <b>Release Candidate</b><br> <!-- <a href="archive/beta3/beta3.html">Release notes</a><br> --> June 25th, 2004 diff --git a/web/index b/web/index index d701c09c4d5..52a8ced8b09 100644 --- a/web/index +++ b/web/index @@ -1,3 +1,4 @@ +<meta http-equiv="Refresh" content="0"; URL=http://www.mono-project.com/"> <link rel="alternate" type="application/rss+xml" title="RSS" href="index.rss"/> @@ -174,6 +175,26 @@ </a> Wikis. </p> +@item Jun 30th, 2004: Mono 1.0 + + <table> + <tr> + <td> + <img + src="http://www.go-mono.com/archive/1.0/mono1.gif"></td> + <td> + <b>Mono 1.0 has been released!</b><br/> + + <p>Be the first kid in your block to install the + <i>it-took-us-three-years-but-we-did-it</i> development platform. + + <p>Read the <a + href="http://www.go-mono.com/archive/1.0/index.html">release notes</a> + or <a href="http://www.go-mono.com/download.html">download it</a></p> + </td> + </tr> + </table> + @item Jun 23rd, 2004: The Mono Hackers Hall of Fame welcomes John Luke, Dan Morgan and Tim Coleman. The <a href="http://www.go-mono.com/hackers.html">Mono Hackers Hall Of Fame</a> |