Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZoltan Varga <vargaz@gmail.com>2016-09-30 06:53:22 +0300
committerGitHub <noreply@github.com>2016-09-30 06:53:22 +0300
commita0ad8154f7cdca706802aa196d95686e0f8d3b7b (patch)
tree2f4bd97d6f3fc35ae80d74a3d616dfe8e352287b /mcs/class/corlib/System.Reflection.Emit/TypeBuilder.cs
parent2d86893ee60b50f40c5566841dba38ccaef3583c (diff)
Sre cleanup9 (#3661)
* [SRE] Assign pseudo tokens to SRE objects in the BCL instead of doing it in the runtime. Real tokens are assigned after the dynamic types they depend on have been created, by creating the corresponding finished reflection object (i.e. a MonoMethod for a MethodOnTypeBuilderInst etc.) and obtaining its token. In Save mode, this is done in ModuleBuilder.Save (). In Run mode, this is done on-demand when the JIT tries to resolve a token into its corresponding metadata object, by the runtime calling the RuntimeResolve () method on the builder object. * [SRE] Remove dead code. * [SRE] Remove the MonoGenericMethod/MonoGenericCMethod classes, they have not needed. * [SRE] Delay the creation of MonoClass-es for MonoGenericClass/GenericTypeParameterBuilder/SymbolType until its needed. * [SRE] Small code cleanup. * [SRE] Remove the TypeBuilder.IsGenericParameter () icall, it should return false. * [SRE] Unify the calling of the various RuntimeResolve () methods by adding a RuntimeResolve () method to ModuleBuilder, and calling that from native code. * [SRE] Remove unused TypeBuilder::get_event_info () icall. * [SRE] Remove more unused/empty icalls.
Diffstat (limited to 'mcs/class/corlib/System.Reflection.Emit/TypeBuilder.cs')
-rw-r--r--mcs/class/corlib/System.Reflection.Emit/TypeBuilder.cs75
1 files changed, 22 insertions, 53 deletions
diff --git a/mcs/class/corlib/System.Reflection.Emit/TypeBuilder.cs b/mcs/class/corlib/System.Reflection.Emit/TypeBuilder.cs
index 3972192308d..ef60cb1df28 100644
--- a/mcs/class/corlib/System.Reflection.Emit/TypeBuilder.cs
+++ b/mcs/class/corlib/System.Reflection.Emit/TypeBuilder.cs
@@ -40,6 +40,7 @@ using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Globalization;
using System.Collections;
+using System.Collections.Generic;
using System.Security;
using System.Security.Permissions;
using System.Diagnostics.SymbolStore;
@@ -98,9 +99,6 @@ namespace System.Reflection.Emit
[MethodImplAttribute(MethodImplOptions.InternalCall)]
private extern void create_generic_class ();
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- private extern EventInfo get_event_info (EventBuilder eb);
-
internal TypeBuilder (ModuleBuilder mb, TypeAttributes attr, int table_idx)
{
this.parent = null;
@@ -873,6 +871,17 @@ namespace System.Reflection.Emit
}
}
+ internal void FixupTokens (Dictionary<int, int> token_map, Dictionary<int, MemberInfo> member_map) {
+ if (methods != null) {
+ for (int i = 0; i < num_methods; ++i)
+ methods[i].FixupTokens (token_map, member_map);
+ }
+ if (ctors != null) {
+ foreach (var cb in ctors)
+ cb.FixupTokens (token_map, member_map);
+ }
+ }
+
internal void GenerateDebugInfo (ISymbolWriter symbolWriter)
{
symbolWriter.OpenNamespace (this.Namespace);
@@ -968,53 +977,6 @@ namespace System.Reflection.Emit
throw new NotSupportedException ();
}
- // This is only used from MonoGenericInst.initialize().
- internal EventInfo[] GetEvents_internal (BindingFlags bindingAttr)
- {
- if (events == null)
- return new EventInfo [0];
- ArrayList l = new ArrayList ();
- bool match;
- MethodAttributes mattrs;
- MethodInfo accessor;
-
- foreach (EventBuilder eb in events) {
- if (eb == null)
- continue;
- EventInfo c = get_event_info (eb);
- match = false;
- accessor = c.GetAddMethod (true);
- if (accessor == null)
- accessor = c.GetRemoveMethod (true);
- if (accessor == null)
- continue;
- mattrs = accessor.Attributes;
- if ((mattrs & MethodAttributes.MemberAccessMask) == MethodAttributes.Public) {
- if ((bindingAttr & BindingFlags.Public) != 0)
- match = true;
- } else {
- if ((bindingAttr & BindingFlags.NonPublic) != 0)
- match = true;
- }
- if (!match)
- continue;
- match = false;
- if ((mattrs & MethodAttributes.Static) != 0) {
- if ((bindingAttr & BindingFlags.Static) != 0)
- match = true;
- } else {
- if ((bindingAttr & BindingFlags.Instance) != 0)
- match = true;
- }
- if (!match)
- continue;
- l.Add (c);
- }
- EventInfo[] result = new EventInfo [l.Count];
- l.CopyTo (result);
- return result;
- }
-
public override FieldInfo GetField (string name, BindingFlags bindingAttr)
{
if (created != null)
@@ -1666,6 +1628,12 @@ namespace System.Reflection.Emit
return created;
}
+ internal override Type RuntimeResolve ()
+ {
+ check_created ();
+ return created;
+ }
+
internal bool is_created {
get {
return createTypeCalled;
@@ -1764,9 +1732,10 @@ namespace System.Reflection.Emit
}
}
- public extern override bool IsGenericParameter {
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- get;
+ public override bool IsGenericParameter {
+ get {
+ return false;
+ }
}
public override GenericParameterAttributes GenericParameterAttributes {