This patch does the following things:
* Adds support to build without Code Access Security, by using the new
define DISABLE_CAS_USE. The reason is that this is both slow, and
Mono does not actually offer a Code Access Secured environment. So
avoid paying the price.
* Removes some warnings from the build for unused variables.
* Allows the code to be bootstrapped with a 2.0 compiler (which Mono
does during the bootstrap phase currently).
#if !FEATURE_NETCORE
[NonSerialized()]
#endif
#if !FEATURE_NETCORE
[NonSerialized()]
#endif
- public static readonly TimeSpan InfiniteMatchTimeout = Timeout.InfiniteTimeSpan;
+ public static readonly TimeSpan InfiniteMatchTimeout =
+#if BOOTSTRAP_BASIC
+ new TimeSpan (0, 0, 0, 0, Timeout.Infinite);
+#else
+ Timeout.InfiniteTimeSpan;
+#endif
#else
internal static readonly TimeSpan InfiniteMatchTimeout = new TimeSpan(0, 0, 0, 0, Timeout.Infinite);
#endif
#else
internal static readonly TimeSpan InfiniteMatchTimeout = new TimeSpan(0, 0, 0, 0, Timeout.Infinite);
#endif
* This method is internal virtual so the jit does not inline it.
*/
[
* This method is internal virtual so the jit does not inline it.
*/
[
HostProtection(MayLeakOnAbort=true),
HostProtection(MayLeakOnAbort=true),
MethodImplAttribute(MethodImplOptions.NoInlining)
]
internal RegexRunnerFactory Compile(RegexCode code, RegexOptions roptions) {
MethodImplAttribute(MethodImplOptions.NoInlining)
]
internal RegexRunnerFactory Compile(RegexCode code, RegexOptions roptions) {
#if !SILVERLIGHT
/// <devdoc>
/// </devdoc>
#if !SILVERLIGHT
/// <devdoc>
/// </devdoc>
[HostProtection(MayLeakOnAbort=true)]
[HostProtection(MayLeakOnAbort=true)]
[ResourceExposure(ResourceScope.Machine)] // The AssemblyName is interesting.
[ResourceConsumption(ResourceScope.Machine)]
[SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId="assemblyname", Justification="[....]: already shipped since v1 - can't fix without causing a breaking change")]
[ResourceExposure(ResourceScope.Machine)] // The AssemblyName is interesting.
[ResourceConsumption(ResourceScope.Machine)]
[SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId="assemblyname", Justification="[....]: already shipped since v1 - can't fix without causing a breaking change")]
/// <devdoc>
/// </devdoc>
/// <devdoc>
/// </devdoc>
[HostProtection(MayLeakOnAbort=true)]
[HostProtection(MayLeakOnAbort=true)]
[ResourceExposure(ResourceScope.Machine)] // The AssemblyName is interesting.
[ResourceConsumption(ResourceScope.Machine)]
[SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId="assemblyname", Justification="[....]: already shipped since v1 - can't fix without causing a breaking change")]
[ResourceExposure(ResourceScope.Machine)] // The AssemblyName is interesting.
[ResourceConsumption(ResourceScope.Machine)]
[SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId="assemblyname", Justification="[....]: already shipped since v1 - can't fix without causing a breaking change")]
CompileToAssemblyInternal(regexinfos, assemblyname, attributes, null);
}
CompileToAssemblyInternal(regexinfos, assemblyname, attributes, null);
}
[HostProtection(MayLeakOnAbort=true)]
[HostProtection(MayLeakOnAbort=true)]
[ResourceExposure(ResourceScope.Machine)]
[ResourceConsumption(ResourceScope.Machine)]
[SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId="assemblyname", Justification="[....]: already shipped since v1 - can't fix without causing a breaking change")]
[ResourceExposure(ResourceScope.Machine)]
[ResourceConsumption(ResourceScope.Machine)]
[SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId="assemblyname", Justification="[....]: already shipped since v1 - can't fix without causing a breaking change")]
static RegexCompiler() {
// <SECREVIEW> Regex only generates string manipulation, so this is ok.
// </SECREVIEW>
static RegexCompiler() {
// <SECREVIEW> Regex only generates string manipulation, so this is ok.
// </SECREVIEW>
new ReflectionPermission(PermissionState.Unrestricted).Assert();
new ReflectionPermission(PermissionState.Unrestricted).Assert();
try {
// note some fields
_textbegF = RegexRunnerField("runtextbeg");
try {
// note some fields
_textbegF = RegexRunnerField("runtextbeg");
// <SECREVIEW> Regex only generates string manipulation, so this is ok.
// </SECREVIEW>
// <SECREVIEW> Regex only generates string manipulation, so this is ok.
// </SECREVIEW>
new ReflectionPermission(PermissionState.Unrestricted).Assert();
new ReflectionPermission(PermissionState.Unrestricted).Assert();
try {
factory = c.FactoryInstanceFromCode(code, options);
}
try {
factory = c.FactoryInstanceFromCode(code, options);
}
new ReflectionPermission(PermissionState.Unrestricted).Assert();
new ReflectionPermission(PermissionState.Unrestricted).Assert();
try {
factory = c.FactoryTypeFromCode(code, options, fullname);
c.GenerateRegexType(pattern, options, fullname, regexes[i].IsPublic, code, tree, factory, mTimeout);
try {
factory = c.FactoryTypeFromCode(code, options, fullname);
c.GenerateRegexType(pattern, options, fullname, regexes[i].IsPublic, code, tree, factory, mTimeout);
* grouping stack when they get too full.
*/
internal void GenerateMiddleSection() {
* grouping stack when they get too full.
*/
internal void GenerateMiddleSection() {
+#pragma warning disable 219
Label l1 = DefineLabel();
Label l1 = DefineLabel();
+#pragma warning restore 219
Label lAdvance = DefineLabel();
Label lFail = DefineLabel();
Label lStart = DefineLabel();
Label lAdvance = DefineLabel();
Label lFail = DefineLabel();
Label lStart = DefineLabel();
+#pragma warning disable 219
Label lOutOfRange = DefineLabel();
Label lOutOfRange = DefineLabel();
+#pragma warning restore 219
Label lPartialMatch = DefineLabel();
Label lPartialMatch = DefineLabel();
}
else {
LocalBuilder cV = _temp2V;
}
else {
LocalBuilder cV = _temp2V;
+#pragma warning disable 219
LocalBuilder chV = _tempV;
LocalBuilder chV = _tempV;
+#pragma warning restore 219
Label l1 = DefineLabel();
Label l2 = DefineLabel();
Label l3 = DefineLabel();
Label l1 = DefineLabel();
Label l2 = DefineLabel();
Label l3 = DefineLabel();
LocalBuilder count = _tempV;
LocalBuilder mark = _temp2V;
Label l1 = DefineLabel();
LocalBuilder count = _tempV;
LocalBuilder mark = _temp2V;
Label l1 = DefineLabel();
+#pragma warning disable 219
Label l2 = DefineLabel();
Label l3 = _labels[NextCodepos()];
Label l2 = DefineLabel();
Label l3 = _labels[NextCodepos()];
+#pragma warning restore 219
PopStack();
Stloc(count); // count -> temp
PopStack();
Stloc(count); // count -> temp
// SECREVIEW : Regex only generates string manipulation, so this is
// : ok.
//
// SECREVIEW : Regex only generates string manipulation, so this is
// : ok.
//
new ReflectionPermission(PermissionState.Unrestricted).Assert();
new ReflectionPermission(PermissionState.Unrestricted).Assert();
try {
Debug.Assert(an != null, "AssemblyName should not be null");
try {
Debug.Assert(an != null, "AssemblyName should not be null");
CustomAttributeBuilder transparencyAttribute = new CustomAttributeBuilder(transparencyCtor, new object[0]);
assemblyAttributes.Add(transparencyAttribute);
CustomAttributeBuilder transparencyAttribute = new CustomAttributeBuilder(transparencyCtor, new object[0]);
assemblyAttributes.Add(transparencyAttribute);
ConstructorInfo securityRulesCtor = typeof(SecurityRulesAttribute).GetConstructor(new Type[] { typeof(SecurityRuleSet) });
CustomAttributeBuilder securityRulesAttribute =
new CustomAttributeBuilder(securityRulesCtor, new object[] { SecurityRuleSet.Level2 });
assemblyAttributes.Add(securityRulesAttribute);
ConstructorInfo securityRulesCtor = typeof(SecurityRulesAttribute).GetConstructor(new Type[] { typeof(SecurityRuleSet) });
CustomAttributeBuilder securityRulesAttribute =
new CustomAttributeBuilder(securityRulesCtor, new object[] { SecurityRuleSet.Level2 });
assemblyAttributes.Add(securityRulesAttribute);
_assembly = AppDomain.CurrentDomain.DefineDynamicAssembly(an, AssemblyBuilderAccess.RunAndSave, assemblyAttributes);
_module = _assembly.DefineDynamicModule(an.Name + ".dll");
_assembly = AppDomain.CurrentDomain.DefineDynamicAssembly(an, AssemblyBuilderAccess.RunAndSave, assemblyAttributes);
_module = _assembly.DefineDynamicModule(an.Name + ".dll");
/// multiple threads.</para>
/// </devdoc>
#if !SILVERLIGHT
/// multiple threads.</para>
/// </devdoc>
#if !SILVERLIGHT
[HostProtection(Synchronization=true)]
[HostProtection(Synchronization=true)]
static public Group Synchronized(Group inner) {
#else
static internal Group Synchronized(Group inner) {
static public Group Synchronized(Group inner) {
#else
static internal Group Synchronized(Group inner) {
/// </devdoc>
#if !SILVERLIGHT
/// </devdoc>
#if !SILVERLIGHT
[HostProtection(Synchronization=true)]
[HostProtection(Synchronization=true)]
static public Match Synchronized(Match inner) {
#else
static internal Match Synchronized(Match inner) {
static public Match Synchronized(Match inner) {
#else
static internal Match Synchronized(Match inner) {
protected internal override RegexRunner CreateInstance() {
CompiledRegexRunner runner = new CompiledRegexRunner();
protected internal override RegexRunner CreateInstance() {
CompiledRegexRunner runner = new CompiledRegexRunner();
new ReflectionPermission(PermissionState.Unrestricted).Assert();
new ReflectionPermission(PermissionState.Unrestricted).Assert();
runner.SetDelegates((NoParamDelegate) goMethod.CreateDelegate(typeof(NoParamDelegate)),
(FindFirstCharDelegate) findFirstCharMethod.CreateDelegate(typeof(FindFirstCharDelegate)),
(NoParamDelegate) initTrackCountMethod.CreateDelegate(typeof(NoParamDelegate)));
runner.SetDelegates((NoParamDelegate) goMethod.CreateDelegate(typeof(NoParamDelegate)),
(FindFirstCharDelegate) findFirstCharMethod.CreateDelegate(typeof(FindFirstCharDelegate)),
(NoParamDelegate) initTrackCountMethod.CreateDelegate(typeof(NoParamDelegate)));