Security declarations looks very similar to custom attributes - but
they are not (e.g. a different metadata table).
They need to be marked, just like other metadata, by the linker because
they can encode types that won't show up in the type (or assembly)
references.
Ignoring this can create an invalid binary (the kind that even Cecil
can't load back for further processing).
The exact name (e.g. version) might differ between the original
AssemblyNameReference and the one being used (e.g. PCL).
To make sure we remove unused references we need to resolve
the AssemblyNameReference into AssemblyDefinition and then
continue the sweep based on the _new_ AssemblyNameReference.
The new suspend code works on all major targets, so it's time to remove old suspend.
This change removes all relevant native code, managed code could see some cleanup.
This fixes a couple of small issues with the Visual Basic build support:
- The VBC task now respects the $(NoStdLib) MSBuild option.
- The field @(ReferencePath) should be used for References in the VBC
target as it is for the CSC target.
- The CreateVisualBasicManifestResourceNames task is compiled and used
in the same manner as CreateCSharpManifestResourceNames hence it should
be loaded via UsingTask in the same manner as well.
- Include the VisualBasic Portable targets files.
The VB language requires that code files have statements in the
following order:
- Option
- Import
- Assembly level attributes
- Namespaces / other declarations
The VBCodeGenerator type when given both import and assembly level
attribute statements was generating the attributes first. This lead to
compilation errors in the generated file.
This change fixes the generator to emit assembly level attributes in
the proper location in the file (and adds the corresponding unit tests
as well).
The new socket constructor that only takes a SocketType and a
ProtocolType defaults to InterNetworkV6 (this was done on a previous patch).
In addition, we explicitly set "DualMode" to true, so that on Windows,
this gets set explicitly (it does not matter on Unix).
We surface the DualMode property to allow servers that want to just
bind to the IPv6 address to do so by creating the socket and then
changing DualMode to false.
This is *not* the same setting that Windows has, but it is the
semantics that Mono applications depend on. So a test has been added
to ensure that we do not regress.
This also switches to use SocketOptionName from the ReferenceSources.
Every once in a while, we run into a NullReferenceException attempting to dispose a null timer. It's very rare and we can't reproduce. However, reading this code, it seems possible that two timer callbacks could pile up, and if they did, the first one might dispose the timer, and then the second one would attempt to dispose null.
This change enables managed polling to work with both NaCL and coop as they are exactly the same except for the variables used.
We cleanup how safepoints are injects to be done on a separate pass instead of having in spread around the JIT.
We now inject safepoints at EH handler entry as those did not previously have them.
The generated AOT code was greatly optimized by having the polling variable checked before doing the icall. This more
than doubles the performance of the generated code.
This change adds support for the following MSBuild properties which are specific to VB compilation:
- OptionInfer: controls the /optioninfer switch
- VBRuntime: controls the /vbruntime switch
Concurrent mark modified the card table directly, which had two
drawbacks.
First, it meant that nursery collections would also have to scan the
cards marked by the concurrent collector, which was unnecessary work.
Second, because the nursery collector also modified the cardtable, it
meant that the two could not run concurrently, i.e., we had to suspend
concurrent marking work whenever a nursery collection occurred.
The issue was discovered when using monodoc in an asp.net application; while the code was developed and worked successfully in the local Visual Studio web server, it failed when deployed and executed in IIS. The reason it seems is because of the use of `.GetCallingAssembly()`, which was returning an unexpected assembly reference. This resulted in the `.GetManifestResourceStream` returning null for resources that are definitely a part of monodoc.dll.
Once the code was changed to get the assembly using a type reference of a type that's definitely in monodoc.dll ... the code resumed working as expected.
This does not import System.CodeDom.Compiler because some of them depends
on Windows specific stuff.
CodeGenerator is imported because ours depends on our own internal
Visitor implementation and could not build without making changes a lot.
This allows a piece of code to handle the cases where it's called in running and blocker context
and must always be in blocking context.
This probably makes code more modular at the expense of an easy to follow and debug execution model.
Since we don't currently annotate all icalls with blocking sections we do it with locks but they can
nest and recurse which requires this support for try block.
The commit removed the AC_DEFINE for TARGET_WIN32 from configure.ac,
but many parts of the build rely on it so the build broke.
Fixed this by defining TARGET_WIN32 when we detect it is the target
and do the same for HOST_WIN32.
ArgumentOutOfRangeException expects the parameter name first, then the message. ArgumentException is precisely the opposite, and expects the message first, and then the parameter name. They were swapped here.
Eventually we want to add a better fix for this, like for instance adding this behaviour to the LLVM-specific code path
but until we can research more under exactly what conditions we need to do this then implement this simple workaround.
Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=27055.
We fully control the $target values here as we don't use canonicalization for
them. So we have no reason or excuse to be using wildcards in them.
E.g. any Linux $target in this case would previously be assumed to be Android.
The overflow check is only performed when the result is big enough.
The overflow check is done by decomposing 64 bit operations into 32 bit operations.
Fixes#17817.
- Fix handling of lo64 on big endian systems (fixes 28672)
mono-endian.h:
- Add optimization for s390x read64/read32/read16 operations
exceptions-s390x.c:
- Add profiling support for exception handler
We had a failing arm test which exposed that our caching of the
number of processors was leading to some inconsistencies when
the number of processors increased. TODO: Use the actual number of
online processors when rebalancing threadpool.
Rename the net_4_0 profile which is already only used to trigger copying of reference assemblies
to binary_reference_assemblies and include the 2.0/3.5 files there. This should make it easier
to add more profiles in the future and doesn't clutter the build system as much as making separate
net_2_0 and net_3_5 profiles that do the same.
They build in both desktop and mobile profiles, but the sources are
mostly unchanged i.e. they contain Windows dependent code (DllImports).
The plan here is to import everything essential in WCF as buildable
sources, then remove Windows dependencies, then implement (or bring back)
mobile-ready code. But this commit can be used for different strategies
(like, we import sources from working parts, step by step).
ConcurrentOrderedList isn't referenced in corlib's .sources file or anywhere else anymore,
so it was missing during "make distcheck".
Mono.Parallel still needs it though (and it is the only place), so move the file there.
We cannot start threads during stop-the-world pauses (some thread APIs,
including pthreads, can deadlock), and we want to do marking and sweeping
with the same threads. This new thread pool facility will allow that.
We tag pointers to blocks that are currently being processed. Those
must not even be dereferenced by other threads because the sweep
thread might free them at any point.
The nursery collector requires that sweeping has finished, and instead
of waiting it will cooperate with the sweep thread to finish more
quickly. The sweep thread will traverse the block array from high
indexes to low ones while the nursery collector will go from low to
high. They will contend only very briefly when they meet somewhere in
the middle.
Both the concurrent sweep thread as well as the nursery collector will
need access to the block array. Until we've made that lock-free,
we're simply using a lock.
AdjustmentRule specifies a DST period that starts and ends within a year.
When we have a DST period longer than a year, the generated AdjustmentRule may not be usable.
Thus we fallback to the transitions.
Fixes#24086.
Addresses an oversight in PR 1257 that caused {V}Specified fields to not be set during XML deserialization in some circumstances.
Adds test for optional value serialization round trip
WebConnectionGroup.Close() calls WebConnection.Close(), which takes connection lock and then takes the service point lock. Calling WebConnectionGroup.Close() leads to taking the service point lock *before* the connection lock, which leads to a deadlock.
Coop requires the following set of rules:
-blocking code must be wrapped with MONO_PREPARE_BLOCKING / MONO_FINISH_BLOCKING
Must not read managed refs read/writes inside the block
Managed memory (i.e. inside a byte[]) must be previously pinned[1]
-state escaping transitions (lazy thunks and others sneaky n2m transitions) must be wrapped with MONO_PREPARE_RESET_BLOCKING / MONO_FINISH_RESET_BLOCKING
This lands the thread in runnable state, so be careful to keep it suspendable by following the target environment rules.
The set of rules for what runtime code can/can't are still in flux, but here's the tentative list:
== On Wrapping syscall/waits
- Wrap it on the callee. We can't necessarily know in which context the syscall will be called. This will reduce reentrancy issues as blocking is not reentrant.
- Don't go blocking while holding locks as this will certainly deadlock.
- Avoid allocating memory while holding locks.
- Annotate blocking restrictions in the comments in the same way we do it for locking.
== On aborting blocking
- Avoid it as much as possible as it might lead to unbound pauses.
- Make sure you can always restore back to blocking.
[1] Since we conservatively scan the native stack, acquiring the ref outside of the block is enough for now.
Make sure all logging include the thread tid to ease correlation.
Add counters to check for proper balance of post/wait on the suspend semaphore.
Massive improvement in the coop suspend wait timeout crasher. It will now print
a cue card on the internal states. This makes finding the offending threads much easier.
Method index will be set if the method metadata token is shared by multiple generic specializations.
For StackFrame.GetILOffsetFromFile to work with generics methods a method index is required.
When creating a Mono.Security.Uri with the string "file:///var/lib/jenkins/workspace/test-mono-mainline@2/..."
(happens sometimes in System.Security.Policy.Zone-related unit tests on Jenkins) the current implementation
strips everything up until the @ sign.
Zone thinks the file doesn't exist locally as the Uri.LocalPath doesn't refer to a valid file on disk
anymore and this results in an incorrect zone value, making the tests fail.
Fixing this by treating the @ char differently when it is in an absolute path (as is done for other chars).
This splits the native backend from core functionality it needs to provide. For example,on posix, we want to
use the pthread_create code regardless of the backend enabled.
Native code should not normally be in runnable state. That's reserved only for managed code. In theory.
In practice any code that can witness the managed heap must be in the runnable state.
This in practice means all runtime code (icalls) and embeders. Right now lets focus on the runtime side.
The solution for this is to wrap all calls that could lead to unbound suspension in code that coordinates
with the GC - most syscalls that can block. This is realized with a pair of additional thread states.
1)Blocking: This the state where the runtime is doing something that can potentially block. The suspend count
will be > 0 if the current thread is suspended. In practice it won't suspend, just wait on resume.
2)Blocking and suspended: When leaving the blocking state, if the thread has a pending suspend, we transition
to this state while waiting for resume.
This move allows us to save the thread state much earlier on. In addition to the move, we now produce thread contexts without
the JIT TLS set. This might end up been an issue in some corner cases, just like with domain, so we'll address those when
they show up.
Other places are already logging tid so this makes correlation possible.
TID is a better pick than the MonoThreadInfo pointer as it's easier to find the thread on gdb.
Basically Microsoft SqlClient implementation is full of Windows dependencies
that doesn't work elsewhere. Our implementation has been fully managed
TDS implementation, so we want to bring it back.
This only builds and is not known to "work" yet.
Android does not provide complex.h in the API levels that we compile against so bundle our own header (based on the one from FreeBSD).
Turns out GCC already provides built-in handling for the complex functions used by the code so there's no need to provide our own implementations.
As it turns out, `perf` support crashes/hangs on a lot of Linux
kernels in the wild, and produces no output on some Android devices.
So, given that using a signal + helper thread is more reliable, use
it by default and make `perf` support optional.
The configure flag is now `--enable-perf-events`.
mono_aot_get_method () will not necessarily put methods into the
MonoDomain::jit_code_hash table. But it does return an IP that we
can use to look up the JIT info with mono_jit_info_table_find ().
src: https://bugzilla.xamarin.com/show_bug.cgi?id=27864
As of iOS 8.2 Apple updated Sqlite and broke queries that used to work
pre iOS 8.2 like the select command in this test, The pruppose of this
test is to know when apple fixes this. Expected test behaivour is as follows.
* If iOS 8.2+ Test will pass as long as apple does not fix the bug
* If iOS < 8.2 Test will pass as it does work as expected
* If iOS 8.2+ and apple fixed bug 27864 test will fail and we will need to
remove the fail check on lines 105 and 106
Filled with Apple. From bug report:
The problem appears to be caused by a bug in mmap on the arm64 ios.
In this test, we request a page and mmap returns successfully, but when trying
to access the mapped memory, the program crashes after the 4097th byte, meaning
that it only maps us 4kb(???). It should be mentioned that on arm64 ios the
page size is 16kb.
The way we calculated slot sizes was very brittle when it came to
small slots. Reducing the size of the block header could trigger it
skipping an important small size class, which would lead to increased
memory usage and slower execution times.
Now we always produce all possible small slot sizes, up to four times
the minimum object size.
The code just worked because it never reset cementing. It needs to be
completely rewritten.
With cementing enabled, at the start of a major concurrent
collection, we cannot reset it. That's because if we have
cemented objects, some remsets to them will be missing, and the
major collector does not scan the whole heap immediately, like
the non-concurrent one does.
The proper way to do it seems to be to reset cementing before
finishing a concurrent collection. All major objects that point
to formerly cemented objects must either be marked in the
mod-union table or the current card table. When we scan the card
tables, we should be able to just evict objects.
Currently, the finishing collection pause still does some
scanning via the worker thread. This might be a problem.
These two are consistently failing due to port re-use. Other hard-coded
ports exist, but let's target the *known* issues primarily, and can
handle the others ad-hoc if they demonstrate that they're problematic.
CreateLocal could fail in an unexpected manner. The change re-enables fall back to environment variable "TZ" and allows TimeZoneInfoNotFoundExceptions to be thrown instead of NullReferenceException.
The use case here is when you are documenting a managed wrapper on top of a native platform API. This related link can be used to link to the original platform documentation for that member. This lets the reader look up the semantics of the native call without you having to duplicate the documentation in the managed reference docs; leaving you to focus your energies on documenting any unique considerations when calling this managed API.
Example:
```xml
<related type="PlatformDocAPI" href="https://msdn.microsoft.com/en-us/library/system.console.writeline">Microsoft documentation for <c>System.Console.WriteLine</c></related>
```
If you have a URL of the form ``T:System.Collections.Generic.Dictionary`2``, it parses correctly, but the `EcmaDesc` instance returned by the parser will throw an exception if you try to call the `.ToEcmaCref ()` method. This patch resolves this issue and returns a correctly formatted URL in this instance. Unit test included.
The existing update was not doing a good job of matching members that have both generic and non-generic members. So for example, if you had a method, `Foo<T>`, and added a non-generic version in a future update (`Foo`); you could end up with a situation where one of the members was being duplicated.
at System.ThrowHelper.ThrowArgumentOutOfRangeException () [0x00014] in /Users/marek/git/mono/external/referencesource/mscorlib/system/throwhelper.cs:56
at System.Collections.Generic.List`1[System.Threading.Thread].get_Item (Int32 index) [0x0000e] in /Users/marek/git/mono/external/referencesource/mscorlib/system/collections/generic/list.cs:199
at System.Net.Sockets.SafeSocketHandle.ReleaseHandle () [0x00052] in /Users/marek/git/mono/mcs/class/System/System.Net.Sockets/SafeSocketHandle.cs:79
at System.Runtime.InteropServices.SafeHandle.RunRelease () [0x00091] in /Users/marek/git/mono/mcs/class/corlib/System.Runtime.InteropServices/SafeHandle.cs:203
at System.Runtime.InteropServices.SafeHandle.Dispose (Boolean disposing) [0x00019] in /Users/marek/git/mono/mcs/class/corlib/System.Runtime.InteropServices/SafeHandle.cs:171
at System.Runtime.InteropServices.SafeHandle.Dispose () [0x00003] in /Users/marek/git/mono/mcs/class/corlib/System.Runtime.InteropServices/SafeHandle.cs:150
at System.Net.Sockets.Socket.Dispose (Boolean disposing) [0x0004d] in /Users/marek/git/mono/mcs/class/System/System.Net.Sockets/Socket_2_1.cs:1168
at System.Net.Sockets.Socket.Dispose () [0x00003] in /Users/marek/git/mono/mcs/class/System/System.Net.Sockets/Socket_2_1.cs:1174
at System.Net.Sockets.Socket.Close () [0x00009] in /Users/marek/git/mono/mcs/class/System/System.Net.Sockets/Socket_2_1.cs:1185
at System.Net.Sockets.TcpListener.Stop () [0x0000d] in /Users/marek/git/mono/mcs/class/System/System.Net.Sockets/TcpListener.cs:296
at System.Runtime.Remoting.Channels.Tcp.TcpServerChannel.StopListening (System.Object data) [0x00022] in /Users/marek/git/mono/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Tcp/TcpServerChannel.cs:257
at System.Runtime.Remoting.Channels.Tcp.TcpChannel.StopListening (System.Object data) [0x00013] in /Users/marek/git/mono/mcs/class/System.Runtime.Remoting/System.Runtime.Remoting.Channels.Tcp/TcpChannel.cs:105
at System.Runtime.Remoting.Channels.ChannelServices.UnregisterChannel (IChannel chnl) [0x00057] in /Users/marek/git/mono/mcs/class/corlib/System.Runtime.Remoting.Channels/ChannelServices.cs:463
at MonoTests.Remoting.CallsDomainServer.Stop () [0x00012] in /Users/marek/git/mono/mcs/class/System.Runtime.Remoting/Test/BaseCalls.cs:445
at (wrapper remoting-invoke-with-check) MonoTests.Remoting.CallsDomainServer:Stop ()
at (wrapper xdomain-dispatch) MonoTests.Remoting.CallsDomainServer:Stop (object,byte[]&,byte[]&)
CloseConnectionGroup can concurrently call RemoveConnectionGroup and remove a group that has added to removeList.
We now check that the group still exists before removing it.
Fixes#19823.
This will let us have both the Mono and the Microsoft ThreadPool at the same time.
To switch to the Microsoft one, set the MONO_THREADPOOL environment variable to "microsoft". It will default to the Mono one.
Support by the runtime is also implemented.
The main goal of this change is to ensure that all methods have a `TYPE_JIT`
event emitted in the stream before they are referenced in other events. Before
this change, `TYPE_JIT` events could arrive out of order or not be emitted at
all because of generic sharing.
We now use a separate thread for writing log buffers to the output file.
Whenever a method is referenced in a TLS log buffer, we add it to a TLS list of
methods. When we ship the TLS log buffer off to the writer thread, we also send
the TLS list of methods. The writer thread first goes over all the methods and,
if some of them haven't had a `TYPE_JIT` event emitted yet, emits them to a
temporary buffer which is flushed just before flushing the main log buffer.
This approach ensures that `TYPE_JIT` events will *always* come before the
events that reference them.
Bookkeeping of which methods have been emitted to the output stream is done in
a global, concurrent hash table. Before a thread adds a method to its TLS list
of methods, it checks if the method is in the hash table. If it is, we know
that the method has already been emitted to the output stream, so it isn't
added to the list. The writer thread is the only thread that updates the hash
table (which happens when it flushes the temporary method buffer). So,
eventually, all TLS method lists will end up being empty because all methods
have been emitted to the output stream.
When ReleaseHandle was called by RegisterForBlockingSyscall's DangerousRelease the current thread would be in blocking_threads but there would be no blocking system call to interrupt.
For some reason accept can only be interrupted by thread_abort.
We do not want to use thread_abort by default because it may abort non-atomic operations at an arbitrary point.
The problem was fixed by calling thread_abort_safely, and make sure the target thread was interrupted by calling thread_abort afterwards.
In this change thread_abort is only called if thread_abort_safely returns KERN_SUCCESS, which *should* mean that the target thread has already left the kernel code by the time thread_abort is called.
The problem was caused with the introduction of the pushless backend. We have to compensate for the arguments being popped by native stdcall callees, to keep param_area from shrinking. Fixes#27597
For the case of non-concurrent collector we don't want to mark stores from the heap to the heap, since it would add sgen overhead. When aot compilling we don't know whether the GC will be concurrent or not, so we fallback to the write barrier method.
We emit two write barriers, for the case of the concurrent and non-concurrent collector in the mscorlib image. All calls to the write barrier are made through the plt, calls which are resolved according to the GC configuration at runtime.
Move the ResumeThread () calls out of the assert and check for 0 (which means that the thread was resumed) instead of using the Mach-specific KERN_SUCCESS on Windows.
Fixes the Windows/MSVC build.
Related to https://github.com/mono/mono/commit/296347f.
With the new function it is possible to retrieve other processes start, user and kernel times.
In mach start time is available without special privileges but user and kernel times still require privileges.
This fixes an issue when building dotnet/corefx and all the SR.cs files are modified
because Mono used a HashTable internally in ResXResourceReader and it returned the
elements in a different order than MS.NET.
Even though this isn't explicitly mentioned in the docs, the MS.NET implementation returns
the elements in the same order as they appear in the resx and we should do the same.
We need an extra set of quotes around the whole command to properly handle commands
with spaces since internally the command is called through "cmd /c.
Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=27899.
All primitive types have a short encoding format that avoid using
a typeref token.
It's possible to encode them in another, longer, form with ELEMENT_TYPE_VALUETYPE + a typeref token.
Up to now, this was never seen in the wild so we never supported it.
This patch allows long form encoding of primitives.
STW and managed suspend share a lock to ensure there is only one active suspend initiator.
This originally caused a problem in the managed suspend path as it could be async suspended while it was
in the middle of the suspend protocol (check if top of stack is managed, install abort handlers, etc).
This was worked around by putting that inside a suspend critical section. The resulting code was horrible
as suspend boundaries became unstructured (yeah, pretty stupid idea on my end). Not only that but it had
a race condition.
If a thread doing managed suspend raced with a STW and lost, it would block on the global suspend lock to
finish. That thread would be blocked inside a critical section - the single thing you must not do inside one.
This could be reproduced by stressing mono/tests/sgen-new-threads-dont-join-stw.
The solution is to execute the managed suspend sequence in the same fashion as of a STW. IOW, take locks,
suspend, do stuff, maybe resume and drop locks.
The critical part is the "do stuff" one, which is different for abort and suspend, but everything else
is the same. So we wrap that into a callback and put the common parts in mono-threads. This gives
us structured locking and suspend boundaries.
This won't cause a GC to take longer to init as the critical section would block the STW from progressing
anyways.
While running tests if a socket is closed while blocking system calls are pending an exception is thrown.
A socket should not be closed when a blocking system call is pending.
The purpose of the exception is to inform us when AbortRegisteredThreads is not working.
Having a single unwind state means writes to it must be synchronized between sync and async suspend. We can't
have the state be broken as it could lead to bad unwinding or GC marking.
The original solution was to have an additional state in the self suspend path that signals it's writing to the
thread state and thus any async suspend must give up and let it finish. This ended up been overly complicated
as this requires two additional states instead.
By having a pair of unwind states both can write concurrently without the fear of clashing. This makes fetching the state
a little bit trickier but worth the trouble.
The simplified design has a much smaller state space, which is easier to reason about.
When begin async suspend lands in STATE_SUSPEND_IN_PROGRESS, the initiator don't need to perform an async suspend, it just needs to wait.
If a self suspend is promoted to an async suspend, it must be added to the pending ops set. This ensure that it will be waited otherwise
the suspend initiator might witness an unfinished self suspend and assert when fetching the thread state.
The alternative would be to change finish async suspend to account for the possibility of witnessing STATE_SUSPEND_PROMOTED_TO_ASYNC.
Solving this way requires less async suspends and doesn't increase the valid state space.
The new suspend machinery is based around a single word state machine that is manipulated using CAS.
This solves the first set of problems with the current approach, the lack of atomicity and the impossibility of
doing race free manipulation of protected state. This is specially acute when doing a self suspend.
Suspend data must be atomically protected while we prepare to self suspend so a resume request won't race with the current
thread putting itself to sleep. This is a classical problem that calls for a mutex/conditional variable pair. Except that all
locks in the suspend path must be suspend safe. Wait, WHAT?
A Suspend Safe Lock is a primitive that is obstruction free in the face of the kernel suspending a thread either performing a
lock operation or waiting on a lock to become available. This, unfortunately, is not possible with pthread_mutex on OSX. The
only safe primitive are kernel semaphores, for which doesn't exist conditional variables for.
So back to locking and self-suspend. We need a lock because the existing thread state is not atomic but we can't use a
mutex/condvar pair so we're left with racy code. Yay! The fix is using CAS over a single variable.
Another change was the hardening of the suspend/resume code on posix targets. First we replace a semaphore wait with
sigsuspend for async suspend. This is needed since sem_wait is not async-signal safe (yet sem_post is). Second, we now
respect interruption requests by having a pair of suspend signals, one with SA_RESTART and one without.
Onto the design of the suspension system, a few concepts that are useful looking around.
* Self suspend: This is when the thread decides to suspend itself.
* Async suspend: This is when a thread decides to suspend another thread.
* Suspend Initiator: This the name of a thread that decided to suspend one or more other threads. This is important
since all suspending threads will notify it when they are suspended. There can be only one initiator in the system
at a given time.
* Suspension count: Number of resume calls before a thread is back to running state.
There are 7 states that can happen while a thread is runnable:
* Running: just running...
* (Async|Self) Suspended: Suspended, the difference comes into play when resuming.
* (Async|Self) Suspend Requested: Suspend requested, but not completed. See more below for the discussion on why the request state is needed.
* Suspend In Progress: Self suspend started saving its state thus async suspend should not modify it.
* Suspend Promoted to Async: Async tried to suspend a thread in the middle of a self suspend, it wants to be notified.
Now to the suspension protocol and how it happens on a high level view.
Suspension starts with a suspend request, which bumps the suspend count by one. This suspend request can be fulfilled either
by an async or self suspend action. This is confusing as there's only one initiator but any number of threads can be self suspending.
Async suspend then performs a platform specific action such as posix signals that forces a transition on the target. In the case
of self suspend, it depends on the thread polling its state and trigger the transition.
This works fine except that the suspend state is one huge struct with tons of fields. To control concurrent access to it we use a
single initiator in the case of async suspend and we put the thread in a transitional "saving my state" in the case of self suspend.
In the case of async suspend, the initiator must wait for all 1+ threads to notify back that they have suspended. Only after that
it's possible to know if the async suspend request actually worked or not (we might have hit a dying thread).
Together with this, there's an optional implementation of STW in sgen that can use this new machinery. To enable it set the
MONO_ENABLE_UNIFIED_SUSPEND env var for now while it gets more testing.
They're basically the same thing, but v120 has DX10+ capabilities and v120_xp
is DX9 only. Since we're not building against DirectX, the difference is
purely academic - but changing the value to v120_xp means MSVC binaries run
on XP+, not Vista+
This change was made so StackFrame dumps now show a native offset when the IL offset is unknown.
The native offset can be used by mono-symbolicate tool to retrieve an IL offset from a .msym file.
With AOT sequence points are stored in a .msym file.
As the sequence point data is not avaible at run time, AOT stack traces display a native offset.
mono-symbolicate tool is now able to retrieve an IL offset from a method name, native offset, and the data stored on the .msym file.
The IL offset can then be use to retrieve a filename and line from a .mdb file.
Abstract classes can still have subclasses with KnownType attributes, which are allowed in deserialization.
This used to work as the '__type' hint was always honored no matter the type, and broke with https://github.com/mono/mono/commit/71e152accc727089faffa6b4fd6bf58cb62636cf which removed that behavior.
It fails randomly on Jenkins and my own CI. To reproduce, just wrap the body of the test in while(true) and run for a few minutes.
I tested on MS.NET as well and it fails the same way there, so it's not Mono's implementation of Dataflow.
Filed https://bugzilla.xamarin.com/show_bug.cgi?id=27757 for tracking.
There was a memory leak caused by not having a lookup mechanism for
the RegistryKey. In addition, the entire code to dispose code was
never used (due to the leak), and it was wrong.
In addition, added locking to the "values" field, which currently was
racy.
No test cases, the repro is to run the above code for about 5 minutes.
This is a bit of an hack but it works for now... ideally we should be processing the Unicode command line flags passed by the CRT at startup instead of trying to convert the MBCS string to a wide string.
That was still useful in 2003/2004 but the technical and legal landscape
changed a lot since then. Removing the old, limited key size, cipher
suites also allow removed additional parts of the code that deals with
them.
We used to swallow the error, which is unhelpful.
The reason for that might be because we probe multiple names before giving up but
even then, it's ok log all attempts. It will make troubleshooting easy, even if we
have to go through a lot more log entries.
When using stements with parameters, the OdbcCommand would throw an exception
on ExecSQL when no row was returned. The commit adapts the change done in
5264613b6d for the case of unprepared statements
without parameters.
After MemoryCache was imported from referencesources, some tests started
failing occasionally. Cross-testing on MS.NET showed that you need to
access the cached item to make MemoryCache.GetCount() reliably return the
correct number after an item was expired from the cache.
Also removed __MonoTimerPeriod and __MonoEmulateOneCPU configuration variables,
they were used in Mono code before and don't make sense with the new code.
* Find the type map element that is the most-specific to the
object in question, not the first type it is an instance of
Change-Id: I1867e790bf9f377ce0ae02871f4561b760e27624
Given the test data in this patch the wrong element name
is used when serializing TestSerializeSecondType
Change-Id: I8aff732dfd22f4f654fb42f2d3b987d7ce58d600
The unstable image seemed to cause problems recently.
We should just use the default image and fetch Cygwin ourselves.
Also added caching of the Cygwin files and simplified the script a bit.
There was a memory leak caused by not having a lookup mechanism for
the RegistryKey. In addition, the entire code to dispose code was
never used (due to the leak), and it was wrong.
In addition, added locking to the "values" field, which currently was
racy.
No test cases, the repro is to run the above code for about 5 minutes.
It should be using RESOURCE_STRINGS, but mcs doesn't support its special
option for string resources for multiple files.
The resource .cs files are generated by genresstringcs.sh, but System.Xml.txt
contains some bogus characters that prevents source generation, so after
the tool has generated the sources, I manually fixed them.
It won't matter once mcs supports the option for multiple files anyways.
Removed Configuration dependencies and codegenerator parts in XmlSerializer
as well as switching CodeIdentifier implementation to old mono stuff
as referencesource totally depends on CodeDom (mono doesn't).
The order of those namespaces are insignificant, and the latest
combination of mono corlib (partly referencesource-d) and sys.xml
(referencesource except for XmlSerializer) caused this implementation
glitch.
MS referencesource changed XmlTextWriter behavior regarding EOL so that
now it preserves CRLF as is, instead of replacing them with
XmlWriterSettings.NewLineChars (mono implementation behavior).
There are some tests that depend on old behavior. The entire points of
those XmlDataDocument tests are not about checking EOLs, so just replace
the test XML file to not contain CRLF.
There is implementation mismatch in XmlDocument event order regarding
Load(). Take this code:
string xml = "<root><child>1</child></root>";
var doc = new XmlDocument ();
doc.NodeInserted += (o, e) =>
Console.WriteLine (e.Node.NodeType + e.Node.LocalName);
doc.LoadXml (xml);
This is mono output before referencesource:
Text#text
Elementchild
Elementroot
This is with referencesource:
Elementchild
Text#text
Elementroot
So, there are event order differences in our two implementations.
Now, XmlDataDocument depends on those XmlDocument events to fill DataRow
values. It worked fine with pre-referencesource System.Xml model, but
with referencesource it skipped to fill data row values.
This change makes sure to fill data row values from text node which are
added _after_ the parent node is added to the document.
It is not simply replacement because we have to workaround dynamic codegen
for Xamarin.iOS.
Also there were several tests failing with MS implementation (e.g. for
W3C DOM conformance), so we had to disable them.
There is one regression that rather needs to be fixed in Reflection.Emit.
Also, some WCF tests fail with this implementation. They need to be
investigated, reviewed and appropriately fixed.
In certain cases, hovering over a ToolStripMenuItem
that has a tool tip defined will result in the tool
tip appearing behind, and hidden by, the context
menu containing the item. The change is to cause
the tool tip to be pushed to the front when it is
displayed.
If a profiler has not installed a coverage filter, or the coverage filter has returned FALSE, then calls to mono_profiler_coverage_get trigger a assertion failed warning in g_hash_table_lookup.
If a profiler had requested MONO_PROFILE_COVERAGE events and not installed a
coverage filter, then the coverage info is NULL and a crash quickly followed
false when given a null argument instead of throwing an exception.
According to the msdn here:
https://msdn.microsoft.com/en-us/library/b4e35dwy%28v=vs.110%29.aspx
this method should never throw an exception. This was also confirmed
with the official Microsoft runtime.
This change is released under the MIT license.
/Users/builder/data/lanes/monodroid-mavericks-master/7de6731a/source/mono/support/serial.c:25:26: fatal error: linux/serial.h: No such file or directory
#include <linux/serial.h>
The header is only available on Android NDK API level >= 21.
This changes all bridges to use the _safe variant of sgen_obj_get_descriptor. Bridge processing happens in
the post-scan world, before objects get untagged.
We currently ship a horribly outdated version of EF. This is unnecessary since EF is on NuGet and has an active set of users using it on Unix.
Miguel gave his +1 on the mailing list already.
When a socket has been closed as part of the negotiation, the
SendAlert method would crash when trying to reuse the socket.
Add try/catch around this to prevent this.
Fixes#19334
The new suspend machinery is based around a single word state machine that is manipulated using CAS.
This solves the first set of problems with the current approach, the lack of atomicity and the impossibility of
doing race free manipulation of protected state. This is specially acute when doing a self suspend.
Suspend data must be atomically protected while we prepare to self suspend so a resume request won't race with the current
thread putting itself to sleep. This is a classical problem that calls for a mutex/conditional variable pair. Except that all
locks in the suspend path must be suspend safe. Wait, WHAT?
A Suspend Safe Lock is a primitive that is obstruction free in the face of the kernel suspending a thread either performing a
lock operation or waiting on a lock to become available. This, unfortunately, is not possible with pthread_mutex on OSX. The
only safe primitive are kernel semaphores, for which doesn't exist conditional variables for.
So back to locking and self-suspend. We need a lock because the existing thread state is not atomic but we can't use a
mutex/condvar pair so we're left with racy code. Yay! The fix is using CAS over a single variable.
Another change was the hardening of the suspend/resume code on posix targets. First we replace a semaphore wait with
sigsuspend for async suspend. This is needed since sem_wait is not async-signal safe (yet sem_post is). Second, we now
respect interruption requests by having a pair of suspend signals, one with SA_RESTART and one without.
Onto the design of the suspension system, a few concepts that are useful looking around.
* Self suspend: This is when the thread decides to suspend itself.
* Async suspend: This is when a thread decides to suspend another thread.
* Suspend Initiator: This the name of a thread that decided to suspend one or more other threads. This is important
since all suspending threads will notify it when they are suspended. There can be only one initiator in the system
at a given time.
* Suspension count: Number of resume calls before a thread is back to running state.
There are 7 states that can happen while a thread is runnable:
* Running: just running...
* (Async|Self) Suspended: Suspended, the difference comes into play when resuming.
* (Async|Self) Suspend Requested: Suspend requested, but not completed. See more below for the discussion on why the request state is needed.
* Suspend In Progress: Self suspend started saving its state thus async suspend should not modify it.
* Suspend Promoted to Async: Async tried to suspend a thread in the middle of a self suspend, it wants to be notified.
Now to the suspension protocol and how it happens on a high level view.
Suspension starts with a suspend request, which bumps the suspend count by one. This suspend request can be fulfilled either
by an async or self suspend action. This is confusing as there's only one initiator but any number of threads can be self suspending.
Async suspend then performs a platform specific action such as posix signals that forces a transition on the target. In the case
of self suspend, it depends on the thread polling its state and trigger the transition.
This works fine except that the suspend state is one huge struct with tons of fields. To control concurrent access to it we use a
single initiator in the case of async suspend and we put the thread in a transitional "saving my state" in the case of self suspend.
In the case of async suspend, the initiator must wait for all 1+ threads to notify back that they have suspended. Only after that
it's possible to know if the async suspend request actually worked or not (we might have hit a dying thread).
Together with this, there's an optional implementation of STW in sgen that can use this new machinery. To enable it set the
MONO_ENABLE_UNIFIED_SUSPEND env var for now while it gets more testing.
This has been requested by the maintainers of Npgsql a few times already (https://bugzilla.xamarin.com/show_bug.cgi?id=23119) and we should do it for Mono 4.0.
Miguel gave his +1 on the mailing list already.
This variable must be set to all threads that have been properly suspended. This is
an initial step to simplify suspend state and use explicitly named variables instead
of hiding state in stopped_ip / stopped_domain.
MonoThreads was previously ignoring sgen's in_critical_region, which could lead
to a thread suspended inside a gc critical region leading to the GC not been able
to STW.
(some commits occurred while I have been cherry-picking a lot of "they are
in import-system-xml branch but it works with existing sys.xml" stuff.)
work in master
In referencesource, XmlReader.SchemaInfo does not return different instances
for each node at its state but just returns the XmlReader itself (which
implements IXmlSchemaInfo). Hence, if we just set the corresponding
IXmlScemaInfo to each XObject, it results in inconsistent state.
This fixes two regressions in ExtensionsTest (XAttributeFailValidate and
XAttributeThrowExceptionValidate).
With referencesource, XmlWriter for TextWriter buffers the output.
When closing XamlXmlWriter, it does not flush the output, causing
the buffered XmlWriter output discarded in the wild.
MTOM writer didn't expect multiple top-level elements are rejected at
ConformanceLevel.Auto, neiher do against Write[Start/End]Document() with
such elements.
Also Flush is often needed before directly writing to the Stream(Writer).
EOLs handling was also inconsistent between referencesource and old mono.
XML Schema compilation is done in referencesource.
XmlSchemaImporter is based on mono code. Hence this glitch happened.
The following regression is fixed:
1) MonoTests.System.Xml.Serialization.XmlSchemaImporterTests.DefaultTypeTopLevelElementImportsAllComplexTypes : System.InvalidOperationException : 'Root' is missing.
at System.Xml.Serialization.XmlSchemaImporter.ImportTypeMapping (System.Xml.XmlQualifiedName name) [0x0005a] in /svn/mono/mcs/class/System.XML/System.Xml.Serialization/XmlSchemaImporter.cs:453
at MonoTests.System.Xml.Serialization.XmlSchemaImporterTests.DefaultTypeTopLevelElementImportsAllComplexTypes () [0x00039] in /svn/mono/mcs/class/System.XML/Test/System.Xml.Serialization/XmlSchemaImporterTests.cs:1104
at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00054] in /svn/mono/mcs/class/corlib/System.Reflection/MonoMethod.cs:230
I initially discarded this change, because locking BaseSet (name, sec), didn't prevent the threads from trying to add the same key. That said, following the code, the point at which it actually fails is in NameObjectCollectionBase.BaseAdd, lines 331 and 332. The threads were arriving the second line at the same time:
if (_entriesTable[name] == null)
_entriesTable.Add(name, entry);
In brief, it's safe to call BaseSet twice with the same key, so it's safe to lock only the call to BaseSet
There was some glitch in CP932 encoding and referencesource Encoder
that caused error in Convert(), shown in System.XML tests.
To avoid this, bring back old Encoder as we used before and keep
compatible processing.
It might be buggier, but doesn't regress. We may be able to bring nlp-
based Encodings later too.
If two threads request the same section, which isn't yet cached, both try to insert it into the cache, causing a "Key duplication when adding...". It's neccesary to lock the getter. This solves bugs #5263, #7785, #18303
This generates an XML representation of the check-seq-points target,
as separate tests, which can be easily tracked by anything which
parses NUnit output (e.g. Jenkins or other CI systems). For example,
we are currently regressed on this on ARM.
Creating hardlinks in .NET doesn't have a nice API and using Mono.Unix/Pinvoke doesn't
seem worth the effort at this point since the feature is off by default on msbuild as well.
This is enabled by passing "aot=dump" to the Mono AOT driver and will create a JSON file in the working directory with the name of the assembly.
It's still a work-in-progress and will see improvements in the data dumped as it's needed.
CCLD monodis.exe
../../mono/metadata/.libs/libmonoruntimesgen-static.a(libmonoruntimesgen_static_la-opcodes.o): In function `mono_opcode_name':
/cygdrive/c/projects/mono-817/mono/metadata/opcodes.c:63: multiple definition of `mono_opcode_name'
../mini/.libs/libmonosgen-2.0.dll.a(d001720.o):(.text+0x0): first defined here
collect2: error: ld returned 1 exit status
This change does not involve Windows-specific NLS-based encodings.
We will be still using I18N assemblies until we make more grand design
changes (Xamarin products premise those assemblies).
This also fixes bug #23771 and probably more.
Right now (without this change), Debug.Assert **always** formats its string parameters, even if doing so wouldn't be necessary because the condition is true. This has a huge impact on code that asserts frequently because it assumes that calling Assert(true, ...) is cheap.
.NET implementation is able to get method tokens from other modules.
This was causing a regression on a System.Xml.Xsl.XslTransformTests.Bug487065 while using referencesource's System.Xml implementation.
Custom attributes encoding means it's possible to have a scope that will
point into a PCL facade even if we (just before saving) will resolve all
type references.
Since all other references can be made on the _real_ assembly and that
we do not want to include any facade assembly just for this we need to
resolve those type and update their scope.
This reverts commit c96e58280c.
Getting this to work right with regards to register allocation
is turning out to be more complicated than it seems. Going to
abandon this for now.
CharUnicodeInfo had conversion methods for uppercase/lowercase
conversion, and they are actually used by TextInfo. So moved them.
Then added another icall for "lite" version of internal character table
loader.
The new CharUnicodeInfo depends on "charinfo.nlp" resource file, which
does not exist in referencesource but can be generated by coreclr build
tools (as src/mscorlib/src/System/Globalization/Tables/CharInfo.nlp).
The coreclr rev. that built this specific checkin was c4eb037.
Works around the following compile error:
```/Users/triton/Development/mono/mono/metadata/decimal-ms.h:3:16: error: redefinition of 'struct tagDEC'
typedef struct tagDEC {
^
In file included from /Users/triton/Development/monodroid/builds/toolchains/windows/mxe/usr/i686-w64-mingw32.static/include/unknwn.h:37:0,
from /Users/triton/Development/monodroid/builds/toolchains/windows/mxe/usr/i686-w64-mingw32.static/include/objidl.h:477,
from /Users/triton/Development/monodroid/builds/toolchains/windows/mxe/usr/i686-w64-mingw32.static/include/objbase.h:66,
from /Users/triton/Development/monodroid/builds/toolchains/windows/mxe/usr/i686-w64-mingw32.static/include/ole2.h:17,
from /Users/triton/Development/monodroid/builds/toolchains/windows/mxe/usr/i686-w64-mingw32.static/include/wtypes.h:12,
from /Users/triton/Development/monodroid/builds/toolchains/windows/mxe/usr/i686-w64-mingw32.static/include/winscard.h:10,
from /Users/triton/Development/monodroid/builds/toolchains/windows/mxe/usr/i686-w64-mingw32.static/include/windows.h:97,
from /Users/triton/Development/mono/mono/io-layer/io-layer.h:24,
from /Users/triton/Development/mono/mono/metadata/process.h:17,
from /Users/triton/Development/monodroid/builds/toolchains/windows/mxe/usr/i686-w64-mingw32.static/include/unistd.h:11,
from /Users/triton/Development/mono/mono/metadata/icall.c:27:
/Users/triton/Development/monodroid/builds/toolchains/windows/mxe/usr/i686-w64-mingw32.static/include/wtypes.h:452:16: note: originally defined here
typedef struct tagDEC {
^
```
Design:
- Handle r4 types in the front-end normally like other types.
- Controlled using a 'float32' optimization flag, may become the default in the future.
- new stack type STACK_R4.
- new set of opcodes prefixed by 'R', use the same vregs as 'F' opcodes.
- opcodes which worked with r4 values are used as before, but generate different code
in the back end (OP_R4CONST/OP_LOADR4_MEMBASE/OP_STORER4_MEMBASE_REG, etc.).
The mono-context.h file uses definitions such as mips_fp and mips_sp,
which are defined in <mono/arch/mips/mips-codegen.h>, but this file is
not included, leading to build failures.
This fix is similar to 4437ecea91 (for
ARM).
Signed-off-by: Thomas Petazzoni <[email protected]>
It was caused by a mismatch of the `sig` and `csig` variables when looking the wrapper in the marshalling cache.
This was manifesting as the following crash in all Monodroid programs:
```
#0 mono_type_hash () at /Users/joao/Dev/droid/mono/mono/metadata/metadata.c:1390
#1 0x7512edf4 in mono_signature_hash () at /Users/joao/Dev/droid/mono/mono/metadata/metadata.c:4957
#2 0x75115d18 in signature_pointer_pair_hash () from /Users/joao/Dev/droid/monodroid/tests/runtime/gdb-symbols/libmonosgen-2.0.so
#3 0x751dca10 in rehash () from /Users/joao/Dev/droid/monodroid/tests/runtime/gdb-symbols/libmonosgen-2.0.so
#4 0x751dcbe0 in monoeg_g_hash_table_insert_replace () from /Users/joao/Dev/droid/monodroid/tests/runtime/gdb-symbols/libmonosgen-2.0.so
#5 0x75119570 in mono_mb_create_and_cache_full () from /Users/joao/Dev/droid/monodroid/tests/runtime/gdb-symbols/libmonosgen-2.0.so
#6 0x75127390 in mono_marshal_get_native_func_wrapper () from /Users/joao/Dev/droid/monodroid/tests/runtime/gdb-symbols/libmonosgen-2.0.so
#7 0x75127780 in mono_ftnptr_to_delegate () from /Users/joao/Dev/droid/monodroid/tests/runtime/gdb-symbols/libmonosgen-2.0.so
```
Originally introduced in https://github.com/mono/mono/pull/1540.
Olson TZ transitions are in UTC, and TryGetTransitionOffset used the TZ standard time.
TryGetTransitionOffset was comparing UTC with TZ standard times thus DST transitions could be obtained some hours before their start.
TryGetTransitionOffset is now changing provided times to UTC before comparing them with the transition times.
Fixes#25050.
This completes the list of methods in decimal-ms.c that are surfaced
to the Decimal class. This change also swaps out the Decimal class
from Mono to the Microsoft implementation.
This has not been tested yet, beyond the compiler being able to read
decimals (it did crash without it).
CoreCLR has two different bits of code for SearchScale, it looks like
one is just old and has not been updated. Moved to the new one, and
updated the code to pass the extra data that is missing from the
former one.
fread() spent a great deal of time locking, and we called malloc() once for
each entry. Replacing fread() with read() plus manual buffering, as well
as replacing malloc() with a static buffer, improves throughput by an
order of magnitude.
This also adds an '--input' option for reading from a stream other than
standard input.
This is a port of the CoreCLR Decimal support to C and to the Mono
coding conventions. In the process of porting the code, I removed a
bunch of COM-isms and some Windows-isms that were just workaround with
compatibility typedefs and replaced it instead with stdint.h data
types as well as Mono assertions.
There are still a few methods missing, and the managed library is not
plugged yet (both constructors likely need to be altered to be managed
proxies to the init method).
- otherwise we assert in sgen allocator
in sgen-gc.h:EMIT_TLS_ACCESS_NEXT_ADDR
thru sgen-alloc.c:create_allocator
- note that it is also disabled for ARM[64] and X86
on android
Despite what the makefiles would have you believe, this was never
actually used when running the test suites. Don't ask me why - my
make-fu isn't good enough. Regardless, it's a bad idea to only
run tests for a specific set of assemblies. If some tests fail or
are unstable, they should be fixed, or disabled and have a bug
filed. Sweeping them under the rug like this is the wrong thing
to do. Incidentally, this commit doesn't add any new failures.
* Removed all old profiles from VALID_PROFILE checks.
* Removed most logic under checks like ifeq (net_2_0), $(PROFILE)) as
it is dead code now that those old profiles are gone.
* Simplified the list of assemblies in mcs/class/Makefile now that we
only have one profile.
* LIBRARY_NEEDS_POSTPROCESSING has been removed as it was only used by
old 1.x assemblies that no longer exist.
* Build logic that sets MONO_PATH now points to mcs/class/lib/net_4_5
instead of mcs/class/lib/net_2_0.
The `make tzi.exe` target had bitrotted, and the
`make android-dump-tzdata` target generated inadvertent/unintentional
errors. Fix the makefile so that things build and run.
mono_marshal_get_native_func_wrapper now uses native_func_wrapper_cache indexed by SignaturePointerPair,
Using SignaturePointerPair index instead of MonoMethod index avoids problems when one native function needs multiple wrappers.
e.g: when the managed code creates delegates for function pointers with parameters that require different marshallings.
This fixes bug 26127.
Due to the removal of the net_2_0 profile, the files in ../System.Web/System.Web.Security aren't included in make dist anymore since they aren't used in System.Web (the classes got moved to System.Web.ApplicationServices.dll in .NET 4).
This breaks the tarball builds, as System.Web.ApplicationServices relies
on those files, so we now include the ReferenceSource equivalents instead.
When searching for a pointer with '--color' or '-c', the field in a
protocol entry that matched will be highlighted; when searching for
multiple pointers, they will be highlighted in different colors
according to their order on the command line. When highlighting more
than six pointers, colors will be reused.
The previous implementation did a ton of reflection and boxing making
it about 4x slower than it should be. This new (native) implementation
simply memcpy ()s the values out of the Enum objects and then does the
bitwise AND.
In addition, the JIT now recognizes this common IL pattern:
<push int or long ptr>
<push int or long>
box MyFlagsEnum
constrained. MyFlagsEnum
callvirt instace bool class [mscorlib] System.Enum::HasFlag (class [mscorlib] System.Enum)
This is generated from C# code such as:
MyFlagsEnum a = ..., b = ...;
a.HasFlag (b);
When the operand types of the `box` and `constrained.` instructions are
the same, we can skip all the slow stuff that HasFlag () normally does
and simply turn the whole thing into this IR:
<this> = loadi4_membase <this_ptr>
<temp> = int_and <this> <flag>
icompare <temp> <flag>
<result> = int_ceq
This is about 60x faster than the old HasFlag () without any JIT support
and about 15x faster than the new HasFlag () native implementation.
Also, added missing argument checks to HasFlag ().
This reverts partially commit 753229c72dd9f2b63beb097700e350164b887c2.
Marshallers are not called for ICalls parameters so the change of ICalls parameters to SafeHandle did not prevents handle reuse.
To prevent handle reuse ICalls are no longer called directly.
Instead we call a method that receives a SafeHandle and wraps the ICall call with safeHandle.DangerousAddRef and safeHandle.DangerousReleaseRef.
This guarantees that the safe handle reference countererence does not reach zero before or while the ICall, thus avoiding the handle beeing released and possibly reused.
By locking `threads_lock` before launching the thread, we guarantee that the thread is not going to remove itself from `threads` before we actually add it to `threads`.
The added file Test/symbolicate.expected contains the value that we expect to find in Test/out/symbolicate.out.
make check now uses Test/symbolicate.expected.
Sequences of OP_IL_SEQ_POINT instructions are now reduced to only the instruction.
This removes about half of the generated sequence point instructions.
This HMAC cipher accepts any key size (1), took from RFC2104, which uses
the full 64 bytes of key since it has a block length of 64 bytes.
(1): https://www.ietf.org/rfc/rfc2104.txt - Chapter 2: Definition of HMAC
Fixes a crash when there are two methods overloaded by arity:
System.InvalidOperationException: Sequence contains more than one matching element
at System.Linq.Enumerable.Single[XElement] (IEnumerable`1 source, System.Func`2 predicate, Fallback fallback) [0x00038] in /private/tmp/source-mono-mac-3.10.0-branch/bockbuild-mono-3.10.0-branch/profiles/mono-mac-xamarin/build-root/mono-3.10.0/mcs/class/System.Core/System.Linq/Enumerable.cs:2371
at System.Linq.Enumerable.SingleOrDefault[XElement] (IEnumerable`1 source, System.Func`2 predicate) [0x00007] in /private/tmp/source-mono-mac-3.10.0-branch/bockbuild-mono-3.10.0-branch/profiles/mono-mac-xamarin/build-root/mono-3.10.0/mcs/class/System.Core/System.Linq/Enumerable.cs:2445
at Xamarin.ApiDiff.MemberComparer.Find (IEnumerable`1 target) [0x00019] in /Users/builder/data/lanes/macios-mac-master/177810cb/source/mono/mcs/tools/corcompare/mono-api-html/MemberComparer.cs:72
at Xamarin.ApiDiff.MemberComparer.Compare (IEnumerable`1 source, IEnumerable`1 target) [0x0003c] in /Users/builder/data/lanes/macios-mac-master/177810cb/source/mono/mcs/tools/corcompare/mono-api-html/MemberComparer.cs:83
at Xamarin.ApiDiff.MemberComparer.Compare (System.Xml.Linq.XElement source, System.Xml.Linq.XElement target) [0x000a2] in /Users/builder/data/lanes/macios-mac-master/177810cb/source/mono/mcs/tools/corcompare/mono-api-html/MemberComparer.cs:55
at Xamarin.ApiDiff.ClassComparer.Modified (System.Xml.Linq.XElement source, System.Xml.Linq.XElement target) [0x0005b] in /Users/builder/data/lanes/macios-mac-master/177810cb/source/mono/mcs/tools/corcompare/mono-api-html/ClassComparer.cs:210
at Xamarin.ApiDiff.Comparer.Compare (IEnumerable`1 source, IEnumerable`1 target) [0x00093] in /Users/builder/data/lanes/macios-mac-master/177810cb/source/mono/mcs/tools/corcompare/mono-api-html/Comparer.cs:80
at Xamarin.ApiDiff.ClassComparer.Compare (System.Xml.Linq.XElement source, System.Xml.Linq.XElement target) [0x00055] in /Users/builder/data/lanes/macios-mac-master/177810cb/source/mono/mcs/tools/corcompare/mono-api-html/ClassComparer.cs:67
at Xamarin.ApiDiff.NamespaceComparer.Modified (System.Xml.Linq.XElement source, System.Xml.Linq.XElement target) [0x0001a] in /Users/builder/data/lanes/macios-mac-master/177810cb/source/mono/mcs/tools/corcompare/mono-api-html/NamespaceComparer.cs:75
at Xamarin.ApiDiff.Comparer.Compare (IEnumerable`1 source, IEnumerable`1 target) [0x00093] in /Users/builder/data/lanes/macios-mac-master/177810cb/source/mono/mcs/tools/corcompare/mono-api-html/Comparer.cs:80
at Xamarin.ApiDiff.NamespaceComparer.Compare (System.Xml.Linq.XElement source, System.Xml.Linq.XElement target) [0x00055] in /Users/builder/data/lanes/macios-mac-master/177810cb/source/mono/mcs/tools/corcompare/mono-api-html/NamespaceComparer.cs:49
at Xamarin.ApiDiff.AssemblyComparer.Modified (System.Xml.Linq.XElement source, System.Xml.Linq.XElement target) [0x0002b] in /Users/builder/data/lanes/macios-mac-master/177810cb/source/mono/mcs/tools/corcompare/mono-api-html/AssemblyComparer.cs:70
at Xamarin.ApiDiff.Comparer.Compare (IEnumerable`1 source, IEnumerable`1 target) [0x00093] in /Users/builder/data/lanes/macios-mac-master/177810cb/source/mono/mcs/tools/corcompare/mono-api-html/Comparer.cs:80
at Xamarin.ApiDiff.AssemblyComparer.Compare () [0x0004a] in /Users/builder/data/lanes/macios-mac-master/177810cb/source/mono/mcs/tools/corcompare/mono-api-html/AssemblyComparer.cs:50
at Xamarin.ApiDiff.Program.Main (System.String[] args) [0x00328] in /Users/builder/data/lanes/macios-mac-master/177810cb/source/mono/mcs/tools/corcompare/mono-api-html/ApiDiff.cs:164
Many fonts, including the default DejaVu Sans, use kerning between
certain character pairs. This resulted in garbled or even invisible
display during typing of strings with a lot of kerning going on. An
attempt is made to retain the current speed-optimized implementation
while using accurate, slower string width measurements when needed.
See https://bugzilla.xamarin.com/show_bug.cgi?id=26478 for details.
This is so we can avoid miscompiling things left and right
when new overloads are added. For example, before this patch,
we miscompiled the new 4-parameter CAS () overload.
Calling mono with flag --compile-all=1 avoids running the code and possible stdout problems and it also compiles every method.
As test_op_il_seq_point.sh now only compiles it is now capable of testing libraries and executables that are expecting parameters.
Failure caused by https://github.com/mono/mono/commit/2f1b464beb14a1b6b6099a03fc332493293bef35.
```
../../../../../mono/mono/utils/mono-proclib.c:104:8: error: use of undeclared identifier 'errno'
if (errno != ENOMEM)
^
../../../../../mono/mono/utils/mono-proclib.c:104:17: error: use of undeclared identifier 'ENOMEM'
if (errno != ENOMEM)
```
This reverts commit 4d3877d23b.
We cannot remove this file as the build logic is expecting it since we override it from mono-extensions.
```System/Guid.cs(42,7): error CS0246: The type or namespace name `Crimson' could not be found. Are you missing an assembly reference?```
It started failing when code from MS referencesource was imported.
I checked on MS.NET and the list of attributes is now the same on Mono
(except an additional __DynamicallyInvokableAttribute on MS.NET).
These are emitted by recognizing Interlocked and Volatile methods. They allow
us to generate more efficient instruction sequences on certain architectures
(e.g. ARM64 which has specialized load-acquire and store-release instructions).
* Barrier semantics is now specified as acquire, release, and sequentially
consistent. This is in line with CIL/.NET semantics and also maps better to
LLVM's fence types.
* Use the mfence instruction for memory barriers on AMD64 as it's smaller
(and presumably also faster).
* We now emit specific barriers when using LLVM instead of always emitting
sequentially consistent barriers.
* Barriers emitted for the CIL volatile prefix instruction are now more
specific instead of always being sequentially consistent.
* Fixed emission of CEE_MONO_MEMORY_BARRIER in SGen's managed allocators. For
some reason (that I haven't had time to look into), mono_mb_emit_op ()
clobbers the barrier kind operand. This meant that in many cases we ended
up not actually emitting any barriers because the switches in the backends
didn't handle the clobbered values. mono_mb_emit_i4 () seems to work.
* Fixed handling of CEE_MONO_MEMORY_BARRIER in mono_method_to_ir (). Since it's
a custom opcode, the opcode is actually 2 bytes long. Another source of
barriers not actually being emitted.
This fixes Monodroid cross build, which broke with https://github.com/mono/mono/commit/adca49cdd28e7c7b0cc65073167c143cc5f52fdd.
Error:
```
/Users/joao/Dev/droid/mono/mono/mini/mini.c:6645:31: note: each undeclared identifier is reported only once for each function it appears in
/Users/joao/Dev/droid/mono/mono/mini/mini.c: In function 'mono_sigsegv_signal_handler':
/Users/joao/Dev/droid/mono/mono/mini/mini.c:6704:31: error: 'SIGSEGV' undeclared (first use in this function)
mono_handle_native_sigsegv (SIGSEGV, ctx, info);
```
At some point we zeroed all the unloaded domain's objects first, and then we cleared
weak links, ephemerons, etc. Because the objects were zeroes, we only had to
check that the vtable was null. Now we do it the other way around: clear weak links,
ephemerons, ..., and then zero objects. Obviously we now need to check for the
object's domain, because their vtables will not be null.
Add #ifdef to ignore code in mono/metadata/mono-route.c if OS=linux
Also remove mono-route.c from msvc/libmonoruntime.vcxproj (Windows)
Add #ifdef to ensure mono/metadata/mono-route.h code is not included
on Linux
Change to using #if defined(PLATFORM_MACOSX) || defined(PLATFORM_BSD)
Use sizeof(addr) for maximum length of IP address string, instead of the hard-coded 16.
Should the size of addr ever change it will keep us from disaster in case if shrinking the array length.
Also, do not ignore snprintf return value - check for truncated output and act accordingly if it happens.
Add Tests for System.Net.NetworkInformation/IPInterfacePropertiesTest.cs and System.Net.NetworkInformation/NetworkInterfaceTest.cs
Remove accidental Copyright
add a space before the opening parenthesis, as shown in the coding guidelines.
Indent TestFixture to align with coding style of newer Test classes
Use G_N_ELEMENTS(mib) instead of sizeof(mib) / sizeof(mib[0])
Pinning is done in the worker thread, but reset in the main thread.
The main thread must wait for the worker jobs to finish until it can
reset pinning. We didn't do this before.
When importing a project that contains embedded resources, the id
of those resources must be generated using the path relative
to the project file that includes them, not relative to the
main project file. To fix this problem, we now generate a
Link metadata property for those resources that has the correct
relative path, and later this is used to generate the correct
id for the resource. We also now store a new metadata value
for all items (DefiningProjectFullPath) which contains the
path to the project file that defines the element. This is
used to check if an item was defined in an imported file,
in which case the Link assignment may need to be made.
This fixes bug BXC 20966.
In the TextBoxTest.PasteTest () test case we copy the string "ABCD" to the clipboard.
We then try to paste it again and see if it's the same.
Internally in WinForms, the clipboard data is retrieved via an X11 API that returns
a pointer to the string. In this case, we have a unicode/utf16 string that usually
looks as follows in memory (2 byte per character):
65 'A'
0
-
66 'B'
0
-
67 'C'
0
-
68 'D'
0
-
0 '\0' end of string
0 potential garbage from here on
-
0
0
...
The bug is that we use Marshal.PtrToStringUni (), which reads until the
first null *char* not the first null *byte*.
Imagine if we get the following (happens sometimes):
65 'A'
0
-
66 'B'
0
-
67 'C'
0
-
68 'D'
0
-
0 '\0' end of string
230 <--- garbage, but considered part of a char by PtrToStringUni ()
-
47
56
-
74
43
...
This produces garbage like "ABCD㠯⭊" since PtrToStringUni () reads beyond the original string.
The fix is to use the nitems variable that is returned by the X11 API (it contains the
actual number of bytes in the string) and copy the bytes manually. We already do
the same for the UTF8 case above.
This fixes the TextBoxTest.PasteTest () that intermittently fails on Jenkins.
Fixes#26008
We do not want (transition.DayOfWeek - first) % 7 to be negative.
As (transition.DayOfWeek - first) cannot be lower than -7, adding 7 to it solves the issue.
Little and big endian cases were inverted. It can be seen e.g. from the
reference http://locklessinc.com/articles/locks, where the ticket algorithm
is given for little-endian machines
As a consequence, without this patch, if TryEnter succeeds, it increments
ticket.Value instead of ticket.User, which puts the SpinLock in a corrupted
state, and makes it impossible to release afterwards.
SafeHandle.IsInvalid refer only to the handle value it self. Being true only if the handle is 0 || -1
In all cases, Releasing, Disposing or SetHandleAsInvalid does not change the handle value, so SafeHandle.IsInvalid will remain unchanged.
IsClosed will be true if the handle is released or if SetHandleAsInvalid is called.
The handle will not be released when calling Dispose if SetHandleAsInvalid was called.
The handle is not released at Dispose but when the last ref is removed by DangerousRelease
Some autoconf checks were missing when running on Windows.
Added stub for mono_get_local_interfaces back that was removed in b92e560d3f
for systems like Windows that have neither HAVE_SIOCGIFCONF nor HAVE_GETIFADDRS.
When config PhysicalMemoryLimitPercentage is not set or set to zero MemoryCache.PhysicalMemoryLimit value will depend on the total physical memory available.
Now even if multiple MemoryCacheEntry are added to CacheUsage with the same date time CacheEntryCollection is able to sort them for removal in the same order.
.NET was using this to retrieve the size of an object graph, by using special logic on its GC.
This version of SRef is not doing that, because Mono does not provide that kind of computation.
As the changes that the GC would require to support this are not trivial, SRef returns a wrong size for now.
Known problems:
- CacheMemoryMonitor does not trim the cache when it reaches its memory size limit.
- IMemoryCacheManager.UpdateCacheSize is called with incorrect size.
Performance counter "Available Physical Memory" return the current
amount of ram that is not in use.
This was added to be used by System.Runtime.Caching .NET integration
that relies on the available system memory to resize the cache.
(add a reference to System.Web.Services)
Without this patch we get the following exception after multiple call
to a soap web services:
Error while compiling generated serializer
/tmp/24ee1170/4996ddb2.cs(2519,27) : warning CS1522: Empty switch block
/tmp/24ee1170/4996ddb2.cs(969,29) : error CS0012: The type `System.Web.Services.Protocols.SoapHeader' is defined in an assembly that is not referenced. Consider adding a reference to assembly `System.Web.Services, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
Signed-off-by: Frederic Mestayer <[email protected]>
Signed-off-by: Etienne CHAMPETIER <[email protected]>
We had previously used two separate loops for scanning card tables: One
loop that handled blocks where the object slots were larger than a single card,
and one loop where they were smaller. In the large case we would iterate over
the slots, check whether they were occupied, and if so, check their cards. In the
smaller case we would do it the opposite way: Check the card first, then check
the slots in the card.
For some workloads, the large loop resulted in lots of cache misses, because
we were fetching memory all over the blocks instead of just the cards. The small
loop, on the other hand, would sometimes scan objects twice, namely when they
crossed the boundary between two cards, and both cards were marked.
This new unified loop fixes both problems. We always look at the cards first,
and we keep a scan front pointer that prevents scanning objects more than
once.
For objects that were larger than a card we iterated over the objects in a block, rather
than iterate over the cards. To do that we had to load the object headers, which caused
cache misses. The card bits are consecutive, so they'll be in the cache.
The commit addresses race issues between the waiting on the lock semaphore and the release of the lock. The entry count and the owner field are grouped together into the status field. Accesses to it are done using atomic cas operations so threads aren't lost waiting for release on the lock semaphore.
Disable native fastpaths for now, until they are updated to the new implementation.
Without AOT only code size is checked
With AOT native code is checked.
We cannot compare the native code without AOT because some undeterministic data is stored in the middle of the code and there is no easy way of making the native code dumper ignore it.
Comparing native code is only possible with AOT because it is almost deterministic.
A diff of the smallest method changed by OP_IL_SEQ_POINT is now printed to ease problem identification.
That function is no longer needed since nothing calls it.
This was effective dead code for ages as it would only be used by targets
with no ipv6. So, unless you're using Debian Potato, nothing to see here.
By using a single networking abstraction for name resolution we no longer
need to have two code paths, one for struct hostent and one for struct addrinfo. Good riddance.
More specifically.
We now use functions to fetch protocol numbers and not rely on inline ifdefs.
We use the single abstraction over name resolution, which allows us to have a single code
path to convert the native structure into a managed one.
Finally, we moved the polyfill logic for missing functionality to a separate file to make
things easier.
This meant to replace the ifdef hell that is part of the current socket code and to
modernize the sockets code on some targets.
For some reason we still relied on gethostbyname (and variants) in 2015.
Those functions were deprecated circa the KAME project - yes, I'm that old to remember it.
With that in mind, we now rely on getaddrinfo for all sane targets and drop straight to
the lowest common denominator when it's not available, which is gethostbyname/gethostbyname2.
This patch removes support for the glibc gethostbyname2_r extension. Which is not a practical
problem because all linux/android target we can realistically run on have getaddrinfo.
Sorry grampa, no Slackware 8.0 anymore.
This code has a simpler structure of whole file ifdefs as much as possible, which is
a blessing to OOT ports.
In order to track emitted code with vtune you need to :
* pass --enable-vtune=yes to autogen.sh
* have in the LD_LIBRARY_PATH the path to the profiler libraries (ex $(installation_folder)/lib)
* pass argument --profiler=vtune to mono
Seems that on Jenkins, the request to the (non-existing) IP address used in the test returns before the 1s timeout,
causing the test to fail because the cancellation didn't fire.
Lowering the timeout to 1 millisecond should fix this.
I also verified that the test still correctly fails when the commit that fixed the original issue is reverted.
This fixes the case of the System.ObjectDisposedException being thrown
when editing a text cell in a DataGridView control a second time.
The problem is that the static control would be disposed by the code in
DataGridView's EditingControlInternal, but this instance was reused over
and over.
Instead, we now createa new editing control every time that the TextBoxCell
is created.
The investigation for this bug took place here:
https://bugzilla.xamarin.com/show_bug.cgi?id=9653
Fixes also:
https://bugzilla.xamarin.com/show_bug.cgi?id=22297
Removed the old string-based code and use CodeDom APIs for everything.
Implemented parameter support by adding the necessary properties to the generated class.
Fixed bug where the task references weren't passed to the compiler.
This should now work with VB code as well (assuming the compiler is installed).
Build error #1:
libtool: compile: gcc <...> -c mono-context.c -fPIC -DPIC -o .libs/mono-context.o
mono-context.c: In function 'mono_sigctx_to_monoctx':
mono-context.c:435:68: error: 'MONO_SAVED_GREGS' undeclared (first use in this function)
memcpy (&mctx->regs, &UCONTEXT_REG_Rn(uc, 13), sizeof (mgreg_t) * MONO_SAVED_GREGS);
^
mono-context.c:435:68: note: each undeclared identifier is reported only once for each function it appears in
mono-context.c:436:70: error: 'MONO_SAVED_FREGS' undeclared (first use in this function)
memcpy (&mctx->fregs, &UCONTEXT_REG_FPRn(uc, 14), sizeof (double) * MONO_SAVED_FREGS);
^
The MONO_SAVED_GREGS and MONO_SAVED_FREGS macros are defined in mini-ppc.h.
The problem happens because commit 7e056cd346
moved code using them from exceptions-ppc.h (which includes mini-ppc.h) to
mono-context.c (which doesn't), where they're not #included.
So, include mini-ppc.h in mono-context.c (in the existing powerpc ifdef block).
Signed-off-by: Mauricio Faria de Oliveira <[email protected]>
Build error #2:
Now, it turns out mini-ppc.h doesn't know MonoMethod, MonoMethodSignature, and MonoObject.
So, include object.h (MonoObject), which includes metadata.h (MonoMethod and MonoMethodSignature),
in mini-ppc.h.
libtool: compile: gcc <...> -c mono-context.c -fPIC -DPIC -o .libs/mono-context.o
In file included from mono-context.c:427:0:
../../mono/mini/mini-ppc.h:37:2: error: unknown type name 'MonoMethod'
MonoMethod *method;
^
../../mono/mini/mini-ppc.h:306:31: error: unknown type name 'MonoMethodSignature'
mono_ppc_tail_call_supported (MonoMethodSignature *caller_sig, MonoMethodSignature *callee_sig) MONO_INTERNAL;
^
../../mono/mini/mini-ppc.h:306:64: error: unknown type name 'MonoMethodSignature'
mono_ppc_tail_call_supported (MonoMethodSignature *caller_sig, MonoMethodSignature *callee_sig) MONO_INTERNAL;
^
../../mono/mini/mini-ppc.h:312:27: error: unknown type name 'MonoObject'
mono_ppc_throw_exception (MonoObject *exc, unsigned long eip, unsigned long esp, mgreg_t *int_regs, gdouble *fp_regs, gboolean rethrow) MONO_INTERNAL;
^
Signed-off-by: Mauricio Faria de Oliveira <[email protected]>
Build error #1:
libtool: compile: gcc <...> -c mono-context.c -fPIC -DPIC -o .libs/mono-context.o
mono-context.c: In function 'mono_sigctx_to_monoctx':
mono-context.c:435:68: error: 'MONO_SAVED_GREGS' undeclared (first use in this function)
memcpy (&mctx->regs, &UCONTEXT_REG_Rn(uc, 13), sizeof (mgreg_t) * MONO_SAVED_GREGS);
^
mono-context.c:435:68: note: each undeclared identifier is reported only once for each function it appears in
mono-context.c:436:70: error: 'MONO_SAVED_FREGS' undeclared (first use in this function)
memcpy (&mctx->fregs, &UCONTEXT_REG_FPRn(uc, 14), sizeof (double) * MONO_SAVED_FREGS);
^
The MONO_SAVED_GREGS and MONO_SAVED_FREGS macros are defined in mini-ppc.h.
The problem happens because commit 7e056cd346
moved code using them from exceptions-ppc.h (which includes mini-ppc.h) to
mono-context.c (which doesn't), where they're not #included.
So, include mini-ppc.h in mono-context.c (in the existing powerpc ifdef block).
Signed-off-by: Mauricio Faria de Oliveira <[email protected]>
Build error #2:
Now, it turns out mini-ppc.h doesn't know MonoMethod, MonoMethodSignature, and MonoObject.
So, include object.h (MonoObject), which includes metadata.h (MonoMethod and MonoMethodSignature),
in mini-ppc.h.
libtool: compile: gcc <...> -c mono-context.c -fPIC -DPIC -o .libs/mono-context.o
In file included from mono-context.c:427:0:
../../mono/mini/mini-ppc.h:37:2: error: unknown type name 'MonoMethod'
MonoMethod *method;
^
../../mono/mini/mini-ppc.h:306:31: error: unknown type name 'MonoMethodSignature'
mono_ppc_tail_call_supported (MonoMethodSignature *caller_sig, MonoMethodSignature *callee_sig) MONO_INTERNAL;
^
../../mono/mini/mini-ppc.h:306:64: error: unknown type name 'MonoMethodSignature'
mono_ppc_tail_call_supported (MonoMethodSignature *caller_sig, MonoMethodSignature *callee_sig) MONO_INTERNAL;
^
../../mono/mini/mini-ppc.h:312:27: error: unknown type name 'MonoObject'
mono_ppc_throw_exception (MonoObject *exc, unsigned long eip, unsigned long esp, mgreg_t *int_regs, gdouble *fp_regs, gboolean rethrow) MONO_INTERNAL;
^
Signed-off-by: Mauricio Faria de Oliveira <[email protected]>
Added methods mono_inst_next, mono_inst_prev, mono_bb_first_inst, mono_bb_last_inst
The added methods do respectively the same as ins->next, ins->prev, bb->code, bb->last_ins but skip the instruction until it matches the specified filter.
* Main use case - JSON.NET serialization of CLR objects containing DateTime fields, GetUtcOffset()=>GetApplicableRule() are the highest Mono methods in the profiler
* The property DateTime.Date access in the foreach is very expensive, this has been moved outside the foreach
* Performance for DateTime.Now passed as a parameter is 10x better than before
* This is the simplest possible change to yield an improvement, it would be better to replace the O(N) loop logic with a binary search - this yields a further 2-3x performance improvement, when master is building I may submit later
Whenever a connection to an FTP server is established, FtpWebRequest
sends an option command to the server to enable UTF8 encoding for the
transfer. So far we've failed to check the request status of that
command and assumed that UTF8 is enabled but *also* failed to actually
use the encoding when sending commands (we had the ASCII encoding
hard-coded). This resulted in failed requests whenever a command named a
file or path which included non-ASCII characters. This patch does two
things:
* checks the status of the UTF8 enabling command and uses UTF8 encoding
only if it succeeded. Otherwise Encoding.Default is used.
* uses the encoding detected above for the command stream.
Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=24611
[Tests will follow at a later date]
So in Linux the PingTimeOut test was returning TtlExpired and failing the assertion. Since I'm not exactly sure how ping behaves under all platforms, relax the test to only make sure it doesn't succeed.
Reverted the async delegate firing which is how Caching et al. expect FSW events; and properly handle the multicast case.
Also fixing a typo/regression in @2f1a136583c90cae805441e63b94bc4f277bb953
As-is, on non-Mac, Xbuild looks for MSBuildExtensionsPath in the folder specified by --prefix, i.e. /usr/local/mono/xbuild by default (which may not & should not exist).
After manager.Build is called, a "null" empty for TargetFrameworkDirectory is
a string containing only ";" - a "good" value is the target framework
directory with a trailing ";". By testing for string.Empty, we don't actually
test whether the value has been correctly populated (causing all subsequent
failures).
Used the following script to do this:
var d = XDocument.Load ("Strings.resx");
foreach (var j in d.XPathSelectElements ("/root/data")){ var v = j.XPathSelectElement ("value"); Console.WriteLine ("\tpublic const string {0}=\"{1}\";", j.Attribute ("name").Value, v.Value); }
This brings .NET's parameterized terminfo renderer, various fixes and
semantic changes.
The existing implementation of the Console did not have a proper an
implementation of terminfo's parameterized sequences. Instead of
this, a collection of hacks existed to hardcode both light colors and
cursor position. These are now gone, since the parameterized strings
do contain the correct values for this.
The search path for terminfo now picks the most modern location for
terminfo. With the old paths in place.
The lookup for terminfo databases only supported the lookup based on
the first character of a terminal, so for example, for xterm this was
$terminfo_dir/x/xterm, but OSX and maybe other systems now store the
files in $terminfo_dir/78/xterm (where 78 is the hex representation of
'x', the first letter of the terminal name).
The fallback is still in place for other Unix systems.
We no longer use the built-in terminfo databases as the first pick,
instead we try to load the system terminfo database before we use the
built-in versions.
Worth figuring out if we want to remove the two built-in ones (Linux
and xterm) as broken terminfo databases are no longer the norm in Unix
and just keep the ansi one as a database of last resort.
This means that the console actually now gets high colors on MacOS,
not just Linux.
This also fixes the issue with consoles with more than 256 colors. As
reported in bug 18315.
- XNodeWrite.FillXmlns was adding a prefix to the attribute when no prefix was found (prefix==null)
- XNodeWrite.LookupPrefix now returns string.Empty prefix when the namespace is the same as the element.
A string.Empty prefix explicitly states that it has no prefix whereas null states that prefix was not defined.
When LookupPrefix returns null for a namespace it means that a prefix should be generated first for anything that uses the namespace.
That is what XmlSerializationWriter.GetQualifiedName does.
Fixes#24300
Context: https://bugzilla.xamarin.com/show_bug.cgi?id=24947
When an Android user changes the timezone, those TimeZone changes
aren't reflected in Xamarin.Android apps. Part of this is a
Xamarin.Android bug, in which it needs to listen for TimeZone change
notifications and in turn let Mono know that the TimeZone changed.
Xamarin.Android can/will call Thread.CurrentCulture.ClearCachedData()
and Thread.CurrentUICulture.ClearCachedData() when the TimeZone has
changed. This will allow Mono to lookup the TimeZone info again.
At which point we hit two problems within Mono:
1. TimeZoneInfo.AndroidTimeZones.Local is unnecessarily cached.
2. DateTime itself caches the UTC offset for use by DateTime.Now.
TimeZoneInfo.Local is *already* cached, and TimeZoneInfo.Local is
properly cleared by TimeZoneInfo.ClearCachedData() while
TimeZoneInfo.AndroidTimeZones.Local wasn't. Removing the extra
cache allows the TimeZoneInfo to be looked up again.
Which brings us to DateTime.Now: for my simple test case, after
calling CultureInfo.ClearCachedData() the result of
DateTime.Now.ToString() didn't reflect the newly current TimeZone. The
cause for this was DateTime.to_local_time_span_object and
DateTime.last_now, which DateTime.Now uses as a cache for the
TimeZone's UTC offset.
Since these DateTime fields weren't cleared, subsequent DateTime.Now
invocations reported the *previous* TimeZone instead of the current
timezone.
To fix this, add an `internal` DateTime.ClearCachedData() method, and
call DateTime.ClearCachedData() from CultureInfo.ClearCachedData().
We can't dereference an object's VTable before we know that it's not
tagged. In this case, forwarded. The access would be unaligned and
might even fault.
We call `mono_thread_pool_cleanup` twice from `mono_runtime_try_shutdown` and later `mono_domain_finalize`, which meant we tried to destroy the semaphore twice and that caused a crasher.
Fix this by clearing out the semaphore pointer. That way when we try to destroy it again it's already null and execution continues just fine.
There's an unlikely case that Roslyn triggers quite often on Linux: A
thread tries to allocate from the nursery, but it's full. It triggers
a nursery collection, then tries allocating again. Between the
collection and the allocation retry, another thread fills the nursery
so that the retry also fails.
We failed an assertion in this case. Now we always go to the major
heap if it happens.
This bug is not hit when doing managed allocations with SGen because the
managed allocator catches it. It can be triggered with the embedding API, as
well as when the heavy binary protocol is enabled, in which case `bug-17590`
fails.
Previous code subtracted 4 pixels of the height of the text of a
toolstrip button, presumably to leave a margin. However, margins
are handled elsewhere, so we ended up with truncated text.
The intention is to make build failures easy to spot instead of silently upgrading
target framework from 2 to 4 and then fail down the road on e.g type ambiguity
caused by new 4.0 framework types or methods
This is the fix for https://bugzilla.xamarin.com/show_bug.cgi?id=25158
Current implementation does not contain the DateTimeOffsetConverter
in the list of default converters. This cause NotSupportedException
to be thrown when trying to serialize/deserialize DateTimeOffset
values to/from strings.
In .NET Framework implementation this class is added to such a list.
This fixes bug #25086 (Xamarin.Android). Details described there.
To fix the issue, we use #if XAMARIN_ANDROID to avoid that old cygwin-only
code path. (We are not sure if simply removing the old code still works,
so we don't remove that for now.)
In the Windows implementation of the TabControl, Ctrl+PageUp
navigates to the previous tab and Ctrl+PageDown navigates to the
next tab (with both wrapping around). This change implements this
feature in the Mono implementation.
Change-Id: Ib940bd08d5ba641f05ed91c0e789e356e68f72bb
ToKey() ignores the setting parameter when calling RegistryKey.OpenSubKey() and
thus always asks for write permission. If you try to read read-only keys (say
HKLM without admin rights) it will fail with a SecurityException.
* Fixed the FileSystemEventArgs.Name property for all events
* Fixed regression of bug #5747 (and related path normalizing issues) https://bugzilla.xamarin.com/show_bug.cgi?id=5747
* Improved error handling, set hard limit on file descriptors to 200 for now to help isolate issues
* Fixed issues with rapid event Changed+Renamed firing
Fixes: https://bugzilla.xamarin.com/show_bug.cgi?id=24742
Context: Commit f7fd52ad
Context: https://bugzilla.xamarin.com/show_bug.cgi?id=24958
The logic of Commit f7fd52ad was 'Desktop Mono returns "Local" from
TimeZoneInfo.Local.Id, so surely Xamarin.Android should', predicated
in part on the assumption that whatever Desktop Mono does should be
the same as what Desktop .NET does.
This assumption wasn't verified, and is in fact wrong; Desktop .NET
doesn't return "Local" from TimeZoneInfo.Local.Id, it returns an
actual identifier.
The reason why Desktop Mono returns "Local" is due to implementation
sanity, particularly on OS X: /etc/localtime may be a symlink OR a
copy of the timezone data, and when it's a copy there's no way to
determine the Olson ID for the timezone. Consequently, it may not be
possible to determine the TimeZone ID.
Xamarin.Android doesn't have that problem; it uses the Android
persist.sys.timezone system property value,
falling back to java.util.TimeZone.getDefault().getID() if necessary,
and thus always has access to an Olson ID.
Change TimeZoneInfo.Local.Id on Xamarin.Android to return the Olson ID
instead of "Local", partially reverting Commit f7fd52ad.
When we draw a button with ImageAboveText.ImageAboveText and the
text is too big to fit below the image we have to draw the text over
the image. This should happen from the bottom, not from the top as
the previous implementation did. With the previous code we ended up
having the text at the top of the button under certain conditions.
UriParseComponents.ParseUser was unescaping all escaped chars and when a non valid user info char was encountered it was assuming that those chars were not part of the user info. The chars were not consumed thus the problems while parsing the rest of the input.
UriParseComponents.ParseUser now keeps non valid user info chars escaped.
Due to an incompatibility in the project files and DLL API setup code, we were importing locally defined symbols as DLL. This manifested as a debug heap dialog in VS caused by allocating and freeing memory between two Windows modules (which have their own memory heap).
Fix this by simplifying the DLL defines in MSVC, we are relying on .def files to manually specify the exports anyway.
Fixes: https://bugzilla.xamarin.com/show_bug.cgi?id=24741
Xamarin.Android didn't previously support
TimeZoneInfo.FindSystemTimeZoneById("Local") because of oversight (and
overly nested #if conditionals).
Compare `id` against "Local" *before* doing platform-specific
codepaths so that finding the "Local" TimeZone works as expected on
Xamarin.Android, and merge the `#if MONODROID` with the existing code.
7d1b878fbf altered the behavior of removing rows, breaking
the DataGridViewRowCollectionTest.ClearRows () test
Before the change, this is what happened when the list was cleared
(the number in brackets is the value of the Index property of the DataGridViewRow):
[0] Remove [1] ReIndex [0] Remove [1] ReIndex [0]
[1] --------> [2] --------> [1] ------> [2] -------> [1] ...
[2] [3] [2]
[3]
After the offending commit, ReIndex is only called after the list is cleared, which means
the Index property of the rows is never updated (as there are no items in the list).
The fix is to explicitly set the Index of each row to 0.
This was the end result before the commit anyway, so we can omit the ReIndex call entirely.
Before, the first thing the user saw were instructions for niche platforms like Itanium or Solaris.
Instead, we now just link to the "Compiling Mono" guides for OSX, Linux and Windows on the Mono website.
Additionally, a bunch of instructions were outdated / no longer relevant, updated those.
The "Configuration options" section was moved to the bottom of the readme, it was pretty long and pushed
the other sections into oblivion.
We can't actually use the trick of setting both the pinned and forwarded
bits to indicate cemented objects because the Tarjan bridge requires those
two bits never be set at the same time.
The factor we used previously gave us object sizes in increments that made
some benchmarks use quite a lot more memory than necessary. In particular,
we didn't have a size for 24 byte objects (on 64 bits), just for 16 and 32.
The card scanning code assumed that the size of the block header is less
than the size of a card. If we put the block info into the header and increase
the block size enough, that assumption isn't true anymore, because the
mark bits take up space in proportion to the block size.
The idea here is to first extract all the references within an object
and then to process them, pre-fetching the objects they point to a few
steps ahead.
When the runtime shuts down the last thing the GC usually hears about it
is that the root domain is unloaded. If we don't flush the binary protocol
buffers at that point, we lose entries.
We still have two separate implementations of the scanning code: The optimized
one and the old one. The old one is still needed because it supports the concurrent
collector. For the non-concurrent collector we can now use the optimized
implementation, however.
Fasten is a small tool for optimizing compile-time options:
https://github.com/evincarofautumn/fasten
It does that by parsing source files for numbers that have been marked
as "fastenable", and fiddling around with them. We do this for all
the new optimizations.
We actually implement two separate mark/scan loops: One that doesn't
support evacuation and one that does. We dynamically choose which one
to use. The evacuation-less loop is faster, so we use it whenever we can.
The reason for having a small bitmap was that we could encode the object
size in the descriptor. The main attraction for having object size handy is that
we can quickly check whether an object is in the small object major heap or
in the LOS. We solve this problem by always using complex descriptor types
for large objects, so now we can tell whether an object is small just by looking
at the descriptor type.
To identify more small objects quicker.
Since we now use the runl-length descriptor types to indicate object
size as well, and strings can have any size, we can't use that type
for strings anymore, so we use the complex type which forces us to
look up its size to determine whether it's a small or large object.
We can do the cemented check faster by using the third vtable bit to
tag cemented objects (in addition to the pinned bit). In workloads
that are heavy on cementing (like `lcscbench` or `perimeter`) this
significantly increases performance.
Another experiment: What if we put the whole block info into the block
itself, not just a pointer to it. There's one less indirection we
need to do. On the other hand, many of them will share the same cache
lines. So do the pointers to the block infos, though.
When we scan a small object in the major heap we have to read the
block header of its block. It makes sense to prefetch that as well,
in addition to the object itself.
This is another experiment.
When marking on enqueue, what we need to do is look at the object
we're about to enqueue, to check whether it's a small or large object.
Then, when we dequeue to scan, we look at the object again, so we
essentially fetch each live object header twice.
With mark on dequeue, when we encounter a pointer we always enqueue
it, without even looking at the object. Only when we dequeue do we
figure out whether it's marked yet, and thus whether we need to scan
it.
The basic idea here is to make a loop that combines dequeuing from the
gray queue, scanning and marking/copying/enqueuing, with redundancies
removed and special-casing of the common case.
We make the small bitmap type descriptor only apply to small (as
opposed to LOS) objects so that we can quickly check in that case
whether an object is in the LOS or not without actually looking up its
size.
We disable evacuation and the split nursery because the code doesn't
support them yet.
Without heavy statistics it counts almost no objects, and even with
heavy statistics turned on, it doesn't count everything. SGen has an
accurate counter when heavy statistics are turned on.
In case the test runner returns null we will no longer suffer a NullArgumentException and the collector exceptions will be printed.
The test runner was returning null because of an IOException "Too many open files" on NUnit side.
* Add support for colorizing the HTML output. This can be turned off if desired.
* Some changes are now reported inline (using colors/underline/strikeout)
instead of generating an removed/added pair. This makes the diff
a lot easier to read.
As-is, winsetup.bat replaces config.h with winconfig.h, which is needed for the MSVC compilation - but breaks all further use of cygwin's make (e.g. to build the class library, or run "make install").
This patch introduces a new cygconfig.h as a backup prior to squashing config.h (if it exists, so the runtime can still be built without cygwin ever being used), and makes winconfig.h use it on non-MSVC compilers (i.e. cygwin)
This patch brings .NET's implementation of the RegularExpressions
stack and brings some of the supporting infrastructure required to
build without resource files.
The build commands have been updated with two new defines to assist in
bringing .NET code: MONO (to indicate that the code is being compiled
as part of Mono) and a more granular DISABLE_CAS_USE that is used to
mark regions where Code Access Security is being used in the source
code, as Mono does not actually ship with a working CAS implementation.
A tools thread is one that can access core runtime structures but not touch anything managed (code or heap).
It's intended to enable the profiler to resolve missing backtraces from its helper thread.
THIS IS A HACK.
The right solution would be to not perform this on the profiler at all and simply log IPs and let the decoder
resolve them. But then there's reality and we can't simply break the current format without consequences.
We're taking this hack for now until we can fix the profiler to do something sensible.
Unhelpfully, winconfig.h is used for building eglib, and it includes a hardcoded VERSION definition which needs to match configure.ac - otherwise msvc builds identify themselves as 2.11
MonoPosixHelper fails to build in my testing, due to config.h bailing the
build out if it doesn't think the build platform is XP SP2 or higher.
Adding this define forces that minimum Windows version, allowing mono.sln
to build fully.
For the opcodes sizeof, mkrefany and refanyval the jit
was resolving the operand tokens directly from the image.
In dynamic scenarios where the tokens are stored in the
wrapper data, this triggered TypeLoadExceptions.
This patch uses mini_get_class, as used everywhere else,
to resolve the operand tokens of those opcodes.
Consider spans and absolute sizes in computing PreferredSize for
TableLayoutPanel.
Also fix bug in allocating unused width to SizeType.Absolute columns.
Change-Id: Ic5065b83ced8195d1c5be39087f33b0d632fc9a6
A previous change (885b065e) accidentally calculated the text size
in some places without padding. This resulted in a slightly to small
text rectangle, causing the text to be truncated.
This property uses the new CMD_STACK_FRAME_GET_DOMAIN command
to retrieve and cache the domain in which the stack frame
is executing.
Bump the protocol version to match the runtime.
When cross compiling with gcc, LIBC is defined and
thus never checks the registry for the timezone information.
This change is released under the MIT license.
The underlying problem for bug 7716 [1] was that the Mono C14N XML
canonicalizer was not sorting the XML attributes in the same order as
Microsoft .NET's canonicalizer.
The C14N specification [2] states: "the attributes are sorted
lexicographically by attribute name (based on Unicode character code
points)." This wording suggests that the order of attributes should be
strictly ascending based on Unicode byte value. This commit changes the
attribute sort order to match the specification.
The new tests pass on Windows, fail on Mono before this change, and
succeed on Mono after this change.
[1] https://bugzilla.xamarin.com/show_bug.cgi?id=7716
[2] http://www.w3.org/TR/2000/WD-xml-c14n-20000119.html
When the VirtualListSize changes, the focus_item_index should
be reset (similar to how it currently resets the selected indices).
If the last item in a ListView has focus and it is removed by
an another action on the form (i.e. push a button to remove the
current item), then the focused_item_index is not updated when
the VirtualListSize changes, even though that item doesn't exist
anymore. When the ListView receives focus again, it tries to
invalidate the current focused item which causes an
ArgumentOutOfRangeException.
The previous value was -2, that could introduce comparison issues.
Added flag MONO_SEQ_POINT_FLAG_EXIT_IL that is used to encode the exit IL, this avoids a 4 byte IL offset delta.
This fixes ~30 ppc-specific failures in mono/tests (e.g., appdomain), like this:
wrong maximal instruction length of instruction atomic_add_i4 (expected 20, got 28)
* Assertion: should not be reached at mini-ppc.c:5235
The commit 51c454f6b0 introduced 2 ppc_sync
instructions in OP_ATOMIC_CAS_I4/8 *and* OP_ATOMIC_ADD_NEW_I4/8 (mini-ppc64.c).
Accordingly, commit 83a34c40c6 updated the maxlength
(+8 bytes) of atomic_cas_i4/8 - *but not* atomic_add_new_i4/8 (cpu-ppc64.md).
Recently, commit b784b866da made atomic_add_new_i4/8
exercised (as 'atomic_add_i4/8') - with an incorrect/non-updated 20-byte maxlength,
which should actually be 28.
Thus:
wrong maximal instruction length of instruction atomic_add_i4 (expected 20, got 28)
Signed-off-by: Mauricio Faria de Oliveira <[email protected]>
The ELFv2 ABI specifies some particular cases for in-register parameter
passing, return values, float/double structs; e.g.,
- small struct returned via registers (2 doublewords)
- homogeneous float struct returned via registers (8 members)
- small float struct passed/returned via FR registers
- return via multiple registers
Author: Bill Seurer <[email protected]>
Origin: https://launchpad.net/ubuntu/+source/mono/3.2.8+dfsg-4ubuntu2
Changes: Mauricio Faria de Oliveira <[email protected]>
Signed-off-by: Mauricio Faria de Oliveira <[email protected]>
After the mechanical exchange of ppc_r11 and ppc_r12 we now can use
ppc_r12 for global calls to hold the callees address without clobbering
r11 (which potentially contains IMT_REG, VTABLE_REG and RGCTX_REG).
We don't need to change all indirect calls, only those potentially reaching
functions containing a TOC setup based on r12 (in particular functions
in shared libs). As the instruction sequence patcher can only deal
with one destination register we also need to make some additional
calls use r12. We probably should convert all calls that currently
use r0 to use r12 if no other conflicts arise but this is enough to build.
Author: Michael Matz <[email protected]>
Origin: https://build.opensuse.org/request/show/225490
Changes: Mauricio Faria de Oliveira <[email protected]>
Signed-off-by: Mauricio Faria de Oliveira <[email protected]>
This is a preliminary patch for ppc64le ELFv2 support. That one requires
r12 to hold a functions address at calls to normal (global) C functions.
As is r12 is also used by mini for its IMT_REG, VTABLE_REG and RGCTX_REG
to pass around values to functions outside the normal argument registers
(ugh!), so there's a conflict. This mechanical (by sed) patch simply switches
ppc_r11 and ppc_r12 everywhere, r11 doesn't have any special use in the ABI.
Author: Michael Matz <[email protected]>
Origin: https://build.opensuse.org/request/show/225490
Changes: Mauricio Faria de Oliveira <[email protected]>
Signed-off-by: Mauricio Faria de Oliveira <[email protected]>
This adds initial support for ppc64le to the ppc64 port. That is:
* little endian aware (also in strtod),
* and ELFv2 aware (not using function descriptors)
* adjust various block sizes to be multiple of 64k, the default
pagesize on ppc64le. The sources should have used the system function
to ensure alignment on pagesize, so this is just a stop-gap
It also corrects the list of registers for the precise GC, but that isn't
used in mini at all on any architecture currently.
Author: Michael Matz <[email protected]>
Origin: https://build.opensuse.org/request/show/225490
Changes: Mauricio Faria de Oliveira <[email protected]>
Signed-off-by: Mauricio Faria de Oliveira <[email protected]>
MonoSeqPointInfo has now a pointer to a buffer containing encoded sequence points, and to a buffer containing next values.
As there is no longer an array of SeqPoint ready to be read, SeqPointIterator was added.
This line enable the ASP Javascript validators in IE9 and upper. the user agent the IE10 is "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)".
We don't update mark bits atomically, so we can't have two threads
marking at the same time, which means we have to stop the concurrent
collector worker thread while we do work in the main GC thread. That
includes nursery collections, because they also touch mark bits.
Also problematic are mod-union updates. The worker threads can add
global remsets, which they do in the main cardtable. This will conflict
with updating the mod-union table, so having the workers stopped also
applies there.
Before we do all the major heap work in the finish mark pause of a
concurrent collection, we perform a nursery collection, for simplicity's
sake.
The nursery collection left pinned objects in the nursery, without
following their references into the major heap, so the major heap work
had to scan those objects again. There was no special provisioning
for this—major mark would do the pinning again, and we would
automatically end up scanning the objects again.
The way we determine the stack end for the GC thread, however,
had the effect of making pinning non-deterministic. We would
conservatively scan part of the GC thread's stack, which was
subject to change, to pinning again might result in less or more
objects pinned.
The proper solution would be to determine the stack end correctly,
but for now we will just the whole nursery.
As mentioned in commit 789517f8, I'm trying to compare inter-API level
differences in Mono.Android.dll, and want to reduce as much
"meaningless noise" as possible -- changes which don't meaningfully
break API or ABI.
Among those "meaningless" changes are the addition of property setters
to properties. Adding a setter doesn't break API or ABI.
Add a `mono-api-html --ignore-changes-property-setters` option.
--ignore-changes-property-setters:
Ignore the addition of property setters.
If a source property contains a getter and the target property
contains both a getter and a setter, do not flag this as a
change.
As mentioned in commit 789517f8, the intentino of
`mono-api-html --ignore-changes-virtual` is so that when a method is
changed from non-virtual to virtual or override, or from virtual to
override, a "Removed member" message isn't triggered.
However, the previous implementation was too lenient. While *adding*
virtual to the method is fine, *removing* is NOT fine, as that would
be an API breaking change (e.g. all classes which attempt to override
a previously virtual method could no longer do so).
Make the virtual check stricter so that virtual/override to
non-virtual changes are not ignored.
I've been trying to review API diffs in Xamarin.Android between API
levels, but the diffs are "noisy" because Google will change parameter
names at-will, or will change a non-virtual method into a virtual
method, or a virtual method into an override, all of which are
acceptable changes but individually generate a Removed line in
mono-api-html output, and manually removing the *hundreds* of changes
is error-prone.
Add two new option flags to mono-api-html:
--ignore-changes-parameter-names:
Ignore changes in constructor and method parameter names.
If parameter names change between <reference.xml> and
<assembly.xml>, don't report a change for the constructor or
method.
--ignore-changes-virtual:
Ignore changes in "virtual-ness".
If a method or property changes from non-virtual to virtual,
non-virtual to override, or virtual to override, don't report a
change for the member.
We change the function to use the lock/validate pattern. This is both
more scalable and enables us to use the image lock, since the amount of
work done with it held is now trivial.
The function mono_method_inflated_lookup no longer needs the loader lock to be held
as the hashtable is now protected by the imageset lock.
This means that mono_class_inflate_generic_method_full_checked doesn't need to take the
loader lock.
The function mono_method_set_generic_container uses mono_image_property_insert which takes
the image lock and not the loader lock. Adjust the locking comment.
This is used for counters that are defined after runtime initialization. It implies that TYPE_SAMPLE_COUNTERS_DESC can now be emitted at any time, and not only once.
The same counter instance would be returned if we use the "instance" parameter instead of the "counter"
parameter. Also it is the name of the counter that is stored in mono_perfcounter_create (mono-perfcounters.c:1488).
Fix the following bug : shared_data_find_room return twice the same memory region because it was not marked as "in use" by setting the header.ftype value.
This bug is triggered when we want to create a new shared area (for example a new FTYPE_INSTANCE area) while creating another area (for example a new FTYPE_CATEGORY).
The structure of the encoded SharedCounter is as follow :
- compressed data type : 1 byte
- index in the category : 1 byte
- name of the counter : null terminated string
- help of the counter : null terminated string
DataGridView keeps track of the first visible row in first_row_index.
DataGridViewRowCollection will notify DataGridView its about to delete 1 or
more rows via OnRowsPreRemovedInternal(). When this happens, we need to
ensure first_row_index will still fall within the number of rows that
will remain after the row removal.
This fixes https://bugzilla.xamarin.com/show_bug.cgi?id=24372 which I
reported.
This is a jumbo commit that addresses multiple issues with statistical backtrace collection:
1) It's not possible to reliably collect MonoMethod* so we check that they exist before
serializing to the .mlpd file and retrieve in sync context.
2) It was reporting the generic instance MonoMethod* under gsharing. Those methods are
not reported to the profiler since they are never compiled. They would turn out as unknowns.
3) Collecting IL offsets from async context is currently impossible to be done safely, so it's
now disabled. The way we'll do it in the future is by serializing the sequence point table when
JIT'ing.
4) The way we used to collect frames in statistical ignored all frames until the first LMF, which
discards a lot of them under statistical mode. We now properly pass sigcontext and have it been consumed.
In the future we should simply use the callchain mode.
When issuing a Clear() to remove all rows, a ReIndex() was being called for
each row that was being removed. This is extremely inefficient, instead
do a single ReIndex() after all rows have been removed.
Before doing a Clear() of 30k rows was taking 5.8 seconds. With this patch
it now takes 670ms.
This is useful in the case of the benchmarking suite because we are only interested in the counters, and they represent a minimal part of the output file size.
+ Fix NRE when source_file or source_file.Usings is null. This will now return back an empty string or empty List
+ **Note** that we are returning the ToString() value of NamespaceExpression which is the full resolved namespace of "System.Drawing" instead of "Drawing".
+ Add ToString override for NamespaceExpression to return the full resolved name of the namespace.
Before this change, those Last*Time properties returned only based on
seconds (truncated), which could cause inaccurate time comparison.
Consider code like this:
var fileUpdated = DateTime.Now;
...
File.WriteAllText (path, "foobar");
...
if (fileUpdated > new UnixFileInfo (path).LastWriteTime)
OnUpdatedFile (path);
This could always result in raising update event, even if there was
no update after writing.
Last*Time With milliseconds makes it very unlikely to happen.
The XML work in 661430fd1f and bf39f5aec0 changed the whitespace handling, so the mdoc test suite failed.
Refreshing the files makes them identical to what MS.NET produces and fixes the mdoc tests.
If we run out of memory during the nursery collection in the finishing collection pause,
there will be late-pinned objects in the nursery: pinned objects that were not pinned
from conservative roots (or cementing). We need to scan those, too, so in that case
we just walk the nursery and scan all objects.
The two collectors stepped on each other's toes. Specifically, updating the mod union
card table while the worker thread might mark cards in the card table will not work.
The simplest solution for now is to stop the worker thread during concurrent updates
and nursery collections. In the future we can have the thread help with the nursery
collection.
Cementing can happen during a concurrent collection when processing
the cardtable. We use a separate cementing hash during concurrent
collections but we didn't pin objects from there.
Reset of adjustment rules is mandatory when the base offset is changed because the rules are relative to the base offset.
Adjustment rules are now kept until the base offset changes.
- merge fix for https://bugzilla.xamarin.com/show_bug.cgi?id=21578
the MulticastOption's 'private IPAddress local' field was
removed by linker and the app crashed later at runtime.
- when System.Net.Sockets.MulticastOption object
is passed to System.Net.Sockets.Socket.SetSocketOption
and thru it to System.Net.Sockets.Socket.SetSocketOption_internal
it accesses passed object fields
(thru few more native calls).
The current signal profiling code depended on invalid linux behavior of setitimer
allowing multiple threads to register for the same timer. Linux kernel 2.6.12 fixed
this and only the main thread gets the signal. Always.
The correct POSIX behavior happens on OSX/iOS.
On Linux we could use timer_create and SIGEV_THREAD_ID but that would not work on iOS/OSX
since it's specific to it. Given that little detail, I'll leave implementing it as an
exercise to the reader.
The solution, which aims to be as portable as possible, is to use a pair of signals and
have the first one fire the second one against all other threads.
We use a pair of signals since it's not well defined which thread will receive the signal
so detecting this from the signal is non-trivial.
Parameter names are part of the ABI because of C#4 named parameter.
Consequently, they *must* be consistent with .NET, and .NET a
parameter name of "errorInfo", *not* "errorInfoPtr" [0]:
public static Exception GetExceptionForHR(
int errorCode,
IntPtr errorInfo
)
Change the parameter name from `errorCodeInfo` to `errorCode` so that
the parameter name is consistent with .NET.
[0]: http://msdn.microsoft.com/en-us/library/3xade62s(v=vs.100).aspx
Extend functionality of SgenPointerQueue.
The purpose of this commit is to avoid dependency between GC code and the obtaining of the hash from the object's synchronisation field, which might require additional processing.
for reading the input stream.
According to the MSDN docs, if ReadEntityBodyMode returns "Classic" the code should use
the old method to read the input stream (HttpRequestBase.InputStream) which is fully
implemented in mono.
Manually applied patch from martinjt
Add Makefile rules to automagically download the TimeZone database
from the Android target $(ADB_TARGET), and build the tzi.exe app.
$ make android-dump-tzdata ADB_TARGET=-d
# downloads timezone data into ./android/tzdb.
# dumps timezone data into ./android/tzdata
# builds ./tzi.exe
# Show adjustment rules for a given timezone dump
$ mono tzi.exe -i=tzdata/Asia/Amman
Add `tzi.exe -R` option to show the TimeZoneInfo.GetAdjustmentRules()
output for all encountered timezones.
Add `tzi.exe -o=PATH` option to dump the TimeZone data to disk for
interrogation.
Add `tzi.exe -i=PATH` option to read in the specified TimeZone data
file and dump the rules contained therein.
Update usage comments.
Makefile defines GC_WIN32_THREADS as 1 but gc_config_macros was
redefining as defined but with no value.
Signed-off-by: Alex J Lennon <[email protected]>
FileSystemWatcher.cs: Fixed multicast events.
SearchPattern.cs : Fixed issue where case insensitivity was not being honored.
KeventWatcher.cs:
* Fixed several race conditions
* Fixed file descriptor duplication & leaks
* thread-safe/cleaner state transitions for watcher, and much cleaner stopping
* Now uses fsw.Filter parameter and respects IncludeSubdirectories = false. Use fsw.Filter to watch very large trees
* Added more error handling + OnError event
* Lots of behavior/reliability fixes and optimizations for Monitor() loop
* Fixed kevent/timespec struct definitions (for 64-bit build)
Reworked a lot of the internals of the kqueue FileSystemWatcher. There
is now a separate thread and a separate kqueue for each FileSystemWatcher
object.
https://bugzilla.xamarin.com/show_bug.cgi?id=16259
Adds a configuration file to facilitate build of Mono with Cygwin
on Appveyor Windows-based build workers.
Dependencies are installed on a clean Appveyor build image for
each build and the result of the 'make install' step is stored
as a build output 'artifact' for further testing or deployment.
Signed-off-by: Alex J Lennon <[email protected]>
Error generated by socket-io.c was:
/usr/i686-pc-mingw32/sys-root/mingw/include/ws2tcpip.h:38:2:
error: #error "ws2tcpip.h is not compatible with winsock.h.
Include winsock2.h instead."
Signed-off-by: Alex J Lennon <[email protected]>
- Ref: https://bugzilla.xamarin.com/show_bug.cgi?id=20048
- Mono currently doesn't support 2-args Socket ctor added in .NET 4.5
- Absence of this ctor prevents KestrelHttpServer (web server for
ASP.NET vNext: https://github.com/aspnet/KestrelHttpServer ) test
code from working
- I hesitated to put IPv4 only implementation, but full dual stack
(IPv4/v6) support would need bunch of works to be done. So, I pinned
supported protocol of new ctor to IPv4. Also, I filed v4/v6 support
issue as a MonoTODO entry inside the source code.
- Don't subtract room for ellipsis. Ellipsis should be
handled by the renderer so we shouldn't reserve space for it.
Otherwise we end up not getting ellipsis (because the renderer
thinks there is enough space available), or we don't use up the
available space.
- Don't allow text to go below button if we want to show ellipsis.
When a button is pressed the image and the text needs to be rendered one
pixel to the right and to the bottom so that there is some visual
feedback of the button press. Previously this was only the case if
TextImageRelation was set to Overlay.
On Mono/.NET, TimeZoneInfo.Local has a TimeZoneInfo.Id value of
"Local" and a TimeZoneInfo.DisplayName value of "Local":
$ csharp
csharp> TimeZoneInfo.Local.Id;
"Local"
csharp> TimeZoneInfo.Local.DisplayName;
"Local"
That isn't the case on Xamarin.Android, which returns the timezoneinfo
ID value from both DisplayName and Id, e.g. TimeZoneInfo.Local could
have Id and DisplayName values of "Australia/Sydney".
Rework things so that the TimeZoneInfo.Id and TimeZoneInfo.DisplayName
properties return "Local" on Xamarin.Android for the instance returned
from TimeZoneInfo.Local, just like normal Mono/.NET does.
NUnit breaks when these URI's are treated as UNC paths, so I have no way of
running the tests on Windows without this change to see if it broke anything.
Not all URI tests pass, but the ones that fail seem unrelated to my change.
On Unix, the tests all work, but of course on Unix this is a no-op.
This commit licensed as MIT/X11.
The issue was with the new heuristic of the thread pool which would not create new threads, leading to deadlock between dependent tasks.
The fix is to check if every worker threads are sleeping, waiting or joining, and if that's the case, then we create a new thread because we might be in the case where the tasks being currently run depends on one still being enqueued in the cq or one of the wsq.
The following tests would previously fail :
1) MonoTests.System.Threading.Tasks.TaskTests.DoubleWaitTest : #1
Expected: True
But was: False
at MonoTests.System.Threading.Tasks.TaskTests.<DoubleWaitTest>m__27 () [0x00077] in /Users/ludovic/Xamarin/mono/mcs/class/corlib/Test/System.Threading.Tasks/TaskTest.cs:800
at MonoTests.System.Threading.Tasks.ParallelTestHelper.Repeat (System.Action action, Int32 numRun) [0x00007] in /Users/ludovic/Xamarin/mono/mcs/class/corlib/Test/System.Threading.Tasks/ParallelTestHelper.cs:48
at MonoTests.System.Threading.Tasks.TaskTests.DoubleWaitTest () [0x00000] in /Users/ludovic/Xamarin/mono/mcs/class/corlib/Test/System.Threading.Tasks/TaskTest.cs:790
at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00054] in /Users/ludovic/Xamarin/mono/mcs/class/corlib/System.Reflection/MonoMethod.cs:230
2) MonoTests.System.Threading.Tasks.TaskTests.HideSchedulerTest : #1
Expected: True
But was: False
at MonoTests.System.Threading.Tasks.TaskTests.HideSchedulerTest () [0x0003d] in /Users/ludovic/Xamarin/mono/mcs/class/corlib/Test/System.Threading.Tasks/TaskTest.cs:1914
at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00054] in /Users/ludovic/Xamarin/mono/mcs/class/corlib/System.Reflection/MonoMethod.cs:230
3) MonoTests.System.Threading.Tasks.TaskTests.WaitAll_TimeoutWithExceptionsAfter : #1
Expected: True
But was: False
at MonoTests.System.Threading.Tasks.TaskTests.WaitAll_TimeoutWithExceptionsAfter () [0x00070] in /Users/ludovic/Xamarin/mono/mcs/class/corlib/Test/System.Threading.Tasks/TaskTest.cs:317
at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00054] in /Users/ludovic/Xamarin/mono/mcs/class/corlib/System.Reflection/MonoMethod.cs:230
4) MonoTests.System.Threading.Tasks.TaskTests.WaitAll_TimeoutWithExceptionsBefore : #1
Expected: True
But was: False
at MonoTests.System.Threading.Tasks.TaskTests.WaitAll_TimeoutWithExceptionsBefore () [0x00070] in /Users/ludovic/Xamarin/mono/mcs/class/corlib/Test/System.Threading.Tasks/TaskTest.cs:341
at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00054] in /Users/ludovic/Xamarin/mono/mcs/class/corlib/System.Reflection/MonoMethod.cs:230
5) MonoTests.System.Threading.Tasks.TaskTests.WaitAnyTest : #3
Expected: not -1
But was: -1
at MonoTests.System.Threading.Tasks.TaskTests.<WaitAnyTest>m__0 () [0x00026] in /Users/ludovic/Xamarin/mono/mcs/class/corlib/Test/System.Threading.Tasks/TaskTest.cs:142
at MonoTests.System.Threading.Tasks.ParallelTestHelper.Repeat (System.Action action, Int32 numRun) [0x00007] in /Users/ludovic/Xamarin/mono/mcs/class/corlib/Test/System.Threading.Tasks/ParallelTestHelper.cs:48
at MonoTests.System.Threading.Tasks.ParallelTestHelper.Repeat (System.Action action) [0x00000] in /Users/ludovic/Xamarin/mono/mcs/class/corlib/Test/System.Threading.Tasks/ParallelTestHelper.cs:42
at MonoTests.System.Threading.Tasks.TaskTests.WaitAnyTest () [0x00000] in /Users/ludovic/Xamarin/mono/mcs/class/corlib/Test/System.Threading.Tasks/TaskTest.cs:128
at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00054] in /Users/ludovic/Xamarin/mono/mcs/class/corlib/System.Reflection/MonoMethod.cs:230
6) MonoTests.System.Threading.Tasks.TaskTests.WaitChildTestCase : #0b
Expected: True
But was: False
at MonoTests.System.Threading.Tasks.TaskTests.<WaitChildTestCase>m__25 () [0x0006d] in /Users/ludovic/Xamarin/mono/mcs/class/corlib/Test/System.Threading.Tasks/TaskTest.cs:705
at MonoTests.System.Threading.Tasks.ParallelTestHelper.Repeat (System.Action action, Int32 numRun) [0x00007] in /Users/ludovic/Xamarin/mono/mcs/class/corlib/Test/System.Threading.Tasks/ParallelTestHelper.cs:48
at MonoTests.System.Threading.Tasks.TaskTests.WaitChildTestCase () [0x00000] in /Users/ludovic/Xamarin/mono/mcs/class/corlib/Test/System.Threading.Tasks/TaskTest.cs:684
at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00054] in /Users/ludovic/Xamarin/mono/mcs/class/corlib/System.Reflection/MonoMethod.cs:230
7) MonoTests.System.Threading.Tasks.TaskTests.WaitingForChildrenToComplete : #3
Expected: True
But was: False
at MonoTests.System.Threading.Tasks.TaskTests.WaitingForChildrenToComplete () [0x00048] in /Users/ludovic/Xamarin/mono/mcs/class/corlib/Test/System.Threading.Tasks/TaskTest.cs:734
at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00054] in /Users/ludovic/Xamarin/mono/mcs/class/corlib/System.Reflection/MonoMethod.cs:230
The internal allocator used size segregated blocks which were always
16k large. Since we have quite a few different size classes this led
to a lot of allocation even for very small programs.
We now use block sizes that are determined by the slot size and are as
small as possible. They're power-of-two multiples of the page size,
so we end up with blocks of 4k, 8k and 16k.
The formula for calculating allowance was not only overly complicated
but completely broken, which resulted in the allowance always being the
minimum (4 times the nursery size). That resulted in too frequent garbage
collections when the heap grew larger.
Now we do something very similar to what Boehm does: Allow the heap
to grow by a third before the next major collection happens.
This is especially relevant if we have to shrink the width because of
padding. In this case it is possible that MeasureString calculated that
the string would fit in one line, but because of padding we reduce the
width. If the button is large enough we want to display additional lines
even if MeasureString told us we only need one line.
pid_t (used at line 216) is available on Linux in `unistd.h` and so on on FreeBSD (`sys/types.h` to be precise, included in `unistd.h`), yet on FreeBSD this header is not automatically included.
Unless running in on-demand AOT mode, the AOT runtime will look for an AOT cache alongside the assembly (e.g. /usr/lib/mono/4.5/mscorlib.dll.so).
This patch adds a second search path to the non-on-demand AOT loader, /usr/lib/mono/aot-cache/ARCHITECTURE/path/to/assembly.dll.so
This new structure makes it possible to have more than one Mono architecture on a system, sharing assemblies but not sharing AOT caches (for example, i386 and amd64 Mono on the same system, for different needs)
Because the monitor thread was not marked as background thread, remove_and_abort_threads (threads.c:2807) would mark it as needed to be waited to shutdown the runtime, and wait_for_tids (threads.c:2652) would then wait indefinitely for it to finish. The issue was that the monitor was waiting on the semaphore monitor_sem, and thus would never exit.
Thread 7 (Thread 0x1c13 of process 99776):
#0 0x00007fff86590a56 in ?? () from /usr/lib/system/libsystem_kernel.dylib
#1 0x00000001003cc03a in mono_sem_wait (sem=0x1004f7f50, alertable=0) at mono-semaphore.c:103
#2 0x00000001002cef41 in monitor_thread (unused=0x0) at threadpool.c:898
#3 0x00000001002cb78f in start_wrapper_internal (data=0x10500abf0) at threads.c:657
#4 0x00000001002cb4a1 in start_wrapper (data=0x10500abf0) at threads.c:704
#5 0x00000001003d61d4 in inner_start_thread (arg=0x7fff5fbfe500) at mono-threads-posix.c:84
#6 0x00007fff8e7c9899 in _pthread_body () from /usr/lib/system/libsystem_pthread.dylib
#7 0x00007fff8e7c972a in _pthread_start () from /usr/lib/system/libsystem_pthread.dylib
#8 0x00007fff8e7cdfc9 in thread_start () from /usr/lib/system/libsystem_pthread.dylib
#9 0x0000000000000000 in ?? ()
Thread 1 (Thread 0x1503 of process 99776):
#0 0x00007fff86594716 in ?? () from /usr/lib/system/libsystem_kernel.dylib
#1 0x00007fff8e7cbc3b in _pthread_cond_wait () from /usr/lib/system/libsystem_pthread.dylib
#2 0x000000010039cfaa in _wapi_handle_timedwait_signal_handle (handle=0xa55, timeout=0x0, alertable=1, poll=0) at handles.c:1595
#3 0x000000010039d03d in _wapi_handle_wait_signal_handle (handle=0xa55, alertable=1) at handles.c:1540
#4 0x00000001003b7ba3 in WaitForSingleObjectEx (handle=0xa55, timeout=4294967295, alertable=1) at wait.c:194
#5 0x00000001003b865d in WaitForMultipleObjectsEx (numobjects=1, handles=0x7fff5fbff1f8, waitall=1, timeout=4294967295, alertable=1) at wait.c:516
#6 0x00000001002c75df in wait_for_tids (wait=0x7fff5fbff1f8, timeout=4294967295) at threads.c:2658
#7 0x00000001002c70e5 in mono_thread_manage () at threads.c:2951
#8 0x00000001000d551b in mono_main (argc=6, argv=0x7fff5fbff9e8) at driver.c:2021
#9 0x0000000100001bd1 in mono_main_with_options (argc=6, argv=0x7fff5fbff9e8) at ./main.c:91
#10 0x00000001000017d3 in main (argc=6, argv=0x7fff5fbff9e8) at ./main.c:122
Thanks @akoeplinger for the help debugging
Because the monitor thread was not marked as background thread, remove_and_abort_threads (threads.c:2807) would mark it as needed to be waited to shutdown the runtime, and wait_for_tids (threads.c:2652) would then wait indefinitely for it to finish. The issue was that the monitor was waiting on the semaphore monitor_sem, and thus would never exit.
Thread 7 (Thread 0x1c13 of process 99776):
#0 0x00007fff86590a56 in ?? () from /usr/lib/system/libsystem_kernel.dylib
#1 0x00000001003cc03a in mono_sem_wait (sem=0x1004f7f50, alertable=0) at mono-semaphore.c:103
#2 0x00000001002cef41 in monitor_thread (unused=0x0) at threadpool.c:898
#3 0x00000001002cb78f in start_wrapper_internal (data=0x10500abf0) at threads.c:657
#4 0x00000001002cb4a1 in start_wrapper (data=0x10500abf0) at threads.c:704
#5 0x00000001003d61d4 in inner_start_thread (arg=0x7fff5fbfe500) at mono-threads-posix.c:84
#6 0x00007fff8e7c9899 in _pthread_body () from /usr/lib/system/libsystem_pthread.dylib
#7 0x00007fff8e7c972a in _pthread_start () from /usr/lib/system/libsystem_pthread.dylib
#8 0x00007fff8e7cdfc9 in thread_start () from /usr/lib/system/libsystem_pthread.dylib
#9 0x0000000000000000 in ?? ()
Thread 1 (Thread 0x1503 of process 99776):
#0 0x00007fff86594716 in ?? () from /usr/lib/system/libsystem_kernel.dylib
#1 0x00007fff8e7cbc3b in _pthread_cond_wait () from /usr/lib/system/libsystem_pthread.dylib
#2 0x000000010039cfaa in _wapi_handle_timedwait_signal_handle (handle=0xa55, timeout=0x0, alertable=1, poll=0) at handles.c:1595
#3 0x000000010039d03d in _wapi_handle_wait_signal_handle (handle=0xa55, alertable=1) at handles.c:1540
#4 0x00000001003b7ba3 in WaitForSingleObjectEx (handle=0xa55, timeout=4294967295, alertable=1) at wait.c:194
#5 0x00000001003b865d in WaitForMultipleObjectsEx (numobjects=1, handles=0x7fff5fbff1f8, waitall=1, timeout=4294967295, alertable=1) at wait.c:516
#6 0x00000001002c75df in wait_for_tids (wait=0x7fff5fbff1f8, timeout=4294967295) at threads.c:2658
#7 0x00000001002c70e5 in mono_thread_manage () at threads.c:2951
#8 0x00000001000d551b in mono_main (argc=6, argv=0x7fff5fbff9e8) at driver.c:2021
#9 0x0000000100001bd1 in mono_main_with_options (argc=6, argv=0x7fff5fbff9e8) at ./main.c:91
#10 0x00000001000017d3 in main (argc=6, argv=0x7fff5fbff9e8) at ./main.c:122
Commit 5564dad1 broke the self-test (for testing on the developer
machine, not an Android target). Fixup the comment so that appropriate
data is grabbed and used for testing, and improve
AndroidTimeZones.GetDefaultTimeZoneName() so that the default timezone
ID can be specified via the __XA_OVERRIDE_TIMEZONE_ID__ environment
variable for testing.
Finally, demonstrate TimeZoneInfo.GetUtcOffset(DateTime) use so that I
can get better insight into the timezone data stored within the
database:
$ __XA_OVERRIDE_TIMEZONE_ID__=America/New_York ANDROID_ROOT=`pwd` ANDROID_DATA=`pwd` mono --debug tzi.exe --offset=1969-01-01
Using DateTime Offset: 1/1/1969 12:00:00 AM
DB type: System.AndroidTzData
name=Africa/Abidjan Africa/Abidjan From Offset: 00:00:00
name=Africa/Accra Africa/Accra From Offset: 00:00:00
name=Africa/Addis_Ababa Africa/Addis_Ababa From Offset: 03:00:00
...
This fixes a problem with calculating the text width of a button
which caused the text to get truncated under certain circumstances
instead of being wrapped. This fixes Xamarin-23168.
Change-Id: Iac0d8a2720a99cf5433e05d5123a04c4b019e493
The test changes TZ environment variable and compares DateTime.Now with system date.
The test checks all the timezones installed in /usr/share/zoneinfo/.
The change does not have a negative impact on StringBuilder performance; under variable-string-length microbenchmarks it seems to perform ~15-20% faster than the managed implementation.
Use the new MONO_GC_DEBUG option "nursery-canaries" to suffix each nursery object with a canary (guard) word, which is checked on each minor collection. Can be used to detect/debug
heap corruption issues.
Adding canaries to LOS is also easy if wanted - not sure about major heap.
In some cases the timezone transitions provided by iOS are not convertible to AdjustmentRules because of changes on the base offset.
Now we store the transitions so they can be used instead of an incomplete list of AdjustmentRules.
Depending on alignment and packing, part of the string might be inside the MonoString struct boundaries. This e.g. shows up on 64-bit builds of mono where we were allocating 4 extra bytes per string.
We were spending a lot of time in major_iterate_live_block_ranges() on
the lcscbench benchmark, mainly from following the linked block list.
This change makes it much faster.
We trim the free list of the gray queue to a maximum number of
sections, but we did it at each collection start, so the extraneous
sections were kept around between collections.
At the point where we enqueue objects we have already fetched their
descriptors, and when we later scan them (after dequeuing) we need the
descriptor again, so we avoid cache misses by enqueuing them together.
Later on, when we enqueue objects with their GC descriptors, we won't
load the vtable before scanning (because we'll already have the
descriptor), so the scanning macros shouldn't take them as arguments.
It's not well-tested, not widely used, we can surpass its speed with
upcoming improvements and we won't put those into the fixed
configuration because it's too much of a diversion.
Before the change when the property default value was not null or empty the deserialized value would be the concatenation of the default value and the serialized value.
The correct behavior is to use the serialized value only.
Fixes 18908.
To resolve casting we make all relevant interfaces to use the generic variance casting code.
This only affected ICollection`1 and IList`1, which are not terribly popular.
To fix dispatch we augment vtable resolution to treat those interfaces as variant and use
the already in place machinery.
Memory reduction numbers for the corlib test suite:
Initialized classes 8004 -> 7470 (7% reduction)
Corlib mempool size: 2719832 -> 2678872 (1.5% reduction)
Inflated classes 4500: 3.972 (12% reduction)
Inflated signatures size: 166128 -> 139812 (16% reduction)
Inflated methods size: 565152 -> 485664 (15$ reduction)
https://bugzilla.xamarin.com/show_bug.cgi?id=18411
If a class explicitly implements an internal interface, those members will no
longer be documented, nor will the interface show up in the class' signature.
This allows for a library to hide internal implementation details that an end
user would not be able to take advantage of (ie. can't cast to internal
interface to call methods).
Includes test (check-monodocer-internal-interface) added to makefile.
This should fix c30a3e46d2 failing to link properly with ld 2.22 and GCC 4.9.1, on Linux, with non-LLVM builds.
./.libs/libmini.a(libmini_la-mini.o): In function `llvm_init_inner':
mini.c:(.text+0x1182b): undefined reference to `mono_llvm_init'
/usr/bin/ld: .libs/libmonoboehm-2.0.so.1.0.0: hidden symbol `mono_llvm_init' isn't defined
/usr/bin/ld: final link failed: Bad value
- Tds.cs: Use SecureString objects for passwords; Add method to retrieve string from SecureString
- Tds42.cs: Use SecureString for passwords
- Tds50.cs: Use SecureString for passwords
- Tds70.cs: Use SecureString for passwords
- TdsConnectionParameters.cs: Use SecureString for passwords; Initialize Password parameter as cleared string; Add indicator for when password is set
- SqlConnection.cs: Use SecureString for passwords; Add SqlConnect method that accepts an SqlCredential along with the Connection string; Perform checking of parameters to ensure user/password not specified in connection string if credentials have been specified or using credentials when domain login is specified.
- SqlCredential.cs: Add new class with support for credentials
- System.Data.dll.sources: Add SqlCredential.cs to the build list
[02131] CC libmonoruntimesgen_la-sgen-marksweep.lo
[02131] In file included from sgen-major-copy-object.h:35:0,
[02131] from sgen-marksweep.c:1128:
[02131] sgen-copy-object.h:38:1: warning: always_inline function might not be inlinable [-Wattributes]
[02131] par_copy_object_no_checks (char *destination, MonoVTable *vt, void *obj, mword objsize, SgenGrayQueue *queue)
[02131] ^
[02131] sgen-marksweep.c: In function 'par_copy_object_no_checks':
[02131] sgen-copy-object.h:38:1: error: function 'par_copy_object_no_checks' can never be copied because it saves address of local label in a static variable
[02131] make[3]: *** [libmonoruntimesgen_la-sgen-marksweep.lo] Error 1
[02131] make[3]: Leaving directory `/root/rpmbuild/BUILD/mono-3.10.1/mono/metadata'
[02131] make[2]: *** [all-recursive] Error 1
[02131] make[2]: Leaving directory `/root/rpmbuild/BUILD/mono-3.10.1/mono'
[02131] make[1]: *** [all-recursive] Error 1
[02131] make[1]: Leaving directory `/root/rpmbuild/BUILD/mono-3.10.1'
[02131] make: *** [all] Error 2
[02131] error: Bad exit status from /var/tmp/rpm-tmp.YxcUOE (%build)
Kpp.Load() will throw an unhandled exception if _filename (a folder to use as the key store) does not exist and it cannot be created.
This is an entirely valid thing to have happen - cert importing into the machine store (mozroots --import --machine --sync) as root will create a /usr/share/.mono/certs/ folder, but will not create /usr/share/.mono/keypairs - and since the root user owns /usr/share/.mono/, if the user tries to enumerate the certificates in /usr/share/.mono/certs/, they get 0 certificates returned due to the unhandled exception dropping each loaded certificate on the floor.
Closes: Xamarin bug 23015
Fixes: https://bugzilla.xamarin.com/show_bug.cgi?id=23077
Reverts commit 53ce92470.
Commit 53ce92470 disabled use of statfs(2) on Android, for unspecified
reasons. (My *suspicion* is that the Android version mono was
originally ported to didn't have statfs(2), but I can neither confirm
nor deny that guess.)
Android has supported statfs(2) since API-4 Android v1.6 (in that
statfs(2) is in the header files); what's missing is MNT_RDONLY. What
IS present is MS_RDONLY, which appears to serve the same purpose.
Re-enable use of statfs(2) and use MS_RDONLY when building against the
Android NDK.
This fixes the command to check for dos2unix and makes mkbundle usable again with mingw.
We need first to redirect the standard input, otherwise the check always fails with an InvalidOperationException and set CreateNoWindow=false to avoid spawning a new window.
The problem already starts when creating the OperationDescription; we need
to also look at the End* method here to correctly parse the reply parameters.
Then ClientRuntimeChannel.Process needs to distinguish between sync/async
and copy the out/byref parameters when needed.
SerializationCodeGenerator and XmlSerializationWriterInterpreter will no longer serialize an attribute named {V} if its object has a method named ShouldSerialize{V}() that returns false.
{V}Specified now is also checked to be true before serializating the attribute even if it is a property that is not settable.
Fixes#1852.
{V}Specified is a property or field and ShouldSerialize{V} is a method that can be set to false if we do not want to serialize an attribute with name {V}.
On *nix files are not executable by default where on Windows they
are. This causes problems if installing a NuGet package on *nix that
contains .exe files intended to be used by build tasks. On Windows the
build will invoke these without complaining whereas on *nix the build
will fail with "Native error: cannot find file specified".
On mono, the action that will be taken is to pass the path to the .exe
file to mono as a command-line argument. If this was done in a shell it
would succeed whether or not the .exe file has the executable bit set,
so it seems that this should also succeed within a program.
With thanks to @akoeplinger for help designing the test.
I release this under the MIT license.
Based on pull request feedback, this is a simpler usage, and meets our required use-case. A sample version of this parameter would be: `--dropns MyUnifiedAssembly=MyDroppedPrefix`
We take the loader and the root domain locks before doing a thread dump. This reduces the odds
of us suspending a thread that holds either of them and deadlocking, for example, while decoding
AOT JIs.
Users have been complaining about strange errors arising when using the OracleClient classes.
I have tracked it down to the OciDefineHandle and OciDefineByPos calls, and OracleParameter
handling of amanged objects by unmanaged code. Currently two of the parameters passed to the
above OCI call are short variables. They are passed as "ref" fields as Oracle uses their
address to put size and indicator data once the data is fetched. However, being defined as
short means that they are eligible for being moved during garbage collection. Thus if that
field is moved between the OciDefineByPos call and the fetch of the data then what Oracle is
pointing to may no longer be variable. I'm thinking it may be better to define these fields as
IntPtr and allocate them and retrieve their values via Marshal.ReadInt16. As for OracleParameter,
it uses a managed object "indicator" that is also used in a similar way. This reference is replaced
by a IntPtr and a get/set method to access the contents.
iOS 8 GM lists "Asia/Chita" among its time zones, but when requesting
the time zone data for that time zone, no data is returned.
With this change we ignore time zones without any data when fetching
all the timezones on the system.
In some cases fixed_from_dmy is used with the month parameter greater than the number of months of that year.
Year is now incremented until month parameter is valid.
The changes from 3408b8e5f1 cause
regressions in distros which do not use lib as folder for
arch-specific libraries, like Fedora x86_64.
Instead, reloc_libdir should be used (as in data/mono.pc.in).
This change is released under the MIT/X11 license.
We observed on multiples benchmarks that most internal allocations are for 8, 16, 296 (32bits), 328 (64bits), 504 (32bits) and 1016 (64bits) bytes of memory. To minimize waste, we added these memory sizes to the default allocator sizes.
On Microsoft's implementation of the Uri class, the contructors and TryCreate method both lower-case the host. This commit fixes the issue where the constructors lower-cased the host but the TryCreate method did not.
Currently JsonObject uses a Dictionary and JsonValue does not sort the keys
in SaveInternal(). As iterating over a Dictionary returns the values in
random order, this causes the JSON string to be non-deterministic.
Switching to SortedDictionary makes sure that the same object always will
produce the same JSON string.
The keys are sorted using StringComparer.Ordinal to produce the same order
in all locales.
Marshal.GetHRForException had a MonoTODO because it needs to set
the errorinfo object so that exceptions get properly passed to
unmanaged code. Since not all managed exceptions have a corresponding
HR value but we might need to get to the original thrown exception
we implement a ManagedErrorInfo helper class that implements the
IErrorInfo interface but also stores the exception.
In GetExceptionForHR we check if the errorinfo we get is a
ManagedErrorInfo. If it is we return the exception stored in there
(if it converts to the same error code), otherwise we construct a new
exception.
Also use additional information provided by IErrorInfo to fill in
exception details.
To make use of IErrorInfo on Linux a suitable implementation has to be
provided, e.g. by including libcom plus adding a mapping from
oleauth32.dll to the shared library that provides the implementation.
This completes mono bug 496138
(https://bugzilla.novell.com/show_bug.cgi?id=496138)
2014-03-13 18:53:57 +01:00
11532 changed files with 203182 additions and 834241 deletions
1. Make sure that you used GNU tar to unpack this package, as
Solaris tar will not unpack this correctly, and you will get strange errors.
2. Make sure that you use the GNU toolchain to build the software.
3. Optional dependencies
* libgdiplus - Required for System.Drawing. This library in turn requires glib and pkg-config
* pkg-config - Available at: http://www.freedesktop.org/Software/pkgconfig
* glib 2.4 - Available at: http://www.gtk.org/
* libzlib - This library and the development headers are required for compression
file support in the 2.0 profile.
4. Mono is required to build Mono. Use a system package or monolite (explained further below)
5. If you have a system Mono (not monolite), you will need to read this: http://mono-project.com/Parallel_Mono_Environments#Setting_up_a_Build_Environment
b. Building the Software
------------------------
If you obtained this package as an officially released tarball,
this is very simple, use configure and make:
`./configure --prefix=/usr/local ; make ; make install`
Mono supports a JIT engine on x86, SPARC, SPARCv9, S/390,
S/390x, AMD64, ARM and PowerPC systems.
If you obtained this as a snapshot, you will need an existing
Mono installation. To upgrade your installation, unpack both
mono and mcs:
tar xzf mcs-XXXX.tar.gz
tar xzf mono-XXXX.tar.gz
mv mono-XXX mono
mv mcs-XXX mcs
cd mono
./autogen.sh --prefix=/usr/local
make
The Mono build system is silent for most compilation commands.
To enable a more verbose compile (for example, to pinpoint
problems in your makefiles or your system) pass the V=1 flag to make, like this:
` make V=1`
c. Building the software from GIT
---------------------------------
If you are building the software from GIT, make sure that you
have up-to-date mcs and mono sources:
* If you are an anonymous user: `git clone git://github.com/mono/mono.git`
* If you are a Mono contributor with read/write privileges: `git clone [email protected]:mono/mono.git`
Then, go into the mono directory, and configure:
cd mono
./autogen.sh --prefix=/usr/local
make
For people with non-standard installations of the auto* utils and of
pkg-config (common on misconfigured OSX and windows boxes), you could get
an error like this:
./configure: line 19176: syntax error near unexpected token 'PKG_CHECK_MODULES(BASE_DEPENDENCIES,' ...
This means that you need to set the ACLOCAL_FLAGS environment variable
* Currently this is used with Mono's AOT engine as
Native Client does not support JIT engines yet.
Using Mono
==========
Working With Submodules
=======================
Once you have installed the software, you can run a few programs:
Mono references several external git submodules, for example
a fork of Microsoft's reference source code that has been altered
to be suitable for use with the Mono runtime.
*`mono program.exe` runtime engine
This section describes how to use it.
*`mcs program.cs` C# compiler
An initial clone should be done recursively so all submodules will also be
cloned in a single pass:
*`monodis program.exe` CIL Disassembler
$ git clone --recursive git@github.com:mono/mono
See the man pages for mono(1), mint(1), monodis(1) and mcs(2)
for further details.
Once cloned, submodules can be updated to pull down the latest changes.
This can also be done after an initial non-recursive clone:
Directory Roadmap
=================
$ git submodule update --init --recursive
*`docs/` - Technical documents about the Mono runtime.
To pull external changes into a submodule:
*`data/` - Configuration files installed as part of the Mono runtime.
$ cd <submodule>
$ git pull origin <branch>
$ cd <top-level>
$ git add <submodule>
$ git commit
*`mono/` - The core of the Mono Runtime.
By default, submodules are detached because they point to a specific commit.
Use `git checkout` to move back to a branch before making changes:
*`metadata/` - The object system and metadata reader.
$ cd <submodule>
$ git checkout <branch>
# work as normal; the submodule is a normal repo
$ git commit/push new changes to the repo (submodule)
*`mini/` - The Just in Time Compiler.
$ cd <top-level>
$ git add <submodule> # this will record the new commits to the submodule
$ git commit
*`dis/` - CIL executable Disassembler
To switch the repo of a submodule (this should not be a common or normal thing
to do at all), first edit `.gitmodules` to point to the new location, then:
*`cli/` - Common code for the JIT and the interpreter.
$ git submodule sync -- <path of the submodule>
$ git submodule update --recursive
$ git checkout <desired new hash or branch>
*`io-layer/` - The I/O layer and system abstraction for
emulating the .NET IO model.
*`cil/` - Common Intermediate Representation, XML
definition of the CIL bytecodes.
*`interp/` - Interpreter for CLI executables (obsolete).
*`arch/` - Architecture specific portions.
*`man/` - Manual pages for the various Mono commands and programs.
*`samples/` -Some simple sample programs on uses of the Mono
runtime as an embedded library.
*`scripts/` - Scripts used to invoke Mono and the corresponding program.
*`runtime/` - A directory that contains the Makefiles that link the
mono/ and mcs/ build systems.
*`../olive/`
* If the directory ../olive is present (as an
independent checkout) from the Mono module, that
directory is automatically configured to share the
same prefix than this module gets.
Contributing to Mono
====================
Before submitting changes to Mono, please review the contribution guidelines at http://mono-project.com/Contributing. Please pay particular attention to the [Important Rules](http://mono-project.com/Contributing#Important_Rules) section.
Git submodules maintenance
==========================
Read documentation at http://mono-project.com/Git_Submodule_Maintenance
Maintainer
==========
Mono is maintained by miguel@xamarin.com
Reporting bugs
==============
To submit bug reports, please use Xamarin's Bugzilla:
https://bugzilla.xamarin.com/
Please use the search facility to ensure the same bug hasn't already
been submitted and follow our guidelines on how to make a good bug
AC_ARG_ENABLE(executables, [ --disable-executables disable the build of the runtime executables], enable_executables=$enableval, enable_executables=yes)
AM_CONDITIONAL(DISABLE_EXECUTABLES, test x$enable_executables = xno)
@@ -969,6 +965,12 @@ if test x$enable_gsharing = xyes; then
AC_ARG_ENABLE(bcl-opt, [ --disable-bcl-opt BCL is compiled with no optimizations (allows accurate BCL debugging)], test_bcl_opt=$enableval, test_bcl_opt=yes)
AC_ARG_ENABLE(nunit-tests, [ --enable-nunit-tests Run the nunit tests of the class library on 'make check'])
AC_ARG_ENABLE(perf-events, [ --enable-perf-events Enable using `perf` for profiling on Linux], test_perf_events=$enableval, test_perf_events=no)
if test "x$test_perf_events" == "xyes"; then
AC_DEFINE(ENABLE_PERF_EVENTS, 1, [Enable using `perf` for profiling on Linux])
AC_SUBST(ENABLE_PERF_EVENTS)
fi
AC_MSG_CHECKING([if big-arrays are to be enabled])
AC_ARG_ENABLE(big-arrays, [ --enable-big-arrays Enable the allocation and indexing of arrays greater than Int32.MaxValue], enable_big_arrays=$enableval, enable_big_arrays=no)
@@ -2415,6 +2656,9 @@ AC_ARG_WITH(llvm, [ --with-llvm=<llvm prefix> Enable the LLVM back-end], ena
if test "x$enable_llvm" = "xyes"; then
if test "x$with_llvm" != "x"; then
LLVM_CONFIG=$with_llvm/bin/llvm-config
if test x$target_win32 = xyes; then
LLVM_CONFIG=$LLVM_CONFIG.exe
fi
if test ! -x $LLVM_CONFIG; then
AC_MSG_ERROR([LLVM executable $LLVM_CONFIG not found.])
fi
@@ -2432,6 +2676,8 @@ if test "x$enable_llvm" = "xyes"; then
;;
esac
if test "x$target_win32" = "xno"; then
# The output of --cflags seems to include optimizations flags too
LLVM_CFLAGS=`$LLVM_CONFIG --cflags | sed -e 's/-O2//g' | sed -e 's/-O0//g' | sed -e 's/-fomit-frame-pointer//g' | sed -e 's/-fPIC//g'`
# LLVM is compiled with -fno-rtti, so we need this too, since our classes inherit
@@ -2452,8 +2698,6 @@ if test "x$enable_llvm" = "xyes"; then
AC_MSG_ERROR([Compiling with stock LLVM is not supported, please use the Mono LLVM repo at https://github.com/mono/llvm, with the GIT branch which matches this version of mono, i.e. 'mono-2-10' for Mono 2.10.])
fi
AC_DEFINE_UNQUOTED(LLVM_MAJOR_VERSION, $major_version, [Major version of LLVM libraries])
AC_DEFINE_UNQUOTED(LLVM_MINOR_VERSION, $minor_version, [Minor version of LLVM libraries])
AC_DEFINE_UNQUOTED(LLVM_VERSION, "$llvm_version", [Full version of LLVM libraties])
Loaded 100 of 11532 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.