mirror of
https://github.com/BepInEx/mono.git
synced 2026-11-16 17:10:20 -10:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3b5c655c05 | ||
|
|
3b6f5c3308 | ||
|
|
579a0ca72b | ||
|
|
577dfd5d78 | ||
|
|
57dae7a311 | ||
|
|
a21c08a924 | ||
|
|
e763cd5010 | ||
|
|
964d3433d8 | ||
|
|
89f92560a1 | ||
|
|
b1752875e8 | ||
|
|
2a308efd0a | ||
|
|
bff2b8d6c4 | ||
|
|
9f2d34d689 | ||
|
|
37edaa18f7 | ||
|
|
77d12442c4 | ||
|
|
3ad4bb8e3d | ||
|
|
67c7faf279 | ||
|
|
7757931e8e | ||
|
|
5a55034e93 | ||
|
|
bab18ab6d2 | ||
|
|
4c601b8522 | ||
|
|
36e827b0be | ||
|
|
e137468dc6 | ||
|
|
aa92238b98 | ||
|
|
093a537205 | ||
|
|
fe1653eae0 | ||
|
|
58f029f2d1 | ||
|
|
f16036819a | ||
|
|
784d21f5fd | ||
|
|
c101a18be3 | ||
|
|
f038e86294 | ||
|
|
ef47ac3d22 | ||
|
|
95617646ba | ||
|
|
652ff412d2 | ||
|
|
8ca77a27fa | ||
|
|
3b8eeb54d3 | ||
|
|
6e23108f39 |
No files matched your search
@@ -76,6 +76,7 @@
|
||||
<!--
|
||||
<add path="*.svc" verb="*" type="System.ServiceModel.Activation.HttpHandler, System.ServiceModel.Activation, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="False"/>
|
||||
-->
|
||||
<add verb="*" path="*.svc" type="System.ServiceModel.Channels.SvcHttpHandlerFactory, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<add path="*.rules" verb="*" type="System.Web.HttpForbiddenHandler" validate="True"/>
|
||||
<!--
|
||||
<add path="*.xoml" verb="*" type="System.ServiceModel.Activation.HttpHandler, System.ServiceModel.Activation, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="False"/>
|
||||
|
||||
@@ -50,7 +50,11 @@ namespace System.Windows.Forms.CarbonInternal {
|
||||
private static DragTrackingDelegate DragTrackingHandler = new DragTrackingDelegate (TrackingCallback);
|
||||
|
||||
static Dnd () {
|
||||
InstallTrackingHandler (DragTrackingHandler, IntPtr.Zero, IntPtr.Zero);
|
||||
try {
|
||||
InstallTrackingHandler (DragTrackingHandler, IntPtr.Zero, IntPtr.Zero);
|
||||
} catch (EntryPointNotFoundException) {
|
||||
// it is deprecated in 10.6 and does not exist anymore.
|
||||
}
|
||||
}
|
||||
|
||||
internal Dnd () {
|
||||
|
||||
@@ -158,20 +158,6 @@ namespace Microsoft.CSharp.RuntimeBinder
|
||||
IgnorePrivateMembers = false
|
||||
};
|
||||
|
||||
var core_types = Compiler.TypeManager.InitCoreTypes ();
|
||||
importer.Initialize ();
|
||||
|
||||
// I don't think dynamically loaded assemblies can be used as dynamic
|
||||
// expression without static type to be loaded first
|
||||
// AppDomain.CurrentDomain.AssemblyLoad += (sender, e) => { throw new NotImplementedException (); };
|
||||
|
||||
// Import all currently loaded assemblies
|
||||
var ns = Compiler.GlobalRootNamespace.Instance;
|
||||
foreach (System.Reflection.Assembly a in AppDomain.CurrentDomain.GetAssemblies ()) {
|
||||
ns.AddAssemblyReference (a);
|
||||
importer.ImportAssembly (a, ns);
|
||||
}
|
||||
|
||||
var reporter = new Compiler.Report (ErrorPrinter.Instance) {
|
||||
WarningLevel = 0
|
||||
};
|
||||
@@ -180,8 +166,29 @@ namespace Microsoft.CSharp.RuntimeBinder
|
||||
IsRuntimeBinder = true
|
||||
};
|
||||
|
||||
Compiler.TypeManager.InitCoreTypes (cc, core_types);
|
||||
Compiler.TypeManager.InitOptionalCoreTypes (cc);
|
||||
IList<Compiler.PredefinedTypeSpec> core_types = null;
|
||||
// HACK: To avoid re-initializing static TypeManager types, like string_type
|
||||
if (!Compiler.RootContext.EvalMode) {
|
||||
core_types = Compiler.TypeManager.InitCoreTypes ();
|
||||
}
|
||||
|
||||
importer.Initialize ();
|
||||
|
||||
// I don't think dynamically loaded assemblies can be used as dynamic
|
||||
// expression without static type to be loaded first
|
||||
// AppDomain.CurrentDomain.AssemblyLoad += (sender, e) => { throw new NotImplementedException (); };
|
||||
|
||||
// Import all currently loaded assemblies
|
||||
var ns = cc.GlobalRootNamespace;
|
||||
foreach (System.Reflection.Assembly a in AppDomain.CurrentDomain.GetAssemblies ()) {
|
||||
ns.AddAssemblyReference (a);
|
||||
importer.ImportAssembly (a, ns);
|
||||
}
|
||||
|
||||
if (!Compiler.RootContext.EvalMode) {
|
||||
Compiler.TypeManager.InitCoreTypes (cc, core_types);
|
||||
Compiler.TypeManager.InitOptionalCoreTypes (cc);
|
||||
}
|
||||
|
||||
dc = new DynamicContext (cc);
|
||||
}
|
||||
|
||||
@@ -1165,10 +1165,18 @@ namespace Mono.Unix.Native {
|
||||
EPOLL_CTL_MOD = 3,
|
||||
}
|
||||
|
||||
[StructLayout (LayoutKind.Sequential, Pack = 1)]
|
||||
[StructLayout (LayoutKind.Explicit, Size=12, Pack=1)]
|
||||
public struct EpollEvent {
|
||||
[FieldOffset (0)]
|
||||
public EpollEvents events;
|
||||
public IntPtr fd;
|
||||
[FieldOffset (4)]
|
||||
public int fd;
|
||||
[FieldOffset (4)]
|
||||
public IntPtr ptr;
|
||||
[FieldOffset (4)]
|
||||
public uint u32;
|
||||
[FieldOffset (4)]
|
||||
public ulong u64;
|
||||
}
|
||||
#endregion
|
||||
|
||||
@@ -2669,7 +2677,7 @@ namespace Mono.Unix.Native {
|
||||
return sys_epoll_create1 (flags);
|
||||
}
|
||||
|
||||
public static int epoll_ctl (int epfd, EpollOp op, IntPtr fd, EpollEvents events)
|
||||
public static int epoll_ctl (int epfd, EpollOp op, int fd, EpollEvents events)
|
||||
{
|
||||
EpollEvent ee = new EpollEvent ();
|
||||
ee.events = events;
|
||||
@@ -2693,7 +2701,7 @@ namespace Mono.Unix.Native {
|
||||
private static extern int sys_epoll_create1 (EpollFlags flags);
|
||||
|
||||
[DllImport (LIBC, SetLastError=true, EntryPoint="epoll_ctl")]
|
||||
private static extern int sys_epoll_ctl (int epfd, EpollOp op, IntPtr fd, ref EpollEvent ee);
|
||||
private static extern int sys_epoll_ctl (int epfd, EpollOp op, int fd, ref EpollEvent ee);
|
||||
|
||||
[DllImport (LIBC, SetLastError=true, EntryPoint="epoll_wait")]
|
||||
private static extern int sys_epoll_wait (int epfd, EpollEvent [] ee, int maxevents, int timeout);
|
||||
|
||||
@@ -112,6 +112,7 @@ namespace System.Threading {
|
||||
|
||||
Stopwatch sw = Stopwatch.StartNew ();
|
||||
Interlocked.Increment (ref numReadWaiters);
|
||||
int val = 0;
|
||||
|
||||
while (millisecondsTimeout == -1 || sw.ElapsedMilliseconds < millisecondsTimeout) {
|
||||
if ((rwlock & 0x7) > 0) {
|
||||
@@ -119,12 +120,20 @@ namespace System.Threading {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((Interlocked.Add (ref rwlock, RwRead) & 0x7) == 0) {
|
||||
/* Optimistically try to add ourselves to the reader value
|
||||
* if the adding was too late and another writer came in between
|
||||
* we revert the operation.
|
||||
*/
|
||||
if (((val = Interlocked.Add (ref rwlock, RwRead)) & 0x7) == 0) {
|
||||
/* If we are the first reader, reset the event to let other threads
|
||||
* sleep correctly if they try to acquire write lock
|
||||
*/
|
||||
if (val >> RwReadBit == 1)
|
||||
readerDoneEvent.Reset ();
|
||||
|
||||
ctstate.LockState ^= LockState.Read;
|
||||
ctstate.ReaderRecursiveCount++;
|
||||
Interlocked.Decrement (ref numReadWaiters);
|
||||
if (readerDoneEvent.IsSet ())
|
||||
readerDoneEvent.Reset ();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -173,33 +182,43 @@ namespace System.Threading {
|
||||
Interlocked.Increment (ref numWriteWaiters);
|
||||
bool isUpgradable = ctstate.LockState.Has (LockState.Upgradable);
|
||||
|
||||
// If the code goes there that means we had a read lock beforehand
|
||||
/* If the code goes there that means we had a read lock beforehand
|
||||
* that need to be suppressed, we also take the opportunity to register
|
||||
* our interest in the write lock to avoid other write wannabe process
|
||||
* coming in the middle
|
||||
*/
|
||||
if (isUpgradable && rwlock >= RwRead)
|
||||
Interlocked.Add (ref rwlock, -RwRead);
|
||||
if (Interlocked.Add (ref rwlock, RwWaitUpgrade - RwRead) >> RwReadBit == 0)
|
||||
readerDoneEvent.Set ();
|
||||
|
||||
int stateCheck = isUpgradable ? RwWaitUpgrade : RwWait;
|
||||
int appendValue = RwWait | (isUpgradable ? RwWaitUpgrade : 0);
|
||||
|
||||
while (millisecondsTimeout < 0 || sw.ElapsedMilliseconds < millisecondsTimeout) {
|
||||
int state = rwlock;
|
||||
|
||||
if (state <= stateCheck) {
|
||||
if (Interlocked.CompareExchange (ref rwlock, RwWrite, state) == state) {
|
||||
writerDoneEvent.Reset ();
|
||||
ctstate.LockState ^= LockState.Write;
|
||||
ctstate.WriterRecursiveCount++;
|
||||
Interlocked.Decrement (ref numWriteWaiters);
|
||||
if (writerDoneEvent.IsSet ())
|
||||
writerDoneEvent.Reset ();
|
||||
return true;
|
||||
}
|
||||
state = rwlock;
|
||||
}
|
||||
|
||||
while ((state & RwWait) == 0 && Interlocked.CompareExchange (ref rwlock, state | appendValue, state) == state)
|
||||
state = rwlock;
|
||||
// We register our interest in taking the Write lock (if upgradeable it's already done)
|
||||
if (!isUpgradable)
|
||||
while ((state & RwWait) == 0 && Interlocked.CompareExchange (ref rwlock, state | RwWait, state) == state)
|
||||
state = rwlock;
|
||||
|
||||
while (rwlock > stateCheck && (millisecondsTimeout < 0 || sw.ElapsedMilliseconds < millisecondsTimeout))
|
||||
readerDoneEvent.Wait (ComputeTimeout (millisecondsTimeout, sw));
|
||||
// Before falling to sleep
|
||||
while (rwlock > stateCheck && (millisecondsTimeout < 0 || sw.ElapsedMilliseconds < millisecondsTimeout)) {
|
||||
if ((rwlock & RwWrite) != 0)
|
||||
writerDoneEvent.Wait (ComputeTimeout (millisecondsTimeout, sw));
|
||||
else if ((rwlock >> RwReadBit) > 0)
|
||||
readerDoneEvent.Wait (ComputeTimeout (millisecondsTimeout, sw));
|
||||
}
|
||||
}
|
||||
|
||||
Interlocked.Decrement (ref numWriteWaiters);
|
||||
@@ -218,10 +237,14 @@ namespace System.Threading {
|
||||
if (!ctstate.LockState.Has (LockState.Write))
|
||||
throw new SynchronizationLockException ("The current thread has not entered the lock in write mode");
|
||||
|
||||
bool isUpgradable = ctstate.LockState.Has (LockState.Upgradable);
|
||||
ctstate.LockState ^= LockState.Write;
|
||||
ctstate.WriterRecursiveCount--;
|
||||
Interlocked.Add (ref rwlock, -RwWrite);
|
||||
|
||||
int value = Interlocked.Add (ref rwlock, isUpgradable ? RwRead - RwWrite : -RwWrite);
|
||||
writerDoneEvent.Set ();
|
||||
if (isUpgradable && value >> RwReadBit == 1)
|
||||
readerDoneEvent.Reset ();
|
||||
}
|
||||
|
||||
public void EnterUpgradeableReadLock ()
|
||||
@@ -292,7 +315,8 @@ namespace System.Threading {
|
||||
|
||||
ctstate.LockState ^= LockState.Upgradable;
|
||||
ctstate.UpgradeableRecursiveCount--;
|
||||
Interlocked.Add (ref rwlock, -RwRead);
|
||||
if (Interlocked.Add (ref rwlock, -RwRead) >> RwReadBit == 0)
|
||||
readerDoneEvent.Set ();
|
||||
}
|
||||
|
||||
public void Dispose ()
|
||||
@@ -302,25 +326,25 @@ namespace System.Threading {
|
||||
|
||||
public bool IsReadLockHeld {
|
||||
get {
|
||||
return rwlock >= RwRead;
|
||||
return rwlock >= RwRead && CurrentThreadState.LockState.Has (LockState.Read);
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsWriteLockHeld {
|
||||
get {
|
||||
return (rwlock & RwWrite) > 0;
|
||||
return (rwlock & RwWrite) > 0 && CurrentThreadState.LockState.Has (LockState.Write);
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsUpgradeableReadLockHeld {
|
||||
get {
|
||||
return upgradableTaken.Value;
|
||||
return upgradableTaken.Value && CurrentThreadState.LockState.Has (LockState.Upgradable);
|
||||
}
|
||||
}
|
||||
|
||||
public int CurrentReadCount {
|
||||
get {
|
||||
return (rwlock >> RwReadBit) - (IsUpgradeableReadLockHeld ? 1 : 0);
|
||||
return (rwlock >> RwReadBit) - (upgradableTaken.Value ? 1 : 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -483,5 +483,92 @@ namespace MonoTests.System.Threading
|
||||
Assert.IsTrue (v.TryEnterUpgradeableReadLock (100), "#2");
|
||||
Assert.IsTrue (v.TryEnterUpgradeableReadLock (100), "#3");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void RecursiveReadPropertiesTest ()
|
||||
{
|
||||
var v = new ReaderWriterLockSlim (LockRecursionPolicy.SupportsRecursion);
|
||||
|
||||
v.EnterReadLock ();
|
||||
v.EnterReadLock ();
|
||||
|
||||
Assert.AreEqual (true, v.IsReadLockHeld, "#1a");
|
||||
Assert.AreEqual (1, v.CurrentReadCount, "#2a");
|
||||
Assert.AreEqual (2, v.RecursiveReadCount, "#3a");
|
||||
|
||||
bool rLock = true;
|
||||
int cReadCount = -1, rReadCount = -1;
|
||||
|
||||
Thread t = new Thread ((_) => {
|
||||
rLock = v.IsReadLockHeld;
|
||||
cReadCount = v.CurrentReadCount;
|
||||
rReadCount = v.RecursiveReadCount;
|
||||
});
|
||||
|
||||
t.Start ();
|
||||
t.Join ();
|
||||
|
||||
Assert.AreEqual (false, rLock, "#1b");
|
||||
Assert.AreEqual (1, cReadCount, "#2b");
|
||||
Assert.AreEqual (0, rReadCount, "#3b");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void RecursiveUpgradePropertiesTest ()
|
||||
{
|
||||
var v = new ReaderWriterLockSlim (LockRecursionPolicy.SupportsRecursion);
|
||||
|
||||
v.EnterUpgradeableReadLock ();
|
||||
v.EnterUpgradeableReadLock ();
|
||||
|
||||
Assert.AreEqual (true, v.IsUpgradeableReadLockHeld, "#1a");
|
||||
Assert.AreEqual (false, v.IsReadLockHeld, "#11a");
|
||||
Assert.AreEqual (0, v.CurrentReadCount, "#2a");
|
||||
Assert.AreEqual (2, v.RecursiveUpgradeCount, "#3a");
|
||||
|
||||
bool upLock = false, rLock = false;
|
||||
int rCount = -1, rUCount = -1;
|
||||
|
||||
Thread t = new Thread ((_) => {
|
||||
upLock = v.IsUpgradeableReadLockHeld;
|
||||
rLock = v.IsReadLockHeld;
|
||||
rCount = v.CurrentReadCount;
|
||||
rUCount = v.RecursiveUpgradeCount;
|
||||
});
|
||||
|
||||
t.Start ();
|
||||
t.Join ();
|
||||
|
||||
Assert.AreEqual (false, upLock, "#1b");
|
||||
Assert.AreEqual (false, rLock, "#11b");
|
||||
Assert.AreEqual (0, rCount, "#2b");
|
||||
Assert.AreEqual (0, rUCount, "#3b");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void RecursiveWritePropertiesTest ()
|
||||
{
|
||||
var v = new ReaderWriterLockSlim (LockRecursionPolicy.SupportsRecursion);
|
||||
|
||||
v.EnterWriteLock ();
|
||||
v.EnterWriteLock ();
|
||||
|
||||
Assert.AreEqual (true, v.IsWriteLockHeld, "#1a");
|
||||
Assert.AreEqual (2, v.RecursiveWriteCount, "#3a");
|
||||
|
||||
bool wLock = false;
|
||||
int rWrite = -1;
|
||||
|
||||
Thread t = new Thread ((_) => {
|
||||
wLock = v.IsWriteLockHeld;
|
||||
rWrite = v.RecursiveWriteCount;
|
||||
});
|
||||
|
||||
t.Start ();
|
||||
t.Join ();
|
||||
|
||||
Assert.AreEqual (false, wLock, "#1b");
|
||||
Assert.AreEqual (0, rWrite, "#3b");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,9 +3,30 @@
|
||||
//
|
||||
// Author:
|
||||
// Marcos Cobena ([email protected])
|
||||
// Atsushi Enomoto ([email protected])
|
||||
//
|
||||
// Copyright 2007 Marcos Cobena (http://www.youcannoteatbits.org/)
|
||||
// Copyright 2009-2010 Novell, Inc (http://www.novell.com/)
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -46,8 +67,9 @@ namespace System.ServiceModel.Channels
|
||||
info = new TcpChannelInfo (source, MessageEncoder, quotas);
|
||||
}
|
||||
|
||||
List<ManualResetEvent> accept_handles = new List<ManualResetEvent> ();
|
||||
List<TChannel> accepted_channels = new List<TChannel> ();
|
||||
SynchronizedCollection<ManualResetEvent> accept_handles = new SynchronizedCollection<ManualResetEvent> ();
|
||||
Queue<TcpClient> accepted_clients = new Queue<TcpClient> ();
|
||||
SynchronizedCollection<TChannel> accepted_channels = new SynchronizedCollection<TChannel> ();
|
||||
|
||||
protected override TChannel OnAcceptChannel (TimeSpan timeout)
|
||||
{
|
||||
@@ -89,32 +111,28 @@ namespace System.ServiceModel.Channels
|
||||
{
|
||||
DateTime start = DateTime.Now;
|
||||
|
||||
TcpClient client = null;
|
||||
if (tcp_listener.Pending ()) {
|
||||
client = tcp_listener.AcceptTcpClient ();
|
||||
} else {
|
||||
TcpClient client = accepted_clients.Count == 0 ? null : accepted_clients.Dequeue ();
|
||||
if (client == null) {
|
||||
var wait = new ManualResetEvent (false);
|
||||
tcp_listener.BeginAcceptTcpClient (delegate (IAsyncResult result) {
|
||||
client = tcp_listener.EndAcceptTcpClient (result);
|
||||
wait.Set ();
|
||||
accept_handles.Remove (wait);
|
||||
}, null);
|
||||
if (State == CommunicationState.Closing)
|
||||
return null;
|
||||
accept_handles.Add (wait);
|
||||
wait.WaitOne (timeout);
|
||||
if (!wait.WaitOne (timeout)) {
|
||||
accept_handles.Remove (wait);
|
||||
return null;
|
||||
}
|
||||
accept_handles.Remove (wait);
|
||||
// recurse with new timeout, or return null if it's either being closed or timed out.
|
||||
timeout -= (DateTime.Now - start);
|
||||
return State == CommunicationState.Opened && timeout > TimeSpan.Zero ? AcceptTcpClient (timeout) : null;
|
||||
}
|
||||
|
||||
// This may be optional though ...
|
||||
if (client != null) {
|
||||
foreach (var ch in accepted_channels) {
|
||||
var dch = ch as TcpDuplexSessionChannel;
|
||||
if (dch == null || dch.TcpClient == null && !dch.TcpClient.Connected)
|
||||
continue;
|
||||
if (((IPEndPoint) dch.TcpClient.Client.RemoteEndPoint).Equals (client.Client.RemoteEndPoint))
|
||||
// ... then it should be handled in another BeginTryReceive/EndTryReceive loop in ChannelDispatcher.
|
||||
return AcceptTcpClient (timeout - (DateTime.Now - start));
|
||||
}
|
||||
// There might be bettwe way to exclude those TCP clients though ...
|
||||
foreach (var ch in accepted_channels) {
|
||||
var dch = ch as TcpDuplexSessionChannel;
|
||||
if (dch == null || dch.TcpClient == null && !dch.TcpClient.Connected)
|
||||
continue;
|
||||
if (((IPEndPoint) dch.TcpClient.Client.RemoteEndPoint).Equals (client.Client.RemoteEndPoint))
|
||||
// ... then it should be handled in another BeginTryReceive/EndTryReceive loop in ChannelDispatcher.
|
||||
return AcceptTcpClient (timeout - (DateTime.Now - start));
|
||||
}
|
||||
|
||||
return client;
|
||||
@@ -132,25 +150,25 @@ namespace System.ServiceModel.Channels
|
||||
{
|
||||
if (State == CommunicationState.Closed)
|
||||
return;
|
||||
ProcessClose ();
|
||||
ProcessClose (TimeSpan.Zero);
|
||||
}
|
||||
|
||||
protected override void OnClose (TimeSpan timeout)
|
||||
{
|
||||
if (State == CommunicationState.Closed)
|
||||
return;
|
||||
ProcessClose ();
|
||||
ProcessClose (timeout);
|
||||
}
|
||||
|
||||
void ProcessClose ()
|
||||
void ProcessClose (TimeSpan timeout)
|
||||
{
|
||||
if (tcp_listener == null)
|
||||
throw new InvalidOperationException ("Current state is " + State);
|
||||
lock (accept_handles) {
|
||||
foreach (var wait in accept_handles)
|
||||
wait.Set ();
|
||||
}
|
||||
//tcp_listener.Client.Close (Math.Max (50, (int) timeout.TotalMilliseconds));
|
||||
tcp_listener.Stop ();
|
||||
var l = new List<ManualResetEvent> (accept_handles);
|
||||
foreach (var wait in l) // those handles will disappear from accepted_handles
|
||||
wait.Set ();
|
||||
tcp_listener = null;
|
||||
}
|
||||
|
||||
@@ -164,6 +182,31 @@ namespace System.ServiceModel.Channels
|
||||
int explicitPort = Uri.Port;
|
||||
tcp_listener = new TcpListener (entry.AddressList [0], explicitPort <= 0 ? TcpTransportBindingElement.DefaultPort : explicitPort);
|
||||
tcp_listener.Start ();
|
||||
tcp_listener.BeginAcceptTcpClient (TcpListenerAcceptedClient, tcp_listener);
|
||||
}
|
||||
|
||||
void TcpListenerAcceptedClient (IAsyncResult result)
|
||||
{
|
||||
var listener = (TcpListener) result.AsyncState;
|
||||
try {
|
||||
var client = listener.EndAcceptTcpClient (result);
|
||||
if (client != null) {
|
||||
accepted_clients.Enqueue (client);
|
||||
if (accept_handles.Count > 0)
|
||||
accept_handles [0].Set ();
|
||||
}
|
||||
} catch {
|
||||
/* If an accept fails, just ignore it. Maybe the remote peer disconnected already */
|
||||
} finally {
|
||||
if (State == CommunicationState.Opened) {
|
||||
try {
|
||||
listener.BeginAcceptTcpClient (TcpListenerAcceptedClient, listener);
|
||||
} catch {
|
||||
/* If this fails, we must have disposed the listener */
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,6 +42,21 @@ namespace System.Web.Caching
|
||||
{
|
||||
public static readonly DateTime NoAbsoluteExpiration = DateTime.MaxValue;
|
||||
public static readonly TimeSpan NoSlidingExpiration = TimeSpan.Zero;
|
||||
|
||||
// cacheLock will be released in the code below without checking whether it was
|
||||
// actually acquired. The API doesn't offer a reliable way to check whether the lock
|
||||
// is being held by the current thread and since Mono does't implement CER
|
||||
// (Constrained Execution Regions -
|
||||
// http://msdn.microsoft.com/en-us/library/ms228973.aspx) currently, we have no
|
||||
// reliable way of recording the information that the lock has been successfully
|
||||
// acquired.
|
||||
// It can happen that a Thread.Abort occurs while acquiring the lock and the lock
|
||||
// isn't actually held. In this case the attempt to release a lock will throw an
|
||||
// exception. It's better than a race of setting a boolean flag after acquiring the
|
||||
// lock and then relying upon it here to release it - that may cause a deadlock
|
||||
// should we fail to release the lock which was successfully acquired but
|
||||
// Thread.Abort happened right after that during the stloc instruction to set the
|
||||
// boolean flag. Once CERs are supported we can use the boolean flag reliably.
|
||||
ReaderWriterLockSlim cacheLock;
|
||||
Dictionary <string, CacheItem> cache;
|
||||
CacheItemPriorityQueue timedItems;
|
||||
@@ -153,19 +168,17 @@ namespace System.Web.Caching
|
||||
{
|
||||
if (key == null)
|
||||
throw new ArgumentNullException ("key");
|
||||
|
||||
bool locked = false;
|
||||
|
||||
try {
|
||||
cacheLock.EnterWriteLock ();
|
||||
locked = true;
|
||||
CacheItem it = GetCacheItem (key);
|
||||
|
||||
if (it != null)
|
||||
return it.Value;
|
||||
Insert (key, value, dependencies, absoluteExpiration, slidingExpiration, priority, onRemoveCallback, null, false);
|
||||
} finally {
|
||||
if (locked)
|
||||
cacheLock.ExitWriteLock ();
|
||||
// See comment at the top of the file, above cacheLock declaration
|
||||
cacheLock.ExitWriteLock ();
|
||||
}
|
||||
|
||||
return null;
|
||||
@@ -173,10 +186,8 @@ namespace System.Web.Caching
|
||||
|
||||
public object Get (string key)
|
||||
{
|
||||
bool locked = false;
|
||||
try {
|
||||
cacheLock.EnterUpgradeableReadLock ();
|
||||
locked = true;
|
||||
CacheItem it = GetCacheItem (key);
|
||||
if (it == null)
|
||||
return null;
|
||||
@@ -187,6 +198,7 @@ namespace System.Web.Caching
|
||||
if (!NeedsUpdate (it, CacheItemUpdateReason.DependencyChanged, false))
|
||||
Remove (it.Key, CacheItemRemovedReason.DependencyChanged, false, true);
|
||||
} finally {
|
||||
// See comment at the top of the file, above cacheLock declaration
|
||||
cacheLock.ExitWriteLock ();
|
||||
}
|
||||
|
||||
@@ -212,6 +224,7 @@ namespace System.Web.Caching
|
||||
if (!NeedsUpdate (it, CacheItemUpdateReason.Expired, false))
|
||||
Remove (key, CacheItemRemovedReason.Expired, false, true);
|
||||
} finally {
|
||||
// See comment at the top of the file, above cacheLock declaration
|
||||
cacheLock.ExitWriteLock ();
|
||||
}
|
||||
|
||||
@@ -221,9 +234,8 @@ namespace System.Web.Caching
|
||||
|
||||
return it.Value;
|
||||
} finally {
|
||||
if (locked) {
|
||||
cacheLock.ExitUpgradeableReadLock ();
|
||||
}
|
||||
// See comment at the top of the file, above cacheLock declaration
|
||||
cacheLock.ExitUpgradeableReadLock ();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -282,20 +294,17 @@ namespace System.Web.Caching
|
||||
|
||||
internal void SetItemTimeout (string key, DateTime absoluteExpiration, TimeSpan slidingExpiration, bool doLock)
|
||||
{
|
||||
CacheItem ci = null;
|
||||
bool locked = false;
|
||||
|
||||
CacheItem ci = null;
|
||||
try {
|
||||
if (doLock) {
|
||||
if (doLock)
|
||||
cacheLock.EnterWriteLock ();
|
||||
locked = true;
|
||||
}
|
||||
|
||||
ci = GetCacheItem (key);
|
||||
if (ci != null)
|
||||
SetItemTimeout (ci, absoluteExpiration, slidingExpiration, ci.OnRemoveCallback, null, key, false);
|
||||
} finally {
|
||||
if (locked) {
|
||||
if (doLock) {
|
||||
// See comment at the top of the file, above cacheLock declaration
|
||||
cacheLock.ExitWriteLock ();
|
||||
}
|
||||
}
|
||||
@@ -317,12 +326,9 @@ namespace System.Web.Caching
|
||||
ci.OnRemoveCallback = onRemoveCallback;
|
||||
ci.OnUpdateCallback = onUpdateCallback;
|
||||
|
||||
bool locked = false;
|
||||
try {
|
||||
if (doLock) {
|
||||
if (doLock)
|
||||
cacheLock.EnterWriteLock ();
|
||||
locked = true;
|
||||
}
|
||||
|
||||
if (ci.Timer != null) {
|
||||
ci.Timer.Dispose ();
|
||||
@@ -336,7 +342,8 @@ namespace System.Web.Caching
|
||||
if (!disableExpiration && ci.AbsoluteExpiration != NoAbsoluteExpiration)
|
||||
EnqueueTimedItem (ci);
|
||||
} finally {
|
||||
if (locked) {
|
||||
if (doLock) {
|
||||
// See comment at the top of the file, above cacheLock declaration
|
||||
cacheLock.ExitWriteLock ();
|
||||
}
|
||||
}
|
||||
@@ -376,16 +383,14 @@ namespace System.Web.Caching
|
||||
object Remove (string key, CacheItemRemovedReason reason, bool doLock, bool invokeCallback)
|
||||
{
|
||||
CacheItem it = null;
|
||||
bool locked = false;
|
||||
try {
|
||||
if (doLock) {
|
||||
if (doLock)
|
||||
cacheLock.EnterWriteLock ();
|
||||
locked = true;
|
||||
}
|
||||
|
||||
it = RemoveCacheItem (key);
|
||||
} finally {
|
||||
if (locked) {
|
||||
if (doLock) {
|
||||
// See comment at the top of the file, above cacheLock declaration
|
||||
cacheLock.ExitWriteLock ();
|
||||
}
|
||||
}
|
||||
@@ -424,10 +429,8 @@ namespace System.Web.Caching
|
||||
internal void InvokePrivateCallbacks ()
|
||||
{
|
||||
CacheItemRemovedReason reason = CacheItemRemovedReason.Removed;
|
||||
bool locked = false;
|
||||
try {
|
||||
cacheLock.EnterReadLock ();
|
||||
locked = true;
|
||||
foreach (string key in cache.Keys) {
|
||||
CacheItem item = GetCacheItem (key);
|
||||
if (item.Disabled)
|
||||
@@ -442,25 +445,21 @@ namespace System.Web.Caching
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
if (locked) {
|
||||
cacheLock.ExitReadLock ();
|
||||
}
|
||||
// See comment at the top of the file, above cacheLock declaration
|
||||
cacheLock.ExitReadLock ();
|
||||
}
|
||||
}
|
||||
|
||||
public IDictionaryEnumerator GetEnumerator ()
|
||||
{
|
||||
ArrayList list = new ArrayList ();
|
||||
bool locked = false;
|
||||
try {
|
||||
cacheLock.EnterReadLock ();
|
||||
locked = true;
|
||||
foreach (CacheItem it in cache.Values)
|
||||
list.Add (it);
|
||||
} finally {
|
||||
if (locked) {
|
||||
cacheLock.ExitReadLock ();
|
||||
}
|
||||
// See comment at the top of the file, above cacheLock declaration
|
||||
cacheLock.ExitReadLock ();
|
||||
}
|
||||
|
||||
return new CacheItemEnumerator (list);
|
||||
@@ -478,13 +477,9 @@ namespace System.Web.Caching
|
||||
|
||||
bool NeedsUpdate (CacheItem item, CacheItemUpdateReason reason, bool needLock)
|
||||
{
|
||||
bool locked = false;
|
||||
|
||||
try {
|
||||
if (needLock) {
|
||||
if (needLock)
|
||||
cacheLock.EnterWriteLock ();
|
||||
locked = true;
|
||||
}
|
||||
|
||||
if (item == null || item.OnUpdateCallback == null)
|
||||
return false;
|
||||
@@ -525,8 +520,10 @@ namespace System.Web.Caching
|
||||
} catch (Exception) {
|
||||
return false;
|
||||
} finally {
|
||||
if (locked)
|
||||
if (needLock) {
|
||||
// See comment at the top of the file, above cacheLock declaration
|
||||
cacheLock.ExitWriteLock ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -534,11 +531,9 @@ namespace System.Web.Caching
|
||||
{
|
||||
DateTime now = DateTime.Now;
|
||||
CacheItem item = timedItems.Peek ();
|
||||
bool locked = false;
|
||||
|
||||
try {
|
||||
cacheLock.EnterWriteLock ();
|
||||
locked = true;
|
||||
|
||||
while (item != null) {
|
||||
if (!item.Disabled && item.ExpiresAt > now.Ticks)
|
||||
@@ -549,13 +544,13 @@ namespace System.Web.Caching
|
||||
}
|
||||
|
||||
item = timedItems.Dequeue ();
|
||||
if (!NeedsUpdate (item, CacheItemUpdateReason.Expired, true))
|
||||
if (!NeedsUpdate (item, CacheItemUpdateReason.Expired, false))
|
||||
Remove (item.Key, CacheItemRemovedReason.Expired, false, true);
|
||||
item = timedItems.Peek ();
|
||||
}
|
||||
} finally {
|
||||
if (locked)
|
||||
cacheLock.ExitWriteLock ();
|
||||
// See comment at the top of the file, above cacheLock declaration
|
||||
cacheLock.ExitWriteLock ();
|
||||
}
|
||||
|
||||
if (item != null) {
|
||||
@@ -574,10 +569,8 @@ namespace System.Web.Caching
|
||||
internal void CheckDependencies ()
|
||||
{
|
||||
IList list;
|
||||
bool locked = false;
|
||||
try {
|
||||
cacheLock.EnterWriteLock ();
|
||||
locked = true;
|
||||
list = new List <CacheItem> ();
|
||||
foreach (CacheItem it in cache.Values)
|
||||
list.Add (it);
|
||||
@@ -587,18 +580,15 @@ namespace System.Web.Caching
|
||||
Remove (it.Key, CacheItemRemovedReason.DependencyChanged, false, true);
|
||||
}
|
||||
} finally {
|
||||
if (locked) {
|
||||
cacheLock.ExitWriteLock ();
|
||||
}
|
||||
// See comment at the top of the file, above cacheLock declaration
|
||||
cacheLock.ExitWriteLock ();
|
||||
}
|
||||
}
|
||||
|
||||
internal DateTime GetKeyLastChange (string key)
|
||||
{
|
||||
bool locked = false;
|
||||
try {
|
||||
cacheLock.EnterReadLock ();
|
||||
locked = true;
|
||||
CacheItem it = GetCacheItem (key);
|
||||
|
||||
if (it == null)
|
||||
@@ -606,9 +596,8 @@ namespace System.Web.Caching
|
||||
|
||||
return it.LastChange;
|
||||
} finally {
|
||||
if (locked) {
|
||||
cacheLock.ExitReadLock ();
|
||||
}
|
||||
// See comment at the top of the file, above cacheLock declaration
|
||||
cacheLock.ExitReadLock ();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -41,6 +41,8 @@ namespace System.Web.Caching
|
||||
CacheItem[] heap;
|
||||
int heapSize = 0;
|
||||
int heapCount = 0;
|
||||
|
||||
// See comment for the cacheLock field at top of System.Web.Caching/Cache.cs
|
||||
ReaderWriterLockSlim queueLock;
|
||||
|
||||
public int Count {
|
||||
@@ -94,20 +96,18 @@ namespace System.Web.Caching
|
||||
if (item == null)
|
||||
return;
|
||||
|
||||
bool locked = false;
|
||||
CacheItem[] heap;
|
||||
|
||||
try {
|
||||
queueLock.EnterWriteLock ();
|
||||
locked = true;
|
||||
heap = GetHeapWithGrow ();
|
||||
heap [heapCount++] = item;
|
||||
BubbleUp (heap);
|
||||
|
||||
AddSequenceEntry (item, EDSequenceEntryType.Enqueue);
|
||||
} finally {
|
||||
if (locked)
|
||||
queueLock.ExitWriteLock ();
|
||||
// See comment at the top of the file, above queueLock declaration
|
||||
queueLock.ExitWriteLock ();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -115,12 +115,10 @@ namespace System.Web.Caching
|
||||
{
|
||||
CacheItem ret = null;
|
||||
CacheItem[] heap;
|
||||
bool locked = false;
|
||||
int index;
|
||||
|
||||
try {
|
||||
queueLock.EnterWriteLock ();
|
||||
locked = true;
|
||||
heap = GetHeapWithShrink ();
|
||||
if (heap == null || heapCount == 0)
|
||||
return null;
|
||||
@@ -136,19 +134,17 @@ namespace System.Web.Caching
|
||||
AddSequenceEntry (ret, EDSequenceEntryType.Dequeue);
|
||||
return ret;
|
||||
} finally {
|
||||
if (locked)
|
||||
queueLock.ExitWriteLock ();
|
||||
// See comment at the top of the file, above queueLock declaration
|
||||
queueLock.ExitWriteLock ();
|
||||
}
|
||||
}
|
||||
|
||||
public CacheItem Peek ()
|
||||
{
|
||||
bool locked = false;
|
||||
CacheItem ret;
|
||||
|
||||
try {
|
||||
queueLock.EnterReadLock ();
|
||||
locked = true;
|
||||
if (heap == null || heapCount == 0)
|
||||
return null;
|
||||
|
||||
@@ -157,8 +153,8 @@ namespace System.Web.Caching
|
||||
|
||||
return ret;
|
||||
} finally {
|
||||
if (locked)
|
||||
queueLock.ExitReadLock ();
|
||||
// See comment at the top of the file, above queueLock declaration
|
||||
queueLock.ExitReadLock ();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -94,6 +94,7 @@ namespace System.Web.Compilation
|
||||
// This is here _only_ for the purpose of unit tests!
|
||||
internal static bool suppressDebugModeMessages;
|
||||
|
||||
// See comment for the cacheLock field at top of System.Web.Caching/Cache.cs
|
||||
#if SYSTEMCORE_DEP
|
||||
static ReaderWriterLockSlim buildCacheLock;
|
||||
#else
|
||||
@@ -817,14 +818,12 @@ namespace System.Web.Compilation
|
||||
// to the assembly builder and, in effect, no assembly is produced but there are STILL types that need
|
||||
// to be added to the cache.
|
||||
Assembly compiledAssembly = results != null ? results.CompiledAssembly : null;
|
||||
bool locked = false;
|
||||
try {
|
||||
#if SYSTEMCORE_DEP
|
||||
buildCacheLock.EnterWriteLock ();
|
||||
#else
|
||||
buildCacheLock.AcquireWriterLock (-1);
|
||||
#endif
|
||||
locked = true;
|
||||
if (compiledAssembly != null)
|
||||
referencedAssemblies.Add (compiledAssembly);
|
||||
|
||||
@@ -835,13 +834,11 @@ namespace System.Web.Compilation
|
||||
StoreInCache (bp, compiledAssembly, results);
|
||||
}
|
||||
} finally {
|
||||
if (locked) {
|
||||
#if SYSTEMCORE_DEP
|
||||
buildCacheLock.ExitWriteLock ();
|
||||
buildCacheLock.ExitWriteLock ();
|
||||
#else
|
||||
buildCacheLock.ReleaseWriterLock ();
|
||||
buildCacheLock.ReleaseWriterLock ();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -883,24 +880,19 @@ namespace System.Web.Compilation
|
||||
#endif
|
||||
static BuildManagerCacheItem GetCachedItem (string vp)
|
||||
{
|
||||
bool locked = false;
|
||||
|
||||
try {
|
||||
#if SYSTEMCORE_DEP
|
||||
buildCacheLock.EnterReadLock ();
|
||||
#else
|
||||
buildCacheLock.AcquireReaderLock (-1);
|
||||
#endif
|
||||
locked = true;
|
||||
return GetCachedItemNoLock (vp);
|
||||
} finally {
|
||||
if (locked) {
|
||||
#if SYSTEMCORE_DEP
|
||||
buildCacheLock.ExitReadLock ();
|
||||
buildCacheLock.ExitReadLock ();
|
||||
#else
|
||||
buildCacheLock.ReleaseReaderLock ();
|
||||
buildCacheLock.ReleaseReaderLock ();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1290,27 +1282,22 @@ namespace System.Web.Compilation
|
||||
else
|
||||
return;
|
||||
|
||||
bool locked = false;
|
||||
try {
|
||||
#if SYSTEMCORE_DEP
|
||||
buildCacheLock.EnterWriteLock ();
|
||||
#else
|
||||
buildCacheLock.AcquireWriterLock (-1);
|
||||
#endif
|
||||
locked = true;
|
||||
|
||||
if (HasCachedItemNoLock (virtualPath)) {
|
||||
buildCache [virtualPath] = null;
|
||||
OnEntryRemoved (virtualPath);
|
||||
}
|
||||
} finally {
|
||||
if (locked) {
|
||||
#if SYSTEMCORE_DEP
|
||||
buildCacheLock.ExitWriteLock ();
|
||||
buildCacheLock.ExitWriteLock ();
|
||||
#else
|
||||
buildCacheLock.ReleaseWriterLock ();
|
||||
buildCacheLock.ReleaseWriterLock ();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -67,6 +67,8 @@ namespace System.Web.Configuration {
|
||||
static readonly char[] pathTrimChars = { '/' };
|
||||
static readonly object suppressAppReloadLock = new object ();
|
||||
static readonly object saveLocationsCacheLock = new object ();
|
||||
|
||||
// See comment for the cacheLock field at top of System.Web.Caching/Cache.cs
|
||||
static readonly ReaderWriterLockSlim sectionCacheLock;
|
||||
|
||||
#if !TARGET_J2EE
|
||||
@@ -225,14 +227,11 @@ namespace System.Web.Configuration {
|
||||
|
||||
static void ConfigurationSaveHandler (_Configuration sender, ConfigurationSaveEventArgs args)
|
||||
{
|
||||
bool locked = false;
|
||||
try {
|
||||
sectionCacheLock.EnterWriteLock ();
|
||||
locked = true;
|
||||
sectionCache.Clear ();
|
||||
} finally {
|
||||
if (locked)
|
||||
sectionCacheLock.ExitWriteLock ();
|
||||
sectionCacheLock.ExitWriteLock ();
|
||||
}
|
||||
|
||||
lock (suppressAppReloadLock) {
|
||||
@@ -442,7 +441,6 @@ namespace System.Web.Configuration {
|
||||
int cacheKey;
|
||||
bool pathPresent = !String.IsNullOrEmpty (path);
|
||||
string locationPath = null;
|
||||
bool locked = false;
|
||||
|
||||
if (pathPresent)
|
||||
locationPath = "location_" + path;
|
||||
@@ -453,7 +451,6 @@ namespace System.Web.Configuration {
|
||||
|
||||
try {
|
||||
sectionCacheLock.EnterReadLock ();
|
||||
locked = true;
|
||||
|
||||
object o;
|
||||
if (pathPresent) {
|
||||
@@ -469,8 +466,7 @@ namespace System.Web.Configuration {
|
||||
if (sectionCache.TryGetValue (baseCacheKey, out o))
|
||||
return o;
|
||||
} finally {
|
||||
if (locked)
|
||||
sectionCacheLock.ExitReadLock ();
|
||||
sectionCacheLock.ExitReadLock ();
|
||||
}
|
||||
|
||||
string cachePath = null;
|
||||
@@ -687,27 +683,21 @@ namespace System.Web.Configuration {
|
||||
static void AddSectionToCache (int key, object section)
|
||||
{
|
||||
object cachedSection;
|
||||
bool locked = false;
|
||||
|
||||
try {
|
||||
sectionCacheLock.EnterUpgradeableReadLock ();
|
||||
locked = true;
|
||||
|
||||
if (sectionCache.TryGetValue (key, out cachedSection) && cachedSection != null)
|
||||
return;
|
||||
|
||||
bool innerLocked = false;
|
||||
try {
|
||||
sectionCacheLock.EnterWriteLock ();
|
||||
innerLocked = true;
|
||||
sectionCache.Add (key, section);
|
||||
} finally {
|
||||
if (innerLocked)
|
||||
sectionCacheLock.ExitWriteLock ();
|
||||
sectionCacheLock.ExitWriteLock ();
|
||||
}
|
||||
} finally {
|
||||
if (locked)
|
||||
sectionCacheLock.ExitUpgradeableReadLock ();
|
||||
sectionCacheLock.ExitUpgradeableReadLock ();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -432,7 +432,7 @@ namespace System.Web.UI
|
||||
enable_event_validation = GetBool (atts, "EnableEventValidation", enable_event_validation);
|
||||
maintainScrollPositionOnPostBack = GetBool (atts, "MaintainScrollPositionOnPostBack", maintainScrollPositionOnPostBack);
|
||||
|
||||
if (atts.Contains ("EnableViewState")) {
|
||||
if (atts.Contains ("EnableViewStateMac")) {
|
||||
enableViewStateMac = GetBool (atts, "EnableViewStateMac", enableViewStateMac);
|
||||
enableViewStateMacSet = true;
|
||||
}
|
||||
|
||||
@@ -201,10 +201,15 @@ namespace System.Net.Sockets
|
||||
}
|
||||
|
||||
if (callback != null)
|
||||
callback (this);
|
||||
ThreadPool.QueueUserWorkItem (CB, null);
|
||||
Buffer = null;
|
||||
}
|
||||
|
||||
void CB (object unused)
|
||||
{
|
||||
callback (this);
|
||||
}
|
||||
|
||||
SocketAsyncCall GetDelegate (Worker worker, SocketOperation op)
|
||||
{
|
||||
switch (op) {
|
||||
|
||||
@@ -139,9 +139,14 @@ namespace System.Net
|
||||
{
|
||||
if (!callbackDone && cb != null) {
|
||||
callbackDone = true;
|
||||
cb (this);
|
||||
ThreadPool.QueueUserWorkItem (CB, null);
|
||||
}
|
||||
}
|
||||
|
||||
void CB (object unused)
|
||||
{
|
||||
cb (this);
|
||||
}
|
||||
|
||||
internal void WaitUntilComplete ()
|
||||
{
|
||||
|
||||
@@ -39,6 +39,7 @@ using System.Runtime.Serialization;
|
||||
using System.Globalization;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Security;
|
||||
using System.Security.Cryptography;
|
||||
@@ -825,6 +826,19 @@ namespace System.Reflection.Emit
|
||||
}
|
||||
}
|
||||
|
||||
if (res != null) {
|
||||
List<Exception> exceptions = null;
|
||||
foreach (var type in res) {
|
||||
if (type is TypeBuilder) {
|
||||
if (exceptions == null)
|
||||
exceptions = new List <Exception> ();
|
||||
exceptions.Add (new TypeLoadException (string.Format ("Type '{0}' is not finished", type.FullName)));
|
||||
}
|
||||
}
|
||||
if (exceptions != null)
|
||||
throw new ReflectionTypeLoadException (new Type [exceptions.Count], exceptions.ToArray ());
|
||||
}
|
||||
|
||||
return res == null ? Type.EmptyTypes : res;
|
||||
}
|
||||
|
||||
|
||||
@@ -1776,6 +1776,32 @@ public class AssemblyBuilderTest
|
||||
ab.GetCustomAttributes (true);
|
||||
}
|
||||
|
||||
|
||||
[Test]
|
||||
public void GetTypesWithUnfinishedTypeBuilder ()
|
||||
{
|
||||
AssemblyBuilder ab = genAssembly ();
|
||||
ModuleBuilder mb = ab.DefineDynamicModule("tester", "tester.dll", false);
|
||||
mb.DefineType ("K").CreateType ();
|
||||
var tb = mb.DefineType ("T");
|
||||
|
||||
try {
|
||||
ab.GetTypes ();
|
||||
Assert.Fail ("#1");
|
||||
} catch (ReflectionTypeLoadException ex) {
|
||||
Assert.AreEqual (1, ex.Types.Length, "#2");
|
||||
Assert.AreEqual (1, ex.LoaderExceptions.Length, "#3");
|
||||
Assert.IsNull (ex.Types [0], "#4");
|
||||
Assert.IsTrue (ex.LoaderExceptions [0] is TypeLoadException, "#5");
|
||||
}
|
||||
|
||||
tb.CreateType ();
|
||||
var types = ab.GetTypes ();
|
||||
Assert.AreEqual (2, types.Length, "#5");
|
||||
foreach (var t in types)
|
||||
Assert.IsFalse (t is TypeBuilder, "#6_" + t.Name);
|
||||
}
|
||||
|
||||
private static void AssertAssemblyName (string tempDir, AssemblyName assemblyName, string abName, string fullName)
|
||||
{
|
||||
AppDomain currentDomain = AppDomain.CurrentDomain;
|
||||
|
||||
@@ -305,7 +305,7 @@ namespace Mono.ILASM {
|
||||
%token K_OUT
|
||||
%token K_OPT
|
||||
// %token K_LCID
|
||||
%token K_RETVAL
|
||||
//%token K_RETVAL
|
||||
%token K_STATIC
|
||||
%token K_PUBLIC
|
||||
%token K_PRIVATE
|
||||
|
||||
@@ -143,7 +143,7 @@ namespace Mono.ILASM {
|
||||
keywords ["opt"] = new ILToken (Token.K_OPT, "opt");
|
||||
// Not a keyword according to ilasm 1.1
|
||||
// keywords ["lcid"] = new ILToken (Token.K_LCID, "lcid");
|
||||
keywords ["retval"] = new ILToken (Token.K_RETVAL, "retval");
|
||||
//keywords ["retval"] = new ILToken (Token.K_RETVAL, "retval");
|
||||
keywords ["static"] = new ILToken (Token.K_STATIC, "static");
|
||||
keywords ["public"] = new ILToken (Token.K_PUBLIC, "public");
|
||||
keywords ["private"] = new ILToken (Token.K_PRIVATE, "private");
|
||||
|
||||
@@ -654,6 +654,9 @@ namespace Mono.CSharp {
|
||||
// Otherwise, if the selected operator is a predefined operator
|
||||
//
|
||||
Binary b = source as Binary;
|
||||
if (b == null && source is ReducedExpression)
|
||||
b = ((ReducedExpression) source).OriginalExpression as Binary;
|
||||
|
||||
if (b != null) {
|
||||
//
|
||||
// 2a. the operator is a shift operator
|
||||
|
||||
@@ -1560,7 +1560,7 @@ namespace Mono.CSharp {
|
||||
|
||||
public static void VerifyModulesClsCompliance (CompilerContext ctx)
|
||||
{
|
||||
Module[] modules = GlobalRootNamespace.Instance.Modules;
|
||||
Module[] modules = ctx.GlobalRootNamespace.Modules;
|
||||
if (modules == null)
|
||||
return;
|
||||
|
||||
|
||||
+10
-17
@@ -998,7 +998,7 @@ namespace Mono.CSharp {
|
||||
int type_size = Kind == MemberKind.Struct && first_nonstatic_field == null ? 1 : 0;
|
||||
|
||||
if (IsTopLevel) {
|
||||
if (GlobalRootNamespace.Instance.IsNamespace (Name)) {
|
||||
if (Compiler.GlobalRootNamespace.IsNamespace (Name)) {
|
||||
Report.Error (519, Location, "`{0}' clashes with a predefined namespace", Name);
|
||||
return false;
|
||||
}
|
||||
@@ -1053,14 +1053,12 @@ namespace Mono.CSharp {
|
||||
|
||||
if (proxy_method == null) {
|
||||
string name = CompilerGeneratedClass.MakeName (method.Name, null, "BaseCallProxy", hoisted_base_call_proxies.Count);
|
||||
var base_parameters = method.Parameters.FixedParameters as Parameter[];
|
||||
if (base_parameters == null) {
|
||||
base_parameters = new Parameter[method.Parameters.Count];
|
||||
for (int i = 0; i < base_parameters.Length; ++i) {
|
||||
var base_param = method.Parameters.FixedParameters[i];
|
||||
base_parameters[i] = new Parameter (new TypeExpression (method.Parameters.Types[i], Location),
|
||||
base_param.Name, base_param.ModFlags, null, Location);
|
||||
}
|
||||
var base_parameters = new Parameter[method.Parameters.Count];
|
||||
for (int i = 0; i < base_parameters.Length; ++i) {
|
||||
var base_param = method.Parameters.FixedParameters[i];
|
||||
base_parameters[i] = new Parameter (new TypeExpression (method.Parameters.Types[i], Location),
|
||||
base_param.Name, base_param.ModFlags, null, Location);
|
||||
base_parameters[i].Resolve (this, i);
|
||||
}
|
||||
|
||||
var cloned_params = ParametersCompiled.CreateFullyResolved (base_parameters, method.Parameters.Types);
|
||||
@@ -2634,14 +2632,9 @@ namespace Mono.CSharp {
|
||||
while (mt.IsPointer)
|
||||
mt = TypeManager.GetElementType (mt);
|
||||
|
||||
if (mt.MemberDefinition == this) {
|
||||
for (var p = Parent; p != null; p = p.Parent) {
|
||||
if (p.Kind == MemberKind.Class) {
|
||||
has_unmanaged_check_done = true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
continue;
|
||||
if (mt.IsGenericOrParentIsGeneric || mt.IsGenericParameter) {
|
||||
has_unmanaged_check_done = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (TypeManager.IsUnmanagedType (mt))
|
||||
|
||||
+9
-8
@@ -38,6 +38,7 @@ namespace Mono.CSharp {
|
||||
public class CodeGen {
|
||||
static AppDomain current_domain;
|
||||
|
||||
// Breaks dynamic and repl
|
||||
public static AssemblyClass Assembly;
|
||||
|
||||
static CodeGen ()
|
||||
@@ -107,7 +108,7 @@ namespace Mono.CSharp {
|
||||
if (an.KeyPair != null) {
|
||||
// If we are going to strong name our assembly make
|
||||
// sure all its refs are strong named
|
||||
foreach (Assembly a in GlobalRootNamespace.Instance.Assemblies) {
|
||||
foreach (Assembly a in ctx.GlobalRootNamespace.Assemblies) {
|
||||
AssemblyName ref_name = a.GetName ();
|
||||
byte [] b = ref_name.GetPublicKeyToken ();
|
||||
if (b == null || b.Length == 0) {
|
||||
@@ -1012,7 +1013,7 @@ namespace Mono.CSharp {
|
||||
Arguments named = new Arguments (1);
|
||||
named.Add (new NamedArgument ("SkipVerification", loc, new BoolLiteral (true, loc)));
|
||||
|
||||
GlobalAttribute g = new GlobalAttribute (new NamespaceEntry (null, null, null), "assembly",
|
||||
GlobalAttribute g = new GlobalAttribute (new NamespaceEntry (Compiler, null, null, null), "assembly",
|
||||
new MemberAccess (system_security_permissions, "SecurityPermissionAttribute"),
|
||||
new Arguments[] { pos, named }, loc, false);
|
||||
g.AttachTo (this, this);
|
||||
@@ -1281,7 +1282,7 @@ namespace Mono.CSharp {
|
||||
|
||||
try {
|
||||
var fi = typeof (AssemblyBuilder).GetField ("culture", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.SetField);
|
||||
fi.SetValue (CodeGen.Assembly.Builder, value == "neutral" ? "" : value);
|
||||
fi.SetValue (Builder, value == "neutral" ? "" : value);
|
||||
} catch {
|
||||
Report.RuntimeMissingSupport (a.Location, "AssemblyCultureAttribute setting");
|
||||
}
|
||||
@@ -1302,7 +1303,7 @@ namespace Mono.CSharp {
|
||||
|
||||
try {
|
||||
var fi = typeof (AssemblyBuilder).GetField ("version", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.SetField);
|
||||
fi.SetValue (CodeGen.Assembly.Builder, vinfo);
|
||||
fi.SetValue (Builder, vinfo);
|
||||
} catch {
|
||||
Report.RuntimeMissingSupport (a.Location, "AssemblyVersionAttribute setting");
|
||||
}
|
||||
@@ -1319,7 +1320,7 @@ namespace Mono.CSharp {
|
||||
|
||||
try {
|
||||
var fi = typeof (AssemblyBuilder).GetField ("algid", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.SetField);
|
||||
fi.SetValue (CodeGen.Assembly.Builder, alg);
|
||||
fi.SetValue (Builder, alg);
|
||||
} catch {
|
||||
Report.RuntimeMissingSupport (a.Location, "AssemblyAlgorithmIdAttribute setting");
|
||||
}
|
||||
@@ -1335,12 +1336,12 @@ namespace Mono.CSharp {
|
||||
flags |= ((uint) cdata[pos + 3]) << 24;
|
||||
|
||||
// Ignore set PublicKey flag if assembly is not strongnamed
|
||||
if ((flags & (uint) AssemblyNameFlags.PublicKey) != 0 && (CodeGen.Assembly.Builder.GetName ().KeyPair == null))
|
||||
if ((flags & (uint) AssemblyNameFlags.PublicKey) != 0 && (Builder.GetName ().KeyPair == null))
|
||||
flags &= ~(uint)AssemblyNameFlags.PublicKey;
|
||||
|
||||
try {
|
||||
var fi = typeof (AssemblyBuilder).GetField ("flags", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.SetField);
|
||||
fi.SetValue (CodeGen.Assembly.Builder, flags);
|
||||
fi.SetValue (Builder, flags);
|
||||
} catch {
|
||||
Report.RuntimeMissingSupport (a.Location, "AssemblyFlagsAttribute setting");
|
||||
}
|
||||
@@ -1411,7 +1412,7 @@ namespace Mono.CSharp {
|
||||
if (has_extension_method)
|
||||
Compiler.PredefinedAttributes.Extension.EmitAttribute (Builder);
|
||||
|
||||
PredefinedAttribute pa = Compiler.PredefinedAttributes.RuntimeCompatibility;
|
||||
PredefinedAttribute pa = tc.Compiler.PredefinedAttributes.RuntimeCompatibility;
|
||||
if (pa.IsDefined && (OptAttributes == null || !OptAttributes.Contains (pa))) {
|
||||
var ci = TypeManager.GetPredefinedConstructor (pa.Type, Location.Null, TypeSpec.EmptyTypes);
|
||||
PropertyInfo [] pis = new PropertyInfo [1];
|
||||
|
||||
+10
-1
@@ -553,12 +553,21 @@ namespace Mono.CSharp
|
||||
readonly Report report;
|
||||
readonly ReflectionMetaImporter meta_importer;
|
||||
readonly PredefinedAttributes attributes;
|
||||
readonly GlobalRootNamespace root;
|
||||
|
||||
public CompilerContext (ReflectionMetaImporter metaImporter, Report report)
|
||||
{
|
||||
this.meta_importer = metaImporter;
|
||||
this.attributes = new PredefinedAttributes ();
|
||||
this.report = report;
|
||||
|
||||
this.attributes = new PredefinedAttributes ();
|
||||
this.root = new GlobalRootNamespace ();
|
||||
}
|
||||
|
||||
public GlobalRootNamespace GlobalRootNamespace {
|
||||
get {
|
||||
return root;
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsRuntimeBinder { get; set; }
|
||||
|
||||
@@ -474,7 +474,7 @@ namespace_declaration
|
||||
Report.Error(1671, name.Location, "A namespace declaration cannot have modifiers or attributes");
|
||||
}
|
||||
|
||||
current_namespace = new NamespaceEntry (
|
||||
current_namespace = new NamespaceEntry (compiler,
|
||||
current_namespace, file, name.GetName ());
|
||||
current_class = current_namespace.SlaveDeclSpace;
|
||||
current_container = current_class.PartialContainer;
|
||||
@@ -6346,7 +6346,7 @@ public CSharpParser (SeekableStreamReader reader, CompilationUnit file, Compiler
|
||||
|
||||
this.file = file;
|
||||
this.compiler = ctx;
|
||||
current_namespace = new NamespaceEntry (null, file, null);
|
||||
current_namespace = new NamespaceEntry (ctx, null, file, null);
|
||||
current_class = current_namespace.SlaveDeclSpace;
|
||||
current_container = current_class.PartialContainer; // == RootContest.ToplevelTypes
|
||||
oob_stack.Clear ();
|
||||
|
||||
+22
-8
@@ -22,10 +22,10 @@ namespace Mono.CSharp {
|
||||
//
|
||||
// Delegate container implementation
|
||||
//
|
||||
public class Delegate : TypeContainer
|
||||
public class Delegate : TypeContainer, IParametersMember
|
||||
{
|
||||
FullNamedExpression ReturnType;
|
||||
public readonly ParametersCompiled Parameters;
|
||||
readonly ParametersCompiled parameters;
|
||||
|
||||
Constructor Constructor;
|
||||
Method InvokeBuilder;
|
||||
@@ -59,10 +59,24 @@ namespace Mono.CSharp {
|
||||
ModFlags = ModifiersExtensions.Check (AllowedModifiers, mod_flags,
|
||||
IsTopLevel ? Modifiers.INTERNAL :
|
||||
Modifiers.PRIVATE, name.Location, Report);
|
||||
Parameters = param_list;
|
||||
parameters = param_list;
|
||||
spec = new TypeSpec (Kind, null, this, null, ModFlags | Modifiers.SEALED);
|
||||
}
|
||||
|
||||
#region Properties
|
||||
public TypeSpec MemberType {
|
||||
get {
|
||||
return ReturnType.Type;
|
||||
}
|
||||
}
|
||||
|
||||
public AParametersCollection Parameters {
|
||||
get {
|
||||
return parameters;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
public override void ApplyAttributeBuilder (Attribute a, MethodSpec ctor, byte[] cdata, PredefinedAttributes pa)
|
||||
{
|
||||
if (a.Target == AttributeTargets.ReturnValue) {
|
||||
@@ -105,7 +119,7 @@ namespace Mono.CSharp {
|
||||
// First, call the `out of band' special method for
|
||||
// defining recursively any types we need:
|
||||
//
|
||||
var p = Parameters;
|
||||
var p = parameters;
|
||||
|
||||
if (!p.Resolve (this))
|
||||
return false;
|
||||
@@ -217,7 +231,7 @@ namespace Mono.CSharp {
|
||||
|
||||
int param = 0;
|
||||
for (int i = 0; i < Parameters.FixedParameters.Length; ++i) {
|
||||
Parameter p = Parameters [i];
|
||||
Parameter p = parameters [i];
|
||||
if ((p.ModFlags & Parameter.Modifier.ISBYREF) == 0)
|
||||
continue;
|
||||
|
||||
@@ -246,7 +260,7 @@ namespace Mono.CSharp {
|
||||
public override void DefineConstants ()
|
||||
{
|
||||
if (!Parameters.IsEmpty) {
|
||||
Parameters.ResolveDefaultValues (this);
|
||||
parameters.ResolveDefaultValues (this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -267,7 +281,7 @@ namespace Mono.CSharp {
|
||||
}
|
||||
}
|
||||
|
||||
Parameters.ApplyAttributes (this, InvokeBuilder.MethodBuilder);
|
||||
parameters.ApplyAttributes (this, InvokeBuilder.MethodBuilder);
|
||||
|
||||
Constructor.ConstructorBuilder.SetImplementationFlags (MethodImplAttributes.Runtime);
|
||||
InvokeBuilder.MethodBuilder.SetImplementationFlags (MethodImplAttributes.Runtime);
|
||||
@@ -314,7 +328,7 @@ namespace Mono.CSharp {
|
||||
return false;
|
||||
}
|
||||
|
||||
Parameters.VerifyClsCompliance (this);
|
||||
parameters.VerifyClsCompliance (this);
|
||||
|
||||
if (!ReturnType.Type.IsCLSCompliant ()) {
|
||||
Report.Warning (3002, 1, Location, "Return type of `{0}' is not CLS-compliant",
|
||||
|
||||
+1
-1
@@ -616,7 +616,7 @@ namespace Mono.CSharp {
|
||||
xref.SetAttribute ("cref", "N:" + ns.GetSignatureForError ());
|
||||
return; // a namespace
|
||||
}
|
||||
if (GlobalRootNamespace.Instance.IsNamespace (name)) {
|
||||
if (mc.Compiler.GlobalRootNamespace.IsNamespace (name)) {
|
||||
xref.SetAttribute ("cref", "N:" + name);
|
||||
return; // a namespace
|
||||
}
|
||||
|
||||
+5
-6
@@ -413,9 +413,9 @@ namespace Mono.CSharp
|
||||
|
||||
// Extern aliased refs require special handling
|
||||
if (alias == null)
|
||||
GlobalRootNamespace.Instance.AddAssemblyReference (a);
|
||||
ctx.GlobalRootNamespace.AddAssemblyReference (a);
|
||||
else
|
||||
GlobalRootNamespace.Instance.DefineRootNamespace (alias, a, ctx);
|
||||
ctx.GlobalRootNamespace.DefineRootNamespace (alias, a, ctx);
|
||||
|
||||
} catch (BadImageFormatException f) {
|
||||
// .NET 2.0 throws this if we try to load a module without an assembly manifest ...
|
||||
@@ -455,7 +455,7 @@ namespace Mono.CSharp
|
||||
}
|
||||
}
|
||||
|
||||
GlobalRootNamespace.Instance.AddModuleReference (m);
|
||||
ctx.GlobalRootNamespace.AddModuleReference (m);
|
||||
|
||||
} catch (BadImageFormatException f) {
|
||||
Error9 ("module", f.FileName, f.FusionLog);
|
||||
@@ -487,7 +487,7 @@ namespace Mono.CSharp
|
||||
foreach (var entry in external_aliases)
|
||||
LoadAssembly (entry.Value, entry.Key, false);
|
||||
|
||||
GlobalRootNamespace.Instance.ComputeNamespaces (ctx);
|
||||
ctx.GlobalRootNamespace.ComputeNamespaces (ctx);
|
||||
}
|
||||
|
||||
static string [] LoadArgs (string file)
|
||||
@@ -1695,7 +1695,7 @@ namespace Mono.CSharp
|
||||
set_method.Invoke (CodeGen.Assembly.Builder, BindingFlags.Default, null, new object[]{true}, null);
|
||||
}
|
||||
|
||||
GlobalRootNamespace.Instance.AddModuleReference (RootContext.ToplevelTypes.Builder);
|
||||
ctx.GlobalRootNamespace.AddModuleReference (RootContext.ToplevelTypes.Builder);
|
||||
|
||||
//
|
||||
// Load assemblies required
|
||||
@@ -2036,7 +2036,6 @@ namespace Mono.CSharp
|
||||
PointerContainer.Reset ();
|
||||
Parameter.Reset ();
|
||||
|
||||
GlobalRootNamespace.Reset ();
|
||||
Unary.Reset ();
|
||||
Binary.Reset ();
|
||||
ConstantFold.Reset ();
|
||||
|
||||
@@ -1873,6 +1873,16 @@ namespace Mono.CSharp {
|
||||
this.loc = orig_expr.Location;
|
||||
}
|
||||
|
||||
#region Properties
|
||||
|
||||
public Expression OriginalExpression {
|
||||
get {
|
||||
return orig_expr;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
//
|
||||
// Creates fully resolved expression switcher
|
||||
//
|
||||
|
||||
+4
-24
@@ -879,7 +879,7 @@ namespace Mono.CSharp {
|
||||
{
|
||||
lock (evaluator_lock){
|
||||
driver.LoadAssembly (file, false);
|
||||
GlobalRootNamespace.Instance.ComputeNamespaces (ctx);
|
||||
ctx.GlobalRootNamespace.ComputeNamespaces (ctx);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -891,7 +891,7 @@ namespace Mono.CSharp {
|
||||
lock (evaluator_lock){
|
||||
// GlobalRootNamespace.Instance.AddAssemblyReference (a);
|
||||
// GlobalRootNamespace.Instance.ComputeNamespaces (ctx);
|
||||
ctx.MetaImporter.ImportAssembly (a, GlobalRootNamespace.Instance);
|
||||
ctx.MetaImporter.ImportAssembly (a, ctx.GlobalRootNamespace);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1186,32 +1186,12 @@ namespace Mono.CSharp {
|
||||
}
|
||||
|
||||
// This means its really a statement.
|
||||
if (clone.Type == TypeManager.void_type){
|
||||
source = source.Resolve (ec);
|
||||
target = null;
|
||||
type = TypeManager.void_type;
|
||||
eclass = ExprClass.Value;
|
||||
return this;
|
||||
if (clone.Type == TypeManager.void_type || clone is DynamicInvocation || clone is Assign) {
|
||||
return clone;
|
||||
}
|
||||
|
||||
return base.DoResolve (ec);
|
||||
}
|
||||
|
||||
public override void Emit (EmitContext ec)
|
||||
{
|
||||
if (target == null)
|
||||
source.Emit (ec);
|
||||
else
|
||||
base.Emit (ec);
|
||||
}
|
||||
|
||||
public override void EmitStatement (EmitContext ec)
|
||||
{
|
||||
if (target == null)
|
||||
source.Emit (ec);
|
||||
else
|
||||
base.EmitStatement (ec);
|
||||
}
|
||||
}
|
||||
|
||||
public class Undo {
|
||||
|
||||
@@ -7174,7 +7174,7 @@ namespace Mono.CSharp {
|
||||
public override FullNamedExpression ResolveAsTypeStep (IMemberContext ec, bool silent)
|
||||
{
|
||||
if (alias == GlobalAlias) {
|
||||
expr = GlobalRootNamespace.Instance;
|
||||
expr = ec.Compiler.GlobalRootNamespace;
|
||||
return base.ResolveAsTypeStep (ec, silent);
|
||||
}
|
||||
|
||||
|
||||
+22
-6
@@ -510,10 +510,18 @@ namespace Mono.CSharp {
|
||||
}
|
||||
|
||||
//
|
||||
// Is the member of the correct type ?
|
||||
// Destructors are ignored as they cannot be overridden by user
|
||||
// Is the member of same type ?
|
||||
//
|
||||
if ((entry.Kind & ~MemberKind.Destructor & mkind & MemberKind.MaskType) == 0) {
|
||||
if ((entry.Kind & MemberKind.Destructor) == 0 && (member_param == null || !(entry is IParametersMember))) {
|
||||
// Destructors are ignored as they cannot be overridden by user
|
||||
if ((entry.Kind & MemberKind.Destructor) != 0)
|
||||
continue;
|
||||
|
||||
// Only different arity methods hide
|
||||
if (mkind != MemberKind.Method && member.MemberName.Arity != entry.Arity)
|
||||
continue;
|
||||
|
||||
if ((member_param == null || !(entry is IParametersMember))) {
|
||||
bestCandidate = entry;
|
||||
return null;
|
||||
}
|
||||
@@ -535,13 +543,21 @@ namespace Mono.CSharp {
|
||||
continue;
|
||||
|
||||
var pm = entry as IParametersMember;
|
||||
if (pm == null)
|
||||
continue;
|
||||
AParametersCollection entry_parameters;
|
||||
if (pm == null) {
|
||||
if (entry.Kind != MemberKind.Delegate)
|
||||
continue;
|
||||
|
||||
// TODO: I don't have DelegateSpec
|
||||
entry_parameters = Delegate.GetParameters (member.Compiler, (TypeSpec) entry);
|
||||
} else {
|
||||
entry_parameters = pm.Parameters;
|
||||
}
|
||||
|
||||
if (entry.IsAccessor != member is AbstractPropertyEventMethod)
|
||||
continue;
|
||||
|
||||
if (!TypeSpecComparer.Override.IsEqual (pm.Parameters, member_param))
|
||||
if (!TypeSpecComparer.Override.IsEqual (entry_parameters, member_param))
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
+20
-23
@@ -83,25 +83,18 @@ namespace Mono.CSharp {
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: It should go to AssemblyClass or AssemblySpec
|
||||
public class GlobalRootNamespace : RootNamespace {
|
||||
Module [] modules;
|
||||
Dictionary<string, RootNamespace> root_namespaces;
|
||||
|
||||
// TODO: Breaks dynamic/eval
|
||||
public static GlobalRootNamespace Instance = new GlobalRootNamespace ();
|
||||
|
||||
GlobalRootNamespace ()
|
||||
public GlobalRootNamespace ()
|
||||
: base ("global")
|
||||
{
|
||||
root_namespaces = new Dictionary<string, RootNamespace> ();
|
||||
root_namespaces.Add (alias_name, this);
|
||||
}
|
||||
|
||||
public static void Reset ()
|
||||
{
|
||||
Instance = new GlobalRootNamespace ();
|
||||
}
|
||||
|
||||
public Assembly [] Assemblies {
|
||||
get { return referenced_assemblies; }
|
||||
}
|
||||
@@ -695,9 +688,9 @@ namespace Mono.CSharp {
|
||||
this.Location = loc;
|
||||
}
|
||||
|
||||
public virtual FullNamedExpression Resolve (IMemberContext rc)
|
||||
public virtual FullNamedExpression Resolve (IMemberContext rc, bool local)
|
||||
{
|
||||
FullNamedExpression fne = GlobalRootNamespace.Instance.GetRootNamespace (Alias);
|
||||
FullNamedExpression fne = rc.Compiler.GlobalRootNamespace.GetRootNamespace (Alias);
|
||||
if (fne == null) {
|
||||
rc.Compiler.Report.Error (430, Location,
|
||||
"The extern alias `{0}' was not specified in -reference option",
|
||||
@@ -724,12 +717,12 @@ namespace Mono.CSharp {
|
||||
this.value = name;
|
||||
}
|
||||
|
||||
public override FullNamedExpression Resolve (IMemberContext rc)
|
||||
public override FullNamedExpression Resolve (IMemberContext rc, bool local)
|
||||
{
|
||||
if (resolved != null || value == null)
|
||||
return resolved;
|
||||
|
||||
if (rc == null)
|
||||
if (local)
|
||||
return null;
|
||||
|
||||
resolved = value.GetTypeExpression ().ResolveAsTypeStep (rc, false);
|
||||
@@ -765,6 +758,7 @@ namespace Mono.CSharp {
|
||||
public readonly DeclSpace SlaveDeclSpace;
|
||||
static readonly Namespace [] empty_namespaces = new Namespace [0];
|
||||
Namespace [] namespace_using_table;
|
||||
CompilerContext ctx;
|
||||
|
||||
static List<NamespaceEntry> entries = new List<NamespaceEntry> ();
|
||||
|
||||
@@ -773,8 +767,10 @@ namespace Mono.CSharp {
|
||||
entries = new List<NamespaceEntry> ();
|
||||
}
|
||||
|
||||
public NamespaceEntry (NamespaceEntry parent, CompilationUnit file, string name)
|
||||
// TODO: ctx should be a module
|
||||
public NamespaceEntry (CompilerContext ctx, NamespaceEntry parent, CompilationUnit file, string name)
|
||||
{
|
||||
this.ctx = ctx;
|
||||
this.parent = parent;
|
||||
this.file = file;
|
||||
entries.Add (this);
|
||||
@@ -782,14 +778,15 @@ namespace Mono.CSharp {
|
||||
if (parent != null)
|
||||
ns = parent.NS.GetNamespace (name, true);
|
||||
else if (name != null)
|
||||
ns = GlobalRootNamespace.Instance.GetNamespace (name, true);
|
||||
ns = Compiler.GlobalRootNamespace.GetNamespace (name, true);
|
||||
else
|
||||
ns = GlobalRootNamespace.Instance;
|
||||
ns = Compiler.GlobalRootNamespace;
|
||||
SlaveDeclSpace = new RootDeclSpace (this);
|
||||
}
|
||||
|
||||
private NamespaceEntry (NamespaceEntry parent, CompilationUnit file, Namespace ns, bool slave)
|
||||
private NamespaceEntry (CompilerContext ctx, NamespaceEntry parent, CompilationUnit file, Namespace ns, bool slave)
|
||||
{
|
||||
this.ctx = ctx;
|
||||
this.parent = parent;
|
||||
this.file = file;
|
||||
this.IsImplicit = true;
|
||||
@@ -872,7 +869,7 @@ namespace Mono.CSharp {
|
||||
NamespaceEntry Doppelganger {
|
||||
get {
|
||||
if (!IsImplicit && doppelganger == null) {
|
||||
doppelganger = new NamespaceEntry (ImplicitParent, file, ns, true);
|
||||
doppelganger = new NamespaceEntry (ctx, ImplicitParent, file, ns, true);
|
||||
doppelganger.using_aliases = using_aliases;
|
||||
}
|
||||
return doppelganger;
|
||||
@@ -894,7 +891,7 @@ namespace Mono.CSharp {
|
||||
if (implicit_parent == null) {
|
||||
implicit_parent = (parent.NS == ns.Parent)
|
||||
? parent
|
||||
: new NamespaceEntry (parent, file, ns.Parent, false);
|
||||
: new NamespaceEntry (ctx, parent, file, ns.Parent, false);
|
||||
}
|
||||
return implicit_parent;
|
||||
}
|
||||
@@ -1065,7 +1062,7 @@ namespace Mono.CSharp {
|
||||
|
||||
foreach (UsingAliasEntry ue in n.using_aliases) {
|
||||
if (ue.Alias == name)
|
||||
return ue.Resolve (Doppelganger);
|
||||
return ue.Resolve (Doppelganger ?? this, Doppelganger == null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1098,7 +1095,7 @@ namespace Mono.CSharp {
|
||||
}
|
||||
}
|
||||
|
||||
return ue.Resolve (Doppelganger);
|
||||
return ue.Resolve (Doppelganger ?? this, Doppelganger == null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1252,7 +1249,7 @@ namespace Mono.CSharp {
|
||||
{
|
||||
if (using_aliases != null) {
|
||||
foreach (UsingAliasEntry ue in using_aliases)
|
||||
ue.Resolve (Doppelganger);
|
||||
ue.Resolve (Doppelganger, Doppelganger == null);
|
||||
}
|
||||
|
||||
if (using_clauses != null) {
|
||||
@@ -1284,7 +1281,7 @@ namespace Mono.CSharp {
|
||||
#region IMemberContext Members
|
||||
|
||||
public CompilerContext Compiler {
|
||||
get { return RootContext.ToplevelTypes.Compiler; }
|
||||
get { return ctx; }
|
||||
}
|
||||
|
||||
public TypeSpec CurrentType {
|
||||
|
||||
@@ -226,7 +226,7 @@ namespace Mono.CSharp {
|
||||
|
||||
public static TypeSpec CoreLookupType (CompilerContext ctx, string ns_name, string name, int arity, MemberKind kind, bool required)
|
||||
{
|
||||
Namespace ns = GlobalRootNamespace.Instance.GetNamespace (ns_name, true);
|
||||
Namespace ns = ctx.GlobalRootNamespace.GetNamespace (ns_name, true);
|
||||
var te = ns.LookupType (ctx, name, arity, !required, Location.Null);
|
||||
var ts = te == null ? null : te.Type;
|
||||
|
||||
@@ -355,7 +355,7 @@ namespace Mono.CSharp {
|
||||
continue;
|
||||
|
||||
if (!RootContext.StdLib) {
|
||||
var ns = GlobalRootNamespace.Instance.GetNamespace (p.Namespace, false);
|
||||
var ns = ctx.GlobalRootNamespace.GetNamespace (p.Namespace, false);
|
||||
ns.ReplaceTypeWithPredefined (found, p);
|
||||
|
||||
var tc = found.MemberDefinition as TypeContainer;
|
||||
|
||||
+66
-40
@@ -7,21 +7,19 @@
|
||||
%define sgen no
|
||||
%endif
|
||||
|
||||
%if %llvm == yes
|
||||
%define enable_llvm --enable-loadedllvm
|
||||
%endif
|
||||
|
||||
Name: mono-core
|
||||
License: LGPL v2.1 only
|
||||
Group: Development/Languages/Mono
|
||||
Summary: A .NET Runtime Environment
|
||||
Url: http://www.mono-project.com
|
||||
Version: @VERSION@
|
||||
Release: 30
|
||||
Release: 0
|
||||
Source0: mono-%{version}.tar.bz2
|
||||
BuildRequires: bison
|
||||
BuildRequires: fdupes
|
||||
BuildRequires: gcc-c++
|
||||
BuildRequires: pkgconfig
|
||||
BuildRequires: xorg-x11-libX11-devel
|
||||
BuildRequires: zlib-devel
|
||||
%ifnarch ia64
|
||||
BuildRequires: valgrind-devel
|
||||
@@ -95,9 +93,15 @@ export CFLAGS=" $RPM_OPT_FLAGS -fno-strict-aliasing"
|
||||
export PATH=/opt/novell/llvm-mono/bin:$PATH
|
||||
%endif
|
||||
%configure \
|
||||
--with-ikvm=yes \
|
||||
--with-sgen=%{sgen} \
|
||||
%{?enable_llvm} \
|
||||
%if %llvm == yes
|
||||
--enable-loadedllvm \
|
||||
--disable-system-aot \
|
||||
%endif
|
||||
%ifnarch %ix86 x86_64
|
||||
--disable-system-aot \
|
||||
%endif
|
||||
--with-ikvm=yes \
|
||||
--with-moonlight=no
|
||||
make # We are not -jN safe! %{?jobs:-j%jobs}
|
||||
|
||||
@@ -122,9 +126,10 @@ rm -f %buildroot%_prefix/lib/mono/*/culevel.exe*
|
||||
rm -f %buildroot%_prefix/lib/mono/2.0/cilc.exe*
|
||||
# brp-compress doesn't search _mandir
|
||||
# so we cheat it
|
||||
ln -s . %buildroot%_prefix/usr
|
||||
ln -s . %buildroot%_prefix%_prefix
|
||||
RPM_BUILD_ROOT=%buildroot%_prefix /usr/lib/rpm/brp-compress
|
||||
rm %buildroot%_prefix/usr
|
||||
rm %buildroot%_prefix%_prefix
|
||||
%fdupes %buildroot%_prefix
|
||||
%find_lang mcs
|
||||
|
||||
%clean
|
||||
@@ -148,6 +153,8 @@ rm -rf %buildroot
|
||||
%dir %_sysconfdir/mono
|
||||
%dir %_sysconfdir/mono/2.0
|
||||
%dir %_sysconfdir/mono/4.0
|
||||
%_bindir/al
|
||||
%_bindir/al2
|
||||
%_bindir/certmgr
|
||||
%_bindir/chktrust
|
||||
%_bindir/csharp
|
||||
@@ -203,6 +210,7 @@ rm -rf %buildroot
|
||||
%_prefix/lib/mono/2.0/System.Xml.Linq.dll
|
||||
%_prefix/lib/mono/2.0/System.Xml.dll
|
||||
%_prefix/lib/mono/2.0/System.dll
|
||||
%_prefix/lib/mono/2.0/al.exe*
|
||||
%_prefix/lib/mono/2.0/cscompmgd.dll
|
||||
%_prefix/lib/mono/2.0/csharp.exe*
|
||||
%_prefix/lib/mono/2.0/gacutil.exe*
|
||||
@@ -234,6 +242,7 @@ rm -rf %buildroot
|
||||
%_prefix/lib/mono/4.0/System.Xml.Linq.dll
|
||||
%_prefix/lib/mono/4.0/System.Xml.dll
|
||||
%_prefix/lib/mono/4.0/System.dll
|
||||
%_prefix/lib/mono/4.0/al.exe*
|
||||
%_prefix/lib/mono/4.0/certmgr.exe*
|
||||
%_prefix/lib/mono/4.0/chktrust.exe*
|
||||
%_prefix/lib/mono/4.0/cscompmgd.dll
|
||||
@@ -303,6 +312,7 @@ A Library for embedding Mono in your Application.
|
||||
License: LGPL v2.1 only
|
||||
Summary: Development files for libmono
|
||||
Group: Development/Languages/Mono
|
||||
Requires: mono-core == %version-%release
|
||||
|
||||
%description -n libmono-2_0-devel
|
||||
The Mono Project is an open development initiative that is working to
|
||||
@@ -347,6 +357,7 @@ A Library for embedding Mono in your Application (sgen version).
|
||||
License: LGPL v2.1 only
|
||||
Summary: Development files for libmonosgen
|
||||
Group: Development/Languages/Mono
|
||||
Requires: mono-core == %version-%release
|
||||
|
||||
%description -n libmonosgen-2_0-devel
|
||||
The Mono Project is an open development initiative that is working to
|
||||
@@ -456,19 +467,19 @@ Database connectivity for Mono.
|
||||
%_prefix/lib/mono/2.0/Novell.Directory.Ldap.dll
|
||||
%_prefix/lib/mono/2.0/System.Data.DataSetExtensions.dll
|
||||
%_prefix/lib/mono/2.0/System.Data.Linq.dll
|
||||
%_prefix/lib/mono/2.0/System.Data.Services.dll
|
||||
%_prefix/lib/mono/2.0/System.Data.dll
|
||||
%_prefix/lib/mono/2.0/System.DirectoryServices.dll
|
||||
%_prefix/lib/mono/2.0/System.EnterpriseServices.dll
|
||||
%_prefix/lib/mono/2.0/System.Runtime.Serialization.dll
|
||||
%_prefix/lib/mono/2.0/System.Transactions.dll
|
||||
%_prefix/lib/mono/4.0/Mono.Data.Tds.dll
|
||||
%_prefix/lib/mono/4.0/Novell.Directory.Ldap.dll
|
||||
%_prefix/lib/mono/4.0/System.Data.DataSetExtensions.dll
|
||||
%_prefix/lib/mono/4.0/System.Data.Linq.dll
|
||||
%_prefix/lib/mono/4.0/System.Data.Services.dll
|
||||
%_prefix/lib/mono/4.0/System.Data.dll
|
||||
%_prefix/lib/mono/4.0/System.DirectoryServices.dll
|
||||
%_prefix/lib/mono/4.0/System.EnterpriseServices.dll
|
||||
%_prefix/lib/mono/4.0/System.Runtime.Serialization.dll
|
||||
%_prefix/lib/mono/4.0/System.Transactions.dll
|
||||
%_prefix/lib/mono/4.0/sqlmetal.exe*
|
||||
%_prefix/lib/mono/4.0/sqlsharp.exe*
|
||||
@@ -477,9 +488,9 @@ Database connectivity for Mono.
|
||||
%_prefix/lib/mono/gac/System.Data
|
||||
%_prefix/lib/mono/gac/System.Data.DataSetExtensions
|
||||
%_prefix/lib/mono/gac/System.Data.Linq
|
||||
%_prefix/lib/mono/gac/System.Data.Services
|
||||
%_prefix/lib/mono/gac/System.DirectoryServices
|
||||
%_prefix/lib/mono/gac/System.EnterpriseServices
|
||||
%_prefix/lib/mono/gac/System.Runtime.Serialization
|
||||
%_prefix/lib/mono/gac/System.Transactions
|
||||
|
||||
%package -n mono-winforms
|
||||
@@ -649,31 +660,28 @@ Mono implementation of WCF, Windows Communication Foundation
|
||||
%defattr(-, root, root)
|
||||
%_bindir/svcutil
|
||||
%_libdir/pkgconfig/wcf.pc
|
||||
%_prefix/lib/mono/2.0/System.Data.Services.dll
|
||||
%_prefix/lib/mono/2.0/System.IdentityModel.Selectors.dll
|
||||
%_prefix/lib/mono/2.0/System.IdentityModel.dll
|
||||
%_prefix/lib/mono/2.0/System.Runtime.Serialization.dll
|
||||
%_prefix/lib/mono/2.0/System.ServiceModel.Web.dll
|
||||
%_prefix/lib/mono/2.0/System.ServiceModel.dll
|
||||
%_prefix/lib/mono/4.0/System.Data.Services.dll
|
||||
%_prefix/lib/mono/4.0/System.IdentityModel.Selectors.dll
|
||||
%_prefix/lib/mono/4.0/System.IdentityModel.dll
|
||||
%_prefix/lib/mono/4.0/System.Runtime.DurableInstancing.dll
|
||||
%_prefix/lib/mono/4.0/System.Runtime.Serialization.dll
|
||||
%_prefix/lib/mono/4.0/System.ServiceModel.Discovery.dll
|
||||
%_prefix/lib/mono/4.0/System.ServiceModel.Routing.dll
|
||||
%_prefix/lib/mono/4.0/System.ServiceModel.Web.dll
|
||||
%_prefix/lib/mono/4.0/System.ServiceModel.dll
|
||||
%_prefix/lib/mono/4.0/System.Web.ApplicationServices.dll
|
||||
%_prefix/lib/mono/4.0/svcutil.exe*
|
||||
%_prefix/lib/mono/gac/System.Data.Services.Client
|
||||
%_prefix/lib/mono/gac/System.Data.Services
|
||||
%_prefix/lib/mono/gac/System.IdentityModel
|
||||
%_prefix/lib/mono/gac/System.IdentityModel.Selectors
|
||||
%_prefix/lib/mono/gac/System.Runtime.DurableInstancing
|
||||
%_prefix/lib/mono/gac/System.Runtime.Serialization
|
||||
%_prefix/lib/mono/gac/System.ServiceModel
|
||||
%_prefix/lib/mono/gac/System.ServiceModel.Discovery
|
||||
%_prefix/lib/mono/gac/System.ServiceModel.Routing
|
||||
%_prefix/lib/mono/gac/System.ServiceModel.Web
|
||||
%_prefix/lib/mono/gac/System.Web.ApplicationServices
|
||||
|
||||
%package -n mono-winfxcore
|
||||
License: MIT License (or similar) ; Ms-Pl
|
||||
@@ -694,6 +702,7 @@ Mono implementation of core WinFX APIs
|
||||
%defattr(-, root, root)
|
||||
%_prefix/lib/mono/2.0/WindowsBase.dll*
|
||||
%_prefix/lib/mono/4.0/WindowsBase.dll*
|
||||
%_prefix/lib/mono/gac/System.Data.Services.Client
|
||||
%_prefix/lib/mono/gac/WindowsBase
|
||||
|
||||
%package -n mono-web
|
||||
@@ -739,10 +748,6 @@ Mono implementation of ASP.NET, Remoting and Web Services.
|
||||
%_bindir/wsdl2
|
||||
%_bindir/xsd
|
||||
%_libdir/pkgconfig/mono.web.pc
|
||||
%_libdir/pkgconfig/system.web.extensions.design_1.0.pc
|
||||
%_libdir/pkgconfig/system.web.extensions_1.0.pc
|
||||
%_libdir/pkgconfig/system.web.mvc.pc
|
||||
%_libdir/pkgconfig/system.web.mvc2.pc
|
||||
%_mandir/man1/disco.1%ext_man
|
||||
%_mandir/man1/mconfig.1%ext_man
|
||||
%_mandir/man1/soapsuds.1%ext_man
|
||||
@@ -754,16 +759,11 @@ Mono implementation of ASP.NET, Remoting and Web Services.
|
||||
%_prefix/lib/mono/2.0/System.Runtime.Remoting.dll
|
||||
%_prefix/lib/mono/2.0/System.Runtime.Serialization.Formatters.Soap.dll
|
||||
%_prefix/lib/mono/2.0/System.Web.Abstractions.dll
|
||||
%_prefix/lib/mono/2.0/System.Web.DynamicData.dll
|
||||
%_prefix/lib/mono/2.0/System.Web.Extensions.Design.dll
|
||||
%_prefix/lib/mono/2.0/System.Web.Extensions.dll
|
||||
%_prefix/lib/mono/2.0/System.Web.Mvc.dll
|
||||
%_prefix/lib/mono/2.0/System.Web.Routing.dll
|
||||
%_prefix/lib/mono/2.0/System.Web.Services.dll
|
||||
%_prefix/lib/mono/2.0/System.Web.dll
|
||||
%_prefix/lib/mono/2.0/wsdl.exe*
|
||||
%_prefix/lib/mono/2.0/xsd.exe*
|
||||
%_prefix/lib/mono/3.5/System.Web.Extensions.Design.dll
|
||||
%_prefix/lib/mono/4.0/Mono.Http.dll
|
||||
%_prefix/lib/mono/4.0/Mono.Web.dll
|
||||
%_prefix/lib/mono/4.0/System.ComponentModel.Composition.dll
|
||||
@@ -771,9 +771,7 @@ Mono implementation of ASP.NET, Remoting and Web Services.
|
||||
%_prefix/lib/mono/4.0/System.Runtime.Remoting.dll
|
||||
%_prefix/lib/mono/4.0/System.Runtime.Serialization.Formatters.Soap.dll
|
||||
%_prefix/lib/mono/4.0/System.Web.Abstractions.dll
|
||||
%_prefix/lib/mono/4.0/System.Web.DynamicData.dll
|
||||
%_prefix/lib/mono/4.0/System.Web.Extensions.Design.dll
|
||||
%_prefix/lib/mono/4.0/System.Web.Extensions.dll
|
||||
%_prefix/lib/mono/4.0/System.Web.ApplicationServices.dll
|
||||
%_prefix/lib/mono/4.0/System.Web.Routing.dll
|
||||
%_prefix/lib/mono/4.0/System.Web.Services.dll
|
||||
%_prefix/lib/mono/4.0/System.Web.dll
|
||||
@@ -782,9 +780,6 @@ Mono implementation of ASP.NET, Remoting and Web Services.
|
||||
%_prefix/lib/mono/4.0/soapsuds.exe*
|
||||
%_prefix/lib/mono/4.0/wsdl.exe*
|
||||
%_prefix/lib/mono/4.0/xsd.exe*
|
||||
%_prefix/lib/mono/compat-2.0/System.Web.Extensions.Design.dll
|
||||
%_prefix/lib/mono/compat-2.0/System.Web.Extensions.dll
|
||||
%_prefix/lib/mono/compat-2.0/System.Web.Mvc.dll
|
||||
%_prefix/lib/mono/gac/Mono.Http
|
||||
%_prefix/lib/mono/gac/Mono.Web
|
||||
%_prefix/lib/mono/gac/System.ComponentModel.Composition
|
||||
@@ -793,12 +788,46 @@ Mono implementation of ASP.NET, Remoting and Web Services.
|
||||
%_prefix/lib/mono/gac/System.Runtime.Serialization.Formatters.Soap
|
||||
%_prefix/lib/mono/gac/System.Web
|
||||
%_prefix/lib/mono/gac/System.Web.Abstractions
|
||||
%_prefix/lib/mono/gac/System.Web.ApplicationServices
|
||||
%_prefix/lib/mono/gac/System.Web.Routing
|
||||
%_prefix/lib/mono/gac/System.Web.Services
|
||||
|
||||
%package -n mono-mvc
|
||||
License: MIT License (or similar) ; Ms-Pl
|
||||
Summary: Mono implementation of ASP.NET MVC
|
||||
Group: Development/Languages/Mono
|
||||
Requires: mono-core == %version-%release
|
||||
|
||||
%description -n mono-mvc
|
||||
The Mono Project is an open development initiative that is working to
|
||||
develop an open source, Unix version of the .NET development platform.
|
||||
Its objective is to enable Unix developers to build and deploy
|
||||
cross-platform .NET applications. The project will implement various
|
||||
technologies that have been submitted to the ECMA for standardization.
|
||||
|
||||
Mono implementation of ASP.NET MVC.
|
||||
|
||||
%files -n mono-mvc
|
||||
%defattr(-, root, root)
|
||||
%_libdir/pkgconfig/system.web.extensions.design_1.0.pc
|
||||
%_libdir/pkgconfig/system.web.extensions_1.0.pc
|
||||
%_libdir/pkgconfig/system.web.mvc.pc
|
||||
%_libdir/pkgconfig/system.web.mvc2.pc
|
||||
%_prefix/lib/mono/2.0/System.Web.DynamicData.dll
|
||||
%_prefix/lib/mono/2.0/System.Web.Extensions.Design.dll
|
||||
%_prefix/lib/mono/2.0/System.Web.Extensions.dll
|
||||
%_prefix/lib/mono/2.0/System.Web.Mvc.dll
|
||||
%_prefix/lib/mono/3.5/System.Web.Extensions.Design.dll
|
||||
%_prefix/lib/mono/4.0/System.Web.DynamicData.dll
|
||||
%_prefix/lib/mono/4.0/System.Web.Extensions.Design.dll
|
||||
%_prefix/lib/mono/4.0/System.Web.Extensions.dll
|
||||
%_prefix/lib/mono/compat-2.0/System.Web.Extensions.Design.dll
|
||||
%_prefix/lib/mono/compat-2.0/System.Web.Extensions.dll
|
||||
%_prefix/lib/mono/compat-2.0/System.Web.Mvc.dll
|
||||
%_prefix/lib/mono/gac/System.Web.DynamicData
|
||||
%_prefix/lib/mono/gac/System.Web.Extensions
|
||||
%_prefix/lib/mono/gac/System.Web.Extensions.Design
|
||||
%_prefix/lib/mono/gac/System.Web.Mvc
|
||||
%_prefix/lib/mono/gac/System.Web.Routing
|
||||
%_prefix/lib/mono/gac/System.Web.Services
|
||||
|
||||
%package -n mono-data-oracle
|
||||
License: LGPL v2.1 only
|
||||
@@ -930,8 +959,6 @@ Mono development tools.
|
||||
|
||||
%files -n mono-devel
|
||||
%defattr(-, root, root)
|
||||
%_bindir/al
|
||||
%_bindir/al2
|
||||
%_bindir/caspol
|
||||
%_bindir/ccrewrite
|
||||
%_bindir/cert2spc
|
||||
@@ -1022,7 +1049,6 @@ Mono development tools.
|
||||
%_prefix/lib/mono/2.0/Microsoft.VisualBasic.targets
|
||||
%_prefix/lib/mono/2.0/Mono.Debugger.Soft.dll
|
||||
%_prefix/lib/mono/2.0/PEAPI.dll
|
||||
%_prefix/lib/mono/2.0/al.exe*
|
||||
%_prefix/lib/mono/2.0/genxs.exe*
|
||||
%_prefix/lib/mono/2.0/ilasm.exe*
|
||||
%_prefix/lib/mono/2.0/mkbundle.exe*
|
||||
@@ -1055,7 +1081,6 @@ Mono development tools.
|
||||
%_prefix/lib/mono/4.0/Microsoft.VisualBasic.targets
|
||||
%_prefix/lib/mono/4.0/Mono.CodeContracts.dll
|
||||
%_prefix/lib/mono/4.0/PEAPI.dll
|
||||
%_prefix/lib/mono/4.0/al.exe*
|
||||
%_prefix/lib/mono/4.0/caspol.exe*
|
||||
%_prefix/lib/mono/4.0/ccrewrite.exe*
|
||||
%_prefix/lib/mono/4.0/cert2spc.exe*
|
||||
@@ -1101,6 +1126,7 @@ Mono development tools.
|
||||
License: LGPL v2.1 only
|
||||
Summary: Monodoc - Documentation tools for C# code
|
||||
Group: Development/Tools/Other
|
||||
Requires: mono-core == %version-%release
|
||||
Obsoletes: monodoc
|
||||
Provides: monodoc
|
||||
# Added to uncompress and compare documentation used by build-compare
|
||||
@@ -1145,6 +1171,7 @@ Monodoc-core contains documentation tools for C#.
|
||||
License: LGPL v2.1 only
|
||||
Summary: Install everything built from the mono source tree
|
||||
Group: Development/Languages/Mono
|
||||
Requires: mono-core = %version-%release
|
||||
Requires: ibm-data-db2 = %version-%release
|
||||
Requires: libmono-2_0-1 = %version-%release
|
||||
Requires: libmono-2_0-devel = %version-%release
|
||||
@@ -1155,7 +1182,6 @@ Requires: libmono-llvm0 = %version-%release
|
||||
Requires: libmonosgen-2_0-0 = %version-%release
|
||||
Requires: libmonosgen-2_0-devel = %version-%release
|
||||
%endif
|
||||
Requires: mono-core = %version-%release
|
||||
Requires: mono-data = %version-%release
|
||||
Requires: mono-data-oracle = %version-%release
|
||||
Requires: mono-data-postgresql = %version-%release
|
||||
|
||||
+17
-4
@@ -124,6 +124,10 @@ struct _WapiFileShareLayout *_wapi_fileshare_layout = NULL;
|
||||
* 4MB array.
|
||||
*/
|
||||
static GHashTable *file_share_hash;
|
||||
static CRITICAL_SECTION file_share_hash_mutex;
|
||||
|
||||
#define file_share_hash_lock() EnterCriticalSection (&file_share_hash_mutex)
|
||||
#define file_share_hash_unlock() LeaveCriticalSection (&file_share_hash_mutex)
|
||||
|
||||
guint32 _wapi_fd_reserve;
|
||||
|
||||
@@ -220,8 +224,10 @@ static void handle_cleanup (void)
|
||||
_wapi_shm_detach (WAPI_SHM_DATA);
|
||||
_wapi_shm_detach (WAPI_SHM_FILESHARE);
|
||||
|
||||
if (file_share_hash)
|
||||
if (file_share_hash) {
|
||||
g_hash_table_destroy (file_share_hash);
|
||||
DeleteCriticalSection (&file_share_hash_mutex);
|
||||
}
|
||||
|
||||
for (i = 0; i < _WAPI_PRIVATE_MAX_SLOTS; ++i)
|
||||
g_free (_wapi_private_handles [i]);
|
||||
@@ -1643,9 +1649,9 @@ void
|
||||
_wapi_free_share_info (_WapiFileShare *share_info)
|
||||
{
|
||||
if (!_wapi_shm_enabled ()) {
|
||||
_wapi_handle_lock_shared_handles ();
|
||||
file_share_hash_lock ();
|
||||
g_hash_table_remove (file_share_hash, share_info);
|
||||
_wapi_handle_unlock_shared_handles ();
|
||||
file_share_hash_unlock ();
|
||||
} else {
|
||||
memset (share_info, '\0', sizeof(struct _WapiFileShare));
|
||||
}
|
||||
@@ -1697,11 +1703,16 @@ gboolean _wapi_handle_get_or_set_share (dev_t device, ino_t inode,
|
||||
* info. This is needed even if SHM is disabled, to track sharing inside
|
||||
* the current process.
|
||||
*/
|
||||
if (!file_share_hash)
|
||||
if (!file_share_hash) {
|
||||
file_share_hash = g_hash_table_new_full (wapi_share_info_hash, wapi_share_info_equal, NULL, g_free);
|
||||
InitializeCriticalSection (&file_share_hash_mutex);
|
||||
}
|
||||
|
||||
tmp.device = device;
|
||||
tmp.inode = inode;
|
||||
|
||||
file_share_hash_lock ();
|
||||
|
||||
file_share = g_hash_table_lookup (file_share_hash, &tmp);
|
||||
if (file_share) {
|
||||
*old_sharemode = file_share->sharemode;
|
||||
@@ -1723,6 +1734,8 @@ gboolean _wapi_handle_get_or_set_share (dev_t device, ino_t inode,
|
||||
|
||||
g_hash_table_insert (file_share_hash, file_share, file_share);
|
||||
}
|
||||
|
||||
file_share_hash_unlock ();
|
||||
} else {
|
||||
/* If a linear scan gets too slow we'll have to fit a hash
|
||||
* table onto the shared mem backing store
|
||||
|
||||
@@ -17,12 +17,8 @@
|
||||
#define _WAPI_PROCESS_CURRENT (gpointer)0xFFFFFFFF
|
||||
|
||||
/* This marks a system process that we don't have a handle on */
|
||||
/* FIXME: cope with pids > 16bit */
|
||||
#if defined(__HAIKU__)
|
||||
/* FIXME: cope with pids > 31bit? */
|
||||
#define _WAPI_PROCESS_UNHANDLED_PID_MASK 0x7FFFFFFF
|
||||
#else
|
||||
#define _WAPI_PROCESS_UNHANDLED_PID_MASK 0x7FFF
|
||||
#endif
|
||||
#define _WAPI_PROCESS_UNHANDLED (-1 & ~_WAPI_PROCESS_UNHANDLED_PID_MASK)
|
||||
|
||||
extern gpointer _wapi_process_duplicate (void);
|
||||
|
||||
@@ -1690,6 +1690,16 @@ static gboolean process_open_compare (gpointer handle, gpointer user_data)
|
||||
}
|
||||
}
|
||||
|
||||
gboolean CloseProcess(gpointer handle)
|
||||
{
|
||||
if ((GPOINTER_TO_UINT (handle) & _WAPI_PROCESS_UNHANDLED) == _WAPI_PROCESS_UNHANDLED) {
|
||||
/* This is a pseudo handle */
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
return CloseHandle (handle);
|
||||
}
|
||||
|
||||
gpointer OpenProcess (guint32 req_access G_GNUC_UNUSED, gboolean inherit G_GNUC_UNUSED, guint32 pid)
|
||||
{
|
||||
/* Find the process handle that corresponds to pid */
|
||||
@@ -1701,10 +1711,9 @@ gpointer OpenProcess (guint32 req_access G_GNUC_UNUSED, gboolean inherit G_GNUC_
|
||||
g_message ("%s: looking for process %d", __func__, pid);
|
||||
#endif
|
||||
|
||||
if (_wapi_shm_enabled ())
|
||||
handle = _wapi_search_handle (WAPI_HANDLE_PROCESS,
|
||||
process_open_compare,
|
||||
GUINT_TO_POINTER (pid), NULL, TRUE);
|
||||
handle = _wapi_search_handle (WAPI_HANDLE_PROCESS,
|
||||
process_open_compare,
|
||||
GUINT_TO_POINTER (pid), NULL, TRUE);
|
||||
if (handle == 0) {
|
||||
#if defined(PLATFORM_MACOSX) || defined(__OpenBSD__)
|
||||
if ((kill(pid, 0) == 0) || (errno == EPERM)) {
|
||||
|
||||
@@ -190,6 +190,7 @@ extern gpointer GetCurrentProcess (void);
|
||||
extern guint32 GetProcessId (gpointer handle);
|
||||
extern guint32 GetCurrentProcessId (void);
|
||||
extern gboolean EnumProcesses (guint32 *pids, guint32 len, guint32 *needed);
|
||||
extern gboolean CloseProcess (gpointer handle);
|
||||
extern gpointer OpenProcess (guint32 access, gboolean inherit, guint32 pid);
|
||||
extern gboolean GetExitCodeProcess (gpointer process, guint32 *code);
|
||||
extern gboolean GetProcessTimes (gpointer process, WapiFileTime *create_time,
|
||||
|
||||
@@ -65,7 +65,11 @@ void ves_icall_System_Diagnostics_Process_Process_free_internal (MonoObject *thi
|
||||
g_message ("%s: Closing process %p, handle %p", __func__, this, process);
|
||||
#endif
|
||||
|
||||
#if TARGET_WIN32
|
||||
CloseHandle (process);
|
||||
#else
|
||||
CloseProcess (process);
|
||||
#endif
|
||||
}
|
||||
|
||||
#define STASH_SYS_ASS(this) \
|
||||
|
||||
@@ -906,7 +906,7 @@ mono_debugger_agent_cleanup (void)
|
||||
//WaitForSingleObject (debugger_thread_handle, INFINITE);
|
||||
if (GetCurrentThreadId () != debugger_thread_id) {
|
||||
mono_mutex_lock (&debugger_thread_exited_mutex);
|
||||
if (!debugger_thread_exited) {
|
||||
while (!debugger_thread_exited) {
|
||||
#ifdef HOST_WIN32
|
||||
if (WAIT_TIMEOUT == WaitForSingleObject(debugger_thread_exited_cond, 0)) {
|
||||
mono_mutex_unlock (&debugger_thread_exited_mutex);
|
||||
|
||||
@@ -3792,7 +3792,7 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
|
||||
*/
|
||||
mono_add_patch_info (cfg, offset, MONO_PATCH_INFO_SWITCH, ins->inst_p0);
|
||||
max_len += 4 * GPOINTER_TO_INT (ins->klass);
|
||||
if (offset > (cfg->code_size - max_len - 16)) {
|
||||
if (offset + max_len > (cfg->code_size - 16)) {
|
||||
cfg->code_size += max_len;
|
||||
cfg->code_size *= 2;
|
||||
cfg->native_code = g_realloc (cfg->native_code, cfg->code_size);
|
||||
|
||||
Reference in new issue
Block a user