Compare commits

...
118 Commits
Author SHA1 Message Date
Ankit Jain 96c0883549 [msbuild] Add symlink to csc.exe in msbuild bin dir
Roslyn looks only inside `$msbuild_bin/Roslyn/` and does not fallback to
the framework path. msbuild worked around this by setting `CscToolPath`:

https://github.com/mono/msbuild/commit/157a0f4d1a7aadd4e561e3ca8c784cbc2529926f

But this kicks in only if the default msbuild target files are imported!
If the `Csc` task is being used without importing them, then we fail
with

	`error MSB3082: Task failed because "csc.exe" was not found.`

`Microsoft.CodeAnalysis.VisualBasic.dll` is the only file not being
symlinked, after this change. So, instead we will symlink all the files.

Fixes bxc #60340 .

Cherry-pick 26ccf75f06
2017-10-25 09:14:54 +02:00
Bernhard Urban 60b980b3bb [System.Net] Tweak tests for watchOS 2017-10-18 20:00:11 +02:00
Bernhard Urban 3c84401ec8 [eglib] check if result is set
quote from the darwin man page:

> The functions getpwnam_r(), getpwuid_r(), and getpwuuid_r()
> return 0 if no error occurred, or an error number to indicate
> failure.  It is not an error if a matching entry is not found.
> (Thus, if result is NULL and the return value is 0, no
> matching entry exists.)
2017-10-18 10:24:16 +02:00
Bernhard Urban 44162b8a8b [linker] update referenced source files 2017-10-18 10:16:34 +02:00
Bernhard Urban 355944f0d6 Bump linker 2017-10-18 10:16:34 +02:00
Alexander Köplinger 9f4a644133 [msvc] Fix MONO_CORLIB_VERSION to match configure.ac (#5770)
When I simplified MONO_CORLIB_VERSION to only include major.minor
instead of major.minor.build in https://github.com/mono/mono/pull/5449
I forgot to apply the same change to the msvc copy of that logic.

(cherry picked from commit 43757d67ef)
2017-10-12 02:35:04 +02:00
Zoltan Varga c83b0a3f98 [llvm] Map byref types to the same type as the this argument so they are called using the same signature if the this argument is passed explicitly. Fixes #59436. (#5572) (#5756) 2017-10-11 08:49:21 +02:00
Rolf Bjarne Kvinge b7422c2c22 [appletls] Trust SecTrustResult.Proceed as well. Fixes #58411.
Apple states clearly in their documentation about SecTrustResult.Proceed [1]:

    The user explicitly chose to trust a certificate in the chain (usually by
    clicking a button in a certificate trust panel).

    Your app should trust the chain.

This fixes bug #[58411][2], where SecTrustEvaluate returns
SecTrustResult.Proceed starting with iOS 11.

[1]: https://developer.apple.com/documentation/security/1394363-sectrustevaluate
[2]: https://bugzilla.xamarin.com/show_bug.cgi?id=58411
2017-10-06 08:48:50 +02:00
Marek Habersack c9e78b5322 [monodroid] Fix Mono.Posix tests build (#5697) (#5701)
TestHelper was previously excluded because the XA tests weren't built
as part of Mono but rather as part of XA test suite which included
its own version of the helper. Now, however (https://github.com/xamarin/xamarin-android/commit/e9daf5ea35709ce1bc6ba81c7c37d72d385bace2),
XA uses BCL+friends test assemblies built by Mono itself and so
we need to restore TestHelper in the build.
2017-10-05 03:12:40 +02:00
Cody Russell 7898a926f0 Add glib to the list of packages with debugging symbols.
(cherry picked from commit f99b88b812)
2017-10-04 17:56:30 +02:00
Marek Habersack a3000fbb7f Prepare Mono for Android NDK with unified headers (#5680)
Up until NDK release 14 Android SDK included a separate set of C header
files for each supported platform. NDK 14 introduced a new set of those
headers (they are NOT the same as the old ones) which unifies support
for all of the platforms so that bug fixes are available for all the
API levels without having to backport etc. With NDK 15 the unified headers
become the default ones (including when creating standalone toolchains)
and with NDK 16 (in beta currently) the old per-platform headers are removed.

Unfortunately, the new headers introduce breaking changes which made it
impossible to build Mono with NDK configured to use them. This commit makes
a handful of changes to Mono which make it build with unified headers.
2017-10-03 20:38:17 +02:00
Zoltan Varga df4669b216 [jit] Fix the saving of the 'cfg->ret_var_set' flag when inlining, it… (#5674)
* [jit] Fix the saving of the 'cfg->ret_var_set' flag when inlining, it was set to FALSE before it was saved, causing invalid code to be generated in some cases when doing nested inlining. Fixes #59608. (#5654)

* Bump API snapshot submodule
2017-10-03 12:23:14 +02:00
Marek Safar 76db8b168c [ilasm] Adds AggressiveInlining support 2017-10-03 00:17:29 +02:00
Aleksey Kliger 0f76c2acec [sre] register a canonical MonoReflectionMethod for a methodref token
In mono_image_create_token we are passed in a managed reflection object and we
need to create a token for it and optionally register it so that we can resolve
that token back to a runtime structure and managed object later.

For a MonoReflectionMethod object that refers to a method from outside the
current dynamic image, we need to generate a memberref token.  It will be the
same token for the same underlying MonoMethod*.  When we go to register the
token with mono_dynamic_image_register_token we need to pass a managed object.
Unfortunately two MonoReflectionMethod objects could refer to the same
MonoMethod* but differ in their ReflectedType, so just registering the
passed-in MonoReflectionMethod means we could assert in
mono_dynamic_image_register_token because previously we may have registered the
same method via a different ReflectedType.

So what we do is we cal mono_method_get_object_handle with NULL for the
reflected type - which corresponds to just using the DeclaringType of the given
MonoMethod*.

Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=59364
2017-09-29 08:57:15 +02:00
Aleksey Kliger 1a431e6183 [sre] Expect a new token for MonoArrayMethod and SignatureHelper 2017-09-29 08:57:15 +02:00
Aleksey Kliger 0e86b9e40b [sre] Remove MonoDynamicImage:handleref_managed field
It's now unused.
2017-09-29 08:57:15 +02:00
Aleksey Kliger ce75ab6aed [sre] Map fieldref tokens to MonoClassField*
Previously, we mapped fieldref tokens to MonoReflectionField managed objects,
But the object is just used as a key for caching the token so we may as well
use the native field instead of a managed object.
2017-09-29 08:57:15 +02:00
Aleksey Kliger 75367e0413 [sre] Wrap mono_image_create_token with HANDLE_FUNCTION_{ENTER,RETURN}
We will allocate a handle for the object that we will register.  For now it's
just an alias of the object passed in, but it could differ.
2017-09-29 08:57:15 +02:00
Aleksey Kliger 044b7d4ac8 [test] SRE ILGenerator test for methodref and fieldref token caching
Regression test for https://bugzilla.xamarin.com/show_bug.cgi?id=59364

We need to cause SRE to generate the same methodref/fieldref token from two
different reflection objects.  That happens if you get the same method or field
via a base and a derived class so that the MemberInfo:DeclaredType is different
but the underlying MonoMethod* or MonoClassField* is the same.
2017-09-29 08:57:15 +02:00
Ankit Jain 707e9c6b03 [msbuild] Bump msbuild to fix test failures on wrench (#5662) 2017-09-29 02:48:00 +02:00
Ludovic Henry ce9765ffe0 Merge pull request #5645 from luhenry/backport-2017-08-1d763c4dc62964059281766ffc0b73bfb5fb68a0
[w32process] Fix inverted kernel and user ticks (#5641)
2017-09-27 17:01:41 -04:00
Ludovic Henry 85d51db4f0 Merge pull request #5649 from luhenry/backport-2017-08-932a58ea407d6878d610cbe516d901293977aba1
[w32handle] Only own first handle if doing WaitHandle.WaitAny (#5625)
2017-09-27 15:14:44 -04:00
Manuel de la Pena af502ec4df Fix bug 4786 test. (#5653)
The fix in #5501 had a scoping error causing `make check` to fail.
2017-09-27 19:53:03 +02:00
Ludovic Henry b72ef417bc [Tests] Fail with message in case symlink fails 2017-09-27 16:05:17 +02:00
Ludovic Henry bc699443c1 [w32handle] Only own first handle if doing WaitHandle.WaitAny (#5625)
This is the behaviour on .NET, even if it goes against the documentation at https://msdn.microsoft.com/en-us/library/tdykks7z(v=vs.110).aspx#Anchor_2

Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=59281
2017-09-27 09:22:43 -04:00
Ludovic Henry addce38b83 [w32process] Fix inverted kernel and user ticks (#5641) 2017-09-27 09:10:28 -04:00
Katelyn Gadd b2250d8ecf Fix bug 57918:
Async Socket reads that need to perform multiple underlying read operations fail to return a correct total # of bytes read
2017-09-26 09:16:07 +02:00
Aleksey Kliger cfe2428963 [class] Use constraints of gparam T2 in T1.IsAssignableFrom (T2)
Suppose we want to know C.IsAssignableFrom (T1):
```
  class C { }
  class G<T1, T2> where T1 : T2, T2 : C { }
```

Previously, we would get `False`, because we only checked the constraints of T1
if C was an interface or another gparam.  Now Instead we always consider the
constraints in `A.IsAssignableFrom (B)` whenever `B` is a gparam.

Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=58809
2017-09-26 08:51:52 +02:00
Aleksey Kliger e51d521ff9 [test] Add regression test for 58809
Check that generic parameters's constraints properly affect the subclass and
interface relationships even when the constraints relate several of the generic
parameters themselves.
2017-09-26 08:51:52 +02:00
Cody Russell d5885b1996 Merge pull request #5621 from mono/2017-08-bump-bockbuild
Bump bockbuild to get gtk Japanese IME fixes
2017-09-21 15:18:16 -05:00
Cody Russell b429bfe794 Bump bockbuild to get gtk Japanese IME fixes 2017-09-21 11:04:32 -05:00
Rolf Bjarne Kvinge 48e94bd5f6 [mono-api-html] Print ref/out modifiers on parameters. Fixes #59430.
Print ref/out modifiers on parameters, so that any changes in ref/out are detected.

https://bugzilla.xamarin.com/show_bug.cgi?id=59430
2017-09-21 11:09:30 +02:00
Marek Safar 726b2befe9 Merge pull request #5604 from lambdageek/bug-43563-2017-08
[2017-08][loader] Init MonoClass:sizes.element_size lazily (Fixes #43563)
2017-09-19 08:44:18 +02:00
Aleksey Kliger bff4165b8d [loader] Init MonoClass:sizes.element_size lazily (Fixes #43563)
Originally mono_bounded_array_class_get () would populate
MonoClass:sizes.element_size as soon as the MonoClass for the array was needed.
This is a problem because we cannot call mono_class_array_element_size () on
the element class on a valuetype until mono_class_layout_fields () finishes
initializing it.

That means that structs which contain an array of themselves would hit the
recursive initialization check in mono_class_setup_fields and the MonoClass for
the element class would be marked as failed to load.

Instead we rely on the MonoClass:size_inited bit to tell us whether the array
class has been initialized and if not, we set the array element size in
mono_class_layout_fields.

This is possible because MonoClass:sizes.element_size is only really needed to
know how to allocate space for an array.  When laying out a class that contains
an array we don't need the element size - they array is just a reference type.

Example:
```csharp
struct S {
    static S[][] foo;
}
```

Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=43563
2017-09-18 11:09:25 -04:00
Aleksey Kliger b4ec38c280 [tests] Check that runtime can represent recursive structs
Regression tests for https://bugzilla.xamarin.com/show_bug.cgi?id=43563
2017-09-18 11:09:24 -04:00
Aleksey Kliger d5cfcd6b2a [loader] Improve error message when a field's type is a failed class
Add the class failure to the field failure error message.
2017-09-18 11:09:24 -04:00
Aleksey Kliger 1ee454fce3 [loader] If signaling recursive type initialize, don't double free
If we detect that a recursive type initialization is happening, we should leave
without removing the class from the init_pending_tld_id list.  Otherwise we get
a double-free when the outer recursive call finally finishes and tries to
remove the same element.

Also re-load the init_list from TLS since a recursive call to mono_class_init could
have modified it between the time the current mono_class_init call started and
when it is finishing.
2017-09-18 11:09:23 -04:00
Ankit Jain 24775d13d4 [msbuild] Bump to get workaround for bxc #55697 . (#5590)
https://github.com/mono/msbuild/commit/8b76a1d2b9ffc493349a861962e44540ea14eaac
2017-09-15 10:06:54 -04:00
Alexis Christoforides 934465474b Merge pull request #5584 from nosami/2017-08-install-netsdk-targets
Install Microsoft.FSharp.NetSdk.props and targets
2017-09-14 17:19:30 -04:00
nosami 8c1b959850 Install Microsoft.FSharp.NetSdk.props and targets
Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=57771
2017-09-14 20:09:41 +01:00
Alex Rønne Petersen 26c39f88fb Merge pull request #5561 from alexrp/2017-08
[2017-08][profiler] Revert the root_type field back to uleb128.
2017-09-13 21:49:14 +02:00
Ankit Jain 92f7d7ac14 Bump NuGet.BuildTasks to get new updates and switch to dev branch (#5539) 2017-09-13 08:51:05 -04:00
Marek Safar 2636235a82 [corlib] Update negative symbol for all cultures. Fixes #57496 2017-09-13 13:44:40 +02:00
Aleksey Kliger 5267bcb2b7 [appdomain] Catch exceptions when invoking AppDomain.DoAssemblyResolve
Otherwise we may leak a coop handle for the requesting assembly, which may
lead to an assertion when we unload the current domain.
2017-09-13 11:28:39 +02:00
Aleksey Kliger d03c1a55e0 [test] Regression test for #58950
If a reflection only assembly resolve event handler throws an exception, catch
the exception in the runtime to ensure that no coop handles leak.
2017-09-13 11:28:39 +02:00
Alex Rønne Petersen 63798ae475 [profiler] Revert the root_type field back to uleb128.
It's actually a 32-bit value.
2017-09-13 09:18:38 +02:00
Ankit Jain 31c099d7ca [msbuild] Bump msbuild to pick up SDK updates (#5547) 2017-09-12 16:45:43 -04:00
Jason Imison ad9daeaf58 [F#] Reinstate _DebugFileExt as it's needed for mobile debugging. (#5537)
Also added a mechanism for users to override DebugType
2017-09-09 00:27:30 +02:00
Jason Imison 829534374f F# portable debugging (#5530)
* Switch F# builds over to portable pdb

* Add portable pdb metadata fix from https://github.com/Microsoft/visualfsharp/pull/3553
2017-09-08 14:32:01 +02:00
Manuel de la Pena 6ce90d742b [Tests] Fix Mono.Data.Tds tests on iOS (#5501)
* [Tests] Fix Mono.Data.Tds tests on iOS

The modified tests failed on iOS following PR:
https://github.com/xamarin/xamarin-macios/pull/2580 that adds support
for Xharness to run the Mono.Data.Tds on Xamarin.iOS. With the changes
the tests run a expected.

* Close Listener when done.

(cherry picked from commit a09b912b86)
2017-09-08 14:11:16 +02:00
Marek Safar 28dcb2abb3 Bump roslyn to 2.3.2 2017-09-08 11:58:02 +02:00
Alexander Köplinger 1438e3a015 Fix partial cherry-pick of updating reference-assemblies 2017-09-07 18:39:21 +02:00
Alexander Köplinger b403e9b528 Update reference-assemblies 2017-09-07 12:27:42 +02:00
Bernhard Urban f02e94d25c Merge pull request #5514 from lewurm/2017-08-gethashcode-delegate
[2017-08][bcl] Use RuntimeHelpers.GetHashCode () for getting the hash code of …
2017-09-06 14:03:21 +02:00
Zoltan Varga c93b4d1722 [bcl] Use RuntimeHelpers.GetHashCode () for getting the hash code of … (#5511)
* [bcl] Use RuntimeHelpers.GetHashCode () for getting the hash code of the delegate target to avoid calling user defined hash code implementations which can throw exceptions. Fixes a regression introduced by a48bc43985.

* add test for #59235

https://bugzilla.xamarin.com/show_bug.cgi?id=59235

* [fixup] RuntimeHelpers.GetHashCode handles null
2017-09-06 13:58:44 +02:00
Rodrigo Kumpera 5d37aa59b9 [mini] Handle magic interfaces in common_trampoline as if they were variant.
With the introduction of magic array interfaces, they must be handled as if they
were variant if they are being dispatched against an array.

This was not being done in common_trampoline and resulted in the IMT thunk never
getting rebuilt and getting decent perf.

With this patch, dispatch to simple methods such as Array::Count over a magic interface
in a covariant case (such as IList<object> dispatch onto string[]) will accrue gvi's.

On a trivial benchmark of executing Count 1M times, perf goes from 760ms to 50ms.
2017-09-04 11:04:04 +02:00
Bernhard Urban 3c7e98aa62 Merge pull request #5494 from lewurm/2017-08-mono-api-html
[2017-08][mono-api-html] Allow `-r` to ignore class removals
2017-09-04 10:41:39 +02:00
Jonathan Pryor 0e2248ca22 [mono-api-html] Allow -r to ignore class removals
Allow `mono-api-html -r REGEX` to be used to silence messages
regarding class and namespace removals in addition to member removals.
2017-09-01 23:27:09 +02:00
Martin Baulig ec43cc1dc4 [Mono.Security]: Add 'MonoTlsProvider.SupportsCleanShutdown' and 'MonoTlsSettings.SendCloseNotify'. (#5465) (#5478)
Only send close_notify when using BTLS and explicitly requested via 'MonoTlsSettings.SendCloseNotify'.
(cherry picked from commit 4a79280b3b)
2017-08-31 12:49:43 -04:00
Marek Safar 3cd2ccce57 Bump cecil 2017-08-31 15:34:40 +02:00
Ludovic Henry eaff739a03 [w32error] Add ENODEV -> ERROR_DEV_NOT_EXIST error translation (#5385) (#5391)
Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=58738
2017-08-30 17:58:03 -04:00
Ludovic Henry 742e703eb4 [marshal] Rethrow in native-to-managed wrapper to keep exception stacktrace (#5384) (#5395)
* [marshal] Rethrow in native-to-managed wrapper to keep exception stacktrace

Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=58782

* [interp] disable tests for 58782 as they rely on appdomains
2017-08-30 17:57:38 -04:00
Zoltan Varga fe214b46bd [amd64] Make code patching smp safe for the case where we emit a mov + call_reg. Hopefully fixes #57959. (#5452) 2017-08-28 16:28:51 -04:00
Alexander Köplinger c843b3f25f [configure.ac] Don't include the .build number in runtime-corlib version (#5449)
It's causing unnecessary complexity because we need to create a new
monolite when bumping the .build number in a major.minor.build
version like from 5.2.0 -> 5.2.1

corlib version bumps are very rare in those cases and even then
you can just increment the MONO_CORLIB_COUNTER variable.
(cherry picked from commit ec9a95dd53)
2017-08-25 21:59:25 +02:00
Alex Rønne Petersen b5e1cb7236 [profiler] Correct the description of the 'legacy' option. 2017-08-25 21:07:12 +02:00
Alex Rønne Petersen 47f6b08657 [profiler] Fix code coverage support. 2017-08-24 23:04:22 +02:00
Uri Simchoni 1d8c43241a [profiler] Fix log profiler SetMonitorEvents icall
Set the right flag when enabling/disabling monitor
event profiling
2017-08-24 23:04:15 +02:00
Alex Rønne Petersen 90be24e928 [profiler] Add a missing method_leave event for the CEE_MONO_RETOBJ opcode. 2017-08-24 23:04:03 +02:00
Alex Rønne Petersen 34a97709ce [profiler] Add a missing method_tail_call event when the tailc optimization is enabled. 2017-08-24 23:03:51 +02:00
Marek Safar 632c5e8e1c [mcs] Update logic when checking for tuple element names when overriding inherited member 2017-08-24 10:39:28 +02:00
Marek Safar b0527fafe3 [threadpool] Reduce logging verbosity level. Fixes #58829 2017-08-23 09:49:35 +02:00
Rogier Hofboer e3a2754a33 [Mono.Security] Bugfix of bug 23153. Certificate loop variable not used to find certificate 2017-08-22 16:42:46 +02:00
Jo Shields 0deb1fd312 [msi] Fix typos in f9bdab7928
(cherry picked from commit da9287e432)
2017-08-22 10:19:21 -04:00
Alexander Köplinger 3ffbfe94c9 [MacSDK] Whitelist the csi script
(cherry picked from commit 27877d7103)
2017-08-22 12:50:23 +02:00
Martin Baulig 51599d15b2 [System]: Fix major AppleTls memory leak. Bug #56814. (#5370) (#5375)
(cherry picked from commit c74f44126e)
2017-08-21 17:01:44 -04:00
Martin Baulig 68fc0a509f [System]: Fix minor leaks in AppleTls. (#5369) (#5374)
These should be automatically collected by the GC, but explicitly disposing
will keep memory usage more stable over time and keep pressure off the GC.

(cherry picked from commit 093915cf83)
(cherry picked from commit 9b8bb0edbe)
2017-08-21 17:01:22 -04:00
Jo Shields 6eaec1bb59 [msi] Pull in MSI changes from Mono 5.2 branch
(cherry picked from commit 929575bb0e)
2017-08-21 10:02:42 -04:00
Alexander Köplinger de06b9c866 Bump libgdiplus (#5393)
(cherry picked from commit 538829f456)
2017-08-21 15:29:43 +02:00
Alexander Köplinger ec16c55370 Bump timeout for TaskTests.Delay_Simple (#5410)
Should be reverted once https://bugzilla.xamarin.com/show_bug.cgi?id=58877 is investigated and fixed.
(cherry picked from commit f567c2e5eb)
2017-08-21 13:47:24 +02:00
Aleksey Kliger dcc1d41ffb [threads] Use designated initializer syntax in MAKE_SPECIAL_STATIC_OFFSET
Originally we used a C90-style struct initializer `{ (index), (offset), (type)
}`.  Unfortunately, SpecialStaticOffset is defined with fields in a different
order on big-endian and little-endian machines.  Using a designated
initializer, we don't have to care about the order.
2017-08-18 18:00:29 -04:00
Zoltan Varga d6af8351b4 Bump roslyn-binaries.
(cherry picked from commit 8f0de0cbfb)
2017-08-18 01:25:50 +02:00
Alexander Köplinger c3c06baf61 Bump bockbuild to remove gtk+ screen patch 2017-08-17 21:14:02 +02:00
Ludovic Henry c5a0d0e011 [corlib] Increase timeout for MonoTests.System.Runtime.Remoting.TestSynchronizationReleasedOnMultipleAcquire (#5373)
(cherry picked from commit 6e30ded242)
2017-08-17 19:01:22 +02:00
Alexander Köplinger 5e8d4de0f7 Bump bockbuild 2017-08-17 18:47:09 +02:00
Marek Safar b4632e0789 Bump api-snapshot (#5383) 2017-08-16 23:07:20 +02:00
Ankit Jain 141d8fafaa [msbuild] Bump to xplat-master branch HEAD 2017-08-16 15:01:33 -04:00
Marek Safar 259864a1d3 Update list of denied assemblies 2017-08-16 14:56:41 -04:00
Ankit Jain 3eb8d6d178 [msbuild] Install a deniedAssembliesList.txt to support denied ... (#5358)
... assemblies.

msbuild tries to filter out the denied assemblies, which mono refuses to
load, during a build. It uses the `deniedAssembliesList.txt` installed
to `$mono_prefix/lib/mono/xbuild` to identify them.

This was generated with:

 `$ mono tools/nuget-hash-extractor/nuget-hash-extractor.exe nugets guids_for_msbuild > mcs/tools/xbuild/data/deniedAssembliesList.txt`

This file needs to be kept in sync with any changes in the assemblies
denied by the runtime.

msbuild PR that adds support for this -
https://github.com/mono/msbuild/pull/23 .

cherry-pick 823bca4aed
2017-08-16 14:56:23 -04:00
Ankit Jain 3deebbf487 Install Roslyn binaries, including msbuild tasks to msbuild/Roslyn (#5251)
.. directory, which is `$mono_prefix/lib/mono/msbuild/15.0/bin/Roslyn/`

Mono installs `csc.exe` but the corresponding
`Microsoft.Build.Tasks.CodeAnalysis.dll` required for supporting msbuild C#
projects is installed by msbuild. But these two can get out of sync,
like they did and had to be worked around in
https://github.com/mono/msbuild/pull/19 .

Instead, we now install all the relevant roslyn bits (C# and VB) from the same
source. Only the msbuild specific files are copied to the Roslyn folder.
VBCSCompiler, csi and their dependencies are symlinked from `lib/mono/4.5`.

Also:

- csi.exe is included since the tool is surfaced as an msbuild task,
  and that requires the *Scripting.dll assemblies.
- VBCSCompiler* - shared compiler is installed
- vbc.exe doesn't work on mono currently, so skipping that
- And `Microsoft.DiaSymReader.Native.{amd64,x86}.dll` are dropped.

Cherry-picking 43cec6c0dd
2017-08-16 14:54:52 -04:00
Alexander Köplinger 0e486b814f Bump bockbuild 2017-08-16 19:09:13 +02:00
Marek Safar 04f45d88f9 netstandard dependant facades update after 2.0 release (#5371) 2017-08-15 23:29:42 +02:00
Alexis Christoforides fdd7beb707 [MacSDK] Update bockbuild to work around build/staging issue
Commit message: Allow for non-fatal shell execution, and turn “install_name_tool” staging failures to warnings as we find a more permanent solution to AOT dylibs not always having enough field space for the new path (all other dylibs made in the build with the XCode toolchain typically do, as they are built with the “-headerpad_max_install_names” flag.
2017-08-15 11:28:26 -04:00
Aleksey Kliger (λgeek) 0ec03cb37c Merge pull request #5365 from lambdageek/bug-17325-2017-08
[2017-08][remoting] transparent proxy GetType of an interface should return the interface Type, not MarshalByRefObject. (Fixes #17325)
2017-08-14 16:31:31 -04:00
Alexander Köplinger 03298038d7 Bump nuget to latest 4.3.0 release (#5368)
(cherry picked from commit a9a08890cb)
2017-08-14 19:30:19 +02:00
Alexis Christoforides 310bba2a01 [MacSDK] Switch to HTTPS for downloading SQLite
(cherry picked from commit aa2ea3b812)
2017-08-14 19:28:54 +02:00
Alexander Köplinger db62348438 Bump nuget-buildtasks (#5364)
Includes https://github.com/NuGet/NuGet.BuildTasks/pull/35

(cherry picked from commit e88178655b)
2017-08-14 17:54:25 +02:00
Aleksey Kliger f5040c4e67 [remoting] transparent proxy GetType of an interface should return the
interface Type, not MarshalByRefObject. (Fixes #17325)

If a RealProxy instance is created (using the protected RealProxy(Type)
constructor) for an interface, mono internally sets up a MonoRemoteClass which
looks like a proxy for a MarshalByRefObject instance that happens to implement
the given interface.  However mono_class_proxy_vtable just does a memcpy() to
setup the MonoVTable:type field of the transparent proxy's vtable.  That type
field is hit by the JIT when System.Object.GetType() is called - and on .NET
Framework GetType for a transparent proxy of an interface returns the interface
not (as Mono used to) typeof(MarshalByRefObject).

Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=17325
2017-08-14 11:17:49 -04:00
Aleksey Kliger 1d366da8f0 [test] Add regression test for GetType() of a transparent proxy.
Check that calling GetType() on a transparent proxy of a RealProxy of an
interface returns that interface type.
2017-08-14 11:17:49 -04:00
Zoltan Varga ed0f1b4992 [llvm] Avoid generating invalid llvm IR when a finally clause contains a loop which branches back to the beginning of the finally clause. (#5354) 2017-08-10 20:29:38 -04:00
Ankit Jain e9f63bbd97 [msbuild] Bump to xplat-master branch HEAD 2017-08-09 21:08:55 -04:00
Ankit Jain 640748df04 [msbuild] Bump to the xplat-master branch HEAD 2017-08-09 13:26:56 -04:00
Alexander Köplinger 3f3e41781e Default powerpc to mcs instead of roslyn (#5326)
It is crashing still way more than it works and now that the mcs
configuration works again we should default to that to make our CI
more pleasant.
(cherry picked from commit ee8c7c80b7)
2017-08-09 03:11:47 +02:00
Aleksey Kliger 74a8e56233 [eglib] (goutput.c) Revert Android logging host-target change
Revert part of 590473d01b - the Android-specific
logging in eglib/goutput.c should be used when the host is Android, not the
target.
2017-08-08 18:17:21 -04:00
Zoltan Varga 0e38c766cc [runtime] Fix a case where klass->blittable was written without holding the loader locked. (#5331) 2017-08-08 16:37:45 -04:00
Alex Rønne Petersen 73d4810c70 [runtime] Add ICALL_DECL_EXPORT.
ICALL_EXPORT is only used on function definitions, not declarations.
2017-08-08 18:12:54 +02:00
Alex Rønne Petersen 15bd67a390 [runtime] Declare MonoProfilerCallContext::return_value offset. 2017-08-08 18:12:50 +02:00
Alex Rønne Petersen 6af040720f [profiler] Split method_leave callback into a method_tail_call callback.
With this, profilers can distinguish between the two, and also know what the
target method of a tail call is.

The call instrumentation flags have been renamed accordingly and a new flag has
been added for instrumenting tail calls. I've also added a flag for exceptional
leave events, and method_exception_leave is only raised if this flag is given
for a method.

Also refactored the relevant JIT code a bit so it's easier to follow.
2017-08-08 15:21:09 +02:00
Alex Rønne Petersen d7767d7f41 [profiler] Mark generated raise functions as ICALL_DECL_EXPORT.
This is currently needed for method_enter, method_leave, and gc_allocation.
2017-08-08 15:21:09 +02:00
Alex Rønne Petersen ba0a5b09ae [profiler] Properly clean up the resources used by the profiler API on shutdown.
Also introduce mono_profiler_set_cleanup_callback ().
2017-08-08 15:21:09 +02:00
Alex Rønne Petersen 94d9ccc8b7 [profiler] Some improvements to the code coverage API.
Code coverage must now be explicitly enabled. This simplifies initialization
of some coverage-related structures and also lets us enable debug info which
is needed to produce good data.

Also change the signature of mono_profiler_get_coverage_data so it returns a
value indicating whether coverage data was available.
2017-08-08 15:21:09 +02:00
Uri Simchoni 759ae465ea [profiler] Avoid instrumenting inlined methods
An inlined method does not require instrumentation (if it
did, it would not have been inlined). The flags that
control instrumentation options are valid for the caller
method and are not to be consulted.

This patch replaces an assertion with a check and early
return. A method that "wants to be instrumented" does not
get inlined, but a method that "doesn't want to be instrumented"
can get inlined. However, the flags that control instrumention
options have been calculated against the caller method, hence
they should not be consulted at all. The extra check renders
the assertion unnecessary.
2017-08-08 15:21:09 +02:00
Uri Simchoni c4c358fcb3 [profile] set the "no profiling" bitmask equal to zero
This makes constructs such as "if (!mono_profiler_get_call_instrumentation_flags(methos))"
correct. See mono_method_check_inlining()
2017-08-08 15:21:09 +02:00
Jason Imison a88a2802d8 Merge pull request #5336 from mono/2017-08-fsharp-resources
Bump F# to 4.1.25 and remove already merged patches
2017-08-08 12:55:32 +01:00
nosami 884e4bffa0 Bump F# to 4.1.25 and remove already merged patches 2017-08-08 12:34:48 +01:00
Ludovic Henry 9417be0f11 Bump version to 5.6 (#5324) 2017-08-07 15:41:12 +02:00
Alexander Köplinger c212bccc3d [eglib] Add back NEWS file, it's required for the tarball
(cherry picked from commit 7845ed2d91)
2017-08-07 14:32:47 +02:00
Ludovic Henry 1dd426f94b Revert "Bump version to 5.6"
This reverts commit fe021658d9.
2017-08-07 14:26:08 +02:00
Ludovic Henry fe021658d9 Bump version to 5.6 2017-08-07 14:18:43 +02:00
155 changed files with 3592 additions and 1803 deletions

No files matched your search

+75 -5
View File
@@ -1,7 +1,7 @@
# Process this file with autoconf to produce a configure script.
#AC_PREREQ([2.62])
AC_INIT(mono, [5.5.0],
AC_INIT(mono, [5.6.0],
[http://bugzilla.xamarin.com/enter_bug.cgi?classification=Mono])
AC_CONFIG_SRCDIR([README.md])
@@ -40,8 +40,8 @@ MONO_VERSION_BUILD=`echo $VERSION | cut -d . -f 3`
# This can be reset to 0 when Mono's version number is bumped
# since it's part of the corlib version (the prefix '1' in the full
# version number is to ensure the number isn't treated as octal in C)
MONO_CORLIB_COUNTER=3
MONO_CORLIB_VERSION=`printf "1%02d%02d%02d%03d" $MONO_VERSION_MAJOR $MONO_VERSION_MINOR $MONO_VERSION_BUILD $MONO_CORLIB_COUNTER`
MONO_CORLIB_COUNTER=0
MONO_CORLIB_VERSION=`printf "1%02d%02d%02d%03d" $MONO_VERSION_MAJOR $MONO_VERSION_MINOR 0 $MONO_CORLIB_COUNTER`
AC_DEFINE_UNQUOTED(MONO_CORLIB_VERSION,$MONO_CORLIB_VERSION,[Version of the corlib-runtime interface])
AC_SUBST(MONO_CORLIB_VERSION)
@@ -529,6 +529,73 @@ AC_CHECK_FUNCS(_finite, , AC_MSG_CHECKING(for _finite in math.h)
# for Linux statfs support
AC_CHECK_HEADERS(linux/magic.h)
# For Android NDK unified headers
if test x$platform_android = xyes; then
AC_CHECK_HEADERS(machine/endian.h sys/endian.h)
AC_CHECK_HEADERS(android/legacy_signal_inlines.h, [have_android_signal_inlines=yes], [have_android_signal_inlines=no])
# Make sure SIGRT{MIN,MAX} work - they will fail to work with unified headers if building for
# API level < 21 *and* android/legacy_signal_inlines.h doesn't declare (and define) the required
# libc APIs to obtain values for SIGRT{MIN,MAX}. We perform the check only if android/legacy_signal_inlines.h
# is found because in other cases the macros will either work (for NDK < 14) or fail if the legacy header
# doesn't contain the required definitions (NDK 14)
if test x$have_android_signal_inlines = xyes; then
AC_MSG_CHECKING([Whether Android SIGRTMIN/SGRTMAX macros are valid])
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([#include <android/legacy_signal_inlines.h>],[
int i;
for (i = SIGRTMIN + 1; i < SIGRTMAX; ++i) {
}
])],[
AC_MSG_RESULT(yes)
android_sigrtminmax_work=yes
],[
AC_MSG_RESULT(no)
android_sigrtminmax_work=no
]
)
if test x$android_sigrtminmax_work = xno; then
AC_MSG_ERROR([Android SIGRTMIN/SIGRTMAX macros don't work in this NDK])
fi
fi
# Attempt to detect whether we're using Android NDK unified headers
AC_CHECK_HEADERS(android/api-level.h, [have_android_api_level=yes], [have_android_api_level=no])
AC_CHECK_HEADERS(android/versioning.h, [have_android_versioning=yes], [have_android_versioning=no])
android_unified_headers=no
if test x$have_android_api_level = xyes; then
if test x$have_android_versioning = xyes; then
AC_MSG_CHECKING([whether using Android NDK unified headers])
# Both macros are defined only in the NDK unified headers
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([
#include <android/api-level.h>
#include <android/versioning.h>
],[
#if __ANDROID_API_O__ == 26 && defined(__INTRODUCED_IN)
return 0
#else
#error __ANDROID_API_O__ != 26 or the __INTRODUCED_IN macro not defined
#endif
])],[
AC_MSG_RESULT(yes)
android_unified_headers=yes
],[
AC_MSG_RESULT(no)
android_unified_headers=no
]
)
fi
fi
if test x$android_unified_headers = xyes; then
AC_DEFINE(ANDROID_UNIFIED_HEADERS, 1, [Whether Android NDK unified headers are used])
fi
fi # Android
# not 64 bit clean in cross-compile
AC_CHECK_SIZEOF(void *, 4)
@@ -783,7 +850,10 @@ if test $csc_compiler = default; then
if test $endian = big; then
csc_compiler=mcs
elif test $endian = little; then
csc_compiler=roslyn
case "$host" in
powerpc*) csc_compiler=mcs ;;
*) csc_compiler=roslyn ;;
esac
else
csc_compiler=mcs
fi
@@ -4324,7 +4394,7 @@ AC_SUBST(mono_build_root)
mono_runtime=mono/mini/mono
AC_SUBST(mono_runtime)
CSC_LOCATION=`cd $srcdir && pwd`/external/roslyn-binaries/Microsoft.Net.Compilers/Microsoft.Net.Compilers.2.3.1/tools/csc.exe
CSC_LOCATION=`cd $srcdir && pwd`/external/roslyn-binaries/Microsoft.Net.Compilers/Microsoft.Net.Compilers.2.3.2/tools/csc.exe
if test $csc_compiler = mcs; then
CSC=$mcs_topdir/class/lib/build/mcs.exe
+3
View File
@@ -0,0 +1,3 @@
Release notes for Mono are hosted on the web, please see:
http://www.mono-project.com/docs/about-mono/releases/
+2 -2
View File
@@ -127,7 +127,7 @@ get_pw_data (void)
{
#ifdef HAVE_GETPWUID_R
struct passwd pw;
struct passwd *result;
struct passwd *result = NULL;
char buf [4096];
#endif
@@ -145,7 +145,7 @@ get_pw_data (void)
#ifdef HAVE_GETPWUID_R
if (home_dir == NULL || user_name == NULL) {
if (getpwuid_r (getuid (), &pw, buf, 4096, &result) == 0) {
if (getpwuid_r (getuid (), &pw, buf, 4096, &result) == 0 && result) {
if (home_dir == NULL)
home_dir = g_strdup (pw.pw_dir);
if (user_name == NULL)
+1 -1
View File
@@ -137,7 +137,7 @@ g_assertion_message (const gchar *format, ...)
exit (0);
}
#if TARGET_ANDROID
#if PLATFORM_ANDROID
#include <android/log.h>
static android_LogPriority
+1 -1
+1 -1
@@ -30,6 +30,7 @@
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.SqlClient.SqlBulkCopyColumnMappingCollection))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.SqlClient.SqlBulkCopyOptions))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.SqlClient.SqlClientFactory))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.SqlClient.SqlClientMetaDataCollectionNames))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.SqlClient.SqlCommand))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.SqlClient.SqlConnection))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.SqlClient.SqlConnectionStringBuilder))]
@@ -41,6 +41,8 @@
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.CngProvider))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.CngUIPolicy))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.CngUIProtectionLevels))]
// TODO: [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.DSACng))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.ECDsaCng))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.ECKeyXmlFormat))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.RSACng))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.TripleDESCng))]
@@ -36,6 +36,7 @@
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Channels.WebSocketTransportUsage))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.HttpBindingBase))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.HttpClientCredentialType))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.HttpProxyCredentialType))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.HttpTransportSecurity))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.NetHttpBinding))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.NetHttpsBinding))]
+6 -6
View File
@@ -45,19 +45,18 @@ namespace MonoTests.Mono.Data.Tds
public void CheckNullException()
{
TcpListener Listener = null;
//set up dummy sql listener, if there is a real sql server on this
//machine at that port, in theory this part will fail, but that's ok
//becuase something will be listening on the port and that's all we
//require at this point: a listener on port 1433...
try{
Socket Listener = new Socket(AddressFamily.InterNetwork,
SocketType.Stream,
ProtocolType.Tcp);
IPAddress hostIP =Dns.GetHostEntry("localhost").AddressList[0];
IPEndPoint ep = new IPEndPoint(hostIP, 1433);
Listener.Bind(ep);
Listener.Listen(1);
IPEndPoint ep = new IPEndPoint(hostIP, 1433);
Listener = new TcpListener (ep);
Listener.Start ();
} catch (Exception){
//ignore
}
@@ -103,6 +102,7 @@ namespace MonoTests.Mono.Data.Tds
pool.ReleaseConnection(tds);
Listener.Stop ();
//exit
}
}
@@ -1,2 +1 @@
#include monodroid_Mono.Posix_test.dll.new-exclude.sources
Mono.Unix.Android/TestHelper.cs
@@ -163,5 +163,14 @@ namespace Mono.Security.Interface
X509CertificateCollection certificates, bool wantsChain, ref X509Chain chain,
ref MonoSslPolicyErrors errors, ref int status11);
#endregion
#region Misc
internal abstract bool SupportsCleanShutdown {
get;
}
#endregion
}
}
@@ -86,6 +86,13 @@ namespace Mono.Security.Interface
get; set;
}
/*
* This is only supported if MonoTlsProvider.SupportsCleanShutdown is true.
*/
internal bool SendCloseNotify {
get; set;
}
/*
* If you set this here, then it will override 'ServicePointManager.SecurityProtocol'.
*/
@@ -173,6 +180,7 @@ namespace Mono.Security.Interface
EnabledProtocols = other.EnabledProtocols;
EnabledCiphers = other.EnabledCiphers;
CertificateValidationTime = other.CertificateValidationTime;
SendCloseNotify = other.SendCloseNotify;
if (other.TrustAnchors != null)
TrustAnchors = new X509CertificateCollection (other.TrustAnchors);
if (other.CertificateSearchPaths != null) {
@@ -137,7 +137,7 @@ namespace Mono.Security.Protocol.Tls.Handshake.Client
return null;
foreach (X509Certificate certificate in this.Context.ClientSettings.Certificates) {
if (cert.GetName () == cert.GetIssuerName ())
if (certificate.GetName () == cert.GetIssuerName ())
return certificate;
}
return null;
+3 -1
View File
@@ -92,7 +92,9 @@ namespace PEAPI {
/// </summary>
public enum ImplAttr { IL, Native, Runtime = 0x03, Unmanaged = 0x04,
ForwardRef = 0x10, PreserveSig = 0x0080, InternalCall = 0x1000,
Synchronised = 0x0020, Synchronized = 0x0020, NoInLining = 0x0008, NoOptimization = 0x0040, Optil = 0x0002}
Synchronised = 0x0020, Synchronized = 0x0020, NoInLining = 0x0008, NoOptimization = 0x0040, Optil = 0x0002,
AggressiveInlining = 0x0100
}
/// <summary>
/// Storage location for initial field data
@@ -37,6 +37,12 @@ namespace Microsoft.Win32.SafeHandles
{
}
protected SafeNCryptHandle (IntPtr handle, System.Runtime.InteropServices.SafeHandle parentHandle)
: base (false)
{
throw new NotImplementedException ();
}
public override bool IsInvalid { get { throw new NotImplementedException (); } }
protected override bool ReleaseHandle ()
@@ -26,6 +26,8 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
namespace Microsoft.Win32.SafeHandles
{
public sealed class SafeNCryptKeyHandle : SafeNCryptHandle
@@ -34,6 +36,12 @@ namespace Microsoft.Win32.SafeHandles
{
}
public SafeNCryptKeyHandle (IntPtr handle, System.Runtime.InteropServices.SafeHandle parentHandle)
: base (handle, parentHandle)
{
}
protected override bool ReleaseNativeHandle ()
{
return false;
@@ -71,6 +71,7 @@ corefx/SR.missing.cs
../referencesource/System.Core/System/Security/Cryptography/ECDiffieHellmanPublicKey.cs
../referencesource/System.Core/System/Security/Cryptography/ECDsa.cs
../referencesource/System.Core/System/Security/Cryptography/ECDsaCng.cs
../referencesource/System.Core/System/Security/Cryptography/ECKeyXmlFormat.cs
../referencesource/System.Core/System/Security/Cryptography/NCryptNative.cs
../referencesource/System.Core/System/Security/Cryptography/RsaCng.cs
@@ -14,6 +14,5 @@ System.Security.Cryptography/SHA512Cng.cs
../referencesource/System.Core/System/Security/Cryptography/AesManaged.cs
../referencesource/System.Core/System/Security/Cryptography/ECDiffieHellman.cs
../referencesource/System.Core/System/Security/Cryptography/ECKeyXmlFormat.cs
../referencesource/System.Core/System/threading/ReaderWriterLockSlim/LockRecursionException.cs
@@ -133,28 +133,28 @@ namespace Mono.AppleTls
targetHost = targetHost.Substring (0, pos);
}
var policy = SecPolicy.CreateSslPolicy (!serverMode, targetHost);
var trust = new SecTrust (certificates, policy);
using (var policy = SecPolicy.CreateSslPolicy (!serverMode, targetHost))
using (var trust = new SecTrust (certificates, policy)) {
if (validator.Settings.TrustAnchors != null) {
var status = trust.SetAnchorCertificates (validator.Settings.TrustAnchors);
if (status != SecStatusCode.Success)
throw new InvalidOperationException (status.ToString ());
trust.SetAnchorCertificatesOnly (false);
}
if (validator.Settings.TrustAnchors != null) {
var status = trust.SetAnchorCertificates (validator.Settings.TrustAnchors);
if (status != SecStatusCode.Success)
throw new InvalidOperationException (status.ToString ());
trust.SetAnchorCertificatesOnly (false);
if (validator.Settings.CertificateValidationTime != null) {
var status = trust.SetVerifyDate (validator.Settings.CertificateValidationTime.Value);
if (status != SecStatusCode.Success)
throw new InvalidOperationException (status.ToString ());
}
var result = trust.Evaluate ();
if (result == SecTrustResult.Unspecified || result == SecTrustResult.Proceed)
return true;
errors |= MonoSslPolicyErrors.RemoteCertificateChainErrors;
return false;
}
if (validator.Settings.CertificateValidationTime != null) {
var status = trust.SetVerifyDate (validator.Settings.CertificateValidationTime.Value);
if (status != SecStatusCode.Success)
throw new InvalidOperationException (status.ToString ());
}
var result = trust.Evaluate ();
if (result == SecTrustResult.Unspecified)
return true;
errors |= MonoSslPolicyErrors.RemoteCertificateChainErrors;
return false;
}
}
}
@@ -235,32 +235,41 @@ namespace Mono.AppleTls
*
*/
var trust = GetPeerTrust (!IsServer);
X509CertificateCollection certificates;
if (trust == null || trust.Count == 0) {
remoteCertificate = null;
if (!IsServer)
throw new TlsException (AlertDescription.CertificateUnknown);
certificates = null;
} else {
if (trust.Count > 1)
Debug ("WARNING: Got multiple certificates in SecTrust!");
certificates = new X509CertificateCollection ();
for (int i = 0; i < trust.Count; i++)
certificates.Add (trust [(IntPtr)i].ToX509Certificate ());
remoteCertificate = certificates [0];
Debug ("Got peer trust: {0}", remoteCertificate);
}
bool ok;
SecTrust trust = null;
X509CertificateCollection certificates = null;
try {
trust = GetPeerTrust (!IsServer);
if (trust == null || trust.Count == 0) {
remoteCertificate = null;
if (!IsServer)
throw new TlsException (AlertDescription.CertificateUnknown);
certificates = null;
} else {
if (trust.Count > 1)
Debug ("WARNING: Got multiple certificates in SecTrust!");
certificates = new X509CertificateCollection ();
for (int i = 0; i < trust.Count; i++)
certificates.Add (trust.GetCertificate (i));
remoteCertificate = new X509Certificate (certificates [0]);
Debug ("Got peer trust: {0}", remoteCertificate);
}
ok = ValidateCertificate (certificates);
} catch (Exception ex) {
Debug ("Certificate validation failed: {0}", ex);
throw new TlsException (AlertDescription.CertificateUnknown, "Certificate validation threw exception.");
} finally {
if (trust != null)
trust.Dispose ();
if (certificates != null) {
for (int i = 0; i < certificates.Count; i++)
certificates [i].Dispose ();
}
}
if (!ok)
@@ -665,7 +674,7 @@ namespace Mono.AppleTls
if (value == IntPtr.Zero)
throw new TlsException (AlertDescription.CertificateUnknown);
}
return (value == IntPtr.Zero) ? null : new SecTrust (value);
return (value == IntPtr.Zero) ? null : new SecTrust (value, true);
}
#endregion
@@ -850,24 +859,7 @@ namespace Mono.AppleTls
public override void Shutdown ()
{
if (Interlocked.Exchange (ref pendingIO, 1) == 1)
throw new InvalidOperationException ();
Debug ("Shutdown");
lastException = null;
try {
if (closed || disposed)
return;
var status = SSLClose (Handle);
Debug ("Shutdown done: {0}", status);
CheckStatusAndThrow (status);
} finally {
closed = true;
pendingIO = 0;
}
closed = true;
}
#endregion
@@ -65,6 +65,10 @@ namespace Mono.AppleTls
get { return true; }
}
internal override bool SupportsCleanShutdown {
get { return false; }
}
public override SslProtocols SupportedProtocols {
get { return SslProtocols.Tls12 | SslProtocols.Tls11 | SslProtocols.Tls; }
}
+13
View File
@@ -66,6 +66,8 @@ namespace Mono.AppleTls {
foreach (var certificate in certificates)
array [i++] = new SecCertificate (certificate);
Initialize (array, policy);
for (i = 0; i < array.Length; i++)
array [i].Dispose ();
}
void Initialize (SecCertificate[] array, SecPolicy policy)
@@ -122,6 +124,17 @@ namespace Mono.AppleTls {
}
}
internal X509Certificate GetCertificate (int index)
{
if (handle == IntPtr.Zero)
throw new ObjectDisposedException ("SecTrust");
if (index < 0 || index >= Count)
throw new ArgumentOutOfRangeException ("index");
var ptr = SecTrustGetCertificateAtIndex (handle, (IntPtr)index);
return new X509Certificate (ptr);
}
[DllImport (AppleTlsContext.SecurityLibrary)]
extern static SecStatusCode /* OSStatus */ SecTrustSetAnchorCertificates (IntPtr /* SecTrustRef */ trust, IntPtr /* CFArrayRef */ anchorCertificates);
@@ -364,7 +364,8 @@ namespace Mono.Btls
public override void Shutdown ()
{
Debug ("Shutdown!");
// ssl.SetQuietShutdown ();
if (Settings == null || !Settings.SendCloseNotify)
ssl.SetQuietShutdown ();
ssl.Shutdown ();
}
@@ -75,6 +75,10 @@ namespace Mono.Btls
get { return true; }
}
internal override bool SupportsCleanShutdown {
get { return true; }
}
public override SslProtocols SupportedProtocols {
get { return SslProtocols.Tls12 | SslProtocols.Tls11 | SslProtocols.Tls; }
}
@@ -68,6 +68,10 @@ namespace Mono.Net.Security
get { return false; }
}
internal override bool SupportsCleanShutdown {
get { return false; }
}
public override SslProtocols SupportedProtocols {
get { return SslProtocols.Tls; }
}
@@ -46,6 +46,7 @@ namespace System.ComponentModel
case 32: /* ERROR_SHARING_VIOLATION */ return "Sharing violation";
case 33: /* ERROR_LOCK_VIOLATION */ return "Lock violation";
case 50: /* ERROR_NOT_SUPPORTED */ return "Operation not supported";
case 55: /* ERROR_DEV_NOT_EXIST */ return "Device does not exist";
case 87: /* ERROR_INVALID_PARAMETER */ return "Invalid parameter";
case 120: /* ERROR_CALL_NOT_IMPLEMENTED */ return "Call not implemented";
case 123: /* ERROR_INVALID_NAME */ return "Invalid name";
@@ -143,7 +144,6 @@ namespace System.ComponentModel
case 52: /* ERROR_DUP_NAME */ return "Duplicate name";
case 53: /* ERROR_BAD_NETPATH */ return "Bad netpath";
case 54: /* ERROR_NETWORK_BUSY */ return "Network busy";
case 55: /* ERROR_DEV_NOT_EXIST */ return "Device does not exist";
case 56: /* ERROR_TOO_MANY_CMDS */ return "Too many commands";
case 57: /* ERROR_ADAP_HDW_ERR */ return "ADAP HDW error";
case 58: /* ERROR_BAD_NET_RESP */ return "Bad net response";
@@ -1902,7 +1902,7 @@ m_Handle, buffer, offset + sent, size - sent, socketFlags, out nativeError, is_b
sockares.Size -= total;
if (sockares.socket.CleanedUp) {
sockares.Complete (total);
sockares.Complete (sent_so_far);
return;
}
@@ -1914,7 +1914,7 @@ m_Handle, buffer, offset + sent, size - sent, socketFlags, out nativeError, is_b
sockares.Total = sent_so_far;
}
sockares.Complete (total);
sockares.Complete (sent_so_far);
}
[CLSCompliant (false)]
@@ -56,7 +56,6 @@ namespace System.Net
object socketLock = new object ();
IWebConnectionState state;
WebExceptionStatus status;
WaitCallback initConn;
bool keepAlive;
byte [] buffer;
EventHandler abortHandler;
@@ -1737,6 +1737,9 @@ namespace MonoTests.System.Net.Sockets
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void BeginConnectAddressPortNull ()
{
Socket sock = new Socket (AddressFamily.InterNetwork,
@@ -1779,7 +1782,11 @@ namespace MonoTests.System.Net.Sockets
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#else
[ExpectedException (typeof(ObjectDisposedException))]
#endif
public void BeginConnectAddressPortClosed ()
{
Socket sock = new Socket (AddressFamily.InterNetwork,
@@ -1909,6 +1916,9 @@ namespace MonoTests.System.Net.Sockets
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void BeginConnectMultipleNull ()
{
Socket sock = new Socket (AddressFamily.InterNetwork,
@@ -1958,7 +1968,11 @@ namespace MonoTests.System.Net.Sockets
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#else
[ExpectedException (typeof(ObjectDisposedException))]
#endif
public void BeginConnectMultipleClosed ()
{
Socket sock = new Socket (AddressFamily.InterNetwork,
@@ -2246,6 +2260,9 @@ namespace MonoTests.System.Net.Sockets
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void ConnectAddressPortNull ()
{
Socket sock = new Socket (AddressFamily.InterNetwork,
@@ -2287,7 +2304,11 @@ namespace MonoTests.System.Net.Sockets
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#else
[ExpectedException (typeof(ObjectDisposedException))]
#endif
public void ConnectAddressPortClosed ()
{
Socket sock = new Socket (AddressFamily.InterNetwork,
@@ -2395,6 +2416,9 @@ namespace MonoTests.System.Net.Sockets
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void ConnectMultipleNull ()
{
Socket sock = new Socket (AddressFamily.InterNetwork,
@@ -2442,7 +2466,11 @@ namespace MonoTests.System.Net.Sockets
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#else
[ExpectedException (typeof(ObjectDisposedException))]
#endif
public void ConnectMultipleClosed ()
{
Socket sock = new Socket (AddressFamily.InterNetwork,
@@ -3721,6 +3749,9 @@ namespace MonoTests.System.Net.Sockets
// Test case for https://bugzilla.novell.com/show_bug.cgi?id=443346
// See also https://bugzilla.xamarin.com/show_bug.cgi?id=52157
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void ConnectedProperty ()
{
var port = NetworkHelpers.FindFreePort ();
@@ -43,6 +43,9 @@ namespace MonoTests.System.Net
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (WebException))] // Something catches the PlatformNotSupportedException and re-throws an WebException
#endif
public void DownloadTwice ()
{
WebClient wc = new WebClient();
@@ -79,6 +79,9 @@ namespace MonoTests.System.Net
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (AggregateException))] // Something catches the PlatformNotSupportedException and re-throws an AggregateException
#endif
public void DownloadFileTaskAsync ()
{
WebClient wc = new WebClient ();
+1 -1
View File
@@ -499,7 +499,7 @@ namespace System
m = Method;
return (m != null ? m.GetHashCode () : GetType ().GetHashCode ()) ^ (m_target != null ? m_target.GetHashCode () : 0);
return (m != null ? m.GetHashCode () : GetType ().GetHashCode ()) ^ RuntimeHelpers.GetHashCode (m_target);
}
protected virtual MethodInfo GetMethodImpl ()
@@ -49,9 +49,15 @@ namespace MonoTests.System.Globalization
c = CultureInfo.InvariantCulture;
Assert.AreEqual (2, c.NumberFormat.CurrencyDecimalDigits, "#3");
}
[Test]
public void AllCulturesCanParseNegativeNumber ()
{
foreach (var c in CultureInfo.GetCultures (CultureTypes.AllCultures))
{
int.Parse ("-1", c);
}
}
}
}
+4 -2
View File
@@ -2709,8 +2709,10 @@ namespace MonoTests.System.IO
File.Delete (path2);
try {
symlink (path1, path2);
symlink (path2, path1);
if (symlink (path1, path2) != 0)
Assert.Fail ("symlink #1 failed with errno={0}", Marshal.GetLastWin32Error ());
if (symlink (path2, path1) != 0)
Assert.Fail ("symlink #2 failed with errno={0}", Marshal.GetLastWin32Error ());
Assert.IsTrue (File.Exists (path1), "File.Exists must return true for path1 symlink loop");
Assert.IsTrue (File.Exists (path2), "File.Exists must return true for path2 symlink loop");
@@ -480,5 +480,97 @@ namespace MonoTests.System.Reflection.Emit
Assert.AreEqual (0x02, il [14]); //typedef
Assert.AreEqual (0x01, il [19]); //typeref
}
[Test]
public void MethodRefTokenSame () {
// Get the same non-virtual method from a base and a derived type so
// that the MemberInfo:DeclaredType differs but the tokens are the same.
//
// Regression test for bugzilla #59364
DefineBasicMethod ();
var m1 = typeof (object).GetMethod ("GetType");
var m2 = typeof (string).GetMethod ("GetType");
var value_getter = typeof (RuntimeMethodHandle).GetProperty ("Value").GetMethod;
var il = il_gen;
var loc = il.DeclareLocal (typeof (RuntimeMethodHandle));
// return ((int)(RuntimeMethodHandle (m1).Value == RuntimeMethodHandle (m2).Value)).ToString ()
il.Emit (OpCodes.Ldtoken, m1);
il.Emit (OpCodes.Stloc, loc);
il.Emit (OpCodes.Ldloca, loc);
il.Emit (OpCodes.Call, value_getter);
il.Emit (OpCodes.Ldtoken, m2);
il.Emit (OpCodes.Stloc, loc);
il.Emit (OpCodes.Ldloca, loc);
il.Emit (OpCodes.Call, value_getter);
il.Emit (OpCodes.Ceq);
il.Emit (OpCodes.Box, typeof (Int32));
il.Emit (OpCodes.Callvirt, typeof (object).GetMethod ("ToString"));
il.Emit (OpCodes.Ret);
var baked = tb.CreateType ();
var x = Activator.CreateInstance (baked);
var m = baked.GetMethod ("F");
var s = m.Invoke (x, null);
Assert.AreEqual ("1", s);
}
public class Base {
public int x;
}
public class Derived : Base {
}
[Test]
public void FieldRefTokenSame () {
DefineBasicMethod ();
// Get the same field from a base and a derived type so hat
// the MemberInfo:DeclaredType differs but the tokens are the same.
//
// Regression test for bugzilla #59364
var f1 = typeof (Base).GetField ("x");
var f2 = typeof (Derived).GetField ("x");
var value_getter = typeof (RuntimeFieldHandle).GetProperty("Value").GetMethod;
var il = il_gen;
var loc = il.DeclareLocal (typeof (RuntimeFieldHandle));
il.Emit (OpCodes.Ldtoken, f1);
il.Emit (OpCodes.Stloc, loc);
il.Emit (OpCodes.Ldloca, loc);
il.Emit (OpCodes.Call, value_getter);
il.Emit (OpCodes.Ldtoken, f2);
il.Emit (OpCodes.Stloc, loc);
il.Emit (OpCodes.Ldloca, loc);
il.Emit (OpCodes.Call, value_getter);
il.Emit (OpCodes.Ceq);
il.Emit (OpCodes.Box, typeof (Int32));
il.Emit (OpCodes.Callvirt, typeof (object).GetMethod ("ToString"));
il.Emit (OpCodes.Ret);
var baked = tb.CreateType ();
var x = Activator.CreateInstance (baked);
var m = baked.GetMethod ("F");
var s = m.Invoke (x, null);
Assert.AreEqual ("1", s);
}
}
}
@@ -0,0 +1,76 @@
//
// MonoTests.System.Runtime.Remoting.Proxies.RealProxyTest.cs
//
//
using System;
using System.Runtime.Remoting.Messaging;
using System.Runtime.Remoting.Proxies;
using NUnit.Framework;
namespace MonoTests.System.Runtime.Remoting.Proxies {
[TestFixture]
public class RealProxyTest {
public class ExampleInterfaceProxy : RealProxy {
public bool Called;
public ExampleInterfaceProxy () : base (typeof(IComparable))
{
Called = false;
}
public override IMessage Invoke (IMessage msg)
{
Called = true;
return new ReturnMessage (typeof(IComparable), null, 0, null, null);
}
}
[Test]
public void InterfaceProxyGetTypeOkay ()
{
// Regression test for #17325
// Check that GetType () for a proxy of an interface
// returns the interface.
var prox = new ExampleInterfaceProxy ();
var tprox = prox.GetTransparentProxy ();
Assert.IsNotNull (tprox, "#1");
var tproxType = tprox.GetType ();
Assert.IsFalse (prox.Called, "#2"); // this is true on .NET Framework, but false on Mono.
Assert.IsNotNull (tproxType, "#3");
Assert.IsTrue (tproxType.IsAssignableFrom (typeof(IComparable)), "#4");
}
[Test]
public void InterfaceProxyGetTypeViaReflectionOkay ()
{
// Regression test for #17325
// Check that GetType () for a proxy of an interface
// returns the interface.
//
// This versions calls GetType using reflection, which
// avoids the fast path in the JIT.
var prox = new ExampleInterfaceProxy ();
var tprox = prox.GetTransparentProxy ();
Assert.IsNotNull (tprox, "#1");
var m = typeof(object).GetMethod ("GetType");
var tproxType = m.Invoke (tprox, null);
Assert.IsTrue (prox.Called, "#2");
Assert.IsNotNull (tproxType, "#3");
Assert.IsTrue (tproxType is Type, "#4");
Assert.IsTrue ((tproxType as Type).IsAssignableFrom (typeof(IComparable)), "#5");
}
}
}
@@ -341,7 +341,7 @@ namespace MonoTests.System.Runtime.Remoting
Thread tr = new Thread (new ThreadStart (CallbackThread));
tr.Start();
bool terminated = tr.Join(2000);
bool terminated = tr.Join(10000);
Assert.IsTrue(terminated, "Thread didn't get lock of context bound object.");
Assert.IsTrue (!otResult, "Concurrency detected in CallbackThread");
@@ -1258,7 +1258,7 @@ namespace MonoTests.System.Threading.Tasks
{
var t = Task.Delay (300);
Assert.IsTrue (TaskStatus.WaitingForActivation == t.Status || TaskStatus.Running == t.Status, "#1");
Assert.IsTrue (t.Wait (400), "#2");
Assert.IsTrue (t.Wait (1200), "#2");
}
[Test]
+32
View File
@@ -3619,6 +3619,38 @@ namespace MonoTests.System
public int field;
}
[Test]
public void IsAssignableFromGenericArgumentsWithConstraints ()
{
// Regression test for #58809
// Generic Parameters of a gtd should have their
// constraints respected even when those constraints
// are other generic parameters themselves.
var ps = typeof (GenericWithParamConstraints<,,>).GetGenericArguments ();
var a = ps[0];
var b = ps[1];
var c = ps[2];
// Foo<C>
var fooOfC = typeof (Foo<>).MakeGenericType (c);
// constraint B : Foo <C>
Assert.IsTrue (fooOfC.IsAssignableFrom (b), "#1");
// constraint A : B
Assert.IsTrue (b.IsAssignableFrom (a), "#2");
// A : Foo<C> since A : B and B : Foo<C>
Assert.IsTrue (fooOfC.IsAssignableFrom (a), "#3");
}
class GenericWithParamConstraints<A, B, C> where B : Foo<C> where A : B
{
}
[Test] // Bug #612780
public void CannotMakeDerivedTypesFromTypedByRef ()
{
+1
View File
@@ -205,6 +205,7 @@ System.Runtime.Remoting.Channels/ChannelServicesTest.cs
System.Runtime.Remoting.Contexts/SynchronizationAttributeTest.cs
System.Runtime.Remoting.Messaging/CallContextTest.cs
System.Runtime.Remoting.Metadata.W3cXsd2001/SoapHexBinaryTest.cs
System.Runtime.Remoting.Proxies/RealProxyTest.cs
System.Runtime.Serialization/FormatterServicesTests.cs
System.Runtime.Serialization/ObjectIDGeneratorTests.cs
System.Runtime.Serialization/SerializationBinderTest.cs
@@ -40,6 +40,7 @@ System.Runtime.Remoting.Channels/ChannelServicesTest.cs
System.Runtime.Remoting.Contexts/SynchronizationAttributeTest.cs
System.Runtime.Remoting.Messaging/CallContextTest.cs
System.Runtime.Remoting.Metadata.W3cXsd2001/SoapHexBinaryTest.cs
System.Runtime.Remoting.Proxies/RealProxyTest.cs
System.Security.AccessControl/AuthorizationRuleTest.cs
System.Security.AccessControl/CommonAceTest.cs
System.Security.AccessControl/CommonAclTest.cs
+14
View File
@@ -38,6 +38,7 @@ install-local:
$(INSTALL_LIB) ../../../external/binary-reference-assemblies/v4.6.1/*.dll $(PROFILE_DIR)/4.6.1-api
$(INSTALL_LIB) ../../../external/binary-reference-assemblies/v4.6.2/*.dll $(PROFILE_DIR)/4.6.2-api
$(INSTALL_LIB) ../../../external/binary-reference-assemblies/v4.7/*.dll $(PROFILE_DIR)/4.7-api
$(INSTALL_LIB) ../../../external/binary-reference-assemblies/v4.5/Facades/*.dll $(PROFILE_DIR)/4.5-api/Facades
$(INSTALL_LIB) ../../../external/binary-reference-assemblies/v4.5.1/Facades/*.dll $(PROFILE_DIR)/4.5.1-api/Facades
$(INSTALL_LIB) ../../../external/binary-reference-assemblies/v4.5.2/Facades/*.dll $(PROFILE_DIR)/4.5.2-api/Facades
@@ -46,6 +47,16 @@ install-local:
$(INSTALL_LIB) ../../../external/binary-reference-assemblies/v4.6.2/Facades/*.dll $(PROFILE_DIR)/4.6.2-api/Facades
$(INSTALL_LIB) ../../../external/binary-reference-assemblies/v4.7/Facades/*.dll $(PROFILE_DIR)/4.7-api/Facades
$(INSTALL_LIB) ../../../external/binary-reference-assemblies/mono/*.dll $(PROFILE_DIR)/2.0-api
$(INSTALL_LIB) ../../../external/binary-reference-assemblies/mono/*.dll $(PROFILE_DIR)/4.0-api
$(INSTALL_LIB) ../../../external/binary-reference-assemblies/mono/*.dll $(PROFILE_DIR)/4.5-api
$(INSTALL_LIB) ../../../external/binary-reference-assemblies/mono/*.dll $(PROFILE_DIR)/4.5.1-api
$(INSTALL_LIB) ../../../external/binary-reference-assemblies/mono/*.dll $(PROFILE_DIR)/4.5.2-api
$(INSTALL_LIB) ../../../external/binary-reference-assemblies/mono/*.dll $(PROFILE_DIR)/4.6-api
$(INSTALL_LIB) ../../../external/binary-reference-assemblies/mono/*.dll $(PROFILE_DIR)/4.6.1-api
$(INSTALL_LIB) ../../../external/binary-reference-assemblies/mono/*.dll $(PROFILE_DIR)/4.6.2-api
$(INSTALL_LIB) ../../../external/binary-reference-assemblies/mono/*.dll $(PROFILE_DIR)/4.7-api
# Unfortunately, a few programs (most notably NUnit and FSharp) have hardcoded checks for <prefix>/lib/mono/4.0/mscorlib.dll or Mono.Posix.dll,
# so we need to place something there or those tools break. We decided to symlink to the reference assembly for now.
# See https://bugzilla.xamarin.com/show_bug.cgi?id=38331 and https://bugzilla.xamarin.com/show_bug.cgi?id=41052
@@ -71,6 +82,7 @@ DISTFILES = \
$(wildcard ../../../external/binary-reference-assemblies/v4.0/*.dll) \
$(wildcard ../../../external/binary-reference-assemblies/v3.5/*.dll) \
$(wildcard ../../../external/binary-reference-assemblies/v2.0/*.dll) \
$(wildcard ../../../external/binary-reference-assemblies/mono/*.dll) \
$(wildcard ../../../external/binary-reference-assemblies/src/v4.7/Facades/*.cs) \
$(wildcard ../../../external/binary-reference-assemblies/src/v4.6.2/Facades/*.cs) \
$(wildcard ../../../external/binary-reference-assemblies/src/v4.6.1/Facades/*.cs) \
@@ -88,6 +100,7 @@ DISTFILES = \
$(wildcard ../../../external/binary-reference-assemblies/src/v4.0/*.cs) \
$(wildcard ../../../external/binary-reference-assemblies/src/v3.5/*.cs) \
$(wildcard ../../../external/binary-reference-assemblies/src/v2.0/*.cs) \
$(wildcard ../../../external/binary-reference-assemblies/src/mono/*.cs) \
../../../external/binary-reference-assemblies/v4.7/Makefile \
../../../external/binary-reference-assemblies/v4.6.2/Makefile \
../../../external/binary-reference-assemblies/v4.6.1/Makefile \
@@ -98,6 +111,7 @@ DISTFILES = \
../../../external/binary-reference-assemblies/v4.0/Makefile \
../../../external/binary-reference-assemblies/v3.5/Makefile \
../../../external/binary-reference-assemblies/v2.0/Makefile \
../../../external/binary-reference-assemblies/mono/Makefile \
../../../external/binary-reference-assemblies/Makefile \
Makefile
@@ -35,6 +35,8 @@ namespace System.Security.Cryptography {
throw new NotImplementedException ();
}
public CngAlgorithm HashAlgorithm { get; set; }
public CngKey Key {
get {
throw new NotImplementedException ();
@@ -52,6 +54,38 @@ namespace System.Security.Cryptography {
public override bool VerifyHash(byte[] hash, byte[] signature) {
throw new NotImplementedException();
}
public void FromXmlString (string xml, ECKeyXmlFormat format) {
throw new NotImplementedException();
}
public byte[] SignData (byte[] data) {
throw new NotImplementedException();
}
public byte[] SignData (System.IO.Stream data) {
throw new NotImplementedException();
}
public byte[] SignData (byte[] data, int offset, int count) {
throw new NotImplementedException();
}
public string ToXmlString (ECKeyXmlFormat format) {
throw new NotImplementedException();
}
public bool VerifyData (byte[] data, byte[] signature) {
throw new NotImplementedException();
}
public bool VerifyData (System.IO.Stream data, byte[] signature) {
throw new NotImplementedException();
}
public bool VerifyData (byte[] data, int offset, int count, byte[] signature) {
throw new NotImplementedException();
}
#else
private static KeySizes[] s_legalKeySizes = new KeySizes[] { new KeySizes(256, 384, 128), new KeySizes(521, 521, 0) };
+2
View File
@@ -288,6 +288,7 @@ namespace Mono.ILASM {
/* Keywords */
%token K_AT
%token K_AS
%token K_AGGRESSIVEINLINING
%token K_IMPLICITCOM
%token K_IMPLICITRES
%token K_NOAPPDOMAIN
@@ -2016,6 +2017,7 @@ impl_attr : /* EMPTY */ { $$ = new ImplAttr (); }
| impl_attr K_SYNCHRONIZED { $$ = (ImplAttr) $1 | ImplAttr.Synchronised; }
| impl_attr K_NOINLINING { $$ = (ImplAttr) $1 | ImplAttr.NoInLining; }
| impl_attr K_NOOPTIMIZATION { $$ = (ImplAttr) $1 | ImplAttr.NoOptimization; }
| impl_attr K_AGGRESSIVEINLINING{ $$ = (ImplAttr) $1 | ImplAttr.AggressiveInlining; }
;
sig_args : /* EMPTY */
+1
View File
@@ -321,6 +321,7 @@ namespace Mono.ILASM {
keywords ["legacy"] = new ILToken (Token.K_LEGACY, "legacy");
keywords ["library"] = new ILToken (Token.K_LIBRARY, "library");
keywords ["auto"] = new ILToken (Token.K_AUTO, "auto");
keywords ["aggressiveinlining"] = new ILToken (Token.K_AGGRESSIVEINLINING, "aggressiveinlining");
return keywords;
}
+4 -4
View File
@@ -234,15 +234,15 @@ namespace Mono.CSharp
public static bool CheckOverrideName (TypeSpec type, TypeSpec baseType)
{
var btype_ntuple = baseType as NamedTupleSpec;
var mtype_ntupe = type as NamedTupleSpec;
if (btype_ntuple == null && mtype_ntupe == null)
var mtype_ntuple = type as NamedTupleSpec;
if (btype_ntuple == null && mtype_ntuple == null)
return true;
if (btype_ntuple != null || mtype_ntupe != null)
if (btype_ntuple == null || mtype_ntuple == null)
return false;
var b_elements = btype_ntuple.elements;
var m_elements = mtype_ntupe.elements;
var m_elements = mtype_ntuple.elements;
for (int i = 0; i < b_elements.Count; ++i) {
if (b_elements [i] != m_elements [i])
return false;
+22 -4
View File
@@ -3,24 +3,42 @@ include ../build/rules.make
ROSLYN_CSC_DIR = $(dir $(CSC_LOCATION))
ROSLYN_FILES = \
ROSLYN_FILES_FOR_MONO = \
$(ROSLYN_CSC_DIR)/csc.exe \
$(ROSLYN_CSC_DIR)/csc.rsp \
$(ROSLYN_CSC_DIR)/csc.exe.config \
$(ROSLYN_CSC_DIR)/csi.exe \
$(ROSLYN_CSC_DIR)/csi.exe.config \
$(ROSLYN_CSC_DIR)/csi.rsp \
$(ROSLYN_CSC_DIR)/Microsoft.CodeAnalysis.CSharp.dll \
$(ROSLYN_CSC_DIR)/Microsoft.CodeAnalysis.CSharp.Scripting.dll \
$(ROSLYN_CSC_DIR)/Microsoft.CodeAnalysis.VisualBasic.dll \
$(ROSLYN_CSC_DIR)/Microsoft.CodeAnalysis.dll \
$(ROSLYN_CSC_DIR)/Microsoft.CodeAnalysis.Scripting.dll \
$(ROSLYN_CSC_DIR)/System.Collections.Immutable.dll \
$(ROSLYN_CSC_DIR)/System.Reflection.Metadata.dll
$(ROSLYN_CSC_DIR)/System.Reflection.Metadata.dll \
$(ROSLYN_CSC_DIR)/VBCSCompiler.exe \
$(ROSLYN_CSC_DIR)/VBCSCompiler.exe.config
DISTFILES = $(ROSLYN_FILES)
ROSLYN_FILES_TO_COPY_FOR_MSBUILD = \
$(ROSLYN_CSC_DIR)/Microsoft.Build.Tasks.CodeAnalysis.dll \
$(ROSLYN_CSC_DIR)/Microsoft.CSharp.Core.targets \
$(ROSLYN_CSC_DIR)/Microsoft.VisualBasic.Core.targets
DISTFILES = $(ROSLYN_FILES_FOR_MONO) $(ROSLYN_FILES_TO_COPY_FOR_MSBUILD)
ifeq ($(PROFILE), $(DEFAULT_PROFILE))
TARGET_DIR = $(DESTDIR)$(mono_libdir)/mono/$(FRAMEWORK_VERSION)
MSBUILD_ROSLYN_DIR = $(DESTDIR)$(mono_libdir)/mono/msbuild/15.0/bin/Roslyn
install-local:
$(MKINSTALLDIRS) $(TARGET_DIR)
$(INSTALL_LIB) $(ROSLYN_FILES) $(TARGET_DIR)
$(INSTALL_LIB) $(ROSLYN_FILES_FOR_MONO) $(TARGET_DIR)
$(MKINSTALLDIRS) $(MSBUILD_ROSLYN_DIR)
$(INSTALL_LIB) $(ROSLYN_FILES_TO_COPY_FOR_MSBUILD) $(MSBUILD_ROSLYN_DIR)
(cd $(MSBUILD_ROSLYN_DIR); for asm in $(ROSLYN_FILES_FOR_MONO); do ln -fs ../../../../$(FRAMEWORK_VERSION)/$$(basename $$asm) . ; done)
endif
+19
View File
@@ -0,0 +1,19 @@
class Base
{
public virtual (int, long rest) Foo ()
{
return (1, 2);
}
}
class Test : Base
{
public override (int, long rest) Foo ()
{
return (3, 4);
}
public static void Main ()
{
}
}
+21
View File
@@ -73115,6 +73115,27 @@
</method>
</type>
</test>
<test name="test-tuple-06.cs">
<type name="Base">
<method name="System.ValueTuple`2[System.Int32,System.Int64] Foo()" attrs="454">
<size>17</size>
</method>
<method name="Void .ctor()" attrs="6278">
<size>7</size>
</method>
</type>
<type name="Test">
<method name="System.ValueTuple`2[System.Int32,System.Int64] Foo()" attrs="198">
<size>17</size>
</method>
<method name="Void Main()" attrs="150">
<size>2</size>
</method>
<method name="Void .ctor()" attrs="6278">
<size>7</size>
</method>
</type>
</test>
<test name="test-var-01.cs">
<type name="Test">
<method name="Int32 Main()" attrs="150">
@@ -55,6 +55,7 @@
<Compile Include="..\..\..\external\linker\linker\Mono.Linker.Steps\BaseStep.cs" />
<Compile Include="..\..\..\external\linker\linker\Mono.Linker.Steps\BlacklistStep.cs" />
<Compile Include="..\..\..\external\linker\linker\Mono.Linker.Steps\CleanStep.cs" />
<Compile Include="..\..\..\external\linker\linker\Mono.Linker.Steps\ConsoleLogger.cs" />
<Compile Include="..\..\..\external\linker\linker\Mono.Linker.Steps\IStep.cs" />
<Compile Include="..\..\..\external\linker\linker\Mono.Linker.Steps\LoadI18nAssemblies.cs" />
<Compile Include="..\..\..\external\linker\linker\Mono.Linker.Steps\LoadReferencesStep.cs" />
@@ -73,6 +74,7 @@
<Compile Include="..\..\..\external\linker\linker\Mono.Linker\AssemblyResolver.cs" />
<Compile Include="..\..\..\external\linker\linker\Mono.Linker\Driver.cs" />
<Compile Include="..\..\..\external\linker\linker\Mono.Linker\I18nAssemblies.cs" />
<Compile Include="..\..\..\external\linker\linker\Mono.Linker\ILogger.cs" />
<Compile Include="..\..\..\external\linker\linker\Mono.Linker\IXApiVisitor.cs" />
<Compile Include="..\..\..\external\linker\linker\Mono.Linker\LinkContext.cs" />
<Compile Include="..\..\..\external\linker\linker\Mono.Linker\LoadException.cs" />
+2
View File
@@ -8,6 +8,8 @@
../../../external/linker/linker/Mono.Linker/AssemblyAction.cs
../../../external/linker/linker/Mono.Linker/Driver.cs
../../../external/linker/linker/Mono.Linker/I18nAssemblies.cs
../../../external/linker/linker/Mono.Linker/ILogger.cs
../../../external/linker/linker/Mono.Linker/ConsoleLogger.cs
../../../external/linker/linker/Mono.Linker/MethodAction.cs
../../../external/linker/linker/Mono.Linker/XApiReader.cs
../../../external/linker/linker/Mono.Linker/IXApiVisitor.cs
+6 -1
View File
@@ -252,7 +252,12 @@ namespace Xamarin.ApiDiff {
public override void Removed (XElement source)
{
Output.Write ("<h3>Removed Type <span class='breaking' data-is-breaking>{0}.{1}</span></h3>", State.Namespace, GetTypeName (source));
string name = State.Namespace + "." + GetTypeName (source);
if (State.IgnoreRemoved.Any (re => re.IsMatch (name)))
return;
Output.Write ("<h3>Removed Type <span class='breaking' data-is-breaking>{0}</span></h3>", name);
}
public virtual string GetTypeName (XElement type)
@@ -133,10 +133,15 @@ namespace Xamarin.ApiDiff {
if (parameters != null) {
var list = new List<string> ();
foreach (var p in parameters.Elements ("parameter")) {
var pTypeName = p.GetTypeName ("type");
list.Add (State.IgnoreParameterNameChanges
? pTypeName
: pTypeName + " " + p.GetAttribute ("name"));
var param = p.GetTypeName ("type");
if (!State.IgnoreParameterNameChanges)
param += " " + p.GetAttribute ("name");
var direction = p.GetAttribute ("direction");
if (direction?.Length > 0)
param = direction + " " + param;
list.Add (param);
}
sb.Append (String.Join (", ", list));
}
@@ -91,6 +91,10 @@ namespace Xamarin.ApiDiff {
public override void Removed (XElement source)
{
var name = source.Attribute ("name").Value;
if (State.IgnoreRemoved.Any (re => re.IsMatch (name)))
return;
Output.WriteLine ("<!-- start namespace {0} --> <div>", name);
Output.WriteLine ("<h2>Removed Namespace {0}</h2>", name);
Output.WriteLine ();
+7 -1
View File
@@ -22,6 +22,7 @@ endif
PORTABLE_TARGETS_SRC:=data/Portable/Targets
PCL5_FX_SRC:=data/Portable/Frameworks/v5.0
DENIED_ASSEMBLY_LIST_SRC=data/deniedAssembliesList.txt
NETFRAMEWORK_DIR=$(mono_libdir)/mono/xbuild-frameworks/.NETFramework
PCL5_FX_DIR=$(mono_libdir)/mono/xbuild-frameworks/.NETPortable/v5.0
@@ -39,7 +40,7 @@ endif
install-versioned-files: install-bin-data install-nuget-imports
#install files that are only installed once across all xbuild versions
install-global-files: install-frameworks install-web-targets install-pcl-targets install-pcl5-framework install-nuget-targets
install-global-files: install-frameworks install-web-targets install-pcl-targets install-pcl5-framework install-nuget-targets install-msbuild-specific-files
install-bin-data:
$(MKINSTALLDIRS) $(DESTDIR)$(XBUILD_BIN_DIR)/MSBuild
@@ -126,6 +127,10 @@ install-pcl5-framework:
$(INSTALL_DATA) "$(PCL5_FX_SRC)/ASP.NET Core 1.0.xml" "$(DESTDIR)$(PCL5_FX_DIR)/SupportedFrameworks/ASP.NET Core 1.0.xml"
$(INSTALL_DATA) "$(PCL5_FX_SRC)/Windows Universal 10.0.xml" "$(DESTDIR)$(PCL5_FX_DIR)/SupportedFrameworks/Windows Universal 10.0.xml"
install-msbuild-specific-files:
$(MKINSTALLDIRS) $(DESTDIR)$(mono_libdir)/mono/xbuild
$(INSTALL_DATA) $(DENIED_ASSEMBLY_LIST_SRC) $(DESTDIR)$(mono_libdir)/mono/xbuild
EXTRA_DISTFILES = \
data/xbuild.rsp \
data/xbuild.exe.config.in \
@@ -168,6 +173,7 @@ EXTRA_DISTFILES = \
"data/Portable/Frameworks/v5.0/ASP.NET Core 1.0.xml" \
"data/Portable/Frameworks/v5.0/FrameworkList.xml" \
"data/Portable/Frameworks/v5.0/Windows Universal 10.0.xml" \
data/deniedAssembliesList.txt \
frameworks/net_2.0.xml \
frameworks/net_3.0.xml \
frameworks/net_3.5.xml \
@@ -0,0 +1,18 @@
System.Globalization.Extensions.dll,475DBF02-9F68-44F1-8FB5-C9F69F1BD2B1,4,0,0,0
System.Globalization.Extensions.dll,5FCD54F0-4B97-4259-875D-30E481F02EA2,4,0,1,0
System.Globalization.Extensions.dll,E9FCFF5B-4DE1-4BDC-9CE8-08C640FC78CC,4,0,2,0
System.IO.Compression.dll,44FCA06C-A510-4B3E-BDBF-D08D697EF65A,4,1,0,0
System.IO.Compression.dll,3A58A219-266B-47C3-8BE8-4E4F394147AB,4,1,2,0
System.Net.Http.dll,269B562C-CC15-4736-B1B1-68D4A43CAA98,4,1,0,0
System.Net.Http.dll,EA2EC6DC-51DD-479C-BFC2-E713FB9E7E47,4,1,0,1
System.Net.Http.dll,C0E04D9C-70CF-48A6-A179-FBFD8CE69FD0,4,1,1,0
System.Net.Http.dll,817F01C3-4011-477D-890A-98232B85553D,4,1,1,0
System.Net.Http.dll,09D4A140-061C-4884-9B63-22067E841931,4,1,1,1
System.Runtime.InteropServices.RuntimeInformation.dll,F13660F8-9D0D-419F-BA4E-315693DD26EA,4,0,0,0
System.Runtime.InteropServices.RuntimeInformation.dll,DD91439F-3167-478E-BD2C-BF9C036A1395,4,0,1,0
System.Text.Encoding.CodePages.dll,C142254F-DEB5-46A7-AE43-6F10320D1D1F,4,0,1,0
System.Text.Encoding.CodePages.dll,FD178CD4-EF4F-44D5-9C3F-812B1E25126B,4,0,2,0
System.Text.Encoding.CodePages.dll,F5CCCBEC-E1AD-4DBB-9B44-9B42C86B94B8,4,1,0,0
System.Threading.Overlapped.dll,9F5D4F09-787A-458A-BA08-553AA71470F1,4,0,0,0
System.Threading.Overlapped.dll,FCBD003B-2BB4-4940-BAEF-63AF520C2336,4,0,1,0
System.Threading.Overlapped.dll,87697E71-D192-4F0B-BAD4-02BBC7793005,4,0,2,0
+7 -1
View File
@@ -1174,7 +1174,13 @@ mono_try_assembly_resolve_handle (MonoDomain *domain, MonoStringHandle fname, Mo
params [0] = MONO_HANDLE_RAW (fname);
params[1] = requesting ? MONO_HANDLE_RAW (requesting_handle) : NULL;
params [2] = &isrefonly;
MonoReflectionAssemblyHandle result = MONO_HANDLE_NEW (MonoReflectionAssembly, mono_runtime_invoke_checked (method, domain->domain, params, error));
MonoObject *exc = NULL;
MonoReflectionAssemblyHandle result = MONO_HANDLE_NEW (MonoReflectionAssembly, mono_runtime_try_invoke (method, domain->domain, params, &exc, error));
if (!is_ok (error) || exc != NULL) {
if (is_ok (error))
mono_error_set_exception_instance (error, (MonoException*)exc);
goto leave;
}
ret = !MONO_HANDLE_IS_NULL (result) ? MONO_HANDLE_GETVAL (result, assembly) : NULL;
if (ret && !refonly && ret->ref_only) {
+2
View File
@@ -37,8 +37,10 @@ typedef struct _MonoMethodPInvoke MonoMethodPInvoke;
#ifdef ENABLE_ICALL_EXPORT
#pragma GCC diagnostic ignored "-Wmissing-prototypes"
#define ICALL_DECL_EXPORT MONO_API
#define ICALL_EXPORT MONO_API
#else
#define ICALL_DECL_EXPORT
#define ICALL_EXPORT static
#endif
+39 -15
View File
@@ -1512,6 +1512,7 @@ mono_class_set_type_load_failure_causedby_class (MonoClass *klass, const MonoCla
* Sets the following fields in \p klass:
* - all the fields initialized by mono_class_init_sizes ()
* - element_class/cast_class (for enums)
* - sizes:element_size (for arrays)
* - field->type/offset for all fields
* - fields_inited
*
@@ -1771,6 +1772,7 @@ mono_class_layout_fields (MonoClass *klass, int base_instance_size, int packing_
MonoClassField *field;
gboolean blittable;
int instance_size = base_instance_size;
int element_size = -1;
int class_size, min_align;
int *field_offsets;
gboolean *fields_has_references;
@@ -2100,6 +2102,9 @@ mono_class_layout_fields (MonoClass *klass, int base_instance_size, int packing_
else if (klass->byval_arg.type == MONO_TYPE_PTR)
instance_size = sizeof (MonoObject) + sizeof (gpointer);
if (klass->byval_arg.type == MONO_TYPE_SZARRAY || klass->byval_arg.type == MONO_TYPE_ARRAY)
element_size = mono_class_array_element_size (klass->element_class);
/* Publish the data */
mono_loader_lock ();
if (klass->instance_size && !klass->image->dynamic) {
@@ -2130,6 +2135,9 @@ mono_class_layout_fields (MonoClass *klass, int base_instance_size, int packing_
klass->fields [i].offset = field_offsets [i];
}
if (klass->byval_arg.type == MONO_TYPE_SZARRAY || klass->byval_arg.type == MONO_TYPE_ARRAY)
klass->sizes.element_size = element_size;
mono_memory_barrier ();
klass->size_inited = 1;
mono_loader_unlock ();
@@ -4879,7 +4887,7 @@ mono_class_init (MonoClass *klass)
GSList *init_list = (GSList *)mono_native_tls_get_value (init_pending_tls_id);
if (g_slist_find (init_list, klass)) {
mono_class_set_type_load_failure (klass, "Recursive type definition detected");
goto leave;
goto leave_no_init_pending;
}
init_list = g_slist_prepend (init_list, klass);
mono_native_tls_set_value (init_pending_tls_id, init_list);
@@ -5078,10 +5086,12 @@ mono_class_init (MonoClass *klass)
goto leave;
leave:
leave:
init_list = mono_native_tls_get_value (init_pending_tls_id);
init_list = g_slist_remove (init_list, klass);
mono_native_tls_set_value (init_pending_tls_id, init_list);
leave_no_init_pending:
if (locked)
mono_loader_unlock ();
@@ -6595,7 +6605,7 @@ mono_bounded_array_class_get (MonoClass *eclass, guint32 rank, gboolean bounded)
/* element_size -1 is ok as this is not an instantitable type*/
klass->sizes.element_size = -1;
} else
klass->sizes.element_size = mono_class_array_element_size (eclass);
klass->sizes.element_size = -1;
mono_class_setup_supertypes (klass);
@@ -8209,22 +8219,31 @@ mono_class_is_assignable_from (MonoClass *klass, MonoClass *oklass)
return mono_gparam_is_assignable_from (klass, oklass);
}
if (MONO_CLASS_IS_INTERFACE (klass)) {
if ((oklass->byval_arg.type == MONO_TYPE_VAR) || (oklass->byval_arg.type == MONO_TYPE_MVAR)) {
MonoGenericParam *gparam = oklass->byval_arg.data.generic_param;
MonoClass **constraints = mono_generic_container_get_param_info (gparam->owner, gparam->num)->constraints;
int i;
/* This can happen if oklass is a tyvar that has a constraint which is another tyvar which in turn
* has a constraint which is a class type:
*
* class Foo { }
* class G<T1, T2> where T1 : T2 where T2 : Foo { }
*
* In this case, Foo is assignable from T1.
*/
if ((oklass->byval_arg.type == MONO_TYPE_VAR) || (oklass->byval_arg.type == MONO_TYPE_MVAR)) {
MonoGenericParam *gparam = oklass->byval_arg.data.generic_param;
MonoClass **constraints = mono_generic_container_get_param_info (gparam->owner, gparam->num)->constraints;
int i;
if (constraints) {
for (i = 0; constraints [i]; ++i) {
if (mono_class_is_assignable_from (klass, constraints [i]))
return TRUE;
}
if (constraints) {
for (i = 0; constraints [i]; ++i) {
if (mono_class_is_assignable_from (klass, constraints [i]))
return TRUE;
}
return FALSE;
}
return mono_class_has_parent (oklass, klass);
}
if (MONO_CLASS_IS_INTERFACE (klass)) {
/* interface_offsets might not be set for dynamic classes */
if (mono_class_get_ref_info_handle (oklass) && !oklass->interface_bitmap) {
/*
@@ -8633,11 +8652,16 @@ handle_enum:
* \param ac pointer to a \c MonoArrayClass
*
* \returns The size of single array element.
*
* LOCKING: Acquires the loader lock.
*/
gint32
mono_array_element_size (MonoClass *ac)
{
g_assert (ac->rank);
if (G_UNLIKELY (!ac->size_inited)) {
mono_class_setup_fields (ac);
}
return ac->sizes.element_size;
}
File diff suppressed because it is too large. Load diff
-4
View File
@@ -355,7 +355,6 @@ mono_dynamic_image_create (MonoDynamicAssembly *assembly, char *assembly_name, c
image->method_aux_hash = g_hash_table_new (NULL, NULL);
image->vararg_aux_hash = g_hash_table_new (NULL, NULL);
image->handleref = g_hash_table_new (NULL, NULL);
image->handleref_managed = mono_g_hash_table_new_type ((GHashFunc)mono_object_hash, NULL, MONO_HASH_KEY_GC, MONO_ROOT_SOURCE_REFLECTION, "dynamic module reference-to-token table");
image->tokens = mono_g_hash_table_new_type (NULL, NULL, MONO_HASH_VALUE_GC, MONO_ROOT_SOURCE_REFLECTION, "dynamic module tokens table");
image->generic_def_objects = mono_g_hash_table_new_type (NULL, NULL, MONO_HASH_VALUE_GC, MONO_ROOT_SOURCE_REFLECTION, "dynamic module generic definitions table");
image->typespec = g_hash_table_new ((GHashFunc)mono_metadata_type_hash, (GCompareFunc)mono_metadata_type_equal);
@@ -475,7 +474,6 @@ void
mono_dynamic_image_release_gc_roots (MonoDynamicImage *image)
{
release_hashtable (&image->token_fixups);
release_hashtable (&image->handleref_managed);
release_hashtable (&image->tokens);
release_hashtable (&image->remapped_tokens);
release_hashtable (&image->generic_def_objects);
@@ -495,8 +493,6 @@ mono_dynamic_image_free (MonoDynamicImage *image)
g_hash_table_destroy (di->typeref);
if (di->handleref)
g_hash_table_destroy (di->handleref);
if (di->handleref_managed)
mono_g_hash_table_destroy (di->handleref_managed);
if (di->tokens)
mono_g_hash_table_destroy (di->tokens);
if (di->remapped_tokens)
+7 -1
View File
@@ -1256,7 +1256,13 @@ ves_icall_System_Object_GetType (MonoObjectHandle obj, MonoError *error)
if (mono_class_is_transparent_proxy (klass)) {
MonoTransparentProxyHandle proxy_obj = MONO_HANDLE_CAST (MonoTransparentProxy, obj);
MonoRemoteClass *remote_class = MONO_HANDLE_GETVAL (proxy_obj, remote_class);
MonoType *proxy_type = &remote_class->proxy_class->byval_arg;
/* If it's a transparent proxy for an interface, return the
* interface type, not the unhelpful proxy_class class (which
* is just MarshalByRefObject). */
MonoType *proxy_type =
mono_remote_class_is_interface_proxy (remote_class) ?
&remote_class->interfaces[0]->byval_arg :
&remote_class->proxy_class->byval_arg;
return mono_type_get_object_handle (domain, proxy_type, error);
} else
#endif
+8 -10
View File
@@ -1113,6 +1113,11 @@ Right now the list of nugets are the ones that provide the assemblies in $ignore
This is to be removed once a proper fix is shipped through nuget.
Please keep this in sync with mcs/tools/xbuild/data/deniedAssembliesList.txt
If any assemblies are added/removed, then this should be regenerated with:
$ mono tools/nuget-hash-extractor/nuget-hash-extractor.exe nugets guids_for_msbuild > mcs/tools/xbuild/data/deniedAssembliesList.txt
*/
typedef enum {
@@ -1121,8 +1126,7 @@ typedef enum {
SYS_IO_COMPRESSION = 2, //System.IO.Compression
SYS_NET_HTTP = 3, //System.Net.Http
SYS_TEXT_ENC_CODEPAGES = 4, //System.Text.Encoding.CodePages
SYS_REF_DISP_PROXY = 5, //System.Reflection.DispatchProxy
SYS_THREADING_OVERLAPPED = 6, //System.Threading.Overlapped
SYS_THREADING_OVERLAPPED = 5, //System.Threading.Overlapped
} IgnoredAssemblyNames;
typedef struct {
@@ -1142,7 +1146,6 @@ const char *ignored_assemblies_file_names[] = {
"System.IO.Compression.dll",
"System.Net.Http.dll",
"System.Text.Encoding.CodePages.dll",
"System.Reflection.DispatchProxy.dll",
"System.Threading.Overlapped.dll"
};
@@ -1159,13 +1162,11 @@ static const IgnoredAssembly ignored_assemblies [] = {
IGNORED_ASSEMBLY (0x8437178B, SYS_NET_HTTP, "C0E04D9C-70CF-48A6-A179-FBFD8CE69FD0", "4.3.0 net46"),
IGNORED_ASSEMBLY (0xFAFDA422, SYS_NET_HTTP, "817F01C3-4011-477D-890A-98232B85553D", "4.3.1 net46"),
IGNORED_ASSEMBLY (0x472FA630, SYS_NET_HTTP, "09D4A140-061C-4884-9B63-22067E841931", "4.3.2 net46"),
IGNORED_ASSEMBLY (0x4A15555E, SYS_REF_DISP_PROXY, "E40AFEB4-CABE-4124-8412-B46AB79C92FD", "4.0.0 net46"),
IGNORED_ASSEMBLY (0xD20D9783, SYS_REF_DISP_PROXY, "2A69F0AD-B86B-40F2-8E4C-5B671E47479F", "4.0.1 netstandard1.3"),
IGNORED_ASSEMBLY (0xA33A7E68, SYS_REF_DISP_PROXY, "D4E8D2DB-BD65-4168-99EA-D2C1BDEBF9CC", "4.3.0 netstandard1.3"),
IGNORED_ASSEMBLY (0x46A4A1C5, SYS_RT_INTEROP_RUNTIME_INFO, "F13660F8-9D0D-419F-BA4E-315693DD26EA", "4.0.0 net45"),
IGNORED_ASSEMBLY (0xD07383BB, SYS_RT_INTEROP_RUNTIME_INFO, "DD91439F-3167-478E-BD2C-BF9C036A1395", "4.3.0 net45"),
IGNORED_ASSEMBLY (0x911D9EC3, SYS_TEXT_ENC_CODEPAGES, "C142254F-DEB5-46A7-AE43-6F10320D1D1F", "4.0.1 net46"),
IGNORED_ASSEMBLY (0xFA686A38, SYS_TEXT_ENC_CODEPAGES, "FD178CD4-EF4F-44D5-9C3F-812B1E25126B", "4.3.0 net46"),
IGNORED_ASSEMBLY (0xF6D18A2E, SYS_TEXT_ENC_CODEPAGES, "F5CCCBEC-E1AD-4DBB-9B44-9B42C86B94B8", "4.4.0 net461"),
IGNORED_ASSEMBLY (0xAA21986B, SYS_THREADING_OVERLAPPED, "9F5D4F09-787A-458A-BA08-553AA71470F1", "4.0.0 net46"),
IGNORED_ASSEMBLY (0x7D927C2A, SYS_THREADING_OVERLAPPED, "FCBD003B-2BB4-4940-BAEF-63AF520C2336", "4.0.1 net46"),
IGNORED_ASSEMBLY (0x6FE03EE2, SYS_THREADING_OVERLAPPED, "87697E71-D192-4F0B-BAD4-02BBC7793005", "4.3.0 net46")
@@ -1178,7 +1179,6 @@ const char *ignored_assemblies_names[] = {
"System.IO.Compression",
"System.Net.Http",
"System.Text.Encoding.CodePages",
"System.Reflection.DispatchProxy",
"System.Threading.Overlapped"
};
@@ -1194,13 +1194,11 @@ static const IgnoredAssemblyVersion ignored_assembly_versions [] = {
IGNORED_ASM_VER (SYS_NET_HTTP, 4, 1, 0, 1),
IGNORED_ASM_VER (SYS_NET_HTTP, 4, 1, 1, 0),
IGNORED_ASM_VER (SYS_NET_HTTP, 4, 1, 1, 1),
IGNORED_ASM_VER (SYS_REF_DISP_PROXY, 4, 0, 0, 0),
IGNORED_ASM_VER (SYS_REF_DISP_PROXY, 4, 0, 1, 0),
IGNORED_ASM_VER (SYS_REF_DISP_PROXY, 4, 0, 2, 0),
IGNORED_ASM_VER (SYS_RT_INTEROP_RUNTIME_INFO, 4, 0, 0, 0),
IGNORED_ASM_VER (SYS_RT_INTEROP_RUNTIME_INFO, 4, 0, 1, 0),
IGNORED_ASM_VER (SYS_TEXT_ENC_CODEPAGES, 4, 0, 1, 0),
IGNORED_ASM_VER (SYS_TEXT_ENC_CODEPAGES, 4, 0, 2, 0),
IGNORED_ASM_VER (SYS_TEXT_ENC_CODEPAGES, 4, 1, 0, 0),
IGNORED_ASM_VER (SYS_THREADING_OVERLAPPED, 4, 0, 0, 0),
IGNORED_ASM_VER (SYS_THREADING_OVERLAPPED, 4, 0, 1, 0),
IGNORED_ASM_VER (SYS_THREADING_OVERLAPPED, 4, 0, 2, 0),
+11 -3
View File
@@ -313,9 +313,17 @@ mono_field_from_token_checked (MonoImage *image, guint32 token, MonoClass **retk
mono_class_init (k);
if (retklass)
*retklass = k;
field = mono_class_get_field (k, token);
if (!field) {
mono_error_set_bad_image (error, image, "Could not resolve field token 0x%08x", token);
if (mono_class_has_failure (k)) {
MonoError causedby_error;
error_init (&causedby_error);
mono_error_set_for_class_failure (&causedby_error, k);
mono_error_set_bad_image (error, image, "Could not resolve field token 0x%08x, due to: %s", token, mono_error_get_message (&causedby_error));
mono_error_cleanup (&causedby_error);
} else {
field = mono_class_get_field (k, token);
if (!field) {
mono_error_set_bad_image (error, image, "Could not resolve field token 0x%08x", token);
}
}
}
+5 -3
View File
@@ -11590,7 +11590,6 @@ mono_marshal_load_type_info (MonoClass* klass)
layout = mono_class_get_flags (klass) & TYPE_ATTRIBUTE_LAYOUT_MASK;
/* The mempool is protected by the loader lock */
info = (MonoMarshalType *)mono_image_alloc0 (klass->image, MONO_SIZEOF_MARSHAL_TYPE + sizeof (MonoMarshalField) * count);
info->num_fields = count;
@@ -11677,8 +11676,11 @@ mono_marshal_load_type_info (MonoClass* klass)
info->min_align = min_align;
/* Update the class's blittable info, if the layouts don't match */
if (info->native_size != mono_class_value_size (klass, NULL))
if (info->native_size != mono_class_value_size (klass, NULL)) {
mono_loader_lock ();
klass->blittable = FALSE;
mono_loader_unlock ();
}
/* If this is an array type, ensure that we have element info */
if (klass->rank && !mono_marshal_is_loading_type_info (klass->element_class)) {
@@ -12364,7 +12366,7 @@ ftnptr_eh_callback_default (guint32 gchandle)
mono_gchandle_free (gchandle);
mono_raise_exception (exc);
mono_reraise_exception (exc);
}
/*
-1
View File
@@ -503,7 +503,6 @@ struct _MonoDynamicImage {
GHashTable *typespec;
GHashTable *typeref;
GHashTable *handleref;
MonoGHashTable *handleref_managed;
MonoGHashTable *tokens;
GHashTable *blob_cache;
GHashTable *standalonesig_cache;
+4
View File
@@ -643,6 +643,7 @@ typedef struct {
gboolean (*mono_current_thread_has_handle_block_guard) (void);
gboolean (*mono_above_abort_threshold) (void);
void (*mono_clear_abort_threshold) (void);
void (*mono_reraise_exception) (MonoException *ex);
} MonoRuntimeExceptionHandlingCallbacks;
MONO_COLD void mono_set_pending_exception (MonoException *exc);
@@ -1574,6 +1575,9 @@ ves_icall_array_new_specific (MonoVTable *vtable, uintptr_t n);
MonoRemoteClass*
mono_remote_class (MonoDomain *domain, MonoStringHandle class_name, MonoClass *proxy_class, MonoError *error);
gboolean
mono_remote_class_is_interface_proxy (MonoRemoteClass *remote_class);
MonoObject *
mono_remoting_invoke (MonoObject *real_proxy, MonoMethodMessage *msg, MonoObject **exc, MonoArray **out_args, MonoError *error);
+1
View File
@@ -142,6 +142,7 @@ DECL_OFFSET(MonoThreadsSync, status)
DECL_OFFSET(MonoThreadsSync, nest)
DECL_OFFSET(MonoProfilerCallContext, method)
DECL_OFFSET(MonoProfilerCallContext, return_value)
#ifdef HAVE_SGEN_GC
DECL_OFFSET(SgenClientThreadInfo, in_critical_region)
+53
View File
@@ -2165,6 +2165,22 @@ mono_class_create_runtime_vtable (MonoDomain *domain, MonoClass *klass, MonoErro
}
#ifndef DISABLE_REMOTING
/**
* mono_remote_class_is_interface_proxy:
* \param remote_class
*
* Returns TRUE if the given remote class is a proxying an interface (as
* opposed to a class deriving from MarshalByRefObject).
*/
gboolean
mono_remote_class_is_interface_proxy (MonoRemoteClass *remote_class)
{
/* This if condition is taking advantage of how mono_remote_class ()
* works: if that code changes, this needs to change too. */
return (remote_class->interface_count >= 1 &&
remote_class->proxy_class == mono_defaults.marshalbyrefobject_class);
}
/**
* mono_class_proxy_vtable:
* \param domain the application domain
@@ -2259,6 +2275,18 @@ mono_class_proxy_vtable (MonoDomain *domain, MonoRemoteClass *remote_class, Mono
/* we need to keep the GC descriptor for a transparent proxy or we confuse the precise GC */
pvt->gc_descr = mono_defaults.transparent_proxy_class->gc_descr;
if (mono_remote_class_is_interface_proxy (remote_class)) {
/* If it's a transparent proxy for an interface, set the
* MonoVTable:type to the interface type, not the placeholder
* MarshalByRefObject class. This is used when mini JITs calls
* to Object.GetType ()
*/
MonoType *itf_proxy_type = &remote_class->interfaces[0]->byval_arg;
pvt->type = mono_type_get_object_checked (domain, itf_proxy_type, error);
if (!is_ok (error))
goto failure;
}
/* initialize vtable */
mono_class_setup_vtable (klass);
for (i = 0; i < klass->vtable_size; ++i) {
@@ -2526,6 +2554,12 @@ mono_remote_class (MonoDomain *domain, MonoStringHandle class_name, MonoClass *p
key = mp_key;
if (mono_class_is_interface (proxy_class)) {
/* If we need to proxy an interface, we use this stylized
* representation (interface_count >= 1, proxy_class is
* MarshalByRefObject). The code in
* mono_remote_class_is_interface_proxy () depends on being
* able to detect that we're doing this, so if this
* representation changes, change GetType, too. */
rc = (MonoRemoteClass *)mono_domain_alloc (domain, MONO_SIZEOF_REMOTE_CLASS + sizeof(MonoClass*));
rc->interface_count = 1;
rc->interfaces [0] = proxy_class;
@@ -7346,6 +7380,25 @@ mono_raise_exception (MonoException *ex)
eh_callbacks.mono_raise_exception (ex);
}
/**
* mono_raise_exception:
* \param ex exception object
* Signal the runtime that the exception \p ex has been raised in unmanaged code.
*/
void
mono_reraise_exception (MonoException *ex)
{
MONO_REQ_GC_UNSAFE_MODE;
/*
* NOTE: Do NOT annotate this function with G_GNUC_NORETURN, since
* that will cause gcc to omit the function epilog, causing problems when
* the JIT tries to walk the stack, since the return address on the stack
* will point into the next function in the executable, not this one.
*/
eh_callbacks.mono_reraise_exception (ex);
}
void
mono_raise_exception_with_context (MonoException *ex, MonoContext *ctx)
{
+3
View File
@@ -243,6 +243,9 @@ mono_monitor_exit (MonoObject *obj);
MONO_API void
mono_raise_exception (MonoException *ex);
MONO_API void
mono_reraise_exception (MonoException *ex);
MONO_RT_EXTERNAL_ONLY
MONO_API void
mono_runtime_object_init (MonoObject *this_obj);
+1
View File
@@ -56,6 +56,7 @@ MONO_PROFILER_EVENT_1(assembly_unloaded, AssemblyLUnloaded, MonoAssembly *, asse
MONO_PROFILER_EVENT_2(method_enter, MethodEnter, MonoMethod *, method, MonoProfilerCallContext *, context)
MONO_PROFILER_EVENT_2(method_leave, MethodLeave, MonoMethod *, method, MonoProfilerCallContext *, context)
MONO_PROFILER_EVENT_2(method_tail_call, MethodTailCall, MonoMethod *, method, MonoMethod *, target)
MONO_PROFILER_EVENT_2(method_exception_leave, MethodExceptionLeave, MonoMethod *, method, MonoObject *, exception)
MONO_PROFILER_EVENT_1(method_free, MethodFree, MonoMethod *, method)
MONO_PROFILER_EVENT_1(method_begin_invoke, MethodBeginInvoke, MonoMethod *, method)
+4 -4
View File
@@ -7,16 +7,17 @@
#ifndef __MONO_PROFILER_PRIVATE_H__
#define __MONO_PROFILER_PRIVATE_H__
#include <mono/metadata/class-internals.h>
#define MONO_PROFILER_UNSTABLE_GC_ROOTS
#include <mono/metadata/profiler.h>
#include <mono/utils/mono-context.h>
#include <mono/utils/mono-lazy-init.h>
#include <mono/utils/mono-os-mutex.h>
#include <mono/utils/mono-os-semaphore.h>
struct _MonoProfilerDesc {
MonoProfilerHandle next;
MonoProfiler *prof;
volatile gpointer cleanup_callback;
volatile gpointer coverage_filter;
volatile gpointer call_instrumentation_filter;
@@ -46,7 +47,7 @@ typedef struct {
MonoProfilerHandle profilers;
mono_lazy_init_t coverage_status;
gboolean code_coverage;
mono_mutex_t coverage_mutex;
GHashTable *coverage_hash;
@@ -106,7 +107,6 @@ mono_profiler_installed (void)
}
MonoProfilerCoverageInfo *mono_profiler_coverage_alloc (MonoMethod *method, guint32 entries);
void mono_profiler_coverage_free (MonoMethod *method);
struct _MonoProfilerCallContext {
/*
@@ -139,7 +139,7 @@ mono_profiler_allocations_enabled (void)
}
#define _MONO_PROFILER_EVENT(name, ...) \
void mono_profiler_raise_ ## name (__VA_ARGS__);
ICALL_DECL_EXPORT void mono_profiler_raise_ ## name (__VA_ARGS__);
#define MONO_PROFILER_EVENT_0(name, type) \
_MONO_PROFILER_EVENT(name, void)
#define MONO_PROFILER_EVENT_1(name, type, arg1_type, arg1_name) \
+56 -29
View File
@@ -157,23 +157,31 @@ mono_profiler_create (MonoProfiler *prof)
return handle;
}
void
mono_profiler_set_cleanup_callback (MonoProfilerHandle handle, MonoProfilerCleanupCallback cb)
{
InterlockedWritePointer (&handle->cleanup_callback, (gpointer) cb);
}
void
mono_profiler_set_coverage_filter_callback (MonoProfilerHandle handle, MonoProfilerCoverageFilterCallback cb)
{
InterlockedWritePointer (&handle->coverage_filter, (gpointer) cb);
}
static void
initialize_coverage (void)
mono_bool
mono_profiler_enable_coverage (void)
{
if (mono_profiler_state.startup_done)
return FALSE;
mono_os_mutex_init (&mono_profiler_state.coverage_mutex);
mono_profiler_state.coverage_hash = g_hash_table_new (NULL, NULL);
}
static void
lazy_initialize_coverage (void)
{
mono_lazy_initialize (&mono_profiler_state.coverage_status, initialize_coverage);
if (!mono_debug_enabled ())
mono_debug_init (MONO_DEBUG_FORMAT_MONO);
return mono_profiler_state.code_coverage = TRUE;
}
static void
@@ -188,10 +196,11 @@ coverage_unlock (void)
mono_os_mutex_unlock (&mono_profiler_state.coverage_mutex);
}
void
mono_bool
mono_profiler_get_coverage_data (MonoProfilerHandle handle, MonoMethod *method, MonoProfilerCoverageCallback cb)
{
lazy_initialize_coverage ();
if (!mono_profiler_state.code_coverage)
return FALSE;
coverage_lock ();
@@ -200,7 +209,7 @@ mono_profiler_get_coverage_data (MonoProfilerHandle handle, MonoMethod *method,
coverage_unlock ();
if (!info)
return;
return FALSE;
MonoError error;
MonoMethodHeader *header = mono_method_get_header_checked (method, &error);
@@ -209,7 +218,7 @@ mono_profiler_get_coverage_data (MonoProfilerHandle handle, MonoMethod *method,
guint32 size;
const unsigned char *start = mono_method_header_get_code (header, &size, NULL);
const unsigned char *end = start - size;
const unsigned char *end = start + size;
MonoDebugMethodInfo *minfo = mono_debug_lookup_method (method);
for (guint32 i = 0; i < info->entries; i++) {
@@ -245,12 +254,15 @@ mono_profiler_get_coverage_data (MonoProfilerHandle handle, MonoMethod *method,
}
mono_metadata_free_mh (header);
return TRUE;
}
MonoProfilerCoverageInfo *
mono_profiler_coverage_alloc (MonoMethod *method, guint32 entries)
{
lazy_initialize_coverage ();
if (!mono_profiler_state.code_coverage)
return FALSE;
gboolean cover = FALSE;
@@ -277,23 +289,6 @@ mono_profiler_coverage_alloc (MonoMethod *method, guint32 entries)
return info;
}
void
mono_profiler_coverage_free (MonoMethod *method)
{
lazy_initialize_coverage ();
coverage_lock ();
MonoProfilerCoverageInfo *info = g_hash_table_lookup (mono_profiler_state.coverage_hash, method);
if (info) {
g_hash_table_remove (mono_profiler_state.coverage_hash, method);
g_free (info);
}
coverage_unlock ();
}
mono_bool
mono_profiler_enable_sampling (MonoProfilerHandle handle)
{
@@ -489,6 +484,38 @@ mono_profiler_cleanup (void)
#undef MONO_PROFILER_EVENT_3
#undef MONO_PROFILER_EVENT_4
#undef _MONO_PROFILER_EVENT
MonoProfilerHandle head = mono_profiler_state.profilers;
while (head) {
MonoProfilerCleanupCallback cb = head->cleanup_callback;
if (cb)
cb (head->prof);
MonoProfilerHandle cur = head;
head = head->next;
g_free (cur);
}
if (mono_profiler_state.code_coverage) {
mono_os_mutex_destroy (&mono_profiler_state.coverage_mutex);
GHashTableIter iter;
g_hash_table_iter_init (&iter, mono_profiler_state.coverage_hash);
MonoProfilerCoverageInfo *info;
while (g_hash_table_iter_next (&iter, NULL, (gpointer *) &info))
g_free (info);
g_hash_table_destroy (mono_profiler_state.coverage_hash);
}
if (mono_profiler_state.sampling_owner)
mono_os_sem_destroy (&mono_profiler_state.sampling_semaphore);
}
static void
+48 -12
View File
@@ -42,7 +42,9 @@ typedef struct _MonoProfilerDesc *MonoProfilerHandle;
/*
* Installs a profiler and returns a handle for it. The handle is used with the
* other functions in the profiler API (e.g. for setting up callbacks).
* other functions in the profiler API (e.g. for setting up callbacks). The
* given structure pointer will be passed to all callbacks from the profiler
* API. It can be NULL.
*
* This function may only be called from your profiler's init function.
*
@@ -61,6 +63,31 @@ typedef struct _MonoProfilerDesc *MonoProfilerHandle;
*/
MONO_API MonoProfilerHandle mono_profiler_create (MonoProfiler *prof);
typedef void (*MonoProfilerCleanupCallback) (MonoProfiler *prof);
/*
* Sets a profiler cleanup function. This function will be invoked at shutdown
* when the profiler API is cleaning up its internal structures. It's mainly
* intended for a profiler to free the structure pointer that was passed to
* mono_profiler_create, if necessary.
*
* This function is async safe.
*/
MONO_API void mono_profiler_set_cleanup_callback (MonoProfilerHandle handle, MonoProfilerCleanupCallback cb);
/*
* Enables support for code coverage instrumentation. At the moment, this means
* enabling the debug info subsystem. If you do not call this function, you
* will not be able to use mono_profiler_get_coverage_data. Returns TRUE if
* code coverage support was enabled, or FALSE if the function was called too
* late for this to be possible.
*
* This function may only be called from your profiler's init function.
*
* This function is not async safe.
*/
MONO_API mono_bool mono_profiler_enable_coverage (void);
typedef mono_bool (*MonoProfilerCoverageFilterCallback) (MonoProfiler *prof, MonoMethod *method);
/*
@@ -91,11 +118,16 @@ typedef void (*MonoProfilerCoverageCallback) (MonoProfiler *prof, const MonoProf
/*
* Retrieves all coverage data for the specified method and invokes the given
* callback for each entry.
* callback for each entry. Source location information will only be filled out
* if the given method has debug info available. Returns TRUE if the given
* method was instrumented for code coverage; otherwise, FALSE.
*
* Please note that the structure passed to the callback is only valid for the
* duration of the callback.
*
* This function is not async safe.
*/
MONO_API void mono_profiler_get_coverage_data (MonoProfilerHandle handle, MonoMethod *method, MonoProfilerCoverageCallback cb);
MONO_API mono_bool mono_profiler_get_coverage_data (MonoProfilerHandle handle, MonoMethod *method, MonoProfilerCoverageCallback cb);
typedef enum {
/*
@@ -167,15 +199,19 @@ MONO_API mono_bool mono_profiler_enable_allocations (void);
typedef enum {
/* Do not instrument calls. */
MONO_PROFILER_CALL_INSTRUMENTATION_NONE = 1 << 0,
/* Instrument method prologues. */
MONO_PROFILER_CALL_INSTRUMENTATION_PROLOGUE = 1 << 1,
/* Also capture a call context for prologues. */
MONO_PROFILER_CALL_INSTRUMENTATION_PROLOGUE_CONTEXT = 1 << 2,
/* Instrument method epilogues. */
MONO_PROFILER_CALL_INSTRUMENTATION_EPILOGUE = 1 << 3,
/* Also capture a call context for epilogues. */
MONO_PROFILER_CALL_INSTRUMENTATION_EPILOGUE_CONTEXT = 1 << 4,
MONO_PROFILER_CALL_INSTRUMENTATION_NONE = 0,
/* Instrument method entries. */
MONO_PROFILER_CALL_INSTRUMENTATION_ENTER = 1 << 1,
/* Also capture a call context for method entries. */
MONO_PROFILER_CALL_INSTRUMENTATION_ENTER_CONTEXT = 1 << 2,
/* Instrument method exits. */
MONO_PROFILER_CALL_INSTRUMENTATION_LEAVE = 1 << 3,
/* Also capture a call context for method exits. */
MONO_PROFILER_CALL_INSTRUMENTATION_LEAVE_CONTEXT = 1 << 4,
/* Instrument method exits as a result of a tail call. */
MONO_PROFILER_CALL_INSTRUMENTATION_TAIL_CALL = 1 << 5,
/* Instrument exceptional method exits. */
MONO_PROFILER_CALL_INSTRUMENTATION_EXCEPTION_LEAVE = 1 << 6,
} MonoProfilerCallInstrumentationFlags;
typedef MonoProfilerCallInstrumentationFlags (*MonoProfilerCallInstrumentationFilterCallback) (MonoProfiler *prof, MonoMethod *method);
+1
View File
@@ -398,6 +398,7 @@ get_array_fill_vtable (void)
klass.rank = 1;
klass.instance_size = MONO_SIZEOF_MONO_ARRAY;
klass.sizes.element_size = 1;
klass.size_inited = 1;
klass.name = "array_filler_type";
vtable->klass = &klass;
+48 -13
View File
@@ -740,7 +740,7 @@ is_field_on_inst (MonoClassField *field)
#ifndef DISABLE_REFLECTION_EMIT
static guint32
mono_image_get_fieldref_token (MonoDynamicImage *assembly, MonoObjectHandle f, MonoClassField *field)
mono_image_get_fieldref_token (MonoDynamicImage *assembly, MonoClassField *field)
{
MonoType *type;
guint32 token;
@@ -748,7 +748,7 @@ mono_image_get_fieldref_token (MonoDynamicImage *assembly, MonoObjectHandle f, M
g_assert (field);
g_assert (field->parent);
token = GPOINTER_TO_UINT (mono_g_hash_table_lookup (assembly->handleref_managed, MONO_HANDLE_RAW (f)));
token = GPOINTER_TO_UINT (g_hash_table_lookup (assembly->handleref, field));
if (token)
return token;
@@ -761,7 +761,7 @@ mono_image_get_fieldref_token (MonoDynamicImage *assembly, MonoObjectHandle f, M
token = mono_image_get_memberref_token (assembly, &field->parent->byval_arg,
mono_field_get_name (field),
mono_dynimage_encode_fieldref_signature (assembly, field->parent->image, type));
mono_g_hash_table_insert (assembly->handleref_managed, MONO_HANDLE_RAW (f), GUINT_TO_POINTER(token));
g_hash_table_insert (assembly->handleref, field, GUINT_TO_POINTER(token));
return token;
}
@@ -1115,17 +1115,20 @@ mono_image_create_token (MonoDynamicImage *assembly, MonoObjectHandle obj,
gboolean create_open_instance, gboolean register_token,
MonoError *error)
{
HANDLE_FUNCTION_ENTER ();
guint32 token = 0;
error_init (error);
MonoClass *klass = mono_handle_class (obj);
MonoObjectHandle register_obj = MONO_HANDLE_NEW (MonoObject, NULL);
MONO_HANDLE_ASSIGN (register_obj, obj);
/* Check for user defined reflection objects */
/* TypeDelegator is the only corlib type which doesn't look like a MonoReflectionType */
if (klass->image != mono_defaults.corlib || (strcmp (klass->name, "TypeDelegator") == 0)) {
mono_error_set_not_supported (error, "User defined subclasses of System.Type are not yet supported");
return 0;
goto leave;
}
/* This function is called from ModuleBuilder:getToken multiple times for the same objects */
@@ -1133,7 +1136,8 @@ mono_image_create_token (MonoDynamicImage *assembly, MonoObjectHandle obj,
if (strcmp (klass->name, "RuntimeType") == 0) {
MonoType *type = mono_reflection_type_handle_mono_type (MONO_HANDLE_CAST (MonoReflectionType, obj), error);
return_val_if_nok (error, 0);
if (!is_ok (error))
goto leave;
MonoClass *mc = mono_class_from_mono_type (type);
token = mono_metadata_token_from_dor (
mono_dynimage_encode_typedef_or_ref_full (assembly, type, !mono_class_is_gtd (mc) || create_open_instance));
@@ -1170,7 +1174,21 @@ mono_image_create_token (MonoDynamicImage *assembly, MonoObjectHandle obj,
how_collide = MONO_DYN_IMAGE_TOK_NEW;
}
} else {
token = mono_image_get_methodref_token (assembly, method, create_open_instance);
guint32 methodref_token = mono_image_get_methodref_token (assembly, method, create_open_instance);
/* We need to register a 'canonical' object. The same
* MonoMethod could have been reflected via different
* classes so the MonoReflectionMethod:reftype could be
* different, and the object lookup in
* dynamic_image_register_token would assert assert. So
* we pick the MonoReflectionMethod object that has the
* reflected type as NULL (ie, take the declaring type
* of the method) */
MonoReflectionMethodHandle canonical_obj =
mono_method_get_object_handle (MONO_HANDLE_DOMAIN (obj), method, NULL, error);
if (!is_ok (error))
goto leave;
MONO_HANDLE_ASSIGN (register_obj, canonical_obj);
token = methodref_token;
}
/*g_print ("got token 0x%08x for %s\n", token, m->method->name);*/
} else if (strcmp (klass->name, "MonoField") == 0) {
@@ -1182,25 +1200,42 @@ mono_image_create_token (MonoDynamicImage *assembly, MonoObjectHandle obj,
token = MONO_TOKEN_FIELD_DEF | field_table_idx;
how_collide = MONO_DYN_IMAGE_TOK_NEW;
} else {
token = mono_image_get_fieldref_token (assembly, obj, field);
guint32 fieldref_token = mono_image_get_fieldref_token (assembly, field);
/* Same as methodref: get a canonical object to
* register with the token. */
MonoReflectionFieldHandle canonical_obj =
mono_field_get_object_handle (MONO_HANDLE_DOMAIN (obj), field->parent, field, error);
if (!is_ok (error))
goto leave;
MONO_HANDLE_ASSIGN (register_obj, canonical_obj);
token = fieldref_token;
}
/*g_print ("got token 0x%08x for %s\n", token, f->field->name);*/
} else if (strcmp (klass->name, "MonoArrayMethod") == 0) {
MonoReflectionArrayMethodHandle m = MONO_HANDLE_CAST (MonoReflectionArrayMethod, obj);
token = mono_image_get_array_token (assembly, m, error);
return_val_if_nok (error, 0);
/* always returns a fresh token */
guint32 array_token = mono_image_get_array_token (assembly, m, error);
if (!is_ok (error))
goto leave;
token = array_token;
how_collide = MONO_DYN_IMAGE_TOK_NEW;
} else if (strcmp (klass->name, "SignatureHelper") == 0) {
MonoReflectionSigHelperHandle s = MONO_HANDLE_CAST (MonoReflectionSigHelper, obj);
token = MONO_TOKEN_SIGNATURE | mono_image_get_sighelper_token (assembly, s, error);
return_val_if_nok (error, 0);
/* always returns a fresh token */
guint32 sig_token = MONO_TOKEN_SIGNATURE | mono_image_get_sighelper_token (assembly, s, error);
if (!is_ok (error))
goto leave;
token = sig_token;
how_collide = MONO_DYN_IMAGE_TOK_NEW;
} else {
g_error ("requested token for %s\n", klass->name);
}
if (register_token)
mono_dynamic_image_register_token (assembly, token, obj, how_collide);
mono_dynamic_image_register_token (assembly, token, register_obj, how_collide);
return token;
leave:
HANDLE_FUNCTION_RETURN_VAL (token);
}
+4 -4
View File
@@ -387,7 +387,7 @@ worker_park (void)
gboolean timeout = FALSE;
gboolean interrupted = FALSE;
mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_THREADPOOL, "[%p] worker parking",
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_THREADPOOL, "[%p] worker parking",
GUINT_TO_POINTER (MONO_NATIVE_THREAD_ID_TO_UINT (mono_native_thread_id_get ())));
mono_coop_mutex_lock (&worker.parked_threads_lock);
@@ -431,7 +431,7 @@ done:
mono_coop_mutex_unlock (&worker.parked_threads_lock);
mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_THREADPOOL, "[%p] worker unparking, timeout? %s interrupted? %s",
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_THREADPOOL, "[%p] worker unparking, timeout? %s interrupted? %s",
GUINT_TO_POINTER (MONO_NATIVE_THREAD_ID_TO_UINT (mono_native_thread_id_get ())), timeout ? "yes" : "no", interrupted ? "yes" : "no");
return timeout;
@@ -464,7 +464,7 @@ worker_thread (gpointer unused)
MonoInternalThread *thread;
ThreadPoolWorkerCounter counter;
mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_THREADPOOL, "[%p] worker starting",
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_THREADPOOL, "[%p] worker starting",
GUINT_TO_POINTER (MONO_NATIVE_THREAD_ID_TO_UINT (mono_native_thread_id_get ())));
if (!mono_refcount_tryinc (&worker))
@@ -502,7 +502,7 @@ worker_thread (gpointer unused)
counter._.working --;
});
mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_THREADPOOL, "[%p] worker finishing",
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_THREADPOOL, "[%p] worker finishing",
GUINT_TO_POINTER (MONO_NATIVE_THREAD_ID_TO_UINT (mono_native_thread_id_get ())));
mono_refcount_dec (&worker);
+2 -2
View File
@@ -462,8 +462,8 @@ typedef union {
#define SPECIAL_STATIC_OFFSET_TYPE_THREAD 0
#define SPECIAL_STATIC_OFFSET_TYPE_CONTEXT 1
#define MAKE_SPECIAL_STATIC_OFFSET(index, offset, type) \
((SpecialStaticOffset) { .fields = { (index), (offset), (type) } }.raw)
#define MAKE_SPECIAL_STATIC_OFFSET(idx, off, ty) \
((SpecialStaticOffset) { .fields = { .index = (idx), .offset = (off), .type = (ty) } }.raw)
#define ACCESS_SPECIAL_STATIC_OFFSET(x,f) \
(((SpecialStaticOffset *) &(x))->fields.f)
+3
View File
@@ -66,6 +66,9 @@ mono_w32error_unix_to_win32 (guint32 error)
case EINTR: return ERROR_IO_PENDING; /* best match I could find */
case EPIPE: return ERROR_WRITE_FAULT;
case ELOOP: return ERROR_CANT_RESOLVE_FILENAME;
#ifdef ENODEV
case ENODEV: return ERROR_DEV_NOT_EXIST;
#endif
default:
g_error ("%s: unknown error (%d) \"%s\"", __FILE__, error, g_strerror (error));
+1
View File
@@ -31,6 +31,7 @@
#define ERROR_LOCK_VIOLATION 33
#define ERROR_HANDLE_DISK_FULL 39
#define ERROR_NOT_SUPPORTED 50
#define ERROR_DEV_NOT_EXIST 55
#define ERROR_FILE_EXISTS 80
#define ERROR_CANNOT_MAKE 82
#define ERROR_INVALID_PARAMETER 87
+7 -2
View File
@@ -1347,8 +1347,13 @@ mono_w32handle_wait_multiple (gpointer *handles, gsize nhandles, gboolean waital
signalled = (waitall && count == nhandles) || (!waitall && count > 0);
if (signalled) {
for (i = 0; i < nhandles; i++)
own_if_signalled (handles [i], &abandoned [i]);
for (i = 0; i < nhandles; i++) {
if (own_if_signalled (handles [i], &abandoned [i]) && !waitall) {
/* if we are calling WaitHandle.WaitAny, .NET only owns the first one; it matters for Mutex which
* throw AbandonedMutexException in case we owned it but didn't release it */
break;
}
}
}
mono_w32handle_unlock_handles (handles, nhandles);
+2 -2
View File
@@ -2580,8 +2580,8 @@ ves_icall_Microsoft_Win32_NativeMethods_GetProcessTimes (gpointer handle, gint64
&start_ticks, &user_ticks, &kernel_ticks);
ticks_to_processtime (start_ticks, creation_processtime);
ticks_to_processtime (user_ticks, kernel_processtime);
ticks_to_processtime (kernel_ticks, user_processtime);
ticks_to_processtime (kernel_ticks, kernel_processtime);
ticks_to_processtime (user_ticks, user_processtime);
return TRUE;
}
+1
View File
@@ -54,6 +54,7 @@
#include "w32handle.h"
#include "utils/mono-logger-internals.h"
#include "utils/mono-poll.h"
#include "utils/mono-compiler.h"
typedef struct {
int domain;
+2 -2
View File
@@ -99,8 +99,8 @@ long_min_un: dest:i src1:i src2:i len:16 clob:1
long_max: dest:i src1:i src2:i len:16 clob:1
long_max_un: dest:i src1:i src2:i len:16 clob:1
throw: src1:i len:18
rethrow: src1:i len:18
throw: src1:i len:24
rethrow: src1:i len:24
start_handler: len:16
endfinally: len:9
endfilter: src1:a len:9
+67
View File
@@ -2896,4 +2896,71 @@ END:
IL_0018: ldloc.0
ret
}
.method private hidebysig static void fail_inline() cil managed
{
// Code size 9 (0x9)
.maxstack 8
IL_0000: ldc.i4.s 16
IL_0002: conv.u
IL_0003: ldc.i4.1
IL_0004: mul.ovf.un
IL_0005: localloc
IL_0007: pop
IL_0008: ret
}
.method private hidebysig static int32
always_inline(int32 op) cil managed aggressiveinlining
{
// Code size 24 (0x18)
.maxstack 8
IL_0000: ldarg.0
IL_0001: brfalse.s IL_0009
IL_0003: ldarg.0
IL_0004: ldc.i4.2
IL_0005: beq.s IL_000b
IL_0007: br.s IL_000d
IL_0009: ldc.i4.0
IL_000a: ret
IL_000b: ldc.i4.3
IL_000c: ret
IL_000d: call void Tests::fail_inline()
IL_0012: newobj instance void [mscorlib]System.Exception::.ctor()
IL_0017: throw
}
.method public hidebysig static int32 test_3_regress_59608() cil managed
{
.maxstack 8
IL_0000: ldc.i4.2
IL_0001: call int32 Tests::always_inline(int32)
IL_000c: ret
}
.method public static bool llvm_regress_59436 () {
// Code size 41 (0x29)
.maxstack 3
.locals init (float64 V_0,
float64 V_1,
valuetype [mscorlib]System.Decimal V_2)
IL_0000: ldc.r8 1
IL_0009: stloc.0
IL_000a: ldc.r8 2
IL_0013: stloc.1
IL_0014: ldloc.0
IL_0015: newobj instance void [mscorlib]System.Decimal::.ctor(float64)
IL_001a: ldloca.s V_2
IL_001c: ldloc.1
IL_001d: call instance void [mscorlib]System.Decimal::.ctor(float64)
IL_0022: ldloc.2
IL_0023: call bool [mscorlib]System.Decimal::op_LessThanOrEqual(valuetype [mscorlib]System.Decimal,
valuetype [mscorlib]System.Decimal)
IL_0028: ret
}
}
+28 -25
View File
@@ -2436,6 +2436,10 @@ ves_exec_method_with_context (InterpFrame *frame, ThreadContext *context, unsign
}
MINT_IN_CASE(MINT_JMP) {
InterpMethod *new_method = rtm->data_items [* (guint16 *)(ip + 1)];
if (frame->imethod->prof_flags & MONO_PROFILER_CALL_INSTRUMENTATION_TAIL_CALL)
MONO_PROFILER_RAISE (method_tail_call, (frame->imethod->method, new_method->method));
if (!new_method->transformed) {
frame->ip = ip;
frame->ex = mono_interp_transform_method (new_method, context);
@@ -4769,7 +4773,7 @@ array_constructed:
if (MONO_PROFILER_ENABLED (method_enter)) {
MonoProfilerCallContext *prof_ctx = NULL;
if (frame->imethod->prof_flags & MONO_PROFILER_CALL_INSTRUMENTATION_PROLOGUE_CONTEXT) {
if (frame->imethod->prof_flags & MONO_PROFILER_CALL_INSTRUMENTATION_ENTER_CONTEXT) {
prof_ctx = g_new0 (MonoProfilerCallContext, 1);
prof_ctx->interp_frame = frame;
prof_ctx->method = frame->imethod->method;
@@ -5140,35 +5144,34 @@ die_on_ex:
}
exit_frame:
if (!frame->ex) {
if (MONO_PROFILER_ENABLED (method_leave) && frame->imethod->prof_flags & MONO_PROFILER_CALL_INSTRUMENTATION_EPILOGUE) {
MonoProfilerCallContext *prof_ctx = NULL;
if (!frame->ex && MONO_PROFILER_ENABLED (method_leave) &&
frame->imethod->prof_flags & MONO_PROFILER_CALL_INSTRUMENTATION_LEAVE) {
MonoProfilerCallContext *prof_ctx = NULL;
if (frame->imethod->prof_flags & MONO_PROFILER_CALL_INSTRUMENTATION_EPILOGUE_CONTEXT) {
prof_ctx = g_new0 (MonoProfilerCallContext, 1);
prof_ctx->interp_frame = frame;
prof_ctx->method = frame->imethod->method;
if (frame->imethod->prof_flags & MONO_PROFILER_CALL_INSTRUMENTATION_LEAVE_CONTEXT) {
prof_ctx = g_new0 (MonoProfilerCallContext, 1);
prof_ctx->interp_frame = frame;
prof_ctx->method = frame->imethod->method;
MonoType *rtype = mono_method_signature (frame->imethod->method)->ret;
MonoType *rtype = mono_method_signature (frame->imethod->method)->ret;
switch (rtype->type) {
case MONO_TYPE_VOID:
break;
case MONO_TYPE_VALUETYPE:
prof_ctx->return_value = frame->retval->data.p;
break;
default:
prof_ctx->return_value = frame->retval;
break;
}
switch (rtype->type) {
case MONO_TYPE_VOID:
break;
case MONO_TYPE_VALUETYPE:
prof_ctx->return_value = frame->retval->data.p;
break;
default:
prof_ctx->return_value = frame->retval;
break;
}
MONO_PROFILER_RAISE (method_leave, (frame->imethod->method, prof_ctx));
g_free (prof_ctx);
}
} else
MONO_PROFILER_RAISE (method_exception_leave, (frame->imethod->method, (MonoObject *) frame->ex));
MONO_PROFILER_RAISE (method_leave, (frame->imethod->method, prof_ctx));
g_free (prof_ctx);
} else if (frame->ex && frame->imethod->prof_flags & MONO_PROFILER_CALL_INSTRUMENTATION_EXCEPTION_LEAVE)
MONO_PROFILER_RAISE (method_exception_leave, (frame->imethod->method, &frame->ex->object));
DEBUG_LEAVE ();
}
+2 -1
View File
@@ -1514,7 +1514,7 @@ generate (MonoMethod *method, InterpMethod *rtm, unsigned char *is_bb_start, Mon
}
}
if (rtm->prof_flags & MONO_PROFILER_CALL_INSTRUMENTATION_PROLOGUE)
if (rtm->prof_flags & MONO_PROFILER_CALL_INSTRUMENTATION_ENTER)
ADD_CODE (td, MINT_PROF_ENTER);
if (sym_seq_points) {
@@ -3753,6 +3753,7 @@ generate (MonoMethod *method, InterpMethod *rtm, unsigned char *is_bb_start, Mon
case CEE_TAIL_:
++td->ip;
/* FIX: should do something? */;
// TODO: This should raise a method_tail_call profiler event.
break;
case CEE_INITOBJ:
CHECK_STACK(td, 1);
+19 -13
View File
@@ -2217,7 +2217,7 @@ check_method_sharing (MonoCompile *cfg, MonoMethod *cmethod, gboolean *out_pass_
inline static MonoCallInst *
mono_emit_call_args (MonoCompile *cfg, MonoMethodSignature *sig,
MonoInst **args, int calli, int virtual_, int tail, int rgctx, int unbox_trampoline)
MonoInst **args, int calli, int virtual_, int tail, int rgctx, int unbox_trampoline, MonoMethod *target)
{
MonoType *sig_ret;
MonoCallInst *call;
@@ -2229,7 +2229,7 @@ mono_emit_call_args (MonoCompile *cfg, MonoMethodSignature *sig,
tail = FALSE;
if (tail) {
mini_profiler_emit_instrumentation_call (cfg, mono_profiler_raise_method_leave, FALSE, NULL, NULL);
mini_profiler_emit_tail_call (cfg, target);
MONO_INST_NEW_CALL (cfg, call, OP_TAILCALL);
} else
@@ -2362,7 +2362,7 @@ mini_emit_calli (MonoCompile *cfg, MonoMethodSignature *sig, MonoInst **args, Mo
MONO_ADD_INS (cfg->cbb, ins);
}
call = mono_emit_call_args (cfg, sig, args, TRUE, FALSE, FALSE, rgctx_arg ? TRUE : FALSE, FALSE);
call = mono_emit_call_args (cfg, sig, args, TRUE, FALSE, FALSE, rgctx_arg ? TRUE : FALSE, FALSE, NULL);
call->inst.sreg1 = addr->dreg;
@@ -2456,7 +2456,7 @@ mono_emit_method_call_full (MonoCompile *cfg, MonoMethod *method, MonoMethodSign
need_unbox_trampoline = method->klass == mono_defaults.object_class || mono_class_is_interface (method->klass);
call = mono_emit_call_args (cfg, sig, args, FALSE, virtual_, tail, rgctx_arg ? TRUE : FALSE, need_unbox_trampoline);
call = mono_emit_call_args (cfg, sig, args, FALSE, virtual_, tail, rgctx_arg ? TRUE : FALSE, need_unbox_trampoline, method);
#ifndef DISABLE_REMOTING
if (might_be_remote)
@@ -2586,7 +2586,7 @@ mono_emit_native_call (MonoCompile *cfg, gconstpointer func, MonoMethodSignature
g_assert (sig);
call = mono_emit_call_args (cfg, sig, args, FALSE, FALSE, FALSE, FALSE, FALSE);
call = mono_emit_call_args (cfg, sig, args, FALSE, FALSE, FALSE, FALSE, FALSE, NULL);
call->fptr = func;
MONO_ADD_INS (cfg->cbb, (MonoInst*)call);
@@ -6141,9 +6141,7 @@ inline_method (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsig,
prev_args = cfg->args;
prev_arg_types = cfg->arg_types;
prev_inlined_method = cfg->inlined_method;
cfg->inlined_method = cmethod;
cfg->ret_var_set = FALSE;
cfg->inline_depth ++;
prev_ret_var_set = cfg->ret_var_set;
prev_real_offset = cfg->real_offset;
prev_cbb_hash = cfg->cbb_hash;
prev_cil_offset_to_bb = cfg->cil_offset_to_bb;
@@ -6153,9 +6151,12 @@ inline_method (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsig,
prev_cbb = cfg->cbb;
prev_current_method = cfg->current_method;
prev_generic_context = cfg->generic_context;
prev_ret_var_set = cfg->ret_var_set;
prev_disable_inline = cfg->disable_inline;
cfg->inlined_method = cmethod;
cfg->ret_var_set = FALSE;
cfg->inline_depth ++;
if (ip && *ip == CEE_CALLVIRT && !(cmethod->flags & METHOD_ATTRIBUTE_STATIC))
virtual_ = TRUE;
@@ -8030,7 +8031,7 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
if (cfg->gshared && mono_method_check_context_used (cmethod))
GENERIC_SHARING_FAILURE (CEE_JMP);
mini_profiler_emit_instrumentation_call (cfg, mono_profiler_raise_method_leave, FALSE, NULL, NULL);
mini_profiler_emit_tail_call (cfg, cmethod);
fsig = mono_method_signature (cmethod);
n = fsig->param_count + fsig->hasthis;
@@ -8760,6 +8761,9 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
}
for (i = 0; i < n; ++i)
EMIT_NEW_ARGSTORE (cfg, ins, i, sp [i]);
mini_profiler_emit_tail_call (cfg, cmethod);
MONO_INST_NEW (cfg, ins, OP_BR);
MONO_ADD_INS (cfg->cbb, ins);
tblock = start_bblock->out_bb [0];
@@ -8972,7 +8976,7 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
/* Handle tail calls similarly to normal calls */
tail_call = TRUE;
} else {
mini_profiler_emit_instrumentation_call (cfg, mono_profiler_raise_method_leave, FALSE, NULL, NULL);
mini_profiler_emit_tail_call (cfg, cmethod);
MONO_INST_NEW_CALL (cfg, call, OP_JMP);
call->tail_call = TRUE;
@@ -9083,7 +9087,7 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
break;
}
case CEE_RET:
mini_profiler_emit_instrumentation_call (cfg, mono_profiler_raise_method_leave, FALSE, sp - 1, sig->ret);
mini_profiler_emit_leave (cfg, sig->ret->type != MONO_TYPE_VOID ? sp [-1] : NULL);
if (cfg->method != method) {
/* return from inlined method */
@@ -11694,6 +11698,8 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
if (sp != stack_start)
UNVERIFIED;
mini_profiler_emit_leave (cfg, sp [0]);
MONO_INST_NEW (cfg, ins, OP_BR);
ins->inst_target_bb = end_bblock;
MONO_ADD_INS (cfg->cbb, ins);
@@ -12635,7 +12641,7 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
}
cfg->cbb = init_localsbb;
mini_profiler_emit_instrumentation_call (cfg, mono_profiler_raise_method_enter, TRUE, NULL, NULL);
mini_profiler_emit_enter (cfg);
if (seq_points) {
MonoBasicBlock *bb;
+5
View File
@@ -2869,6 +2869,11 @@ emit_call_body (MonoCompile *cfg, guint8 *code, MonoJumpInfoType patch_type, gco
amd64_call_code (code, 0);
}
else {
if (!no_patch && ((guint32)(code + 2 - cfg->native_code) % 8) != 0) {
guint32 pad_size = 8 - ((guint32)(code + 2 - cfg->native_code) % 8);
amd64_padding (code, pad_size);
g_assert ((guint64)(code + 2 - cfg->native_code) % 8 == 0);
}
mono_add_patch_info (cfg, code - cfg->native_code, patch_type, data);
amd64_set_reg_template (code, GP_SCRATCH_REG);
amd64_call_reg (code, GP_SCRATCH_REG);
+17 -5
View File
@@ -251,10 +251,13 @@ mono_exceptions_init (void)
cbs.mono_walk_stack_with_state = mono_walk_stack_with_state;
if (mono_llvm_only)
if (mono_llvm_only) {
cbs.mono_raise_exception = mono_llvm_raise_exception;
else
cbs.mono_reraise_exception = mono_llvm_reraise_exception;
} else {
cbs.mono_raise_exception = (void (*)(MonoException *))mono_get_throw_exception ();
cbs.mono_reraise_exception = (void (*)(MonoException *))mono_get_rethrow_exception ();
}
cbs.mono_raise_exception_with_ctx = mono_raise_exception_with_ctx;
cbs.mono_exception_walk_trace = mono_exception_walk_trace;
cbs.mono_install_handler_block_guard = mono_install_handler_block_guard;
@@ -2230,9 +2233,12 @@ mono_handle_exception_internal (MonoContext *ctx, MonoObject *obj, gboolean resu
}
}
jit_tls->orig_ex_ctx_set = TRUE;
MONO_PROFILER_RAISE (method_exception_leave, (method, ex_obj));
jit_tls->orig_ex_ctx_set = FALSE;
if (MONO_PROFILER_ENABLED (method_exception_leave) &&
mono_profiler_get_call_instrumentation_flags (method) & MONO_PROFILER_CALL_INSTRUMENTATION_EXCEPTION_LEAVE) {
jit_tls->orig_ex_ctx_set = TRUE;
MONO_PROFILER_RAISE (method_exception_leave, (method, ex_obj));
jit_tls->orig_ex_ctx_set = FALSE;
}
*ctx = new_ctx;
}
@@ -3236,6 +3242,12 @@ mono_llvm_raise_exception (MonoException *e)
mono_llvm_throw_exception ((MonoObject*)e);
}
void
mono_llvm_reraise_exception (MonoException *e)
{
mono_llvm_rethrow_exception ((MonoObject*)e);
}
void
mono_llvm_throw_corlib_exception (guint32 ex_token_index)
{
+22 -19
View File
@@ -467,6 +467,9 @@ create_llvm_type_for_type (MonoLLVMModule *module, MonoClass *klass)
static LLVMTypeRef
type_to_llvm_type (EmitContext *ctx, MonoType *t)
{
if (t->byref)
return ThisType ();
t = mini_get_underlying_type (t);
switch (t->type) {
@@ -1226,10 +1229,10 @@ sig_to_llvm_sig_no_cinfo (EmitContext *ctx, MonoMethodSignature *sig)
int i, pindex;
MonoType *rtype;
rtype = mini_get_underlying_type (sig->ret);
ret_type = type_to_llvm_type (ctx, rtype);
ret_type = type_to_llvm_type (ctx, sig->ret);
if (!ctx_ok (ctx))
return NULL;
rtype = mini_get_underlying_type (sig->ret);
param_types = g_new0 (LLVMTypeRef, (sig->param_count * 8) + 3);
pindex = 0;
@@ -1269,10 +1272,10 @@ sig_to_llvm_sig_full (EmitContext *ctx, MonoMethodSignature *sig, LLVMCallInfo *
if (!cinfo)
return sig_to_llvm_sig_no_cinfo (ctx, sig);
rtype = mini_get_underlying_type (sig->ret);
ret_type = type_to_llvm_type (ctx, rtype);
ret_type = type_to_llvm_type (ctx, sig->ret);
if (!ctx_ok (ctx))
return NULL;
rtype = mini_get_underlying_type (sig->ret);
switch (cinfo->ret.storage) {
case LLVMArgVtypeInReg:
@@ -4117,26 +4120,26 @@ emit_handler_start (EmitContext *ctx, MonoBasicBlock *bb, LLVMBuilderRef builder
}
/* Start a new bblock which CALL_HANDLER can branch to */
target_bb = bblocks [bb->block_num].call_handler_target_bb;
if (target_bb) {
ctx->builder = builder = create_builder (ctx);
LLVMPositionBuilderAtEnd (ctx->builder, target_bb);
ctx->builder = builder = create_builder (ctx);
LLVMPositionBuilderAtEnd (ctx->builder, target_bb);
ctx->bblocks [bb->block_num].end_bblock = target_bb;
ctx->bblocks [bb->block_num].end_bblock = target_bb;
/* Store the exception into the IL level exvar */
if (bb->in_scount == 1) {
g_assert (bb->in_scount == 1);
exvar = bb->in_stack [0];
/* Store the exception into the IL level exvar */
if (bb->in_scount == 1) {
g_assert (bb->in_scount == 1);
exvar = bb->in_stack [0];
// FIXME: This is shared with filter clauses ?
g_assert (!values [exvar->dreg]);
// FIXME: This is shared with filter clauses ?
g_assert (!values [exvar->dreg]);
g_assert (ctx->ex_var);
values [exvar->dreg] = LLVMBuildLoad (builder, ctx->ex_var, "");
emit_volatile_store (ctx, exvar->dreg);
}
g_assert (ctx->ex_var);
values [exvar->dreg] = LLVMBuildLoad (builder, ctx->ex_var, "");
emit_volatile_store (ctx, exvar->dreg);
}
/* Make normal branches to the start of the clause branch to the new bblock */
bblocks [bb->block_num].bblock = target_bb;
}
static void
+74 -37
View File
@@ -15,20 +15,79 @@
#ifndef DISABLE_JIT
void
mini_profiler_emit_instrumentation_call (MonoCompile *cfg, void *func, gboolean entry, MonoInst **ret, MonoType *rtype)
static MonoInst *
emit_fill_call_ctx (MonoCompile *cfg, MonoInst *method, MonoInst *ret)
{
gboolean instrument, capture;
cfg->flags |= MONO_CFG_HAS_ALLOCA;
if (entry) {
instrument = cfg->prof_flags & MONO_PROFILER_CALL_INSTRUMENTATION_PROLOGUE;
capture = cfg->prof_flags & MONO_PROFILER_CALL_INSTRUMENTATION_PROLOGUE_CONTEXT;
} else {
instrument = cfg->prof_flags & MONO_PROFILER_CALL_INSTRUMENTATION_EPILOGUE;
capture = cfg->prof_flags & MONO_PROFILER_CALL_INSTRUMENTATION_EPILOGUE_CONTEXT;
MonoInst *alloc, *size, *fill_ctx;
EMIT_NEW_ICONST (cfg, size, sizeof (MonoProfilerCallContext));
MONO_INST_NEW (cfg, alloc, OP_LOCALLOC);
alloc->dreg = alloc_preg (cfg);
alloc->sreg1 = size->dreg;
alloc->flags |= MONO_INST_INIT;
MONO_ADD_INS (cfg->cbb, alloc);
MONO_INST_NEW (cfg, fill_ctx, OP_FILL_PROF_CALL_CTX);
fill_ctx->sreg1 = alloc->dreg;
MONO_ADD_INS (cfg->cbb, fill_ctx);
MONO_EMIT_NEW_STORE_MEMBASE (cfg, OP_STORE_MEMBASE_REG, alloc->dreg, MONO_STRUCT_OFFSET (MonoProfilerCallContext, method), method->dreg);
if (ret) {
MonoInst *var = mono_compile_create_var (cfg, mono_method_signature (cfg->method)->ret, OP_LOCAL);
MonoInst *store, *addr;
EMIT_NEW_TEMPSTORE (cfg, store, var->inst_c0, ret);
EMIT_NEW_VARLOADA (cfg, addr, var, NULL);
MONO_EMIT_NEW_STORE_MEMBASE (cfg, OP_STORE_MEMBASE_REG, alloc->dreg, MONO_STRUCT_OFFSET (MonoProfilerCallContext, return_value), addr->dreg);
}
if (!instrument)
return alloc;
}
void
mini_profiler_emit_enter (MonoCompile *cfg)
{
if (!MONO_CFG_PROFILE (cfg, ENTER) || cfg->current_method != cfg->method)
return;
MonoInst *iargs [2];
EMIT_NEW_METHODCONST (cfg, iargs [0], cfg->method);
if (MONO_CFG_PROFILE (cfg, ENTER_CONTEXT) && !cfg->llvm_only)
iargs [1] = emit_fill_call_ctx (cfg, iargs [0], NULL);
else
EMIT_NEW_PCONST (cfg, iargs [1], NULL);
/* void mono_profiler_raise_method_enter (MonoMethod *method, MonoProfilerCallContext *ctx) */
mono_emit_jit_icall (cfg, mono_profiler_raise_method_enter, iargs);
}
void
mini_profiler_emit_leave (MonoCompile *cfg, MonoInst *ret)
{
if (!MONO_CFG_PROFILE (cfg, LEAVE) || cfg->current_method != cfg->method)
return;
MonoInst *iargs [2];
EMIT_NEW_METHODCONST (cfg, iargs [0], cfg->method);
if (MONO_CFG_PROFILE (cfg, LEAVE_CONTEXT) && !cfg->llvm_only)
iargs [1] = emit_fill_call_ctx (cfg, iargs [0], ret);
else
EMIT_NEW_PCONST (cfg, iargs [1], NULL);
/* void mono_profiler_raise_method_leave (MonoMethod *method, MonoProfilerCallContext *ctx) */
mono_emit_jit_icall (cfg, mono_profiler_raise_method_leave, iargs);
}
void
mini_profiler_emit_tail_call (MonoCompile *cfg, MonoMethod *target)
{
if (!MONO_CFG_PROFILE (cfg, TAIL_CALL) || cfg->current_method != cfg->method)
return;
g_assert (cfg->current_method == cfg->method);
@@ -37,35 +96,13 @@ mini_profiler_emit_instrumentation_call (MonoCompile *cfg, void *func, gboolean
EMIT_NEW_METHODCONST (cfg, iargs [0], cfg->method);
if (capture && !cfg->llvm_only) {
cfg->flags |= MONO_CFG_HAS_ALLOCA;
MonoInst *size, *fill_ctx;
EMIT_NEW_ICONST (cfg, size, sizeof (MonoProfilerCallContext));
MONO_INST_NEW (cfg, iargs [1], OP_LOCALLOC);
iargs [1]->dreg = alloc_preg (cfg);
iargs [1]->sreg1 = size->dreg;
iargs [1]->flags |= MONO_INST_INIT;
MONO_ADD_INS (cfg->cbb, iargs [1]);
MONO_INST_NEW (cfg, fill_ctx, OP_FILL_PROF_CALL_CTX);
fill_ctx->sreg1 = iargs [1]->dreg;
MONO_ADD_INS (cfg->cbb, fill_ctx);
MONO_EMIT_NEW_STORE_MEMBASE (cfg, OP_STORE_MEMBASE_REG, iargs [1]->dreg, MONO_STRUCT_OFFSET (MonoProfilerCallContext, method), iargs [0]->dreg);
if (rtype && rtype->type != MONO_TYPE_VOID) {
MonoInst *var = mono_compile_create_var (cfg, rtype, OP_LOCAL);
MonoInst *store, *addr;
EMIT_NEW_TEMPSTORE (cfg, store, var->inst_c0, *ret);
EMIT_NEW_VARLOADA (cfg, addr, var, NULL);
MONO_EMIT_NEW_STORE_MEMBASE (cfg, OP_STORE_MEMBASE_REG, iargs [1]->dreg, MONO_STRUCT_OFFSET (MonoProfilerCallContext, return_value), addr->dreg);
}
} else
if (target)
EMIT_NEW_METHODCONST (cfg, iargs [1], target);
else
EMIT_NEW_PCONST (cfg, iargs [1], NULL);
mono_emit_jit_icall (cfg, func, iargs);
/* void mono_profiler_raise_method_tail_call (MonoMethod *method, MonoMethod *target) */
mono_emit_jit_icall (cfg, mono_profiler_raise_method_tail_call, iargs);
}
#endif
+1
View File
@@ -4059,6 +4059,7 @@ register_icalls (void)
*/
register_icall (mono_profiler_raise_method_enter, "mono_profiler_raise_method_enter", "void ptr ptr", TRUE);
register_icall (mono_profiler_raise_method_leave, "mono_profiler_raise_method_leave", "void ptr ptr", TRUE);
register_icall (mono_profiler_raise_method_tail_call, "mono_profiler_raise_method_tail_call", "void ptr ptr", TRUE);
register_icall (mono_trace_enter_method, "mono_trace_enter_method", NULL, TRUE);
register_icall (mono_trace_leave_method, "mono_trace_leave_method", NULL, TRUE);
+4
View File
@@ -567,6 +567,10 @@ common_call_trampoline (mgreg_t *regs, guint8 *code, MonoMethod *m, MonoVTable *
vtable_slot = mini_resolve_imt_method (vt, vtable_slot, imt_method, &impl_method, &addr, &need_rgctx_tramp, &variant_iface, error);
return_val_if_nok (error, NULL);
/* We must handle magic interfaces on rank 1 arrays of ref types as if they were variant */
if (!variant_iface && vt->klass->rank == 1 && !vt->klass->element_class->valuetype && imt_method->klass->is_array_special_interface)
variant_iface = imt_method;
/* This is the vcall slot which gets called through the IMT trampoline */
vtable_slot_to_patch = vtable_slot;
Loaded 100 of 155 files, more files were not shown because too many files have changed in this diff. Show more