* `--with-gc=[included, boehm, none]` - Selects the default Boehm
garbage collector engine to use.
- * *included*: (*slighty modified Boehm GC*) This is the default
+ * *included*: (*slightly modified Boehm GC*) This is the default
value for the Boehm GC, and it's the most feature complete, it will
allow Mono to use typed allocations and support the debugger.
if test "x$host_win32" = "xno"; then
+ # Should be something like '2.6' or '2.7svn'
+ llvm_version=`$LLVM_CONFIG --version`
+ llvm_api_version=`$LLVM_CONFIG --mono-api-version 2>/dev/null`
+ AC_MSG_CHECKING(LLVM version)
+ AC_MSG_RESULT($llvm_version $llvm_api_version)
+ if echo $llvm_version | grep -q 'mono'; then
+ if test "x$enable_llvm_version_check" == "xyes"; then
+ if test "$llvm_version" != "$expected_llvm_version"; then
+ AC_MSG_ERROR([Expected llvm version $expected_llvm_version, but llvm-config --version returned $llvm_version"])
+ fi
+ fi
+ else
+ AC_MSG_ERROR([Compiling with stock LLVM is not supported, please use the Mono LLVM repo at https://github.com/mono/llvm, with the GIT branch which matches this version of mono, i.e. 'mono-2-10' for Mono 2.10.])
+ fi
+
# The output of --cflags seems to include optimizations flags too
- LLVM_CFLAGS=`$LLVM_CONFIG --cflags | sed -e 's/-O2//g' | sed -e 's/-O0//g' | sed -e 's/-fomit-frame-pointer//g' | sed -e 's/-fPIC//g'`
- LLVM_CXXFLAGS=`$LLVM_CONFIG --cxxflags | sed -e 's/-O2//g' | sed -e 's/-O0//g' | sed -e 's/-fomit-frame-pointer//g' | sed -e 's/-fPIC//g'`
+ if test $llvm_api_version -gt 100; then
+ # The --cflags argument includes all kinds of warnings -pendantic etc.
+ LLVM_CFLAGS="-I$with_llvm/include -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS"
+ LLVM_CXXFLAGS="-I$with_llvm/include -std=c++11 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS"
+ else
+ LLVM_CFLAGS=`$LLVM_CONFIG --cflags | sed -e 's/-O2//g' | sed -e 's/-O0//g' | sed -e 's/-fomit-frame-pointer//g' | sed -e 's/-fPIC//g'`
+ LLVM_CXXFLAGS=`$LLVM_CONFIG --cxxflags | sed -e 's/-O2//g' | sed -e 's/-O0//g' | sed -e 's/-fomit-frame-pointer//g' | sed -e 's/-fPIC//g'`
+ fi
# LLVM is compiled with -fno-rtti, so we need this too, since our classes inherit
# from LLVM classes.
LLVM_CXXFLAGS="$LLVM_CXXFLAGS -fno-rtti -fexceptions"
LLVM_LDFLAGS=`$LLVM_CONFIG --ldflags`
# This might include empty lines
LLVM_SYSTEM_LIBS=`$LLVM_CONFIG --system-libs 2>/dev/null | grep -- -`
- if test "x$host" != "x$target"; then
+ llvm_jit_supported=yes
+ if test $llvm_api_version -gt 100; then
+ # Based on llvm 3.9, only aot is currently supported
+ llvm_jit_supported=no
+ elif test "x$host" != "x$target"; then
+ # No need for jit libs
+ llvm_jit_supported=no
+ fi
+ if test $llvm_jit_supported = no; then
# No need for jit libs
LLVM_LIBS=`$LLVM_CONFIG --libs analysis core bitwriter`
else
LLVM_LIBS=`$LLVM_CONFIG --libs analysis core bitwriter jit mcjit $llvm_codegen`
fi
+ if test "x$LLVM_LIBS" == "x"; then
+ echo "$LLVM_CONFIG --libs failed."
+ exit 1
+ fi
LLVM_LIBS="$LLVM_LIBS $LLVM_LDFLAGS $LLVM_SYSTEM_LIBS"
# The c++ standard library used by llvm doesn't show up in $LLVM_SYSTEM_LIBS so add it manually
if echo $LLVM_CXXFLAGS | grep -q -- '-stdlib=libc++'; then
expected_llvm_version="3.4svn-mono-mono/e656cac"
- # Should be something like '2.6' or '2.7svn'
- llvm_version=`$LLVM_CONFIG --version`
- llvm_api_version=`$LLVM_CONFIG --mono-api-version 2>/dev/null`
- AC_MSG_CHECKING(LLVM version)
- AC_MSG_RESULT($llvm_version)
- if echo $llvm_version | grep -q 'mono'; then
- if test "x$enable_llvm_version_check" == "xyes"; then
- if test "$llvm_version" != "$expected_llvm_version"; then
- AC_MSG_ERROR([Expected llvm version $expected_llvm_version, but llvm-config --version returned $llvm_version"])
- fi
- fi
- else
- AC_MSG_ERROR([Compiling with stock LLVM is not supported, please use the Mono LLVM repo at https://github.com/mono/llvm, with the GIT branch which matches this version of mono, i.e. 'mono-2-10' for Mono 2.10.])
- fi
-
else
LLVM_CFLAGS="-I$with_llvm/include -DNDEBUG -D__NO_CTYPE_INLINE -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS"
LLVM_CXXFLAGS="$LLVM_CFLAGS -std=gnu++11 -fvisibility-inlines-hidden -fno-rtti -Woverloaded-virtual -Wcast-qual"
CUPS_OPTIONS cups_options;
string option_name, option_value;
int cups_size = Marshal.SizeOf(typeof(CUPS_OPTIONS));
+
+ LoadOptionList (ppd, "PageSize", paper_names, out defsize);
+ LoadOptionList (ppd, "InputSlot", paper_sources, out defsource);
for (int j = 0; j < numOptions; j++)
{
option_name = Marshal.PtrToStringAnsi(cups_options.name);
option_value = Marshal.PtrToStringAnsi(cups_options.val);
+ if (option_name == "PageSize") defsize = option_value;
+ else if (option_name == "InputSlot") defsource = option_value;
#if PrintDebug
Console.WriteLine("{0} = {1}", option_name, option_value);
#endif
options = (IntPtr) ((long)options + cups_size);
}
-
- LoadOptionList (ppd, "PageSize", paper_names, out defsize);
- LoadOptionList (ppd, "InputSlot", paper_sources, out defsource);
}
/// <summary>
optionPtr = (IntPtr)((long)optionPtr + cupsOptionSize);
}
cupsFreeDests (1, destPtr);
-
return options;
}
var settings = new PrinterSettings () { PrinterName = PrinterSettings.InstalledPrinters [0] };
Assert.AreEqual (options ["PageSize"], settings.DefaultPageSettings.PaperSize.PaperName,
"Bug #602934 (https://bugzilla.novell.com/show_bug.cgi?id=602934) not fixed (PaperSize)");
- Assert.AreEqual (options ["Resolution"], string.Format ("{0}dpi", settings.DefaultPageSettings.PrinterResolution.X),
- "Bug #602934 (https://bugzilla.novell.com/show_bug.cgi?id=602934) not fixed (Resolution)");
+ if (options.ContainsKey("Resolution"))
+ Assert.AreEqual (options ["Resolution"], string.Format ("{0}dpi", settings.DefaultPageSettings.PrinterResolution.X),
+ "Bug #602934 (https://bugzilla.novell.com/show_bug.cgi?id=602934) not fixed (Resolution)");
}
#endregion
File.Delete ("test.zip");
}
+ [Test]
+ public void ZipOpenAndReopenEntry()
+ {
+ try {
+ File.Copy("archive.zip", "test.zip", overwrite: true);
+ using (var archive = new ZipArchive(File.Open("test.zip", FileMode.Open),
+ ZipArchiveMode.Update))
+ {
+ var entry = archive.GetEntry("foo.txt");
+ Assert.IsNotNull(entry);
+
+ var stream = entry.Open();
+
+ try {
+ stream = entry.Open();
+ } catch (global::System.IO.IOException ex) {
+ return;
+ }
+
+ Assert.Fail();
+ }
+ } finally {
+ File.Delete ("test.zip");
+ }
+ }
+
+
+ [Test]
+ public void ZipOpenCloseAndReopenEntry()
+ {
+ File.Copy("archive.zip", "test.zip", overwrite: true);
+ using (var archive = new ZipArchive(File.Open("test.zip", FileMode.Open),
+ ZipArchiveMode.Update))
+ {
+ var entry = archive.GetEntry("foo.txt");
+ Assert.IsNotNull(entry);
+
+ var stream = entry.Open();
+ stream.Dispose();
+ stream = entry.Open();
+ }
+
+ File.Delete ("test.zip");
+ }
+
[Test]
public void ZipGetEntryDeleteReadMode()
{
namespace System.IO.Compression
{
+ internal class ZipArchiveEntryStream : Stream, IDisposable
+ {
+ private readonly ZipArchiveEntry entry;
+ private readonly Stream stream;
+
+ public override bool CanRead {
+ get {
+ return stream.CanRead;
+ }
+ }
+
+ public override bool CanSeek {
+ get {
+ return stream.CanSeek;
+ }
+ }
+
+ public override bool CanWrite {
+ get {
+ return stream.CanWrite;
+ }
+ }
+
+ public override long Length {
+ get {
+ return stream.Length;
+ }
+ }
+
+ public override long Position {
+ get {
+ return stream.Position;
+ }
+ set {
+ stream.Position = value;
+ }
+ }
+
+ public ZipArchiveEntryStream(ZipArchiveEntry entry, Stream stream)
+ {
+ this.entry = entry;
+ this.stream = stream;
+ }
+
+ public override void Flush ()
+ {
+ stream.Flush();
+ }
+
+ public override long Seek (long offset, SeekOrigin origin)
+ {
+ return stream.Seek(offset, origin);
+ }
+
+ public override void SetLength (long value)
+ {
+ stream.SetLength(value);
+ }
+
+ public override int Read (byte[] buffer, int offset, int count)
+ {
+ return stream.Read(buffer, offset, count);
+ }
+
+ public override void Write (byte[] buffer, int offset, int count)
+ {
+ stream.Write(buffer, offset, count);
+ }
+
+ public new void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ base.Dispose();
+ }
+
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing)
+ {
+ entry.openStream = null;
+ stream.Dispose();
+ }
+ }
+ }
+
public class ZipArchiveEntry
{
readonly SharpCompress.Archive.Zip.ZipArchiveEntry entry;
- private Stream openStream;
+ internal ZipArchiveEntryStream openStream;
private bool wasDeleted;
internal ZipArchiveEntry(ZipArchive archive, SharpCompress.Archive.Zip.ZipArchiveEntry entry)
if (Archive.Mode == ZipArchiveMode.Create && openStream != null)
throw new IOException("The archive for this entry was opened with the Create mode, and this entry has already been written to.");
- openStream = entry.OpenEntryStream();
+ openStream = new ZipArchiveEntryStream(this, entry.OpenEntryStream());
return openStream;
}
{
}
- protected WSDualHttpBinding (WSDualHttpSecurityMode securityMode)
+ public WSDualHttpBinding(string configName)
+ : this (WSDualHttpSecurityMode.Message)
+ {
+ }
+
+ public WSDualHttpBinding (WSDualHttpSecurityMode securityMode)
{
security = new WSDualHttpSecurity (securityMode);
}
LIB_REFS = System System.Configuration
LIB_MCS_FLAGS = -d:SYSTEM_WEB_APPLICATIONSERVICES
-EXTRA_DISTFILES = $(RESOURCE_FILES)
+RESOURCE_STRINGS = ./System.Web.ApplicationServices.txt
+
+EXTRA_DISTFILES = $(RESOURCE_FILES) $(RESOURCE_STRINGS)
VALID_PROFILE := $(filter 4, $(FRAMEWORK_VERSION_MAJOR))
ifndef VALID_PROFILE
../../build/common/Locale.cs
../../build/common/MonoTODOAttribute.cs
-System.Web.Configuration/MembershipPasswordCompatibilityMode.cs
+../../../external/referencesource/System.Web.ApplicationServices/Configuration/MembershipPasswordCompatibilityMode.cs
+../../../external/referencesource/System.Web.ApplicationServices/Security/IMembershipAdapter.cs
System.Web.Security/IMembershipHelper.cs
System.Web.UI/KeyedList.cs
System.Web.UI/KeyedListEnumerator.cs
-System.Web.Security/MembershipCreateStatus.cs
-System.Web.Security/MembershipCreateUserException.cs
-System.Web.Security/MembershipPasswordException.cs
-System.Web.Security/MembershipPasswordFormat.cs
-System.Web.Security/MembershipProviderCollection.cs
+../../../external/referencesource/System.Web.ApplicationServices/Security/MembershipCreateStatus.cs
+../../../external/referencesource/System.Web.ApplicationServices/Security/MembershipCreateUserException.cs
+../../../external/referencesource/System.Web.ApplicationServices/Security/MembershipPasswordException.cs
+../../../external/referencesource/System.Web.ApplicationServices/Security/MembershipPasswordFormat.cs
+../../../external/referencesource/System.Web.ApplicationServices/Security/MembershipProviderCollection.cs
System.Web.Security/MembershipProvider.cs
-System.Web.Security/MembershipUserCollection.cs
+../../../external/referencesource/System.Web.ApplicationServices/Security/MembershipUserCollection.cs
System.Web.Security/MembershipUser.cs
-System.Web.Security/MembershipValidatePasswordEventHandler.cs
+../../../external/referencesource/System.Web.ApplicationServices/Security/MembershipValidatePasswordEventHandler.cs
System.Web.Security/RoleProvider.cs
-System.Web.Security/ValidatePasswordEventArgs.cs
+../../../external/referencesource/System.Web.ApplicationServices/Security/ValidatePasswordEventArgs.cs
+System.Web/ApplicationServicesStrings.cs
--- /dev/null
+Can_not_use_encrypted_passwords_with_autogen_keys=You must specify a non-autogenerated machine key to store passwords in the encrypted format. Either specify a different passwordFormat, or change the machineKey configuration to use a non-autogenerated decryption key.
+CustomLoader_ForbiddenByHost=The host forbids the use of custom loaders.
+CustomLoader_MustImplementICustomLoader=The provided type '{0}' must implement the ICustomLoader interface.
+CustomLoader_NoAttributeFound=The assembly '{0}' did not contain an assembly-level CustomLoaderAttribute.
+CustomLoader_NotInFullTrust=Custom loaders can only be used by fully-trusted applications.
+Membership_DuplicateEmail=The E-mail address is already in use.
+Membership_DuplicateProviderUserKey=The provider user key is already in use.
+Membership_DuplicateUserName=The username is already in use.
+Membership_InvalidAnswer=The password-answer supplied is invalid.
+Membership_InvalidEmail=The E-mail supplied is invalid.
+Membership_InvalidPassword=The password supplied is invalid. Passwords must conform to the password strength requirements configured for the default provider.
+Membership_InvalidProviderUserKey=The provider user key supplied is invalid. It must be of type System.Guid.
+Membership_InvalidQuestion=The password-question supplied is invalid. Note that the current provider configuration requires a valid password question and answer. As a result, a CreateUser overload that accepts question and answer parameters must also be used.
+Membership_InvalidUserName=The username supplied is invalid.
+Membership_no_error=No Error.
+Membership_provider_name_invalid=The membership provider name specified is invalid.
+Membership_UserRejected=The user was rejected.
+Parameter_can_not_be_empty=The parameter '{0}' must not be empty.
+Platform_not_supported=This member is not supported on this platfom.
+Provider_Error=The Provider encountered an unknown error.
+Provider_must_implement_type=Provider must implement the class '{0}'.
+++ /dev/null
-//
-// System.Web.Security.MembershipPasswordCompatibilityMode
-//
-// Authors:
-// Marek Habersack <mhabersack@novell.com>
-//
-// Copyright (C) 2010 Novell, Inc (http://novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-using System;
-
-namespace System.Web.Configuration
-{
- public enum MembershipPasswordCompatibilityMode
- {
- Framework20,
- Framework40
- }
-}
+++ /dev/null
-//
-// System.Web.Security.MembershipCreateStatus
-//
-// Authors:
-// Ben Maurer (bmaurer@users.sourceforge.net)
-//
-// (C) 2003 Ben Maurer
-// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-using System.Runtime.CompilerServices;
-
-namespace System.Web.Security
-{
- [TypeForwardedFrom ("System.Web, Version=2.0.0.0, Culture=Neutral, PublicKeyToken=b03f5f7f11d50a3a")]
- public enum MembershipCreateStatus
- {
- Success,
- InvalidUserName,
- InvalidPassword,
- InvalidQuestion,
- InvalidAnswer,
- InvalidEmail,
- DuplicateUserName,
- DuplicateEmail,
- UserRejected,
- InvalidProviderUserKey,
- DuplicateProviderUserKey,
- ProviderError
- }
-}
-
-
+++ /dev/null
-//
-// System.Web.Security.MembershipCreateUserException
-//
-// Authors:
-// Ben Maurer (bmaurer@users.sourceforge.net)
-//
-// (C) 2003 Ben Maurer
-//
-
-//
-// 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.Runtime.Serialization;
-using System.Runtime.CompilerServices;
-
-namespace System.Web.Security
-{
- [TypeForwardedFrom ("System.Web, Version=2.0.0.0, Culture=Neutral, PublicKeyToken=b03f5f7f11d50a3a")]
- [Serializable]
- public class MembershipCreateUserException : Exception
- {
- MembershipCreateStatus statusCode;
-
- public MembershipCreateUserException ()
- {
- }
-
- public MembershipCreateUserException (string message): base (message)
- {
- }
-
- public MembershipCreateUserException (string message, Exception innerException): base (message, innerException)
- {
- }
-
- protected MembershipCreateUserException (SerializationInfo info, StreamingContext context): base (info, context)
- {
- info.AddValue ("statusCode", statusCode);
- }
-
- public MembershipCreateUserException (MembershipCreateStatus statusCode) : base (statusCode.ToString ())
- {
- this.statusCode = statusCode;
- }
-
- public override void GetObjectData (SerializationInfo info, StreamingContext ctx)
- {
- base.GetObjectData (info, ctx);
- statusCode = (MembershipCreateStatus) info.GetValue ("statusCode", typeof(MembershipCreateStatus));
- }
-
- public MembershipCreateStatus StatusCode {
- get { return statusCode; }
- }
- }
-}
-
-
+++ /dev/null
-//
-// System.Web.Security.MembershipPasswordException
-//
-// Authors:
-// Ben Maurer (bmaurer@users.sourceforge.net)
-//
-// (C) 2003 Ben Maurer
-//
-
-//
-// 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.Runtime.Serialization;
-using System.Runtime.CompilerServices;
-
-namespace System.Web.Security
-{
- [TypeForwardedFrom ("System.Web, Version=2.0.0.0, Culture=Neutral, PublicKeyToken=b03f5f7f11d50a3a")]
- [Serializable]
- public class MembershipPasswordException : Exception
- {
- public MembershipPasswordException () : base () {}
- public MembershipPasswordException (string message) : base (message) {}
- public MembershipPasswordException (string message, Exception innerException) : base (message, innerException) {}
-
- protected MembershipPasswordException (SerializationInfo info, StreamingContext context): base (info, context)
- {
- }
- }
-}
-
-
+++ /dev/null
-//
-// System.Web.Security.MembershipPasswordFormat
-//
-// Authors:
-// Ben Maurer (bmaurer@users.sourceforge.net)
-//
-// (C) 2003 Ben Maurer
-//
-
-//
-// 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.Runtime.CompilerServices;
-
-namespace System.Web.Security
-{
- [TypeForwardedFrom ("System.Web, Version=2.0.0.0, Culture=Neutral, PublicKeyToken=b03f5f7f11d50a3a")]
- public enum MembershipPasswordFormat
- {
- Clear = 0,
- Hashed = 1,
- Encrypted = 2
- }
-}
-
-
+++ /dev/null
-//
-// System.Web.Security.MembershipProviderCollection
-//
-// Authors:
-// Ben Maurer (bmaurer@users.sourceforge.net)
-// Sebastien Pouliot <sebastien@ximian.com>
-//
-// (C) 2003 Ben Maurer
-// Copyright (c) 2005 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-using System.Configuration.Provider;
-using System.Runtime.CompilerServices;
-
-namespace System.Web.Security
-{
- [TypeForwardedFrom ("System.Web, Version=2.0.0.0, Culture=Neutral, PublicKeyToken=b03f5f7f11d50a3a")]
- public sealed class MembershipProviderCollection : ProviderCollection
- {
- public override void Add (ProviderBase provider)
- {
- if (provider == null)
- throw new ArgumentNullException ("provider");
-
- if (provider is MembershipProvider)
- base.Add (provider);
- else {
- throw new ArgumentException ("provider", Locale.GetText (
- "Wrong type, expected {0}.", "MembershipProvider"));
- }
- }
-
- public void CopyTo (MembershipProvider[] array, int index)
- {
- base.CopyTo (array, index);
- }
-
- public new MembershipProvider this [string name] {
- get { return (MembershipProvider) base [name]; }
- }
- }
-}
-
-
+++ /dev/null
-//
-// System.Web.Security.MembershipUserCollection
-//
-// Authors:
-// Ben Maurer (bmaurer@users.sourceforge.net)
-//
-// (C) 2003 Ben Maurer
-// Copyright (C) 2005-2010 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System.Collections;
-using System.Runtime.CompilerServices;
-using System.Web.UI;
-
-namespace System.Web.Security
-{
- [TypeForwardedFrom ("System.Web, Version=2.0.0.0, Culture=Neutral, PublicKeyToken=b03f5f7f11d50a3a")]
- [Serializable]
- public sealed class MembershipUserCollection : ICollection
- {
- public MembershipUserCollection ()
- {
- }
-
- public void Add (MembershipUser user)
- {
- if (user == null)
- throw new ArgumentNullException ("user");
-
- CheckNotReadOnly ();
- store.Add (user.UserName, user);
- }
-
- public void Clear ()
- {
- CheckNotReadOnly ();
- store.Clear ();
- }
-
- void ICollection.CopyTo (Array array, int index)
- {
- store.Values.CopyTo (array, index);
- }
-
- public void CopyTo (MembershipUser[] array, int index)
- {
- store.Values.CopyTo (array, index);
- }
-
- public IEnumerator GetEnumerator ()
- {
- return ((IEnumerable) store).GetEnumerator ();
- }
-
- public void Remove (string name)
- {
- CheckNotReadOnly ();
- store.Remove (name);
- }
-
- public void SetReadOnly ()
- {
- readOnly = true;
- }
-
- public int Count {
- get { return store.Count; }
- }
-
- public bool IsSynchronized {
- get { return false; }
- }
-
- public MembershipUser this [string name] {
- get { return (MembershipUser) store [name]; }
- }
-
- public object SyncRoot {
- get { return this; }
- }
-
- void CheckNotReadOnly ()
- {
- if (readOnly)
- throw new NotSupportedException ();
- }
-
- KeyedList store = new KeyedList ();
- bool readOnly = false;
- }
-}
-
-
+++ /dev/null
-//
-// System.Web.Security.MembershipValidatePasswordEventHandler
-//
-// Authors:
-// Lluis Sanchez Gual (lluis@novell.com)
-//
-// (C) 2005 Novell, inc.
-//
-
-//
-// 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.Runtime.CompilerServices;
-
-namespace System.Web.Security
-{
- [TypeForwardedFrom ("System.Web, Version=2.0.0.0, Culture=Neutral, PublicKeyToken=b03f5f7f11d50a3a")]
- public delegate void MembershipValidatePasswordEventHandler (object sender, ValidatePasswordEventArgs e);
-}
-
-
+++ /dev/null
-//
-// System.Web.Security.ValidatePasswordEventArgs
-//
-// Authors:
-// Lluis Sanchez Gual (lluis@novell.com)
-//
-// (C) 2005 Novell, inc.
-//
-
-//
-// 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.Runtime.CompilerServices;
-
-namespace System.Web.Security
-{
- [TypeForwardedFrom ("System.Web, Version=2.0.0.0, Culture=Neutral, PublicKeyToken=b03f5f7f11d50a3a")]
- public sealed class ValidatePasswordEventArgs: EventArgs
- {
- bool cancel;
- Exception exception;
- bool isNewUser;
- string userName;
- string password;
-
- public ValidatePasswordEventArgs (string userName, string password, bool isNewUser)
- {
- this.isNewUser = isNewUser;
- this.userName = userName;
- this.password = password;
- }
-
- public bool Cancel {
- get { return cancel; }
- set { cancel = value; }
- }
-
- public Exception FailureInformation {
- get { return exception; }
- set { exception = value; }
- }
-
- public bool IsNewUser {
- get { return isNewUser; }
- }
-
- public string UserName {
- get { return userName; }
- }
-
- public string Password {
- get { return password; }
- }
- }
-}
-
--- /dev/null
+namespace System.Web
+{
+ internal class ApplicationServicesStrings
+ {
+ internal const string Can_not_use_encrypted_passwords_with_autogen_keys = "You must specify a non-autogenerated machine key to store passwords in the encrypted format. Either specify a different passwordFormat, or change the machineKey configuration to use a non-autogenerated decryption key.";
+ internal const string CustomLoader_ForbiddenByHost = "The host forbids the use of custom loaders.";
+ internal const string CustomLoader_MustImplementICustomLoader = "The provided type '{0}' must implement the ICustomLoader interface.";
+ internal const string CustomLoader_NoAttributeFound = "The assembly '{0}' did not contain an assembly-level CustomLoaderAttribute.";
+ internal const string CustomLoader_NotInFullTrust = "Custom loaders can only be used by fully-trusted applications (<trust level=\"Full\" />).";
+ internal const string Membership_DuplicateEmail = "The E-mail address is already in use.";
+ internal const string Membership_DuplicateProviderUserKey = "The provider user key is already in use.";
+ internal const string Membership_DuplicateUserName = "The username is already in use.";
+ internal const string Membership_InvalidAnswer = "The password-answer supplied is invalid.";
+ internal const string Membership_InvalidEmail = "The E-mail supplied is invalid.";
+ internal const string Membership_InvalidPassword = "The password supplied is invalid. Passwords must conform to the password strength requirements configured for the default provider.";
+ internal const string Membership_InvalidProviderUserKey = "The provider user key supplied is invalid. It must be of type System.Guid.";
+ internal const string Membership_InvalidQuestion = "The password-question supplied is invalid. Note that the current provider configuration requires a valid password question and answer. As a result, a CreateUser overload that accepts question and answer parameters must also be used.";
+ internal const string Membership_InvalidUserName = "The username supplied is invalid.";
+ internal const string Membership_no_error = "No Error.";
+ internal const string Membership_provider_name_invalid = "The membership provider name specified is invalid.";
+ internal const string Membership_UserRejected = "The user was rejected.";
+ internal const string Parameter_can_not_be_empty = "The parameter '{0}' must not be empty.";
+ internal const string Platform_not_supported = "This member is not supported on the .NET Framework Client Profile.";
+ internal const string Provider_Error = "The Provider encountered an unknown error.";
+ internal const string Provider_must_implement_type = "Provider must implement the class '{0}'.";
+ }
+}
+
+
+++ /dev/null
-//
-// System.Web.UI.WebControls.DefaultProfile.cs
-//
-// Authors:
-// Chris Toshok (toshok@ximian.com)
-//
-// (C) 2005 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Configuration;
-
-namespace System.Web.Profile
-{
- public class DefaultProfile : ProfileBase
- {
- [MonoTODO("Currently does nothing")]
- public DefaultProfile ()
- {
- }
- }
-
-}
-
+++ /dev/null
-//
-// System.Web.Profile.ProfileAuthenticationOption.cs
-//
-// Authors:
-// Duncan Mak (duncan@ximian.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-
-namespace System.Web.Profile
-{
- public enum ProfileAuthenticationOption
- {
- Anonymous = 0,
- Authenticated = 1,
- All = 2
- }
-}
+++ /dev/null
-//
-// System.Web.Profile.ProfileInfo.cs
-//
-// Authors:
-// Chris Toshok (toshok@ximian.com)
-//
-// (C) 2005 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-
-namespace System.Web.Profile
-{
- [Serializable]
- public class ProfileInfo
- {
- string user_name;
- bool is_anonymous;
- DateTime last_activity_date;
- DateTime last_updated_date;
- int size;
-
- protected ProfileInfo ()
- {
- }
-
- public ProfileInfo (string username,
- bool isAnonymous,
- DateTime lastActivityDate,
- DateTime lastUpdatedDate,
- int size)
- {
- user_name = username;
- is_anonymous = isAnonymous;
- last_activity_date = lastActivityDate;
- last_updated_date = lastUpdatedDate;
- this.size = size;
- }
-
- public virtual bool IsAnonymous
- {
- get {
- return is_anonymous;
- }
- }
-
- public virtual DateTime LastActivityDate
- {
- get {
- return last_activity_date;
- }
- }
-
- public virtual DateTime LastUpdatedDate {
- get {
- return last_updated_date;
- }
- }
-
- public virtual int Size {
- get {
- return size;
- }
- }
-
- public virtual string UserName {
- get {
- return user_name;
- }
- }
- }
-
-}
+++ /dev/null
-//
-// System.Web.Profile.ProfileInfoCollection.cs
-//
-// Authors:
-// Chris Toshok (toshok@ximian.com)
-//
-// (C) 2005 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Collections;
-
-namespace System.Web.Profile
-{
- [Serializable]
- public sealed class ProfileInfoCollection : ICollection, IEnumerable
- {
- public ProfileInfoCollection()
- {
- list = new ArrayList ();
- }
-
- public void Add (ProfileInfo profileInfo)
- {
- if (readOnly)
- throw new NotSupportedException ();
-
- list.Add (profileInfo);
- }
-
- public void Clear ()
- {
- if (readOnly)
- throw new NotSupportedException ();
-
- list.Clear ();
- }
-
- public void CopyTo (System.Array array, int index)
- {
- list.CopyTo (array, index);
- }
-
- public void CopyTo (ProfileInfo[ ] array, int index)
- {
- list.CopyTo (array, index);
- }
-
- public IEnumerator GetEnumerator ()
- {
- return list.GetEnumerator ();
- }
-
- public void Remove (string name)
- {
- if (readOnly)
- throw new NotSupportedException ();
-
- for (int i = 0; i < list.Count; i ++) {
- ProfileInfo info = (ProfileInfo)list[i];
- if (info.UserName == name) {
- list.Remove (i);
- break;
- }
- }
- }
-
- public void SetReadOnly ()
- {
- readOnly = true;
- }
-
- public int Count {
- get {
- return list.Count;
- }
- }
-
- public bool IsSynchronized {
- get {
- return false;
- }
- }
-
- public object SyncRoot {
- get {
- return this;
- }
- }
-
- public ProfileInfo this [string name] {
- get {
- for (int i = 0; i < list.Count; i ++) {
- ProfileInfo info = (ProfileInfo)list[i];
- if (info.UserName == name) {
- return info;
- }
- }
-
- return null;
- }
- }
-
- ArrayList list;
- bool readOnly;
- }
-
-}
+++ /dev/null
-//
-// System.Web.UI.WebControls.IPostBackContainer.cs
-//
-// Authors:
-// Sanjay Gupta (gsanjay@novell.com)
-//
-// (C) 2004-2010 Novell, Inc (http://www.novell.com)
-//
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Web.UI;
-
-namespace System.Web.UI.WebControls
-{
- public interface IPostBackContainer
- {
- PostBackOptions GetPostBackOptions (IButtonControl control);
- }
-}
-
-
+++ /dev/null
-//
-// System.Web.UI.ICheckBoxControl.cs
-//
-// Authors:
-// Lluis Sanchez Gual (lluis@novell.com)
-//
-// (C) 2005-2010 Novell, Inc (http://www.novell.com)
-//
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-
-namespace System.Web.UI
-{
- public interface ICheckBoxControl
- {
- bool Checked { get; set; }
- event EventHandler CheckedChanged;
- }
-}
-
+++ /dev/null
-//
-// System.Web.UI.IEditableTextControl.cs
-//
-// Authors:
-// Lluis Sanchez Gual (lluis@novell.com)
-//
-// (C) 2005-2010 Novell, Inc (http://www.novell.com)
-//
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-
-namespace System.Web.UI
-{
- public interface IEditableTextControl: ITextControl
- {
- event EventHandler TextChanged;
- }
-}
-
+++ /dev/null
-//
-// System.Web.UI.ITextControl.cs
-//
-// Authors:
-// Lluis Sanchez Gual (lluis@novell.com)
-//
-// (C) 2005-2010 Novell, Inc (http://www.novell.com)
-//
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-
-namespace System.Web.UI
-{
- public interface ITextControl
- {
- string Text { get; set; }
- }
-}
System.Web/ProcessShutdownReason.cs
System.Web/ProcessStatus.cs
System.Web.Profile/CustomProviderDataAttribute.cs
-System.Web.Profile/DefaultProfile.cs
-System.Web.Profile/ProfileAuthenticationOption.cs
+../../../external/referencesource/System.Web/Profile/DefaultHttpProfile.cs
+../../../external/referencesource/System.Web/Profile/ProfileAuthenticationOptions.cs
System.Web.Profile/ProfileAutoSaveEventArgs.cs
System.Web.Profile/ProfileAutoSaveEventHandler.cs
System.Web.Profile/ProfileBase.cs
../../../external/referencesource/System.Web/Profile/ProfileEventArgs.cs
../../../external/referencesource/System.Web/Profile/ProfileEventHandler.cs
../../../external/referencesource/System.Web/Profile/HttpProfileGroupBase.cs
-System.Web.Profile/ProfileInfoCollection.cs
-System.Web.Profile/ProfileInfo.cs
+../../../external/referencesource/System.Web/Profile/ProfileInfo.cs
System.Web.Profile/ProfileManager.cs
System.Web.Profile/ProfileMigrateEventArgs.cs
System.Web.Profile/ProfileMigrateEventHandler.cs
../../../external/referencesource/System.Web/UI/IBindableControl.cs
../../../external/referencesource/System.Web/UI/IBindableTemplate.cs
../../../external/referencesource/System.Web/UI/ICallbackEventHandler.cs
-System.Web.UI/ICheckBoxControl.cs
+../../../external/referencesource/System.Web/UI/WebControls/ICheckBoxControl.cs
../../../external/referencesource/System.Web/UI/IControlBuilderAccessor.cs
../../../external/referencesource/System.Web/UI/IControlDesignerAccessor.cs
../../../external/referencesource/System.Web/UI/IDataBindingsAccessor.cs
../../../external/referencesource/System.Web/UI/IDataSource.cs
../../../external/referencesource/System.Web/UI/IDataSourceViewSchemaAccessor.cs
../../../external/referencesource/System.Web/UI/IDReferencePropertyAttribute.cs
-System.Web.UI/IEditableTextControl.cs
+../../../external/referencesource/System.Web/UI/WebControls/IEditableTextControl.cs
../../../external/referencesource/System.Web/UI/IExpressionsAccessor.cs
../../../external/referencesource/System.Web/UI/IFilterResolutionService.cs
System.Web.UI/IgnoreUnknownContentAttribute.cs
../../../external/referencesource/System.Web/UI/IScriptResourceMapping.cs
System.Web.UI/ITagNameToTypeMapper.cs
../../../external/referencesource/System.Web/UI/ITemplate.cs
-System.Web.UI/ITextControl.cs
+../../../external/referencesource/System.Web/UI/WebControls/ITextControl.cs
../../../external/referencesource/System.Web/UI/IThemeResolutionService.cs
../../../external/referencesource/System.Web/UI/IUrlResolutionService.cs
../../../external/referencesource/System.Web/UI/IUserControlDesignerAccessor.cs
../../../external/referencesource/System.Web/UI/WebControls/ImageMapEventHandler.cs
System.Web.UI.WebControls/IMenuRenderer.cs
../../../external/referencesource/System.Web/UI/WebControls/IPersistedSelector.cs
-System.Web.UI.WebControls/IPostBackContainer.cs
+../../../external/referencesource/System.Web/UI/WebControls/IPostBackContainer.cs
../../../external/referencesource/System.Web/UI/WebControls/IRepeatInfoUser.cs
System.Web.UI.WebControls/LabelControlBuilder.cs
System.Web.UI.WebControls/Label.cs
../../../external/referencesource/System.Web/UI/WebControls/IDataBoundItemControl.cs
../../../external/referencesource/System.Web/UI/WebControls/IDataBoundListControl.cs
../../../external/referencesource/System.Web/UI/WebControls/IFieldControl.cs
+../../../external/referencesource/System.Web/UI/WebControls/IRenderOuterTableControl.cs
System.Web.UI.WebControls/IRenderOuterTable.cs
System.Web.UI.WebControls/MenuListRenderer.cs
../../../external/referencesource/System.Web/UI/WebControls/MenuRenderingMode.cs
../../../external/referencesource/System.Web/Util/GCUtil.cs
../../../external/referencesource/System.Web/Util/SimpleRecyclingCache.cs
../../../external/referencesource/System.Web/Util/VersionUtil.cs
-
../../../external/referencesource/System.Web/Util/AppVerifierErrorCode.cs
../../../external/referencesource/System.Web/Util/DateTimeUtil.cs
../../../external/referencesource/System.Web/Util/hresults.cs
../../../external/referencesource/System.Web/Util/RegexUtil.cs
../../../external/referencesource/System.Web/Util/ObjectSet.cs
../../../external/referencesource/System.Web/Util/ParseHttpDate.cs
+../../../external/referencesource/System.Web/IntraPartitionAPIs/xsp/PerfCounterEnum.cs
+../../../external/referencesource/System.Web/misc/InvariantComparer.cs
+
+../../../external/referencesource/System.Web/ModelBinding/DictionaryHelpers.cs
+../../../external/referencesource/System.Web/ModelBinding/ValueProviderResult.cs
+../../../external/referencesource/System.Web/ModelBinding/ModelState.cs
+../../../external/referencesource/System.Web/ModelBinding/ModelStateDictionary.cs
+../../../external/referencesource/System.Web/ModelBinding/ModelBindingExecutionContext.cs
+../../../external/referencesource/System.Web/ModelBinding/IValueProvider.cs
+../../../external/referencesource/System.Web/ModelBinding/IValueProviderSource.cs
+../../../external/referencesource/System.Web/ModelBinding/IUnvalidatedValueProviderSource.cs
+../../../external/referencesource/System.Web/UI/IUpdatePanel.cs
+../../../external/referencesource/System.Web/Configuration/IServerConfig2.cs
+../../../external/referencesource/System.Web/UI/WebControls/IBorderPaddingControl.cs
+../../../external/referencesource/System.Web/UI/WebControls/IEditableTextControl.cs
+../../../external/referencesource/System.Web/UI/WebControls/IWizardSideBarListControl.cs
+../../../external/referencesource/System.Web/UI/WebControls/WizardSideBarListControlItemEventArgs.cs
+../../../external/referencesource/System.Web/UI/WebControls/WizardSideBarListControlItem.cs
+../../../external/referencesource/System.Web/Security/Cryptography/ICryptoService.cs
// TODO:
-// DispatcherObject returned by BeginInvoke must allow:
-// * Waiting until delegate is invoked.
-// See: BeginInvoke documentation for details
+// DispatcherObject returned by BeginInvoke must allow:
+// * Waiting until delegate is invoked.
+// See: BeginInvoke documentation for details
//
-// Implement the "Invoke" methods, they are currently not working.
+// Implement the "Invoke" methods, they are currently not working.
//
-// Add support for disabling the dispatcher and resuming it.
-// Add support for Waiting for new tasks to be pushed, so that we dont busy loop.
-// Add support for aborting an operation (emit the hook.operationaborted too)
+// Add support for disabling the dispatcher and resuming it.
+// Add support for Waiting for new tasks to be pushed, so that we dont busy loop.
+// Add support for aborting an operation (emit the hook.operationaborted too)
//
// Very confusing information about Shutdown: it states that shutdown is
// not over, until all events are unwinded, and also states that all events
// are aborted at that point. See 'Dispatcher.InvokeShutdown' docs,
//
// Testing reveals that
-// -> InvokeShutdown() stops processing, even if events are available,
-// there is no "unwinding" of events, even of higher priority events,
-// they are just ignored.
+// -> InvokeShutdown() stops processing, even if events are available,
+// there is no "unwinding" of events, even of higher priority events,
+// they are just ignored.
//
// The documentation for the Dispatcher family is poorly written, complete
// sections are cut-and-pasted that add no value and the important pieces
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
// Copyright (c) 2006 Novell, Inc. (http://www.novell.com)
+// Copyright (c) 2016 Quamotion (http://quamotion.mobi)
//
// Authors:
// Miguel de Icaza (miguel@novell.com)
+// Frederik Carlier (frederik.carlier@quamotion.mobi)
//
using System;
using System.Collections;
return op;
}
+ public DispatcherOperation InvokeAsync (Action callback)
+ {
+ return this.BeginInvoke(callback);
+ }
+
+ public DispatcherOperation InvokeAsync (Action callback, DispatcherPriority priority)
+ {
+ return this.BeginInvoke(callback, priority);
+ }
+
+ public DispatcherOperation InvokeAsync (Action callback, DispatcherPriority priority, CancellationToken cancellationToken)
+ {
+ return this.BeginInvoke(callback, priority);
+ }
+
public object Invoke (Delegate method, params object[] args)
{
throw new NotImplementedException ();
public void Enqueue (object obj)
{
- if (size == array.Length)
- Grow ();
- array[tail] = obj;
- tail = (tail+1) % array.Length;
- size++;
+ if (size == array.Length)
+ Grow ();
+ array[tail] = obj;
+ tail = (tail+1) % array.Length;
+ size++;
}
public object Dequeue ()
- {
- if (size < 1)
- throw new InvalidOperationException ();
- object result = array[head];
- array [head] = null;
- head = (head + 1) % array.Length;
- size--;
- return result;
- }
-
- void Grow () {
- int newc = array.Length * 2;
- object[] new_contents = new object[newc];
- array.CopyTo (new_contents, 0);
- array = new_contents;
- head = 0;
- tail = head + size;
- }
+ {
+ if (size < 1)
+ throw new InvalidOperationException ();
+ object result = array[head];
+ array [head] = null;
+ head = (head + 1) % array.Length;
+ size--;
+ return result;
+ }
+
+ void Grow ()
+ {
+ int newc = array.Length * 2;
+ object[] new_contents = new object[newc];
+ array.CopyTo (new_contents, 0);
+ array = new_contents;
+ head = 0;
+ tail = head + size;
+ }
public int Count {
get {
using System.ComponentModel;
using System.Security;
using System.Threading;
+using System.Threading.Tasks;
namespace System.Windows.Threading {
throw new NotImplementedException ();
}
+ public Task Task {
+ get {
+ throw new NotImplementedException();
+ }
+ }
+
public DispatcherOperationStatus Status {
get {
return status;
public TimeSpan GetUtcOffset (DateTimeOffset dateTimeOffset)
{
- throw new NotImplementedException ();
+ bool isDST;
+ return GetUtcOffset (dateTimeOffset.UtcDateTime, out isDST);
}
private TimeSpan GetUtcOffset (DateTime dateTime, out bool isDST)
Assert.AreEqual(baseUtcOffset, cairo.GetUtcOffset (d));
Assert.AreEqual(baseUtcOffset, cairo.GetUtcOffset (d.Add (new TimeSpan(0,0,0, 1))));
}
- }
+
+ [Test]
+ public void GetUtcOffset_FromDateTimeOffset ()
+ {
+ DateTimeOffset offset;
+
+ offset = new DateTimeOffset(dst1Start, baseUtcOffset);
+ Assert.AreEqual(baseUtcOffset, cairo.GetUtcOffset(offset.Add(new TimeSpan(0, 0, 0, -1))), "dst1Start_with_baseUtcOffset#before");
+ Assert.AreEqual(dstUtcOffset, cairo.GetUtcOffset(offset), "dst1Start_with_baseUtcOffset#exact");
+ Assert.AreEqual(dstUtcOffset, cairo.GetUtcOffset(offset.Add(new TimeSpan(0, 0, 0, 1))), "dst1Start_with_baseUtcOffset#after");
+
+ offset = new DateTimeOffset(dst1End, dstOffset + baseUtcOffset);
+ Assert.AreEqual(dstUtcOffset, cairo.GetUtcOffset(offset.Add(new TimeSpan(0, 0, 0, -1))), "dst1End_with_dstOffset+baseUtcOffset#before");
+ Assert.AreEqual(baseUtcOffset, cairo.GetUtcOffset(offset), "dst1End_with_dstOffset+baseUtcOffset#exact");
+ Assert.AreEqual(baseUtcOffset, cairo.GetUtcOffset(offset.Add(new TimeSpan(0, 0, 0, 1))), "dst1End_with_dstOffset+baseUtcOffset#after");
+
+ offset = new DateTimeOffset(dst2Start, baseUtcOffset);
+ Assert.AreEqual(baseUtcOffset, cairo.GetUtcOffset(offset.Add(new TimeSpan(0, 0, 0, -1))), "dst2Start_with_baseUtcOffset#before");
+ Assert.AreEqual(dstUtcOffset, cairo.GetUtcOffset(offset), "dst2Start_with_baseUtcOffset#exact");
+ Assert.AreEqual(dstUtcOffset, cairo.GetUtcOffset(offset.Add(new TimeSpan(0, 0, 0, 1))), "dst2Start_with_baseUtcOffset#after");
+
+ offset = new DateTimeOffset(dst2End, baseUtcOffset + dstOffset);
+ Assert.AreEqual(dstUtcOffset, cairo.GetUtcOffset(offset.Add(new TimeSpan(0, 0, 0, -1))), "dst2End_with_dstOffset+baseUtcOffset#before");
+ Assert.AreEqual(baseUtcOffset, cairo.GetUtcOffset(offset), "dst2End_with_dstOffset+baseUtcOffset#exact");
+ Assert.AreEqual(baseUtcOffset, cairo.GetUtcOffset(offset.Add(new TimeSpan(0, 0, 0, 1))), "dst2End_with_dstOffset+baseUtcOffset#after");
+ }
+ }
[TestFixture]
public class GetDaylightChanges
// The non-parallel part
byte [] buffer = new byte [8192];
+ // everything other than a-zA-Z0-9_ needs to be escaped in asm symbols.
+ var symbolEscapeRE = new System.Text.RegularExpressions.Regex ("[^\\w_]");
foreach (var url in files) {
string fname = LocateFile (new Uri (url).LocalPath);
string aname = Path.GetFileName (fname);
- string encoded = aname.Replace ("-", "_").Replace (".", "_");
+ string encoded = symbolEscapeRE.Replace (aname, "_");
if (prog == null)
prog = aname;
smonolib = "`pkg-config --variable=libdir mono-2`/libmono-2.0.a ";
else
smonolib = "-Wl,-Bstatic -lmono-2.0 -Wl,-Bdynamic ";
- cmd = String.Format("{4} -o {2} -Wall `pkg-config --cflags mono-2` {0} {3} " +
+ cmd = String.Format("{4} -o '{2}' -Wall `pkg-config --cflags mono-2` {0} {3} " +
"`pkg-config --libs-only-L mono-2` " + smonolib +
"`pkg-config --libs-only-l mono-2 | sed -e \"s/\\-lmono-2.0 //\"` {1}",
temp_c, temp_o, output, zlib, cc);
else
{
- cmd = String.Format("{4} " + debugging + " -o {2} -Wall {0} `pkg-config --cflags --libs mono-2` {3} {1}",
+ cmd = String.Format("{4} " + debugging + " -o '{2}' -Wall {0} `pkg-config --cflags --libs mono-2` {3} {1}",
temp_c, temp_o, output, zlib, cc);
}
Execute (cmd);
static MonoLoadFunc load_function = NULL;
+/* Lazy class loading functions */
+static GENERATE_GET_CLASS_WITH_CACHE (assembly, System.Reflection, Assembly)
+
void
mono_install_runtime_load (MonoLoadFunc func)
{
mono_thread_init (start_cb, attach_cb);
- klass = mono_class_from_name (mono_defaults.corlib, "System", "AppDomainSetup");
+ klass = mono_class_load_from_name (mono_defaults.corlib, "System", "AppDomainSetup");
setup = (MonoAppDomainSetup *) mono_object_new_pinned (domain, klass, error);
return_if_nok (error);
- klass = mono_class_from_name (mono_defaults.corlib, "System", "AppDomain");
+ klass = mono_class_load_from_name (mono_defaults.corlib, "System", "AppDomain");
ad = (MonoAppDomain *) mono_object_new_pinned (domain, klass, error);
return_if_nok (error);
MonoClassField *field;
MonoObject *value;
- klass = mono_class_from_name (mono_defaults.corlib, "System", "Environment");
+ klass = mono_class_load_from_name (mono_defaults.corlib, "System", "Environment");
mono_class_init (klass);
field = mono_class_get_field_from_name (klass, "mono_corlib_version");
if (!field)
mono_error_init (error);
- klass = mono_class_from_name (mono_defaults.corlib, "System.Runtime.Remoting.Contexts", "Context");
-
+ klass = mono_class_load_from_name (mono_defaults.corlib, "System.Runtime.Remoting.Contexts", "Context");
context = (MonoAppContext *) mono_object_new_pinned (domain, klass, error);
return_if_nok (error);
MonoAppDomainSetup *setup;
MonoClass *klass;
- klass = mono_class_from_name (mono_defaults.corlib, "System", "AppDomainSetup");
+ klass = mono_class_load_from_name (mono_defaults.corlib, "System", "AppDomainSetup");
setup = (MonoAppDomainSetup *) mono_object_new_checked (mono_domain_get (), klass, &error);
mono_error_raise_exception (&error); /* FIXME don't raise here */
setup->configuration_file = configuration_file != NULL ? mono_string_new (mono_domain_get (), configuration_file) : NULL;
mono_error_init (error);
caller_domain = mono_domain_get ();
- ads_class = mono_class_from_name (mono_defaults.corlib, "System", "AppDomainSetup");
+ ads_class = mono_class_load_from_name (mono_defaults.corlib, "System", "AppDomainSetup");
copy = (MonoAppDomainSetup*)mono_object_new_checked (domain, ads_class, error);
return_val_if_nok (error, NULL);
mono_error_init (error);
- adclass = mono_class_from_name (mono_defaults.corlib, "System", "AppDomain");
+ adclass = mono_class_load_from_name (mono_defaults.corlib, "System", "AppDomain");
/* FIXME: pin all those objects */
data = mono_domain_create();
MonoError error;
MonoDomain *domain = ad->data;
MonoAssembly* ass;
- static MonoClass *System_Reflection_Assembly;
MonoArray *res;
GSList *tmp;
int i;
GPtrArray *assemblies;
mono_error_init (&error);
-
- if (!System_Reflection_Assembly)
- System_Reflection_Assembly = mono_class_from_name (
- mono_defaults.corlib, "System.Reflection", "Assembly");
/*
* Make a copy of the list of assemblies because we can't hold the assemblies
}
mono_domain_assemblies_unlock (domain);
- res = mono_array_new (domain, System_Reflection_Assembly, assemblies->len);
+ res = mono_array_new (domain, mono_class_get_assembly_class (), assemblies->len);
for (i = 0; i < assemblies->len; ++i) {
ass = (MonoAssembly *)g_ptr_array_index (assemblies, i);
MonoReflectionAssembly *ass_obj = mono_assembly_get_object_checked (domain, ass, &error);
/* Loaded assembly binding info */
static GSList *loaded_assembly_bindings = NULL;
+/* Class lazy loading functions */
+static GENERATE_TRY_GET_CLASS_WITH_CACHE (internals_visible, System.Runtime.CompilerServices, InternalsVisibleToAttribute)
+
static MonoAssembly*
mono_assembly_invoke_search_hook_internal (MonoAssemblyName *aname, MonoAssembly *requesting, gboolean refonly, gboolean postload);
static MonoAssembly*
* names in custom attributes.
*
* This is an internal method, we need this because when we load mscorlib
- * we do not have the mono_defaults.internals_visible_class loaded yet,
+ * we do not have the internals visible cattr loaded yet,
* so we need to load these after we initialize the runtime.
*
* LOCKING: Acquires the assemblies lock plus the loader lock.
MonoAssemblyName *aname;
const gchar *data;
/* Do some sanity checking */
- if (!attr->ctor || attr->ctor->klass != mono_defaults.internals_visible_class)
+ if (!attr->ctor || attr->ctor->klass != mono_class_try_get_internals_visible_class ())
continue;
if (attr->data_size < 4)
continue;
MonoClass *typed_reference_class;
MonoClass *argumenthandle_class;
MonoClass *monitor_class;
- MonoClass *runtimesecurityframe_class;
- MonoClass *executioncontext_class;
- MonoClass *internals_visible_class;
MonoClass *generic_ilist_class;
MonoClass *generic_nullable_class;
- MonoClass *safehandle_class;
MonoClass *handleref_class;
MonoClass *attribute_class;
MonoClass *customattribute_data_class;
- MonoClass *critical_finalizer_object;
+ MonoClass *critical_finalizer_object; /* MAYBE NULL */
MonoClass *generic_ireadonlylist_class;
MonoClass *threadpool_wait_callback_class;
MonoMethod *threadpool_perform_wait_callback_method;
#define GENERATE_GET_CLASS_WITH_CACHE_DECL(shortname) \
MonoClass* mono_class_get_##shortname##_class (void);
+#define GENERATE_TRY_GET_CLASS_WITH_CACHE_DECL(shortname) \
+MonoClass* mono_class_try_get_##shortname##_class (void);
+
#define GENERATE_GET_CLASS_WITH_CACHE(shortname,namespace,name) \
MonoClass* \
mono_class_get_##shortname##_class (void) \
static MonoClass *tmp_class; \
MonoClass *klass = tmp_class; \
if (!klass) { \
- klass = mono_class_from_name (mono_defaults.corlib, #namespace, #name); \
- g_assert (klass); \
+ klass = mono_class_load_from_name (mono_defaults.corlib, #namespace, #name); \
mono_memory_barrier (); \
tmp_class = klass; \
} \
return klass; \
}
-#define GENERATE_STATIC_GET_CLASS_WITH_CACHE(shortname,namespace,name) \
-static GENERATE_GET_CLASS_WITH_CACHE (shortname,namespace,name)
+#define GENERATE_TRY_GET_CLASS_WITH_CACHE(shortname,namespace,name) \
+MonoClass* \
+mono_class_try_get_##shortname##_class (void) \
+{ \
+ static volatile MonoClass *tmp_class; \
+ static volatile gboolean inited; \
+ MonoClass *klass = (MonoClass *)tmp_class; \
+ mono_memory_barrier (); \
+ if (!inited) { \
+ klass = mono_class_try_load_from_name (mono_defaults.corlib, #namespace, #name); \
+ tmp_class = klass; \
+ mono_memory_barrier (); \
+ inited = TRUE; \
+ } \
+ return klass; \
+}
+GENERATE_TRY_GET_CLASS_WITH_CACHE_DECL (safehandle)
#ifndef DISABLE_COM
char *
make_generic_name_string (MonoImage *image, int num);
+MonoClass *
+mono_class_load_from_name (MonoImage *image, const char* name_space, const char *name);
+
+MonoClass*
+mono_class_try_load_from_name (MonoImage *image, const char* name_space, const char *name);
+
#endif /* __MONO_METADATA_CLASS_INTERNALS_H__ */
all_interfaces = eclass->rank && eclass->element_class->rank? FALSE: TRUE;
if (!generic_icollection_class) {
- generic_icollection_class = mono_class_from_name (mono_defaults.corlib,
+ generic_icollection_class = mono_class_load_from_name (mono_defaults.corlib,
"System.Collections.Generic", "ICollection`1");
- generic_ienumerable_class = mono_class_from_name (mono_defaults.corlib,
+ generic_ienumerable_class = mono_class_load_from_name (mono_defaults.corlib,
"System.Collections.Generic", "IEnumerable`1");
- generic_ienumerator_class = mono_class_from_name (mono_defaults.corlib,
+ generic_ienumerator_class = mono_class_load_from_name (mono_defaults.corlib,
"System.Collections.Generic", "IEnumerator`1");
- generic_ireadonlylist_class = mono_class_from_name (mono_defaults.corlib,
+ generic_ireadonlylist_class = mono_class_load_from_name (mono_defaults.corlib,
"System.Collections.Generic", "IReadOnlyList`1");
- generic_ireadonlycollection_class = mono_class_from_name (mono_defaults.corlib,
+ generic_ireadonlycollection_class = mono_class_load_from_name (mono_defaults.corlib,
"System.Collections.Generic", "IReadOnlyCollection`1");
}
CHECKED_METADATA_WRITE_PTR ( klass->parent , pinfo->constraints [0] );
pos++;
} else if (pinfo && pinfo->flags & GENERIC_PARAMETER_ATTRIBUTE_VALUE_TYPE_CONSTRAINT) {
- CHECKED_METADATA_WRITE_PTR ( klass->parent , mono_class_from_name (mono_defaults.corlib, "System", "ValueType") );
+ CHECKED_METADATA_WRITE_PTR ( klass->parent , mono_class_load_from_name (mono_defaults.corlib, "System", "ValueType") );
} else {
CHECKED_METADATA_WRITE_PTR ( klass->parent , mono_defaults.object_class );
}
/* for the building corlib use System.Array from it */
if (image->assembly && assembly_is_dynamic (image->assembly) && image->assembly_name && strcmp (image->assembly_name, "mscorlib") == 0) {
- parent = mono_class_from_name (image, "System", "Array");
+ parent = mono_class_load_from_name (image, "System", "Array");
corlib_type = TRUE;
} else {
parent = mono_defaults.array_class;
}
static MonoClass*
-search_modules (MonoImage *image, const char *name_space, const char *name)
+search_modules (MonoImage *image, const char *name_space, const char *name, MonoError *error)
{
MonoTableInfo *file_table = &image->tables [MONO_TABLE_FILE];
MonoImage *file_image;
MonoClass *klass;
int i;
+ mono_error_init (error);
+
/*
* The EXPORTEDTYPES table only contains public types, so have to search the
* modules as well.
file_image = mono_image_load_file_for_image (image, i + 1);
if (file_image) {
- klass = mono_class_from_name (file_image, name_space, name);
- if (klass)
+ klass = mono_class_from_name_checked (file_image, name_space, name, error);
+ if (klass || !is_ok (error))
return klass;
}
}
}
static MonoClass *
-mono_class_from_name_checked_aux (MonoImage *image, const char* name_space, const char *name, MonoError *error, GHashTable* visited_images)
+mono_class_from_name_checked_aux (MonoImage *image, const char* name_space, const char *name, GHashTable* visited_images, MonoError *error)
{
GHashTable *nspace_table;
MonoImage *loaded_image;
if (get_class_from_name && image->tables [MONO_TABLE_EXPORTEDTYPE].rows == 0) {
gboolean res = get_class_from_name (image, name_space, name, &klass);
if (res) {
- if (!klass)
- klass = search_modules (image, name_space, name);
+ if (!klass) {
+ klass = search_modules (image, name_space, name, error);
+ if (!is_ok (error))
+ return NULL;
+ }
if (nested)
return klass ? return_nested_in (klass, nested) : NULL;
else
for (i = 0; i < image->module_count; ++i) {
MonoImage *module = image->modules [i];
- klass = mono_class_from_name (module, name_space, name);
- if (klass)
+ klass = mono_class_from_name_checked (module, name_space, name, error);
+ if (klass || !is_ok (error))
return klass;
}
}
if (!token) {
- klass = search_modules (image, name_space, name);
- if (klass)
+ klass = search_modules (image, name_space, name, error);
+ if (klass || !is_ok (error))
return klass;
}
loaded_image = mono_assembly_load_module (image->assembly, impl >> MONO_IMPLEMENTATION_BITS);
if (!loaded_image)
return NULL;
- klass = mono_class_from_name_checked_aux (loaded_image, name_space, name, error, visited_images);
+ klass = mono_class_from_name_checked_aux (loaded_image, name_space, name, visited_images, error);
if (nested)
return klass ? return_nested_in (klass, nested) : NULL;
return klass;
g_assert (image->references [assembly_idx - 1]);
if (image->references [assembly_idx - 1] == (gpointer)-1)
return NULL;
- klass = mono_class_from_name_checked_aux (image->references [assembly_idx - 1]->image, name_space, name, error, visited_images);
+ klass = mono_class_from_name_checked_aux (image->references [assembly_idx - 1]->image, name_space, name, visited_images, error);
if (nested)
- return return_nested_in (klass, nested);
+ return klass ? return_nested_in (klass, nested) : NULL;
return klass;
} else {
g_assert_not_reached ();
return klass;
}
+/**
+ * mono_class_from_name_checked:
+ * @image: The MonoImage where the type is looked up in
+ * @name_space: the type namespace
+ * @name: the type short name.
+ *
+ * Obtains a MonoClass with a given namespace and a given name which
+ * is located in the given MonoImage.
+ *
+ * Works like mono_class_from_name, but error handling is tricky. It can return NULL and have no error
+ * set if the class was not found or it will return NULL and set the error if there was a loading error.
+ */
MonoClass *
mono_class_from_name_checked (MonoImage *image, const char* name_space, const char *name, MonoError *error)
{
visited_images = g_hash_table_new (g_direct_hash, g_direct_equal);
- klass = mono_class_from_name_checked_aux (image, name_space, name, error, visited_images);
+ klass = mono_class_from_name_checked_aux (image, name_space, name, visited_images, error);
g_hash_table_destroy (visited_images);
return klass;
}
+/**
+ * mono_class_load_from_name:
+ * @image: The MonoImage where the type is looked up in
+ * @name_space: the type namespace
+ * @name: the type short name.
+ *
+ * This function works exactly like mono_class_from_name but it will abort if the class is not found.
+ * This function should be used by the runtime for critical types to which there's no way to recover but crash
+ * If they are missing. Thing of System.Object or System.String.
+ */
+MonoClass *
+mono_class_load_from_name (MonoImage *image, const char* name_space, const char *name)
+{
+ MonoError error;
+ MonoClass *klass;
+
+ klass = mono_class_from_name_checked (image, name_space, name, &error);
+ if (!klass)
+ g_error ("Runtime critical type %s.%s not found", name_space, name);
+ if (!mono_error_ok (&error))
+ g_error ("Could not load runtime critical type %s.%s due to %s", name_space, name, mono_error_get_message (&error));
+ return klass;
+}
+
+/**
+ * mono_class_try_load_from_name:
+ * @image: The MonoImage where the type is looked up in
+ * @name_space: the type namespace
+ * @name: the type short name.
+ *
+ * This function tries to load a type, returning the class was found or NULL otherwise.
+ * This function should be used by the runtime when probing for optional types, those that could have being linked out.
+ *
+ * Big design consideration. This function aborts if there was an error loading the type. This prevents us from missing
+ * a type that we would otherwise assume to be available but was not due some error.
+ *
+ */
+MonoClass*
+mono_class_try_load_from_name (MonoImage *image, const char* name_space, const char *name)
+{
+ MonoError error;
+ MonoClass *klass;
+
+ klass = mono_class_from_name_checked (image, name_space, name, &error);
+ if (!mono_error_ok (&error))
+ g_error ("Could not load runtime critical type %s.%s due to %s", name_space, name, mono_error_get_message (&error));
+ return klass;
+}
+
+
/**
* mono_class_is_subclass_of:
* @klass: class to probe if it is a subclass of another one
return mono_type_full_name (&klass->byval_arg);
}
+/* Declare all shared lazy type lookup functions */
+GENERATE_TRY_GET_CLASS_WITH_CACHE (safehandle, System.Runtime.InteropServices, SafeHandle)
MONO_API MonoVTable *
mono_class_vtable (MonoDomain *domain, MonoClass *klass);
-MONO_API MonoClass *
+MONO_RT_EXTERNAL_ONLY MONO_API MonoClass *
mono_class_from_name (MonoImage *image, const char* name_space, const char *name);
-MONO_API MonoClass *
+MONO_RT_EXTERNAL_ONLY MONO_API MonoClass *
mono_class_from_name_case (MonoImage *image, const char* name_space, const char *name);
MONO_API MonoMethod *
GENERATE_GET_CLASS_WITH_CACHE (com_object, System, __ComObject)
GENERATE_GET_CLASS_WITH_CACHE (variant, System, Variant)
+static GENERATE_GET_CLASS_WITH_CACHE (interface_type_attribute, System.Runtime.InteropServices, InterfaceTypeAttribute)
+static GENERATE_GET_CLASS_WITH_CACHE (guid_attribute, System.Runtime.InteropServices, GuidAttribute)
+static GENERATE_GET_CLASS_WITH_CACHE (com_visible_attribute, System.Runtime.InteropServices, ComVisibleAttribute)
+
/* Upon creation of a CCW, only allocate a weak handle and set the
* reference count to 0. If the unmanaged client code decides to addref and
* hold onto the CCW, I then allocate a strong handle. Once the reference count
static gboolean inited;
MonoClass *klass;
if (!inited) {
- klass = mono_class_from_name (mono_defaults.corlib, "System", "__ComObject");
+ klass = mono_class_load_from_name (mono_defaults.corlib, "System", "__ComObject");
mono_memory_barrier ();
tmp_class = klass;
mono_memory_barrier ();
static int
cominterop_get_com_slot_begin (MonoClass* klass)
{
- static MonoClass *interface_type_attribute = NULL;
MonoCustomAttrInfo *cinfo = NULL;
MonoInterfaceTypeAttribute* itf_attr = NULL;
- if (!interface_type_attribute)
- interface_type_attribute = mono_class_from_name (mono_defaults.corlib, "System.Runtime.InteropServices", "InterfaceTypeAttribute");
cinfo = mono_custom_attrs_from_class (klass);
if (cinfo) {
MonoError error;
- itf_attr = (MonoInterfaceTypeAttribute*)mono_custom_attrs_get_attr_checked (cinfo, interface_type_attribute, &error);
+ itf_attr = (MonoInterfaceTypeAttribute*)mono_custom_attrs_get_attr_checked (cinfo, mono_class_get_interface_type_attribute_class (), &error);
g_assert (mono_error_ok (&error)); /*FIXME proper error handling*/
if (!cinfo->cached)
mono_custom_attrs_free (cinfo);
static gboolean
cominterop_class_guid (MonoClass* klass, guint8* guid)
{
- static MonoClass *GuidAttribute = NULL;
MonoCustomAttrInfo *cinfo;
- /* Handle the GuidAttribute */
- if (!GuidAttribute)
- GuidAttribute = mono_class_from_name (mono_defaults.corlib, "System.Runtime.InteropServices", "GuidAttribute");
-
cinfo = mono_custom_attrs_from_class (klass);
if (cinfo) {
MonoError error;
- MonoReflectionGuidAttribute *attr = (MonoReflectionGuidAttribute*)mono_custom_attrs_get_attr_checked (cinfo, GuidAttribute, &error);
+ MonoReflectionGuidAttribute *attr = (MonoReflectionGuidAttribute*)mono_custom_attrs_get_attr_checked (cinfo, mono_class_get_guid_attribute_class (), &error);
g_assert (mono_error_ok (&error)); /*FIXME proper error handling*/
if (!attr)
static gboolean
cominterop_com_visible (MonoClass* klass)
{
- static MonoClass *ComVisibleAttribute = NULL;
MonoError error;
MonoCustomAttrInfo *cinfo;
GPtrArray *ifaces;
MonoBoolean visible = 1;
- /* Handle the ComVisibleAttribute */
- if (!ComVisibleAttribute)
- ComVisibleAttribute = mono_class_from_name (mono_defaults.corlib, "System.Runtime.InteropServices", "ComVisibleAttribute");
-
cinfo = mono_custom_attrs_from_class (klass);
if (cinfo) {
MonoError error;
- MonoReflectionComVisibleAttribute *attr = (MonoReflectionComVisibleAttribute*)mono_custom_attrs_get_attr_checked (cinfo, ComVisibleAttribute, &error);
+ MonoReflectionComVisibleAttribute *attr = (MonoReflectionComVisibleAttribute*)mono_custom_attrs_get_attr_checked (cinfo, mono_class_get_guid_attribute_class (), &error);
g_assert (mono_error_ok (&error)); /*FIXME proper error handling*/
if (attr)
case MONO_MARSHAL_CONV_OBJECT_INTERFACE:
case MONO_MARSHAL_CONV_OBJECT_IUNKNOWN:
case MONO_MARSHAL_CONV_OBJECT_IDISPATCH: {
- static MonoClass* com_interop_proxy_class = NULL;
static MonoMethod* com_interop_proxy_get_proxy = NULL;
static MonoMethod* get_transparent_proxy = NULL;
guint32 pos_null = 0, pos_ccw = 0, pos_end = 0;
mono_mb_emit_icall (mb, cominterop_get_ccw_object);
pos_ccw = mono_mb_emit_short_branch (mb, CEE_BRTRUE_S);
- if (!com_interop_proxy_class)
- com_interop_proxy_class = mono_class_from_name (mono_defaults.corlib, "Mono.Interop", "ComInteropProxy");
if (!com_interop_proxy_get_proxy)
- com_interop_proxy_get_proxy = mono_class_get_method_from_name_flags (com_interop_proxy_class, "GetProxy", 2, METHOD_ATTRIBUTE_PRIVATE);
+ com_interop_proxy_get_proxy = mono_class_get_method_from_name_flags (mono_class_get_interop_proxy_class (), "GetProxy", 2, METHOD_ATTRIBUTE_PRIVATE);
#ifndef DISABLE_REMOTING
if (!get_transparent_proxy)
get_transparent_proxy = mono_class_get_method_from_name (mono_defaults.real_proxy_class, "GetTransparentProxy", 0);
#endif
- mono_mb_add_local (mb, &com_interop_proxy_class->byval_arg);
+ mono_mb_add_local (mb, &mono_class_get_interop_proxy_class ()->byval_arg);
mono_mb_emit_ldloc (mb, 0);
mono_mb_emit_byte (mb, CEE_LDIND_I);
}
if (!strcmp(method->name, ".ctor")) {
- static MonoClass *com_interop_proxy_class = NULL;
static MonoMethod *cache_proxy = NULL;
- if (!com_interop_proxy_class)
- com_interop_proxy_class = mono_class_from_name (mono_defaults.corlib, "Mono.Interop", "ComInteropProxy");
if (!cache_proxy)
- cache_proxy = mono_class_get_method_from_name (com_interop_proxy_class, "CacheProxy", 0);
+ cache_proxy = mono_class_get_method_from_name (mono_class_get_interop_proxy_class (), "CacheProxy", 0);
mono_mb_emit_ldarg (mb, 0);
mono_mb_emit_ldflda (mb, MONO_STRUCT_OFFSET (MonoTransparentProxy, rp));
if (cinfo) {
static MonoClass* coclass_attribute = NULL;
if (!coclass_attribute)
- coclass_attribute = mono_class_from_name (mono_defaults.corlib, "System.Runtime.InteropServices", "CoClassAttribute");
+ coclass_attribute = mono_class_load_from_name (mono_defaults.corlib, "System.Runtime.InteropServices", "CoClassAttribute");
if (mono_custom_attrs_has_attr (cinfo, coclass_attribute)) {
g_assert(itf->interface_count && itf->interfaces[0]);
itf = itf->interfaces[0];
/* Handle DispIdAttribute */
if (!ComDispIdAttribute)
- ComDispIdAttribute = mono_class_from_name (mono_defaults.corlib, "System.Runtime.InteropServices", "DispIdAttribute");
+ ComDispIdAttribute = mono_class_load_from_name (mono_defaults.corlib, "System.Runtime.InteropServices", "DispIdAttribute");
g_assert (object);
klass = mono_object_class (object);
if (!domain->domain)
return;
- klass = mono_class_from_name (mono_defaults.corlib, "System", "Console");
+ klass = mono_class_try_load_from_name (mono_defaults.corlib, "System", "Console");
if (klass == NULL)
return;
}
if (desc->name_space && desc->klass) {
- klass = mono_class_from_name (image, desc->name_space, desc->klass);
+ klass = mono_class_try_load_from_name (image, desc->name_space, desc->klass);
if (!klass)
return NULL;
return mono_method_desc_search_in_class (desc, klass);
}
mono_defaults.corlib = mono_assembly_get_image (ass);
- mono_defaults.object_class = mono_class_from_name (
+ mono_defaults.object_class = mono_class_load_from_name (
mono_defaults.corlib, "System", "Object");
- g_assert (mono_defaults.object_class != 0);
- mono_defaults.void_class = mono_class_from_name (
+ mono_defaults.void_class = mono_class_load_from_name (
mono_defaults.corlib, "System", "Void");
- g_assert (mono_defaults.void_class != 0);
- mono_defaults.boolean_class = mono_class_from_name (
+ mono_defaults.boolean_class = mono_class_load_from_name (
mono_defaults.corlib, "System", "Boolean");
- g_assert (mono_defaults.boolean_class != 0);
- mono_defaults.byte_class = mono_class_from_name (
+ mono_defaults.byte_class = mono_class_load_from_name (
mono_defaults.corlib, "System", "Byte");
- g_assert (mono_defaults.byte_class != 0);
- mono_defaults.sbyte_class = mono_class_from_name (
+ mono_defaults.sbyte_class = mono_class_load_from_name (
mono_defaults.corlib, "System", "SByte");
- g_assert (mono_defaults.sbyte_class != 0);
- mono_defaults.int16_class = mono_class_from_name (
+ mono_defaults.int16_class = mono_class_load_from_name (
mono_defaults.corlib, "System", "Int16");
- g_assert (mono_defaults.int16_class != 0);
- mono_defaults.uint16_class = mono_class_from_name (
+ mono_defaults.uint16_class = mono_class_load_from_name (
mono_defaults.corlib, "System", "UInt16");
- g_assert (mono_defaults.uint16_class != 0);
- mono_defaults.int32_class = mono_class_from_name (
+ mono_defaults.int32_class = mono_class_load_from_name (
mono_defaults.corlib, "System", "Int32");
- g_assert (mono_defaults.int32_class != 0);
- mono_defaults.uint32_class = mono_class_from_name (
+ mono_defaults.uint32_class = mono_class_load_from_name (
mono_defaults.corlib, "System", "UInt32");
- g_assert (mono_defaults.uint32_class != 0);
- mono_defaults.uint_class = mono_class_from_name (
+ mono_defaults.uint_class = mono_class_load_from_name (
mono_defaults.corlib, "System", "UIntPtr");
- g_assert (mono_defaults.uint_class != 0);
- mono_defaults.int_class = mono_class_from_name (
+ mono_defaults.int_class = mono_class_load_from_name (
mono_defaults.corlib, "System", "IntPtr");
- g_assert (mono_defaults.int_class != 0);
- mono_defaults.int64_class = mono_class_from_name (
+ mono_defaults.int64_class = mono_class_load_from_name (
mono_defaults.corlib, "System", "Int64");
- g_assert (mono_defaults.int64_class != 0);
- mono_defaults.uint64_class = mono_class_from_name (
+ mono_defaults.uint64_class = mono_class_load_from_name (
mono_defaults.corlib, "System", "UInt64");
- g_assert (mono_defaults.uint64_class != 0);
- mono_defaults.single_class = mono_class_from_name (
+ mono_defaults.single_class = mono_class_load_from_name (
mono_defaults.corlib, "System", "Single");
- g_assert (mono_defaults.single_class != 0);
- mono_defaults.double_class = mono_class_from_name (
+ mono_defaults.double_class = mono_class_load_from_name (
mono_defaults.corlib, "System", "Double");
- g_assert (mono_defaults.double_class != 0);
- mono_defaults.char_class = mono_class_from_name (
+ mono_defaults.char_class = mono_class_load_from_name (
mono_defaults.corlib, "System", "Char");
- g_assert (mono_defaults.char_class != 0);
- mono_defaults.string_class = mono_class_from_name (
+ mono_defaults.string_class = mono_class_load_from_name (
mono_defaults.corlib, "System", "String");
- g_assert (mono_defaults.string_class != 0);
- mono_defaults.enum_class = mono_class_from_name (
+ mono_defaults.enum_class = mono_class_load_from_name (
mono_defaults.corlib, "System", "Enum");
- g_assert (mono_defaults.enum_class != 0);
- mono_defaults.array_class = mono_class_from_name (
+ mono_defaults.array_class = mono_class_load_from_name (
mono_defaults.corlib, "System", "Array");
- g_assert (mono_defaults.array_class != 0);
- mono_defaults.delegate_class = mono_class_from_name (
+ mono_defaults.delegate_class = mono_class_load_from_name (
mono_defaults.corlib, "System", "Delegate");
- g_assert (mono_defaults.delegate_class != 0 );
- mono_defaults.multicastdelegate_class = mono_class_from_name (
+ mono_defaults.multicastdelegate_class = mono_class_load_from_name (
mono_defaults.corlib, "System", "MulticastDelegate");
- g_assert (mono_defaults.multicastdelegate_class != 0 );
- mono_defaults.asyncresult_class = mono_class_from_name (
+ mono_defaults.asyncresult_class = mono_class_load_from_name (
mono_defaults.corlib, "System.Runtime.Remoting.Messaging",
"AsyncResult");
- g_assert (mono_defaults.asyncresult_class != 0 );
- mono_defaults.manualresetevent_class = mono_class_from_name (
+ mono_defaults.manualresetevent_class = mono_class_load_from_name (
mono_defaults.corlib, "System.Threading", "ManualResetEvent");
- g_assert (mono_defaults.manualresetevent_class != 0 );
- mono_defaults.typehandle_class = mono_class_from_name (
+ mono_defaults.typehandle_class = mono_class_load_from_name (
mono_defaults.corlib, "System", "RuntimeTypeHandle");
- g_assert (mono_defaults.typehandle_class != 0);
- mono_defaults.methodhandle_class = mono_class_from_name (
+ mono_defaults.methodhandle_class = mono_class_load_from_name (
mono_defaults.corlib, "System", "RuntimeMethodHandle");
- g_assert (mono_defaults.methodhandle_class != 0);
- mono_defaults.fieldhandle_class = mono_class_from_name (
+ mono_defaults.fieldhandle_class = mono_class_load_from_name (
mono_defaults.corlib, "System", "RuntimeFieldHandle");
- g_assert (mono_defaults.fieldhandle_class != 0);
- mono_defaults.systemtype_class = mono_class_from_name (
+ mono_defaults.systemtype_class = mono_class_load_from_name (
mono_defaults.corlib, "System", "Type");
- g_assert (mono_defaults.systemtype_class != 0);
- mono_defaults.monotype_class = mono_class_from_name (
+ mono_defaults.monotype_class = mono_class_load_from_name (
mono_defaults.corlib, "System", "MonoType");
- g_assert (mono_defaults.monotype_class != 0);
- mono_defaults.runtimetype_class = mono_class_from_name (
+ mono_defaults.runtimetype_class = mono_class_load_from_name (
mono_defaults.corlib, "System", "RuntimeType");
- g_assert (mono_defaults.runtimetype_class != 0);
- mono_defaults.exception_class = mono_class_from_name (
+ mono_defaults.exception_class = mono_class_load_from_name (
mono_defaults.corlib, "System", "Exception");
- g_assert (mono_defaults.exception_class != 0);
- mono_defaults.threadabortexception_class = mono_class_from_name (
+ mono_defaults.threadabortexception_class = mono_class_load_from_name (
mono_defaults.corlib, "System.Threading", "ThreadAbortException");
- g_assert (mono_defaults.threadabortexception_class != 0);
- mono_defaults.thread_class = mono_class_from_name (
+ mono_defaults.thread_class = mono_class_load_from_name (
mono_defaults.corlib, "System.Threading", "Thread");
- g_assert (mono_defaults.thread_class != 0);
- mono_defaults.internal_thread_class = mono_class_from_name (
+ mono_defaults.internal_thread_class = mono_class_load_from_name (
mono_defaults.corlib, "System.Threading", "InternalThread");
- if (!mono_defaults.internal_thread_class) {
- /* This can happen with an old mscorlib */
- fprintf (stderr, "Corlib too old for this runtime.\n");
- fprintf (stderr, "Loaded from: %s\n",
- mono_defaults.corlib? mono_image_get_filename (mono_defaults.corlib): "unknown");
- exit (1);
- }
- mono_defaults.appdomain_class = mono_class_from_name (
+ mono_defaults.appdomain_class = mono_class_load_from_name (
mono_defaults.corlib, "System", "AppDomain");
- g_assert (mono_defaults.appdomain_class != 0);
#ifndef DISABLE_REMOTING
- mono_defaults.transparent_proxy_class = mono_class_from_name (
+ mono_defaults.transparent_proxy_class = mono_class_load_from_name (
mono_defaults.corlib, "System.Runtime.Remoting.Proxies", "TransparentProxy");
- g_assert (mono_defaults.transparent_proxy_class != 0);
- mono_defaults.real_proxy_class = mono_class_from_name (
+ mono_defaults.real_proxy_class = mono_class_load_from_name (
mono_defaults.corlib, "System.Runtime.Remoting.Proxies", "RealProxy");
- g_assert (mono_defaults.real_proxy_class != 0);
- mono_defaults.marshalbyrefobject_class = mono_class_from_name (
+ mono_defaults.marshalbyrefobject_class = mono_class_load_from_name (
mono_defaults.corlib, "System", "MarshalByRefObject");
- g_assert (mono_defaults.marshalbyrefobject_class != 0);
- mono_defaults.iremotingtypeinfo_class = mono_class_from_name (
+ mono_defaults.iremotingtypeinfo_class = mono_class_load_from_name (
mono_defaults.corlib, "System.Runtime.Remoting", "IRemotingTypeInfo");
- g_assert (mono_defaults.iremotingtypeinfo_class != 0);
+
#endif
- mono_defaults.mono_method_message_class = mono_class_from_name (
+ mono_defaults.mono_method_message_class = mono_class_load_from_name (
mono_defaults.corlib, "System.Runtime.Remoting.Messaging", "MonoMethodMessage");
- g_assert (mono_defaults.mono_method_message_class != 0);
- mono_defaults.field_info_class = mono_class_from_name (
+ mono_defaults.field_info_class = mono_class_load_from_name (
mono_defaults.corlib, "System.Reflection", "FieldInfo");
- g_assert (mono_defaults.field_info_class != 0);
- mono_defaults.method_info_class = mono_class_from_name (
+ mono_defaults.method_info_class = mono_class_load_from_name (
mono_defaults.corlib, "System.Reflection", "MethodInfo");
- g_assert (mono_defaults.method_info_class != 0);
- mono_defaults.stringbuilder_class = mono_class_from_name (
+ mono_defaults.stringbuilder_class = mono_class_load_from_name (
mono_defaults.corlib, "System.Text", "StringBuilder");
- g_assert (mono_defaults.stringbuilder_class != 0);
- mono_defaults.math_class = mono_class_from_name (
+ mono_defaults.math_class = mono_class_load_from_name (
mono_defaults.corlib, "System", "Math");
- g_assert (mono_defaults.math_class != 0);
- mono_defaults.stack_frame_class = mono_class_from_name (
+ mono_defaults.stack_frame_class = mono_class_load_from_name (
mono_defaults.corlib, "System.Diagnostics", "StackFrame");
- g_assert (mono_defaults.stack_frame_class != 0);
- mono_defaults.stack_trace_class = mono_class_from_name (
+ mono_defaults.stack_trace_class = mono_class_load_from_name (
mono_defaults.corlib, "System.Diagnostics", "StackTrace");
- g_assert (mono_defaults.stack_trace_class != 0);
- mono_defaults.marshal_class = mono_class_from_name (
+ mono_defaults.marshal_class = mono_class_load_from_name (
mono_defaults.corlib, "System.Runtime.InteropServices", "Marshal");
- g_assert (mono_defaults.marshal_class != 0);
- mono_defaults.typed_reference_class = mono_class_from_name (
+ mono_defaults.typed_reference_class = mono_class_load_from_name (
mono_defaults.corlib, "System", "TypedReference");
- g_assert (mono_defaults.typed_reference_class != 0);
- mono_defaults.argumenthandle_class = mono_class_from_name (
+ mono_defaults.argumenthandle_class = mono_class_load_from_name (
mono_defaults.corlib, "System", "RuntimeArgumentHandle");
- g_assert (mono_defaults.argumenthandle_class != 0);
- mono_defaults.monitor_class = mono_class_from_name (
+ mono_defaults.monitor_class = mono_class_load_from_name (
mono_defaults.corlib, "System.Threading", "Monitor");
- g_assert (mono_defaults.monitor_class != 0);
-
- mono_defaults.runtimesecurityframe_class = mono_class_from_name (
- mono_defaults.corlib, "System.Security", "RuntimeSecurityFrame");
-
- mono_defaults.executioncontext_class = mono_class_from_name (
- mono_defaults.corlib, "System.Threading", "ExecutionContext");
-
- mono_defaults.internals_visible_class = mono_class_from_name (
- mono_defaults.corlib, "System.Runtime.CompilerServices", "InternalsVisibleToAttribute");
-
- mono_defaults.critical_finalizer_object = mono_class_from_name (
- mono_defaults.corlib, "System.Runtime.ConstrainedExecution", "CriticalFinalizerObject");
-
/*
- * mscorlib needs a little help, only now it can load its friends list (after we have
- * loaded the InternalsVisibleToAttribute), load it now
- */
+ Not using GENERATE_TRY_GET_CLASS_WITH_CACHE_DECL as this type is heavily checked by sgen when computing finalization.
+ */
+ mono_defaults.critical_finalizer_object = mono_class_try_load_from_name (mono_defaults.corlib,
+ "System.Runtime.ConstrainedExecution", "CriticalFinalizerObject");
+
mono_assembly_load_friends (ass);
-
- mono_defaults.safehandle_class = mono_class_from_name (
- mono_defaults.corlib, "System.Runtime.InteropServices", "SafeHandle");
- mono_defaults.handleref_class = mono_class_from_name (
+ mono_defaults.handleref_class = mono_class_load_from_name (
mono_defaults.corlib, "System.Runtime.InteropServices", "HandleRef");
- mono_defaults.attribute_class = mono_class_from_name (
+ mono_defaults.attribute_class = mono_class_load_from_name (
mono_defaults.corlib, "System", "Attribute");
- mono_defaults.customattribute_data_class = mono_class_from_name (
+ mono_defaults.customattribute_data_class = mono_class_load_from_name (
mono_defaults.corlib, "System.Reflection", "CustomAttributeData");
mono_class_init (mono_defaults.array_class);
- mono_defaults.generic_nullable_class = mono_class_from_name (
+ mono_defaults.generic_nullable_class = mono_class_load_from_name (
mono_defaults.corlib, "System", "Nullable`1");
- mono_defaults.generic_ilist_class = mono_class_from_name (
+ mono_defaults.generic_ilist_class = mono_class_load_from_name (
mono_defaults.corlib, "System.Collections.Generic", "IList`1");
- mono_defaults.generic_ireadonlylist_class = mono_class_from_name (
+ mono_defaults.generic_ireadonlylist_class = mono_class_load_from_name (
mono_defaults.corlib, "System.Collections.Generic", "IReadOnlyList`1");
- mono_defaults.threadpool_wait_callback_class = mono_class_from_name (
+ mono_defaults.threadpool_wait_callback_class = mono_class_load_from_name (
mono_defaults.corlib, "System.Threading", "_ThreadPoolWaitCallback");
- if (!mono_defaults.threadpool_wait_callback_class) {
- /* This can happen with an old mscorlib */
- fprintf (stderr, "Corlib too old for this runtime.\n");
- fprintf (stderr, "Loaded from: %s\n",
- mono_defaults.corlib? mono_image_get_filename (mono_defaults.corlib): "unknown");
- exit (1);
- }
+
mono_defaults.threadpool_perform_wait_callback_method = mono_class_get_method_from_name (
mono_defaults.threadpool_wait_callback_class, "PerformWaitCallback", 0);
MonoObject *o;
MonoDomain *caller_domain = mono_domain_get ();
- klass = mono_class_from_name (image, name_space, name);
+ klass = mono_class_load_from_name (image, name_space, name);
o = mono_object_new_checked (domain, klass, &error);
g_assert (o != NULL && mono_error_ok (&error)); /* FIXME don't swallow the error */
mono_exception_from_name_two_strings (MonoImage *image, const char *name_space,
const char *name, MonoString *a1, MonoString *a2)
{
- MonoClass *klass = mono_class_from_name (image, name_space, name);
+ MonoClass *klass = mono_class_load_from_name (image, name_space, name);
return create_exception_two_strings (klass, a1, a2);
}
MonoMethod *method;
gpointer iter;
- klass = mono_class_from_name (mono_get_corlib (), "System", "TypeInitializationException");
- g_assert (klass);
+ klass = mono_class_load_from_name (mono_get_corlib (), "System", "TypeInitializationException");
mono_class_init (klass);
MonoMethod *method;
gpointer iter;
- klass = mono_class_from_name (mono_get_corlib (), "System.Reflection", "ReflectionTypeLoadException");
- g_assert (klass);
+ klass = mono_class_load_from_name (mono_get_corlib (), "System.Reflection", "ReflectionTypeLoadException");
+
mono_class_init (klass);
/* Find the Type[], Exception[] ctor */
MonoDomain *domain = mono_domain_get ();
gpointer params [16];
- klass = mono_class_from_name (mono_get_corlib (), "System.Runtime.CompilerServices", "RuntimeWrappedException");
- g_assert (klass);
+ klass = mono_class_load_from_name (mono_get_corlib (), "System.Runtime.CompilerServices", "RuntimeWrappedException");
o = mono_object_new_checked (domain, klass, &error);
g_assert (o != NULL && mono_error_ok (&error)); /* FIXME don't swallow the error */
/* Lazy class loading functions */
static GENERATE_GET_CLASS_WITH_CACHE (string_builder, System.Text, StringBuilder)
static GENERATE_GET_CLASS_WITH_CACHE (date_time, System, DateTime)
+static GENERATE_TRY_GET_CLASS_WITH_CACHE (unmanaged_function_pointer_attribute, System.Runtime.InteropServices, UnmanagedFunctionPointerAttribute)
+static GENERATE_TRY_GET_CLASS_WITH_CACHE (icustom_marshaler, System.Runtime.InteropServices, ICustomMarshaler)
/* MonoMethod pointers to SafeHandle::DangerousAddRef and ::DangerousRelease */
static MonoMethod *sh_dangerous_add_ref;
init_safe_handle ()
{
sh_dangerous_add_ref = mono_class_get_method_from_name (
- mono_defaults.safehandle_class, "DangerousAddRef", 1);
+ mono_class_try_get_safehandle_class (), "DangerousAddRef", 1);
sh_dangerous_release = mono_class_get_method_from_name (
- mono_defaults.safehandle_class, "DangerousRelease", 0);
+ mono_class_try_get_safehandle_class (), "DangerousRelease", 0);
}
static void
static void
parse_unmanaged_function_pointer_attr (MonoClass *klass, MonoMethodPInvoke *piinfo)
{
- static MonoClass *UnmanagedFunctionPointerAttribute;
MonoCustomAttrInfo *cinfo;
MonoReflectionUnmanagedFunctionPointerAttribute *attr;
- if (!UnmanagedFunctionPointerAttribute)
- UnmanagedFunctionPointerAttribute = mono_class_from_name (mono_defaults.corlib, "System.Runtime.InteropServices", "UnmanagedFunctionPointerAttribute");
-
/* The attribute is only available in Net 2.0 */
- if (UnmanagedFunctionPointerAttribute) {
+ if (mono_class_try_get_unmanaged_function_pointer_attribute_class ()) {
/*
* The pinvoke attributes are stored in a real custom attribute so we have to
* construct it.
cinfo = mono_custom_attrs_from_class (klass);
if (cinfo && !mono_runtime_get_no_exec ()) {
MonoError error;
- attr = (MonoReflectionUnmanagedFunctionPointerAttribute*)mono_custom_attrs_get_attr_checked (cinfo, UnmanagedFunctionPointerAttribute, &error);
+ attr = (MonoReflectionUnmanagedFunctionPointerAttribute*)mono_custom_attrs_get_attr_checked (cinfo, mono_class_try_get_unmanaged_function_pointer_attribute_class (), &error);
if (attr) {
piinfo->piflags = (attr->call_conv << 8) | (attr->charset ? (attr->charset - 1) * 2 : 1) | attr->set_last_error;
} else {
return;
}
- if (klass != mono_defaults.safehandle_class) {
+ if (klass != mono_class_try_get_safehandle_class ()) {
if ((klass->flags & TYPE_ATTRIBUTE_LAYOUT_MASK) == TYPE_ATTRIBUTE_AUTO_LAYOUT) {
char *msg = g_strdup_printf ("Type %s which is passed to unmanaged code must have a StructLayout attribute.",
mono_type_full_name (&klass->byval_arg));
usize = info->fields [i + 1].offset - info->fields [i].offset;
}
- if (klass != mono_defaults.safehandle_class){
+ if (klass != mono_class_try_get_safehandle_class ()){
/*
* FIXME: Should really check for usize==0 and msize>0, but we apply
* the layout to the managed structure as well.
int pos2;
if (!ICustomMarshaler) {
- MonoClass *klass = mono_class_from_name (mono_defaults.corlib, "System.Runtime.InteropServices", "ICustomMarshaler");
+ MonoClass *klass = mono_class_try_get_icustom_marshaler_class ();
if (!klass) {
exception_msg = g_strdup ("Current profile doesn't support ICustomMarshaler");
goto handle_exception;
return mono_cominterop_emit_marshal_safearray (m, argnum, t, spec, conv_arg, conv_arg_type, action);
#endif
- if (mono_defaults.safehandle_class != NULL && t->data.klass &&
- mono_class_is_subclass_of (t->data.klass, mono_defaults.safehandle_class, FALSE))
+ if (mono_class_try_get_safehandle_class () != NULL && t->data.klass &&
+ mono_class_is_subclass_of (t->data.klass, mono_class_try_get_safehandle_class (), FALSE))
return emit_marshal_safehandle (m, argnum, t, spec, conv_arg, conv_arg_type, action);
return emit_marshal_object (m, argnum, t, spec, conv_arg, conv_arg_type, action);
MonoMethod *
mono_marshal_get_managed_wrapper (MonoMethod *method, MonoClass *delegate_klass, uint32_t target_handle)
{
- static MonoClass *UnmanagedFunctionPointerAttribute;
MonoMethodSignature *sig, *csig, *invoke_sig;
MonoMethodBuilder *mb;
MonoMethod *res, *invoke;
mono_marshal_set_callconv_from_modopt (invoke, csig);
- /* Handle the UnmanagedFunctionPointerAttribute */
- if (!UnmanagedFunctionPointerAttribute)
- UnmanagedFunctionPointerAttribute = mono_class_from_name (mono_defaults.corlib, "System.Runtime.InteropServices", "UnmanagedFunctionPointerAttribute");
-
/* The attribute is only available in Net 2.0 */
- if (UnmanagedFunctionPointerAttribute) {
+ if (mono_class_try_get_unmanaged_function_pointer_attribute_class ()) {
MonoCustomAttrInfo *cinfo;
MonoCustomAttrEntry *attr;
if (cinfo) {
for (i = 0; i < cinfo->num_attrs; ++i) {
MonoClass *ctor_class = cinfo->attrs [i].ctor->klass;
- if (mono_class_has_parent (ctor_class, UnmanagedFunctionPointerAttribute)) {
+ if (mono_class_has_parent (ctor_class, mono_class_try_get_unmanaged_function_pointer_attribute_class ())) {
attr = &cinfo->attrs [i];
break;
}
*conv = MONO_MARSHAL_CONV_DEL_FTN;
return MONO_NATIVE_FUNC;
}
- if (mono_defaults.safehandle_class && type->data.klass == mono_defaults.safehandle_class){
+ if (mono_class_try_get_safehandle_class () && type->data.klass == mono_class_try_get_safehandle_class ()){
*conv = MONO_MARSHAL_CONV_SAFEHANDLE;
return MONO_NATIVE_INT;
}
{
MonoMethod *ctor = NULL;
- MonoClass *mme = mono_class_from_name (mono_defaults.corlib, exc_nspace, exc_name);
+ MonoClass *mme = mono_class_load_from_name (mono_defaults.corlib, exc_nspace, exc_name);
mono_class_init (mme);
ctor = mono_class_get_method_from_name (mme, ".ctor", 0);
g_assert (ctor);
MonoError error;
MonoMList* res;
if (!monolist_item_vtable) {
- MonoClass *klass = mono_class_from_name (mono_defaults.corlib, "System", "MonoListItem");
+ MonoClass *klass = mono_class_load_from_name (mono_defaults.corlib, "System", "MonoListItem");
monolist_item_vtable = mono_class_vtable (mono_get_root_domain (), klass);
g_assert (monolist_item_vtable);
}
}
}
- klass = mono_class_from_name (system_security_assembly,
+ klass = mono_class_load_from_name (system_security_assembly,
"System.Security.Cryptography", "ProtectedMemory");
method = mono_class_get_method_from_name (klass, encrypt ? "Protect" : "Unprotect", 2);
params [0] = data;
#ifdef __GNUC__
-/* namespace and name should be a constant */
-/* image must be mscorlib since other assemblies can be unloaded */
-#define mono_class_from_name_cached(image,namespace,name) ({ \
- static MonoClass *tmp_klass; \
- if (!tmp_klass) { \
- g_assert (image == mono_defaults.corlib); \
- tmp_klass = mono_class_from_name ((image), (namespace), (name)); \
- g_assert (tmp_klass); \
- }; \
- tmp_klass; })
/* name should be a compile-time constant */
#define mono_class_get_field_from_name_cached(klass,name) ({ \
static MonoClassField *tmp_field; \
#else
-#define mono_class_from_name_cached(image,namespace,name) mono_class_from_name ((image), (namespace), (name))
#define mono_class_get_field_from_name_cached(klass,name) mono_class_get_field_from_name ((klass), (name))
#define mono_array_class_get_cached(eclass,rank) mono_array_class_get ((eclass), (rank))
#define mono_array_new_cached(domain, eclass, size) mono_array_new_specific (mono_class_vtable ((domain), mono_array_class_get_cached ((eclass), 1)), (size))
static MonoImage *system_assembly=NULL;
+//Hand coded version that loads from system
+static MonoClass*
+mono_class_get_file_version_info_class (void)
+{
+ static MonoClass *tmp_class;
+ MonoClass *klass = tmp_class;
+ if (!klass) {
+ klass = mono_class_load_from_name (system_assembly, "System.Diagnostics", "FileVersionInfo");
+ mono_memory_barrier ();
+ tmp_class = klass;
+ }
+ return klass;
+}
+
+static MonoClass*
+mono_class_get_process_module_class (void)
+{
+ static MonoClass *tmp_class;
+ MonoClass *klass = tmp_class;
+ if (!klass) {
+ klass = mono_class_load_from_name (system_assembly, "System.Diagnostics", "ProcessModule");
+ mono_memory_barrier ();
+ tmp_class = klass;
+ }
+ return klass;
+}
+
+
static guint32 unicode_chars (const gunichar2 *str)
{
guint32 len=0;
static MonoObject* get_process_module (MonoAssembly *assembly, MonoClass *proc_class)
{
MonoError error;
- static MonoClass *filever_class = NULL;
MonoObject *item, *filever;
MonoDomain *domain = mono_domain_get ();
char *filename;
*/
item = mono_object_new_checked (domain, proc_class, &error);
mono_error_raise_exception (&error); /* FIXME don't raise here */
-
- if (!filever_class)
- filever_class = mono_class_from_name (system_assembly,
- "System.Diagnostics",
- "FileVersionInfo");
-
- filever = mono_object_new_checked (domain, filever_class, &error);
+ filever = mono_object_new_checked (domain, mono_class_get_file_version_info_class (), &error);
if (!mono_error_ok (&error)) goto leave;
process_get_assembly_fileversion (filever, assembly);
static MonoObject* process_add_module (HANDLE process, HMODULE mod, gunichar2 *filename, gunichar2 *modulename, MonoClass *proc_class)
{
MonoError error;
- static MonoClass *filever_class = NULL;
MonoObject *item, *filever;
MonoDomain *domain=mono_domain_get ();
MODULEINFO modinfo;
*/
item=mono_object_new_checked (domain, proc_class, &error);
mono_error_raise_exception (&error); /* FIXME don't raise here */
-
- if (!filever_class)
- filever_class=mono_class_from_name (system_assembly,
- "System.Diagnostics",
- "FileVersionInfo");
-
- filever=mono_object_new_checked (domain, filever_class, &error);
+ filever = mono_object_new_checked (domain, mono_class_get_file_version_info_class (), &error);
mono_error_raise_exception (&error); /* FIXME don't raise here */
process_get_fileversion (filever, filename);
DWORD needed;
guint32 count = 0, module_count = 0, assembly_count = 0;
guint32 i, num_added = 0;
- static MonoClass *proc_class = NULL;
GPtrArray *assemblies = NULL;
static HANDLE current_process = 0;
}
count = module_count + assembly_count;
- if (!proc_class)
- proc_class = mono_class_from_name (system_assembly, "System.Diagnostics", "ProcessModule");
-
- temp_arr = mono_array_new (mono_domain_get (), proc_class, count);
+ temp_arr = mono_array_new (mono_domain_get (), mono_class_get_process_module_class (), count);
for (i = 0; i < module_count; i++) {
if (GetModuleBaseName (process, mods[i], modname, MAX_PATH) &&
GetModuleFileNameEx (process, mods[i], filename, MAX_PATH)) {
MonoObject *module = process_add_module (process, mods[i],
- filename, modname, proc_class);
+ filename, modname, mono_class_get_process_module_class ());
mono_array_setref (temp_arr, num_added++, module);
}
}
if (assemblies) {
for (i = 0; i < assembly_count; i++) {
MonoAssembly *ass = (MonoAssembly *)g_ptr_array_index (assemblies, i);
- MonoObject *module = get_process_module (ass, proc_class);
+ MonoObject *module = get_process_module (ass, mono_class_get_process_module_class ());
mono_array_setref (temp_arr, num_added++, module);
}
g_ptr_array_free (assemblies, TRUE);
arr = temp_arr;
} else {
/* shorter version of the array */
- arr = mono_array_new (mono_domain_get (), proc_class, num_added);
+ arr = mono_array_new (mono_domain_get (), mono_class_get_process_module_class (), num_added);
for (i = 0; i < num_added; i++)
mono_array_setref (arr, i, mono_array_get (temp_arr, MonoObject*, i));
/* Class lazy loading functions */
static GENERATE_GET_CLASS_WITH_CACHE (security_manager, System.Security, SecurityManager)
+static GENERATE_TRY_GET_CLASS_WITH_CACHE (execution_context, System.Threading, ExecutionContext)
static MonoSecurityMode mono_security_mode = MONO_SECURITY_MODE_NONE;
return NULL;
/* older corlib revisions won't have the class (nor the method) */
- if (mono_defaults.executioncontext_class && !method) {
- mono_class_init (mono_defaults.executioncontext_class);
- method = mono_class_get_method_from_name (mono_defaults.executioncontext_class, "Capture", 0);
+ MonoClass *execution_context = mono_class_try_get_execution_context_class ();
+ if (execution_context && !method) {
+ mono_class_init (execution_context);
+ method = mono_class_get_method_from_name (execution_context, "Capture", 0);
}
return method;
/* catch */
clause->flags = MONO_EXCEPTION_CLAUSE_NONE;
clause->try_len = mono_mb_get_pos (mb) - clause->try_offset;
- clause->data.catch_class = mono_class_from_name (mono_defaults.corlib,
+ clause->data.catch_class = mono_class_load_from_name (mono_defaults.corlib,
"System", "OverflowException");
- g_assert (clause->data.catch_class);
clause->handler_offset = mono_mb_get_label (mb);
- oom_exc_class = mono_class_from_name (mono_defaults.corlib,
+ oom_exc_class = mono_class_load_from_name (mono_defaults.corlib,
"System", "OutOfMemoryException");
- g_assert (oom_exc_class);
ctor = mono_class_get_method_from_name (oom_exc_class, ".ctor", 0);
g_assert (ctor);
socket_assembly = get_socket_assembly ();
g_assert (socket_assembly);
- socket_class = mono_class_from_name (socket_assembly, "System.Net.Sockets", "Socket");
- g_assert (socket_class);
+ socket_class = mono_class_load_from_name (socket_assembly, "System.Net.Sockets", "Socket");
ipv4_field = mono_class_get_field_from_name (socket_class, "ipv4_supported");
g_assert (ipv4_field);
/* Build a System.Net.SocketAddress object instance */
if (!domain->sockaddr_class) {
- domain->sockaddr_class=mono_class_from_name (get_socket_assembly (), "System.Net", "SocketAddress");
- g_assert (domain->sockaddr_class);
+ domain->sockaddr_class = mono_class_load_from_name (get_socket_assembly (), "System.Net", "SocketAddress");
}
sockaddr_obj=mono_object_new_checked(domain, domain->sockaddr_class, &merror);
mono_error_raise_exception (&merror); /* FIXME don't raise here */
switch(name) {
case SocketOptionName_Linger:
/* build a System.Net.Sockets.LingerOption */
- obj_class=mono_class_from_name(get_socket_assembly (),
+ obj_class = mono_class_load_from_name (get_socket_assembly (),
"System.Net.Sockets",
"LingerOption");
obj=mono_object_new_checked(domain, obj_class, &merror);
}
}
- obj_class = mono_class_from_name(mono_posix_image,
+ obj_class = mono_class_load_from_name (mono_posix_image,
"Mono.Posix",
"PeerCredData");
obj = mono_object_new_checked(domain, obj_class, &merror);
g_assert (work_item);
if (!threadpool_class)
- threadpool_class = mono_class_from_name (mono_defaults.corlib, "System.Threading", "ThreadPool");
- g_assert (threadpool_class);
+ threadpool_class = mono_class_load_from_name (mono_defaults.corlib, "System.Threading", "ThreadPool");
if (!unsafe_queue_custom_work_item_method)
unsafe_queue_custom_work_item_method = mono_class_get_method_from_name (threadpool_class, "UnsafeQueueCustomWorkItem", 2);
MonoObject *state = NULL;
if (!async_call_klass)
- async_call_klass = mono_class_from_name (mono_defaults.corlib, "System", "MonoAsyncCall");
- g_assert (async_call_klass);
+ async_call_klass = mono_class_load_from_name (mono_defaults.corlib, "System", "MonoAsyncCall");
mono_lazy_initialize (&status, initialize);
/* Assembly runtime-invoke (string, bool) [DoAssemblyResolve] */
csig = mono_metadata_signature_alloc (mono_defaults.corlib, 2);
csig->hasthis = 1;
- csig->ret = &(mono_class_from_name (
+ csig->ret = &(mono_class_load_from_name (
mono_defaults.corlib, "System.Reflection", "Assembly"))->byval_arg;
csig->params [0] = &mono_defaults.string_class->byval_arg;
csig->params [1] = &mono_defaults.boolean_class->byval_arg;
memset (&ctx, 0, sizeof (ctx));
- icomparable = mono_class_from_name (mono_defaults.corlib, "System", "IComparable`1");
- g_assert (icomparable);
+ icomparable = mono_class_load_from_name (mono_defaults.corlib, "System", "IComparable`1");
+
args [0] = &tclass->byval_arg;
ctx.class_inst = mono_metadata_get_generic_inst (1, args);
if (mono_class_is_assignable_from (mono_class_inflate_generic_class (icomparable, &ctx), tclass)) {
- gcomparer = mono_class_from_name (mono_defaults.corlib, "System.Collections.Generic", "GenericComparer`1");
- g_assert (gcomparer);
+ gcomparer = mono_class_load_from_name (mono_defaults.corlib, "System.Collections.Generic", "GenericComparer`1");
add_generic_class (acfg, mono_class_inflate_generic_class (gcomparer, &ctx), FALSE, "Comparer<T>");
}
}
memset (&ctx, 0, sizeof (ctx));
- iface = mono_class_from_name (mono_defaults.corlib, "System", "IEquatable`1");
+ iface = mono_class_load_from_name (mono_defaults.corlib, "System", "IEquatable`1");
g_assert (iface);
args [0] = &tclass->byval_arg;
ctx.class_inst = mono_metadata_get_generic_inst (1, args);
if (mono_class_is_assignable_from (mono_class_inflate_generic_class (iface, &ctx), tclass)) {
- gcomparer = mono_class_from_name (mono_defaults.corlib, "System.Collections.Generic", "GenericEqualityComparer`1");
- g_assert (gcomparer);
+ gcomparer = mono_class_load_from_name (mono_defaults.corlib, "System.Collections.Generic", "GenericEqualityComparer`1");
add_generic_class (acfg, mono_class_inflate_generic_class (gcomparer, &ctx), FALSE, "EqualityComparer<T>");
}
}
args [0] = &tclass->byval_arg;
ctx.class_inst = mono_metadata_get_generic_inst (1, args);
- enum_comparer = mono_class_from_name (mono_defaults.corlib, "System.Collections.Generic", "EnumEqualityComparer`1");
- g_assert (enum_comparer);
+ enum_comparer = mono_class_load_from_name (mono_defaults.corlib, "System.Collections.Generic", "EnumEqualityComparer`1");
add_generic_class (acfg, mono_class_inflate_generic_class (enum_comparer, &ctx), FALSE, "EqualityComparer<T>");
}
}
args [0] = &tclass->byval_arg;
ctx.class_inst = mono_metadata_get_generic_inst (1, args);
- comparer = mono_class_from_name (mono_defaults.corlib, "System.Collections.Generic", "ObjectComparer`1");
- g_assert (comparer);
+ comparer = mono_class_load_from_name (mono_defaults.corlib, "System.Collections.Generic", "ObjectComparer`1");
add_generic_class (acfg, mono_class_inflate_generic_class (comparer, &ctx), FALSE, "Comparer<T>");
}
}
insts [ninsts ++] = &mono_defaults.boolean_class->byval_arg;
/* Add GenericComparer<T> instances for primitive types for Enum.ToString () */
- klass = mono_class_from_name (acfg->image, "System.Collections.Generic", "GenericComparer`1");
+ klass = mono_class_try_load_from_name (acfg->image, "System.Collections.Generic", "GenericComparer`1");
if (klass)
add_instances_of (acfg, klass, insts, ninsts, TRUE);
- klass = mono_class_from_name (acfg->image, "System.Collections.Generic", "GenericEqualityComparer`1");
+ klass = mono_class_try_load_from_name (acfg->image, "System.Collections.Generic", "GenericEqualityComparer`1");
if (klass)
add_instances_of (acfg, klass, insts, ninsts, TRUE);
insts [ninsts ++] = &mono_defaults.uint32_class->byval_arg;
insts [ninsts ++] = &mono_defaults.uint16_class->byval_arg;
insts [ninsts ++] = &mono_defaults.byte_class->byval_arg;
- enum_comparer = mono_class_from_name (mono_defaults.corlib, "System.Collections.Generic", "EnumEqualityComparer`1");
- g_assert (enum_comparer);
+ enum_comparer = mono_class_load_from_name (mono_defaults.corlib, "System.Collections.Generic", "EnumEqualityComparer`1");
add_instances_of (acfg, enum_comparer, insts, ninsts, FALSE);
ninsts = 0;
insts [ninsts ++] = &mono_defaults.int16_class->byval_arg;
- enum_comparer = mono_class_from_name (mono_defaults.corlib, "System.Collections.Generic", "ShortEnumEqualityComparer`1");
- g_assert (enum_comparer);
+ enum_comparer = mono_class_load_from_name (mono_defaults.corlib, "System.Collections.Generic", "ShortEnumEqualityComparer`1");
add_instances_of (acfg, enum_comparer, insts, ninsts, FALSE);
ninsts = 0;
insts [ninsts ++] = &mono_defaults.sbyte_class->byval_arg;
- enum_comparer = mono_class_from_name (mono_defaults.corlib, "System.Collections.Generic", "SByteEnumEqualityComparer`1");
- g_assert (enum_comparer);
+ enum_comparer = mono_class_load_from_name (mono_defaults.corlib, "System.Collections.Generic", "SByteEnumEqualityComparer`1");
add_instances_of (acfg, enum_comparer, insts, ninsts, FALSE);
- enum_comparer = mono_class_from_name (mono_defaults.corlib, "System.Collections.Generic", "LongEnumEqualityComparer`1");
- g_assert (enum_comparer);
+ enum_comparer = mono_class_load_from_name (mono_defaults.corlib, "System.Collections.Generic", "LongEnumEqualityComparer`1");
ninsts = 0;
insts [ninsts ++] = &mono_defaults.int64_class->byval_arg;
insts [ninsts ++] = &mono_defaults.uint64_class->byval_arg;
/* Add instances of the array generic interfaces for primitive types */
/* This will add instances of the InternalArray_ helper methods in Array too */
- klass = mono_class_from_name (acfg->image, "System.Collections.Generic", "ICollection`1");
+ klass = mono_class_try_load_from_name (acfg->image, "System.Collections.Generic", "ICollection`1");
if (klass)
add_instances_of (acfg, klass, insts, ninsts, TRUE);
- klass = mono_class_from_name (acfg->image, "System.Collections.Generic", "IList`1");
+
+ klass = mono_class_try_load_from_name (acfg->image, "System.Collections.Generic", "IList`1");
if (klass)
add_instances_of (acfg, klass, insts, ninsts, TRUE);
- klass = mono_class_from_name (acfg->image, "System.Collections.Generic", "IEnumerable`1");
+
+ klass = mono_class_try_load_from_name (acfg->image, "System.Collections.Generic", "IEnumerable`1");
if (klass)
add_instances_of (acfg, klass, insts, ninsts, TRUE);
MonoGenericContext ctx;
MonoType *args [16];
MonoMethod *m;
- MonoClass *interlocked_klass = mono_class_from_name (mono_defaults.corlib, "System.Threading", "Interlocked");
+ MonoClass *interlocked_klass = mono_class_load_from_name (mono_defaults.corlib, "System.Threading", "Interlocked");
gpointer iter = NULL;
while ((m = mono_class_get_methods (interlocked_klass, &iter))) {
MonoGenericContext ctx;
MonoType *args [16];
MonoMethod *m;
- MonoClass *volatile_klass = mono_class_from_name (mono_defaults.corlib, "System.Threading", "Volatile");
+ MonoClass *volatile_klass = mono_class_try_load_from_name (mono_defaults.corlib, "System.Threading", "Volatile");
gpointer iter = NULL;
if (volatile_klass) {
MonoClass *ex_class;
ex_class =
- mono_class_from_name (mono_defaults.exception_class->image,
+ mono_class_load_from_name (mono_defaults.exception_class->image,
"System", (const char *)patch_info->data.target);
- g_assert (ex_class);
encode_klass_ref (acfg, ex_class, p, &p);
break;
}
* then removing tailcallelim + the global opts.
* strip-dead-prototypes deletes unused intrinsics definitions.
*/
- //opts = g_strdup ("-simplifycfg -domtree -domfrontier -scalarrepl -instcombine -simplifycfg -domtree -domfrontier -scalarrepl -simplify-libcalls -instcombine -simplifycfg -instcombine -simplifycfg -reassociate -domtree -loops -loop-simplify -domfrontier -loop-simplify -lcssa -loop-rotate -licm -lcssa -loop-unswitch -instcombine -scalar-evolution -loop-simplify -lcssa -iv-users -indvars -loop-deletion -loop-simplify -lcssa -loop-unroll -instcombine -memdep -gvn -memdep -memcpyopt -sccp -instcombine -domtree -memdep -dse -adce -simplifycfg -domtree -verify");
/* The dse pass is disabled because of #13734 and #17616 */
/*
* The dse bug is in DeadStoreElimination.cpp:isOverwrite ():
// FIXME: This doesn't work yet
opts = g_strdup ("");
else
+#if LLVM_API_VERSION > 100
+ opts = g_strdup ("-O2");
+#else
opts = g_strdup ("-targetlibinfo -no-aa -basicaa -notti -instcombine -simplifycfg -inline-cost -inline -sroa -domtree -early-cse -lazy-value-info -correlated-propagation -simplifycfg -instcombine -simplifycfg -reassociate -domtree -loops -loop-simplify -lcssa -loop-rotate -licm -lcssa -loop-unswitch -instcombine -scalar-evolution -loop-simplify -lcssa -indvars -loop-idiom -loop-deletion -loop-unroll -memdep -gvn -memdep -memcpyopt -sccp -instcombine -lazy-value-info -correlated-propagation -domtree -memdep -adce -simplifycfg -instcombine -strip-dead-prototypes -domtree -verify");
+#endif
command = g_strdup_printf ("\"%sopt\" -f %s -o \"%s\" \"%s\"", acfg->aot_opts.llvm_path, opts, optbc, tempbc);
aot_printf (acfg, "Executing opt: %s\n", command);
if (execute_system (command) != 0)
g_string_append_printf (acfg->llc_args, " -mono-eh-frame-symbol=%s%s", acfg->user_symbol_prefix, acfg->llvm_eh_frame_symbol);
+#if LLVM_API_VERSION > 100
+ g_string_append_printf (acfg->llc_args, " -disable-tail-calls");
+#endif
+
#if defined(TARGET_MACH) && defined(TARGET_ARM)
/* ios requires PIC code now */
g_string_append_printf (acfg->llc_args, " -relocation-model=pic");
if (bb->region == -1 || !MONO_BBLOCK_IS_IN_REGION (bb, MONO_REGION_TRY))
return NULL;
- exclass = mono_class_from_name (mono_get_corlib (), "System", exname);
+ exclass = mono_class_load_from_name (mono_get_corlib (), "System", exname);
/* search for the handler */
for (i = 0; i < header->num_clauses; ++i) {
clause = &header->clauses [i];
if (ji->dbg_attrs_inited)
return;
- if (!hidden_klass) {
- hidden_klass = mono_class_from_name (mono_defaults.corlib, "System.Diagnostics", "DebuggerHiddenAttribute");
- g_assert (hidden_klass);
- }
- if (!step_through_klass) {
- step_through_klass = mono_class_from_name (mono_defaults.corlib, "System.Diagnostics", "DebuggerStepThroughAttribute");
- g_assert (step_through_klass);
- }
- if (!non_user_klass) {
- non_user_klass = mono_class_from_name (mono_defaults.corlib, "System.Diagnostics", "DebuggerNonUserCodeAttribute");
- g_assert (non_user_klass);
- }
+ if (!hidden_klass)
+ hidden_klass = mono_class_load_from_name (mono_defaults.corlib, "System.Diagnostics", "DebuggerHiddenAttribute");
+
+ if (!step_through_klass)
+ step_through_klass = mono_class_load_from_name (mono_defaults.corlib, "System.Diagnostics", "DebuggerStepThroughAttribute");
+
+ if (!non_user_klass)
+ non_user_klass = mono_class_load_from_name (mono_defaults.corlib, "System.Diagnostics", "DebuggerNonUserCodeAttribute");
ainfo = mono_custom_attrs_from_method (jinfo_get_method (ji));
if (ainfo) {
wait_for_suspend ();
#ifdef TRY_MANAGED_SYSTEM_ENVIRONMENT_EXIT
- env_class = mono_class_from_name (mono_defaults.corlib, "System", "Environment");
+ env_class = mono_class_try_load_from_name (mono_defaults.corlib, "System", "Environment");
if (env_class)
exit_method = mono_class_get_method_from_name (env_class, "Exit", 1);
#endif
#include "config.h"
+#include <llvm-c/Core.h>
+#include <llvm-c/ExecutionEngine.h>
+
+#include "mini-llvm-cpp.h"
+
+#if !defined(MONO_CROSS_COMPILE) && LLVM_API_VERSION < 100
+
#include <stdint.h>
#include <llvm/Support/raw_ostream.h>
#include <llvm/IR/IRBuilder.h>
#include <llvm/IR/Module.h>
-#include <llvm-c/Core.h>
-#include <llvm-c/ExecutionEngine.h>
-
-#include "mini-llvm-cpp.h"
-
-#ifndef MONO_CROSS_COMPILE
-
using namespace llvm;
static void (*unhandled_exception)() = default_mono_llvm_unhandled_exception;
int initial_max_vregs = cfg->next_vreg;
max = cfg->next_vreg;
- defs = (MonoInst **)mono_mempool_alloc (cfg->mempool, sizeof (MonoInst*) * cfg->next_vreg + 1);
- def_index = (gint32 *)mono_mempool_alloc (cfg->mempool, sizeof (guint32) * cfg->next_vreg + 1);
+ defs = (MonoInst **)mono_mempool_alloc (cfg->mempool, sizeof (MonoInst*) * cfg->next_vreg);
+ def_index = (gint32 *)mono_mempool_alloc (cfg->mempool, sizeof (guint32) * cfg->next_vreg);
cfg->cbb = bb_opt = mono_mempool_alloc0 ((cfg)->mempool, sizeof (MonoBasicBlock));
for (bb = cfg->bb_entry; bb; bb = bb->next_bb) {
int sregs [MONO_MAX_SRC_REGS];
int num_sregs, i;
- if ((ins->dreg != -1) && (ins->dreg < max)) {
- defs [ins->dreg] = NULL;
+ if (ins->dreg != -1) {
#if SIZEOF_REGISTER == 4
- defs [ins->dreg + 1] = NULL;
+ const char *spec = INS_INFO (ins->opcode);
+ if (spec [MONO_INST_DEST] == 'l') {
+ defs [ins->dreg + 1] = NULL;
+ defs [ins->dreg + 2] = NULL;
+ }
#endif
+ defs [ins->dreg] = NULL;
}
num_sregs = mono_inst_get_src_registers (ins, sregs);
for (i = 0; i < num_sregs; ++i) {
int sreg = sregs [i];
- if (sreg < max) {
- defs [sreg] = NULL;
#if SIZEOF_REGISTER == 4
+ const char *spec = INS_INFO (ins->opcode);
+ if (spec [MONO_INST_SRC1 + i] == 'l') {
defs [sreg + 1] = NULL;
-#endif
+ defs [sreg + 2] = NULL;
}
+#endif
+ defs [sreg] = NULL;
}
}
/* type loading helpers */
static GENERATE_GET_CLASS_WITH_CACHE (runtime_helpers, System.Runtime.CompilerServices, RuntimeHelpers)
+static GENERATE_TRY_GET_CLASS_WITH_CACHE (debuggable_attribute, System.Diagnostics, DebuggableAttribute)
/*
* Instruction metadata
{
MonoAssembly *ass = m->klass->image->assembly;
MonoCustomAttrInfo* attrs;
- static MonoClass *klass;
+ MonoClass *klass;
int i;
gboolean val = FALSE;
if (ass->jit_optimizer_disabled_inited)
return ass->jit_optimizer_disabled;
- if (!klass)
- klass = mono_class_from_name (mono_defaults.corlib, "System.Diagnostics", "DebuggableAttribute");
+ klass = mono_class_try_get_debuggable_attribute_class ();
+
if (!klass) {
/* Linked away */
ass->jit_optimizer_disabled = FALSE;
amd64_patch (patch_info->ip.i + cfg->native_code, code);
- exc_class = mono_class_from_name (mono_defaults.corlib, "System", patch_info->data.name);
- g_assert (exc_class);
+ exc_class = mono_class_load_from_name (mono_defaults.corlib, "System", patch_info->data.name);
throw_ip = patch_info->ip.i;
//x86_breakpoint (code);
}
arm_patch (ip, code);
- exc_class = mono_class_from_name (mono_defaults.corlib, "System", patch_info->data.name);
- g_assert (exc_class);
+ exc_class = mono_class_load_from_name (mono_defaults.corlib, "System", patch_info->data.name);
ARM_MOV_REG_REG (code, ARMREG_R1, ARMREG_LR);
#ifdef USE_JUMP_TABLES
return FALSE;
}
+/* Lazy class loading functions */
+static GENERATE_TRY_GET_CLASS_WITH_CACHE (iasync_state_machine, System.Runtime.CompilerServices, IAsyncStateMachine)
+static GENERATE_TRY_GET_CLASS_WITH_CACHE (async_state_machine_attribute, System.Runtime.CompilerServices, AsyncStateMachineAttribute)
+
+
static G_GNUC_UNUSED gboolean
is_async_state_machine_class (MonoClass *klass)
{
- static MonoClass *iclass;
- static gboolean iclass_set;
+ MonoClass *iclass;
return FALSE;
- if (!iclass_set) {
- iclass = mono_class_from_name (mono_defaults.corlib, "System.Runtime.CompilerServices", "IAsyncStateMachine");
- mono_memory_barrier ();
- iclass_set = TRUE;
- }
+ iclass = mono_class_try_get_iasync_state_machine_class ();
if (iclass && klass->valuetype && mono_class_is_assignable_from (iclass, klass))
return TRUE;
MonoCustomAttrInfo *cattr;
MonoMethodSignature *sig;
gboolean res = FALSE;
- static MonoClass *attr_class;
- static gboolean attr_class_set;
+ MonoClass *attr_class;
return FALSE;
- if (!attr_class_set) {
- attr_class = mono_class_from_name (mono_defaults.corlib, "System.Runtime.CompilerServices", "AsyncStateMachineAttribute");
- mono_memory_barrier ();
- attr_class_set = TRUE;
- }
+ attr_class = mono_class_try_get_iasync_state_machine_class ();
/* Do less expensive checks first */
sig = mono_method_signature (method);
guint8* buf;
guint64 exc_token_index;
- exc_class = mono_class_from_name (mono_defaults.corlib, "System", patch_info->data.name);
- g_assert (exc_class);
+ exc_class = mono_class_load_from_name (mono_defaults.corlib, "System", patch_info->data.name);
exc_token_index = mono_metadata_token_index (exc_class->type_token);
throw_ip = cfg->native_code + patch_info->ip.i;
static void emit_dbg_loc (EmitContext *ctx, LLVMBuilderRef builder, const unsigned char *cil_code);
static LLVMValueRef emit_dbg_subprogram (EmitContext *ctx, MonoCompile *cfg, LLVMValueRef method, const char *name);
static void emit_dbg_info (MonoLLVMModule *module, const char *filename, const char *cu_name);
-
+static void emit_cond_system_exception (EmitContext *ctx, MonoBasicBlock *bb, const char *exc_type, LLVMValueRef cmp);
static inline void
set_failure (EmitContext *ctx, const char *message)
const char *intrins_name;
LLVMValueRef args [16], res;
LLVMTypeRef addr_type;
+ gboolean use_intrinsics = TRUE;
+#if LLVM_API_VERSION > 100
if (is_faulting && bb->region != -1 && !ctx->cfg->llvm_only) {
+ /* The llvm.mono.load/store intrinsics are not supported by this llvm version, emit an explicit null check instead */
+ LLVMValueRef cmp = LLVMBuildICmp (*builder_ref, LLVMIntEQ, addr, LLVMConstNull (LLVMTypeOf (addr)), "");
+ emit_cond_system_exception (ctx, bb, "NullReferenceException", cmp);
+ *builder_ref = ctx->builder;
+ use_intrinsics = FALSE;
+ }
+#endif
+
+ if (is_faulting && bb->region != -1 && !ctx->cfg->llvm_only && use_intrinsics) {
LLVMAtomicOrdering ordering;
switch (barrier) {
{
const char *intrins_name;
LLVMValueRef args [16];
+ gboolean use_intrinsics = TRUE;
+#if LLVM_API_VERSION > 100
if (is_faulting && bb->region != -1 && !ctx->cfg->llvm_only) {
+ /* The llvm.mono.load/store intrinsics are not supported by this llvm version, emit an explicit null check instead */
+ LLVMValueRef cmp = LLVMBuildICmp (*builder_ref, LLVMIntEQ, addr, LLVMConstNull (LLVMTypeOf (addr)), "");
+ emit_cond_system_exception (ctx, bb, "NullReferenceException", cmp);
+ *builder_ref = ctx->builder;
+ use_intrinsics = FALSE;
+ }
+#endif
+
+ if (is_faulting && bb->region != -1 && !ctx->cfg->llvm_only && use_intrinsics) {
LLVMAtomicOrdering ordering;
switch (barrier) {
LLVMBuildCondBr (ctx->builder, cmp, ex_bb, noex_bb);
- exc_class = mono_class_from_name (mono_get_corlib (), "System", exc_type);
- g_assert (exc_class);
+ exc_class = mono_class_load_from_name (mono_get_corlib (), "System", exc_type);
/* Emit exception throwing code */
ctx->builder = builder = create_builder (ctx);
break;
case OP_FCONV_TO_U1:
case OP_RCONV_TO_U1:
- values [ins->dreg] = LLVMBuildZExt (builder, LLVMBuildFPToUI (builder, lhs, LLVMInt8Type (), dname), LLVMInt32Type (), "");
+ values [ins->dreg] = LLVMBuildZExt (builder, LLVMBuildTrunc (builder, LLVMBuildFPToUI (builder, lhs, IntPtrType (), dname), LLVMInt8Type (), ""), LLVMInt32Type (), "");
break;
case OP_FCONV_TO_I2:
case OP_RCONV_TO_I2:
* they can't fail, allowing them to be hoisted out of loops.
*/
set_invariant_load_flag (values [ins->dreg]);
+#if LLVM_API_VERSION < 100
set_metadata_flag (values [ins->dreg], "mono.nofail.load");
+#endif
}
if (sext)
gpointer addr;
MonoClass *exc_class;
- exc_class = mono_class_from_name (mono_defaults.corlib, "System", name);
- g_assert (exc_class);
+ exc_class = mono_class_load_from_name (mono_defaults.corlib, "System", name);
mips_load_const (code, mips_a0, exc_class->type_token);
addr = mono_get_throw_corlib_exception ();
exc_throw_pos [i] = code;
}
- exc_class = mono_class_from_name (mono_defaults.corlib, "System", patch_info->data.name);
- g_assert (exc_class);
+ exc_class = mono_class_load_from_name (mono_defaults.corlib, "System", patch_info->data.name);
ppc_patch (ip, code);
/*mono_add_patch_info (cfg, code - cfg->native_code, MONO_PATCH_INFO_EXC_NAME, patch_info->data.target);*/
/*-----------------------------------------------------*/
s390_patch_rel (ip + 2, (guint64) S390_RELATIVE(code,ip));
- exc_class = mono_class_from_name (mono_defaults.corlib,
+ exc_class = mono_class_load_from_name (mono_defaults.corlib,
"System",
patch_info->data.name);
- g_assert (exc_class);
throw_ip = patch_info->ip.i;
for (iExc = 0; iExc < nThrows; ++iExc)
sparc_patch ((guint32*)(cfg->native_code + patch_info->ip.i), code);
- exc_class = mono_class_from_name (mono_defaults.corlib, "System", patch_info->data.name);
- g_assert (exc_class);
+ exc_class = mono_class_load_from_name (mono_defaults.corlib, "System", patch_info->data.name);
type_idx = exc_class->type_token - MONO_TOKEN_TYPE_DEF;
throw_ip = patch_info->ip.i;
x86_patch (patch_info->ip.i + cfg->native_code, code);
- exc_class = mono_class_from_name (mono_defaults.corlib, "System", patch_info->data.name);
- g_assert (exc_class);
+ exc_class = mono_class_load_from_name (mono_defaults.corlib, "System", patch_info->data.name);
throw_ip = patch_info->ip.i;
/* Find a throw sequence for the same exception class */
vfprintf (stdout, format, ap);
fprintf (stdout, "\n");
va_end (ap);
- klass = mono_class_from_name (mono_get_corlib (), "System", "Environment");
+ klass = mono_class_load_from_name (mono_get_corlib (), "System", "Environment");
mono_class_init (klass);
prop = mono_class_get_property_from_name (klass, "StackTrace");
str = (MonoString*)mono_property_get_value (prop, NULL, NULL, NULL);
return 2;
}
- public static int Main () {
- return TestDriver.RunTests (typeof (Tests));
+ public static int Main (string[] args) {
+ return TestDriver.RunTests (typeof (Tests), args);
}
}
break;
case MONO_ERROR_TYPE_LOAD:
- if (error->type_name || error->assembly_name) {
+ if (error->type_name && error->assembly_name) {
type_name = get_type_name_as_mono_string (error, domain, error_out);
if (!mono_error_ok (error_out))
break;