* [System]: Fully stub-out SslStream on platforms where it's not supported.
* Remove 'SECURITY_DEP' conditional from LocalCertificateSelectionCallback.
* Add the internal delegates and remove 'SECURITY_DEP' from SslStream.platformnotsupported.cs.
* In SslStream.cs, we now provide the full API when '!SECURITY_DEP' using the
PlatformNotSupportedException()-based implementation from SslStream.platformnotsupported.cs
* [System]: Rename the internal class 'ChunkStream' into 'MonoChunkStream'.
Our 'ChunkStream' is used by 'WebConnection', so it will stay after using
HttpListener from corefx.
* [System]: Fully stub-out SslStream on platforms where it's not supported.
* Remove 'SECURITY_DEP' conditional from LocalCertificateSelectionCallback.
* Add the internal delegates and remove 'SECURITY_DEP' from SslStream.platformnotsupported.cs.
* In SslStream.cs, we now provide the full API when '!SECURITY_DEP' using the
PlatformNotSupportedException()-based implementation from SslStream.platformnotsupported.cs
* Fix typo.
if assembly name is NULL, mono_exception_from_name_two_strings_checked looks
for a TLE(string) constructor - which takes a message - which we immediately
overwrite.
So pass the empty string instead, which goes to the (Mono-specific)
TLE(string,string) constructor which intializes ClassName and AssemblyName
members of a TLE.
If a class T has a field e of enum type E, and E is either
incomplete (EnumBuilder that hasn't had CreateType called) or a broken class,
then mark T as failed.
I noticed this when I cleaned my Mono repo and reran autogen.sh.
I suddenly got a popup from XQuartz about "Unrecognized option: =".
Turns out this was introduced in 9e967f00b3,
the second half of the if is missing `test`, so it actually runs
`x = xyes` which starts XQuartz :D
Also cleaned up the USE_NLS checking since that ran immediately
before this and just printed "no" before which confused me.
- System.Text.EncodingHelper.InternalCodePage
- System.Runtime.InteropServices.Marshal.PtrToStringAnsi(intptr)
- Use coop handles for ves_icall_System_Configuration_DefaultConfig_get_machine_config_path
- Use coop handles for ves_icall_System_Configuration_InternalConfigurationHost_get_bundled_app_config
- Use coop handles for System.Web.Util.ICalls.GetMachineInstallDirectory
We trigger degraded mode when we are unable to properly build the nursery fragments due to excessive nursery pinning. This is done by initializing degraded_mode at the end of a minor. alloc_degraded is used to do allocation to major heap either as part of mature allocation or as part of degraded mode (when we bump the degraded_mode so we can detect when the next minor should be triggered).
When failing to allocate from the nursery after doing a minor (because the other threads might have already consumed the nursery) we need to do a mature allocation (as a fallback) instead of a degraded mode allocation so we don't uselessly enable the mode.
* [mixed] Add beginnings of unwinding support for interp->jit transitions by pushing an LMF frame on the stack when exiting interpreted code.
* [runtime] Add a mono_debug_lookup_source_location_by_il () helper function to lookup a source location using an IL offset.
* [mixed] Add support for mixed mode managed stack walks.
* [interp] Generate line number info for interpreted code, using the same MonoDebugMethodJitInfo structure used by the JIT.
* [interp] Pass the clause index to the MINT_ENDFINALLY opcode. Not yet used.
* [interp] Create a MonoJitInfo structure for each interpreted method. Not yet used.
* [interp] Add a mono_interp_set_resume_state () function which can be used to set the frame/ip the interpreter will resume execution from when execution returns to it.
* [mixed] Add support for mixed mode exception handling by extending the normal JIT exception handling code in mini-exceptions.c to handle interpreted frames as well.
* [jit] Add an Unwinder type to reduce the amount of code duplication when unwinding though interpreter frames.
* [interp] Fix the !ENABLE_INTERPRETER build.
* [interp] Disable an assert which is hit even when running without --interpreter.
* Fix a comment.
* [interp] Fix an assertion. Fix/add comments.
With these targets we can generate a snapshot of the current
Mono API in C# source code form.
Whenever we make changes, we can rerun this to ensure we didn't
inadvertently change the public API.
It also outputs a diff in html form that we can show on CI.
The code expected that a custom attribute was specified as a MonoCMethod and
was calling mono_image_create_token(). However that function expects to be
called from the managed S.R.E.ModuleBuilder:GetToken (MemberInfo) which handles
all the builders in managed code. Consequently mono_image_create_token () was
asserting.
So now we encode the token for a ConstructorBuilder in place.
monodroid used to build its own version of mkbundle since it
requires slightly different code than the desktop. This
logic was protected in a #if block. Now that monodroid is
trying to make use of the shipped mkbundle rather than use
its own we need to turn this logic on at runtime.
A new parameter has been added
--bundled-header
When this option is passed, the code which skips including
mono/metadata/mono-config.h
will be skipped in favour of defining the required structures
and entry points directly.
* [System]: Cleanup internal TLS Provider registration.
Merge MonoTlsProviderFactory.Apple.cs and MonoTlsProviderFactory.Droid.cs
into MonoTlsProviderFactory.cs.
Disable the dynamic reflection-load on mobile while still keeping the
registration, so we can use IsSupported() and friends.
* Make it build.
If mono is compiled without DISABLE_STRICT_STRONG_NAMES, but someone passes
--assembly-loader=legacy at runtime, give them the lax strong name
checking behavior (a candidate assembly is good as long as the name is right, but ignoring
the public key token and version).
When strict strong name checking is enabled, Mono will check public key tokens
and versions match between a requested assembly reference and a candidate found
via its usual loading directories.
amend
* [Mono.Security.Interface]: Improve synergy between `MonoTlsProvider`, `SslStream` and `IMonoSslStream`.
* Add `IMonoSslStream.SslStream` property; the `IMonoSslStream` is now only created my the `SslStream`
constructor, so `SslStream` "owns" the `IMonoSslStream`.
* Add internal `MonoTlsProvider.CreateSslStreamInternal()`.
* `SslStream` does not need to implement any additional interfaces; we can do without after
getting rid of the wrapper classes.
* Add internal `SslStream.CreateMonoSslStream(Stream,bool,MonoTlsProvider,MonoTlsSettings)`.
* `MonoTlsProvider.CreateSslStream()` implementations should use this new method.
* Remove ancient obsolete MonoTlsProviderFactory APIs.
* `HttpListener` and `HttpConnection` now use `SslStream` instead of `IMonoSslStream`.
* [System]: Cleanup internal TLS Provider registration.
* Make it build.
errors are correctly dealt with.
Some network errors in iOS are exposed as Stream errors, specially those
related with the lost of the connection. This patch ensures that if such
an issue happens an exception is raised in the async read task.
Fixes bug https://bugzilla.xamarin.com/show_bug.cgi?id=53792
* Check strong names on a couple more codepaths during assembly loading. Fixes [bugzilla #580](https://bugzilla.xamarin.com/show_bug.cgi?id=580) and [bugzilla #55436](https://bugzilla.xamarin.com/show_bug.cgi?id=55436)
* Add `--apply-bindings=FILE` option. Allows us to specify a configuration file for assembly binding redirections when AOTing.
* Use the above flag when AOTing `System.ReflectionMetadata.dll` to pick up `csc.exe.config`
* Add all the Facades to the `framework_assemblies` list in the runtime. Facade and non-Facade framework assemblies behave differently:
* for Facades, don't do any version remapping, and any version is okay.
* for non-Facades, consult the version map to remap depdending on the --runtime used.
Previous it was just the desktop runtime, but now that we have special handling
for framework facade assemblies in the loader, we should do it on other
runtimes, too.
As long as the name and public key token matches.
This is different from the non-facade framework assemblies for which the
name and version must match but the public key token is ignored.
Apply bindings from configuration file FILE when running the AOT compiler.
This is useful if you need to AOT a module bar.dll that is loaded when the main
assembly foo.exe has a configuration file foo.exe.config that specifies
assembly bindings that bar.dll should respect.
* Create one filters file for each targets file
* Import each filters file into the project-level filters file
* Add folders for Common, Win32, and Posix targets files
This change extracts the eglib source files from the build instuctions
for builds via MSVC on Windows. It also separates the source files into
platform-specific and common .targets files. This provides more
flexibility for builds from MSVC in a few important ways:
1. We can do MSVC-based builds for platforms that will not be pushed to
public repos by checking out the Mono code externally and importing the
.targets files into a custom .vcxproj for the platform.
2. We can replace the platform specific .targets files with a custom set
of source files to implement a different platform abstraction layer
that will not be public without the need to merge changes to the
.vcxproj from the public repo.
This allows for ease of synchronizing changes to the public Mono
repo with private forks, while _not_ changing the behavior of the code
in the public repo.
* [aot] Emit class references in EH info in such as way that they can be skipped when reading them in async context.
* [aot] Rewrite the LLVM EH info loading code by moving allocations to callers so the lower level code is async safe.
* [aot] Make the memory allocation in the loading of llvm EH info async safe. Remove fields from MonoLLVMFDEInfo which are passed as parameters.
* [runtime] Add the ability to store the unwind info address/length in the MonoJitInfo structure instead of referencing it using the 'unwind_info' field.
* [aot] Make the loading of llvm EH information async safe.
Memory allocated with mono_gc_alloc_fixed is uncollectable both on sgen and boehm. This array serves no other purpose. It should probably be killed entirely, but it's part of the API.
replace it by its canonical open instantiation.
If we have
```
class Foo<A,B,C> { ... }
class Bar<T,U> { ... }
```
Then if someone tries to construct `Bar<Foo, int>` (or more precisely, the
MonoGenericInst corresponding to `<Foo, int>` instead return `Bar< Foo<A,B,C>, int >`.
Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=54485
The canonical instantiation of a generic type definition is the open
instantiation where the GTD is applied to its own generic parameters in order.
Suppose we have `class T<A,B> { ... }` then the canonical instantiation is just "T<A,B>".
When `PCL` is defined, the intent is that the resulting
`Mono.Options.dll` assembly will be usable on all PCL profiles.
This includes "silly" profiles such as Profile259, which lacks the
`System.Console` type, meaning e.g. `Console.Out` doesn't exist.
Unfortunately, the
`CommandSet(string, Converter<string, string, TextWriter, TextWriter)`
constructor would use `Console.Out` and `Console.Error` when the
`TextWriter` parameters were `null`, meaning this constructor can't
be provided for all PCL profiles.
Altering the constructor to instead use `TextWriter.Null` would allow
the constructor to be provided, but would be a *worse* experience,
IMHO: anybody (everybody!) expecting the default values to
"do something useful" will be sorely disappointed, as output and
error messages would instead be dropped. :-(
Instead, remove this constructor:
public CommandSet (string suite, MessageLocalizerConverter localizer = null, TextWriter output = null, TextWriter error = null);
and replace it with these *two* constructors:
public CommandSet (string suite, MessageLocalizerConverter localizer = null)
public CommandSet (string suite, TextWriter output, TextWriter error, MessageLocalizerConverter localizer = null)
The first constructor, which accepts no `TextWriter` parameters, is
only provided in non-PCL builds, allowing it to use `Console.Out`.
The second constructor is available in PCL profiles, and *requires*
that `output` and `error` be non-`null`.
Documentation has been updated accordingly.
The TrimSpecial() method and Windows-specific code was removed from
xammac 4.5 so reflection can't find it anymore, handle this case.
Also add a workaround for SqlParameterCollectionTest.CopyToTest()
which fails on watchos since the SqlCommand would throw a PNSE.
It's a workaround because it just makes the test ignored since we don't
set the env var that ConnectionManager.Instance.Sql reads in XI tests,
but it makes the test consistent with the other tests in the suite.
We should fix this properly later on.
* There is an existing check for the `sockaddr_in6` struct.
* Use it to wrap code that implements IPv6.
* This makes porting to platforms that don't support IPv6 easier.
* It should have no impact on platforms that do support IPv6.
When ConnectionManager.Instance.Sql.ConnectionString throws in
SetUp() we'd still call SqlConnection.ClearAllPools() in the TearDown()
which happens for example when the connection string environment
variable is not set.
This is a problem on WatchOS since SqlConnection.ClearAllPools()
throws PlatformNotSupportedException there, making the tests fail.
Instead we now check whether the connectionString is set and only
call the method in that case.
We previously recursed through the entire directed cyclic graph
of the type passed to SRE. When given a (legal) circular type reference,
we encountered stack overflows. This was particularly easy to trigger
with fsharpi and with FAKE.
By creating everything about the type before searching for the parent,
and by defering all type hierarchy establishment until the type must be
surfaced to manage code, we tease out the data dependencies caught up in
the cycle.
Note the bounded lifetime of the unmanaged object hidden in the SRE
module, which acts as a global reference for all types reachable from
the TypeBuilder passed to the runtime through the icall.
* Update nuget-buildtasks from upstream's `dev15.1` branch
dev15.1 branch + fixup import paths
This was prompted by needing to support nuget restore for projects with
`PackageReference`.
* [nuget] Bump reference to NuGet.BuildTasks to pick up a build fix
* Remove the use of ExpectedException in Mono.Posix Tests
ExpectedException is not available in later versions of
NUnit. To test the NetCore 2.0 version of Mono.Posix I
need a newer version of NUnit that does not contain ExpectedException.
Using Assert.Throws should be equivalent.
* Mono.Posix Tests move CanUseRealTimeSignals checks
Moving the CanUseRealTimeSignals check outside of the
Assert.Throws callback function.
This is a change in test behavior requested by @akoeplinger
in the PR review.
* Fixing Mono.Posix.UnixSignalTest.TestSignumPropertyThrows
This test throws InvalidOperationException and we need to check
for that in the Assert.Throws type.
mono_gc_wbarrier_value_copy_bitmap shown up when profiling Roslyn and this PR applies the following set of optimizations to it:
- Drop the bitmap, the extra branch in the loop costs more than the extra cardtable store itself
- Rename it to mono_gc_wbarrier_range_copy to reflect its new meaning
- Remove the JIT wrapper, this function doesn't need it
- Use mono_gc_get_range_copy_func as a way to punch through all layers and get the actual implementation
- Move the implementation to sgen-cardtable.c where everything can be inlined
- Exploit the fact we only need to mark the first card of a given range and thus we can hoist the address calculation outside of the loop
All of this speeds up a microbenchmark by 2x and Roslyn wallclock by around 2%.
This optimization exploits the fact that if the element type idepth is <= MONO_DEFAULT_SUPERTABLE_SIZE we can skip the idepth check.
This improves an array store only benchmark by 11%.
On Roslyn, all arrays falls into this case.
* [WebConnection] Make ReadDone and InitRead instance methods to avoid passing cnc around
* [WebConnection] Inline only call to InitConnection
* [WebConnection] Fix race condition between Close and BeginWrite
* ves_icall_System_Runtime_Remoting_Contexts_Context_RegisterContext
* ves_icall_System_Runtime_Remoting_Contexts_Context_ReleaseContext
Added new mono_threads_{register,release}_app_context to be used internally in
the runtime.
* [BTLS]: Cleanup certificate store initialization.
* Kill unused MonoBtlsX509Store.AddTrustedRoots().
* In server-mode, MonoBtlsProvider.SetupCertificateStore() now only adds
certificates explicitly trused via MonoTlsSettings.TrustAnchors.
* MonoTlsProvider.ValidateCertificate() - which is called from
X509Certificate2.Verify() via X509CertificateImplBtls.Verify() - now
uses MonoTlsSettings.DefaultSettings and assumes client-mode.
* [appletls]: Actually use the new code that was added in PR #4671.
* [btls]: Add new MonoTlsSettings.CertificateValidationTime property.
This allows you to set a custom time for certificate expiration checks.
* [appletls]: Bind SecTrustSetVerifyDate() and check MonoTlsSettings.CertificateValidationTime.
When framework assemblies are compiled for the mobile runtime, they are
generally signed with a different key than the normal desktop one.
Unfortunately each assembly has different logic for which key is
used (typically silverlight.pub or corefx.pub in place of ecma.pub), and short
of hardcoding a table in the runtime, there's no good way to know.
Main pointers :
- explicit minor and bridge configuration (add some for missing major)
- reduce duplicated testing or of low relevance (like split nursery)
- intensive testing of latest new configurations combined (parallel minor + major + future experiments)
- include testing with a small and a large nursery for additional variance
* [appletls]: Use SecIdentityCreate() to avoid using the Mac keychain when we have a private key.
Reading Certificates from the Mac Keychain
==========================================
Reading the private key from the keychain is a new feature introduced with
AppleTls on XamMac and iOS. On Desktop Mono, this new feature has several
known issues and it also did not received any testing yet. We go back to the old
way of doing things, which is to explicitly provide an X509Certificate2 with a
private key.
Keychain Dialog Popups
======================
When using Xamarin.Mac or Xamarin.iOS, we try to search the keychain
for the certificate and private key.
On Xamarin.iOS, this is easy because each app has its own keychain.
On Xamarin.Mac, the .app package needs to be trusted via code-sign
to get permission to access the user's keychain. [FIXME: I still have to
research how to actually do that.] Without this, you will get a popup
message each time, asking you whether you want to allow the app to access
the keychain, but you can make these go away by selecting "Trust always".
On Desktop Mono, this is problematic because selecting "Trust always"
give the 'mono' binary (and thus everything you'll ever run with Mono)
permission to retrieve the private key from the keychain.
This code would also trigger constant keychain popup messages,
which could only be suppressed by granting full trust. It also makes it
impossible to run Mono in headless mode.
SecIdentityCreate
=================
To avoid these problems, we are currently using an undocumented API
called SecIdentityRef() to avoid using the Mac keychain whenever a
X509Certificate2 with a private key is used.
On iOS and XamMac, you can still provide the X509Certificate without
a private key - in this case, a keychain search will be performed (and you
may get a popup message on XamMac).
The code was bailing straight to native which is significantly slower. This is the result of roslyn compiling corlib on my machine:
Before:
real 0m5.757s
user 0m22.059s
sys 0m1.736s
After:
real 0m5.816s
user 0m23.623s
sys 0m1.693s
Added a new EXTERNAL_FACADE_DRAWING_REFERENCE variable which
specifies the path to an assembly that contains drawing types,
e.g. in the monotouch/monodroid case System.Drawing is built
inside the XI/XA repos.
Also update netstandard typeforwards to the latest version
from the dotnet/standard repo.
resgen.exe used to load WinForms via reflection which is a pretty
large dependency. Instead we can just embed the few types that
are used for reading/writing resx files directly into the app.
Add System.Drawing.dll to the "build" profile so we can put
resgen there as well and allow us to no longer rely on system
resgen for mobile profiles like monotouch/monodroid.
The first iteration of this code suffered from spurious wakeups due to using a single cond-var for all compilation.
This introduce a per-job cond var and make threads wait on that. Spurious wakeups are quite problematic in heavily threaded
code such as Roslyn. On average, every wait would get 2 extra wakeups for no good reason.
With this change, on my laptop compilation times are the following:
With spurious wakeups:
real 0m6.134s
user 0m23.588s
sys 0m2.331s
Without spurious wakeups:
real 0m5.658s
user 0m22.851s
sys 0m1.694s
This represents a 8% wallclock speedup and 3% user time speedup.
As part of this change, the active threads accounting is gone as the number of waits due to cpu overload was close to zero.
Also remove Mono.Simd as we don't it on new platforms.
Cleanup monotouch_dirs to not depend on testing_aot_full_dirs since
it should be separate (even though it contains the same right now).
This shown up as a problem under parallel roslyn.
We hit frequently the case of multiple threads compiling the same method in parallel
and wasting all but one.
Another issue that happens, but infrequently, is having more threads JITing than there
are cores in the machine. Such thrashing doesn't help.
Test setup. 4/8 macbook pro compiling corlib.
Baseline:
real 0m7.665s
user 0m20.078s
sys 0m2.653s
Methods JITted using mono JIT : 22422
Total time spent JITting (sec) : 18.5365
With this patch:
real 0m6.149s
user 0m18.504s
sys 0m1.487s
Methods JITted using mono JIT : 16619
Total time spent JITting (sec) : 4.9420
New counters
JIT compile waited others : 7681
JIT compile 1+ jobs : 1
JIT compile overload wait : 67
JIT compile spurious wakeups : 14469
This results in a 20% wall clock reduction but only a 8% reduction on user.
We JIT 26% less methods, with very few duplications. Showing this drastically improves the situation.
JIT compilation time metrics are bogus due to .cctors and other sources of interference. So take it with a grain of salt.
Future work:
Based on the new counters, it's clear that the current wakeup design is suboptimal and we could further improve it by cutting on spurious wakeups.
Loading modules for other processes can fail under some linux sandboxing rules but that doesn't mean
we should not be able to compute the process name. So when module == NULL, we make module loading non-fatal.
It is used as the "verify" step on Jenkins/Wrench and I noticed
it didn't run recently.
Looks like it was broken a while ago by 695e8f53ae.
Moving the verifiable_files variable at the top is wrong since
the $$profile variable is only defined inside the for loop and
so we'd get an empty list.
When that was fixed it still didn't work as piping to `echo`
doesn't work. Replaced it with a Makefile solution instead.
While this was ok because workers and sweep could not run at the same time, this is no longer the case with parallel nursery collections. In the future, if many threads will be required for different types of jobs, we can consider running them on same native thread, but the jobs will still need to have appropriate contexts (the SgenThreadPool they belong to).
Stealing a gray section is relatively expensive since it requires locking. We want to avoid repeated stealing, since only one gray queue section is stolen at a time (in the case of the parallel collector).
$(Q)cd$(MONO_API_SNAPSHOT_PATH); git diff --no-renames HEAD > $(abspath $(topdir))/temp.patch
@mkdir -p apidiff
$(Q) sed -e "/@diffdata@/r temp.patch" -e "/@diffdata@/d" -e "s/@title@/Public API Diff/g" -e "s/@description@/If the changes are intentional, run <code>make -C mcs mono-api-diff<\/code> locally and commit changes in external\/api-snapshot./g" diff.html.in > apidiff/index.html
$(Q)if[ -s temp.patch ];thenecho"Error: Found public API differences, see mcs/apidiff/index.html. If the changes are intentional, please go to external/api-snapshot and commit them."; rm -f temp.patch;exit 1;elseecho"No differences found."; rm -f temp.patch;fi
Loaded 100 of 4021 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.