Imported Upstream version 4.2.0.179

Former-commit-id: 0a113cb3a6feb7873f632839b1307cc6033cd595
This commit is contained in:
Xamarin Public Jenkins
2015-08-26 07:17:56 -04:00
committed by Jo Shields
parent 183bba2c9a
commit 6992685b86
7507 changed files with 90259 additions and 657307 deletions

View File

@@ -29,7 +29,7 @@ using System.Reflection;
[assembly: AssemblyCopyright("Copyright (C) 2002-2015 Jeroen Frijters")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("8.0.@BUILD@.0")]
[assembly: AssemblyVersion("8.1.@BUILD@.0")]
#if SIGNCODE
#pragma warning disable 1699

View File

@@ -232,7 +232,7 @@ namespace ikvm.awt
public override void clipRect(int x, int y, int w, int h)
{
checkState();
base.clearRect(x, y, w, h);
base.clipRect(x, y, w, h);
}
public override void clip(java.awt.Shape shape)
@@ -1963,7 +1963,7 @@ namespace ikvm.awt
public override java.awt.Color getBackground()
{
return bgcolor == Color.Empty ? null : new java.awt.Color(color.ToArgb(), true);
return bgcolor == Color.Empty ? null : new java.awt.Color(bgcolor.ToArgb(), true);
}
public override java.awt.Stroke getStroke()

View File

@@ -1 +1 @@
a963d4472d2d9b541b71be3d73cec57c17f4cbb3
a8a055aaac9ad8e98b1c9c47fcd85f5d82ba8ef1

View File

@@ -1,5 +1,5 @@
/*
Copyright (C) 2008 Jeroen Frijters
Copyright (C) 2008-2015 Jeroen Frijters
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@@ -32,6 +32,12 @@ public abstract class CallerID
private Class clazz;
private ClassLoader classLoader;
private CallerID(Class clazz, ClassLoader classLoader)
{
this.clazz = clazz;
this.classLoader = classLoader;
}
protected CallerID() { }
@ikvm.lang.Internal
@@ -41,7 +47,7 @@ public abstract class CallerID
{
clazz = GetClass();
}
return clazz;
return clazz;
}
@ikvm.lang.Internal
@@ -107,6 +113,19 @@ public abstract class CallerID
};
}
// used by the runtime for EmitHostCallerID and DynamicCallerID
static CallerID create(Class clazz, ClassLoader classLoader)
{
return new CallerID(clazz, classLoader) {
Class GetClass() {
return null;
}
ClassLoader GetClassLoader() {
return null;
}
};
}
@ikvm.lang.Internal
public static CallerID getCallerID()
{

View File

@@ -392,8 +392,8 @@ namespace IKVM.Internal
{
foreach(IKVM.Internal.MapXml.Property prop in clazz.Properties)
{
TypeWrapper typeWrapper = GetClassLoader().RetTypeWrapperFromSigNoThrow(prop.Sig);
TypeWrapper[] propargs = GetClassLoader().ArgTypeWrapperListFromSigNoThrow(prop.Sig);
TypeWrapper typeWrapper = GetClassLoader().RetTypeWrapperFromSig(prop.Sig, LoadMode.Link);
TypeWrapper[] propargs = GetClassLoader().ArgTypeWrapperListFromSig(prop.Sig, LoadMode.Link);
Type[] indexer = new Type[propargs.Length];
for(int i = 0; i < propargs.Length; i++)
{
@@ -567,8 +567,8 @@ namespace IKVM.Internal
private void MapSignature(string sig, out Type returnType, out Type[] parameterTypes)
{
returnType = GetClassLoader().RetTypeWrapperFromSigNoThrow(sig).TypeAsSignatureType;
TypeWrapper[] parameterTypeWrappers = GetClassLoader().ArgTypeWrapperListFromSigNoThrow(sig);
returnType = GetClassLoader().RetTypeWrapperFromSig(sig, LoadMode.Link).TypeAsSignatureType;
TypeWrapper[] parameterTypeWrappers = GetClassLoader().ArgTypeWrapperListFromSig(sig, LoadMode.Link);
parameterTypes = new Type[parameterTypeWrappers.Length];
for(int i = 0; i < parameterTypeWrappers.Length; i++)
{

View File

@@ -177,6 +177,7 @@ sealed class IkvmcCompiler
private static bool time;
private static string runtimeAssembly;
private static bool nostdlib;
private static bool emitSymbols;
private static readonly List<string> libpaths = new List<string>();
internal static readonly AssemblyResolver resolver = new AssemblyResolver();
@@ -301,6 +302,7 @@ sealed class IkvmcCompiler
CompilerOptions toplevel = new CompilerOptions();
StaticCompiler.toplevel = toplevel;
comp.ParseCommandLine(argList.GetEnumerator(), targets, toplevel);
StaticCompiler.Init(emitSymbols);
resolver.Warning += loader_Warning;
resolver.Init(StaticCompiler.Universe, nostdlib, toplevel.unresolvedReferences, libpaths);
ResolveReferences(targets);
@@ -752,7 +754,8 @@ sealed class IkvmcCompiler
{
throw new FatalCompilerErrorException(Message.InvalidOptionSyntax, s);
}
options.GetResourcesJar().Add(spec[0].TrimStart('/'), ReadAllBytes(GetFileInfo(spec[1])), null);
FileInfo fileInfo = GetFileInfo(spec[1]);
options.GetResourcesJar().Add(spec[0].TrimStart('/'), ReadAllBytes(fileInfo), fileInfo);
}
else if(s.StartsWith("-externalresource:"))
{
@@ -818,6 +821,7 @@ sealed class IkvmcCompiler
}
else if(s == "-debug")
{
emitSymbols = true;
options.codegenoptions |= CodeGenOptions.Debug;
}
else if(s.StartsWith("-srcpath:"))
@@ -1463,7 +1467,7 @@ sealed class IkvmcCompiler
// extract the resource name by chopping off the base directory
string name = file.Substring(baseDir.FullName.Length);
name = name.TrimStart(Path.DirectorySeparatorChar).Replace('\\', '/');
options.GetResourcesJar().Add(name, ReadAllBytes(fileInfo), null);
options.GetResourcesJar().Add(name, ReadAllBytes(fileInfo), fileInfo);
}
}
}

View File

@@ -1 +1 @@
b71e0f94bba2f37126b0c66cbd774ef9d76cd588
c27a31eb1803a411aadc8b97ad081614b07dd615

View File

@@ -1224,7 +1224,7 @@ namespace IKVM.Internal.MapXml
internal override void Generate(CodeGenContext context, CodeEmitter ilgen)
{
ilgen.Emit(OpCodes.Ldelema, context.ClassLoader.FieldTypeWrapperFromSig(Sig).TypeAsArrayType);
ilgen.Emit(OpCodes.Ldelema, context.ClassLoader.FieldTypeWrapperFromSig(Sig, LoadMode.LoadOrThrow).TypeAsArrayType);
}
}
@@ -1236,7 +1236,7 @@ namespace IKVM.Internal.MapXml
internal override void Generate(CodeGenContext context, CodeEmitter ilgen)
{
ilgen.Emit(OpCodes.Newarr, context.ClassLoader.FieldTypeWrapperFromSig(Sig).TypeAsArrayType);
ilgen.Emit(OpCodes.Newarr, context.ClassLoader.FieldTypeWrapperFromSig(Sig, LoadMode.LoadOrThrow).TypeAsArrayType);
}
}

View File

@@ -1 +1 @@
2bf838b489c7b542eedfe3e782dea1b8492ca32d
9893116e072094e4cdaec2c5e493ef7f7799c5e6

View File

@@ -0,0 +1,208 @@
/*
Copyright (C) 2014-2015 Jeroen Frijters
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
Jeroen Frijters
jeroen@frijters.net
*/
package java.lang.ref;
public class ReferenceQueue<T>
{
static final ReferenceQueue ENQUEUED = new ReferenceQueue();
static final ReferenceQueue NULL = new ReferenceQueue();
private volatile Link<T> activeHead;
private volatile Reference<T> head;
final Object lock = new Object();
volatile boolean waitingForGC;
private final class GCNotification {
protected void finalize() {
waitingForGC = false;
synchronized (lock) {
lock.notifyAll();
}
}
}
// NOTE a known problem with this approach is that the WeakReference will not be available
// after we've become only finalizer reachable
private static class Link<T> extends cli.System.WeakReference {
Link<T> next;
Link(Reference<T> ref) {
super(ref);
}
Reference<T> get() {
return (Reference<T>)get_Target();
}
}
public Reference<? extends T> poll()
{
if (head == null && (activeHead == null || waitingForGC)) {
return null;
}
synchronized (lock) {
return pollImpl();
}
}
private Reference<? extends T> pollImpl()
{
if (head == null) {
if (activeHead == null || waitingForGC) {
return null;
}
scanActiveList();
if (head == null) {
waitingForGC = true;
new GCNotification();
return null;
}
}
Reference<T> ref = head;
head = ref.next;
ref.next = null;
ref.queue = NULL;
return ref;
}
public Reference<? extends T> remove(long timeout) throws IllegalArgumentException, InterruptedException
{
if (timeout < 0)
throw new IllegalArgumentException("Negative timeout value");
synchronized (lock) {
long expiration = 0;
for (;;) {
Reference<? extends T> ref = pollImpl();
if (ref != null)
return ref;
if (timeout == 0) {
lock.wait();
} else {
long now = System.currentTimeMillis();
if (expiration == 0) {
expiration = now + timeout;
if (expiration < 0) {
expiration = Long.MAX_VALUE;
}
}
if (now >= expiration) {
return null;
}
lock.wait(expiration - now);
}
}
}
}
public Reference<? extends T> remove() throws InterruptedException
{
return remove(0);
}
final void clear(Reference<T> ref)
{
synchronized (lock) {
if (ref.queue != ENQUEUED) {
ref.queue = NULL;
}
}
}
final boolean enqueue(Reference<T> ref)
{
synchronized (lock) {
if (ref.queue != ENQUEUED && ref.queue != NULL) {
ref.queue = ENQUEUED;
if (ref.isStrongOrNullRef()) {
ref.next = head;
head = ref;
lock.notifyAll();
return true;
}
Link<T> prev = null;
Link<T> curr = activeHead;
while (curr != null) {
if (curr.get() == ref) {
if (prev == null) {
activeHead = curr.next;
} else {
prev.next = curr.next;
}
ref.next = head;
head = ref;
lock.notifyAll();
return true;
}
prev = curr;
curr = curr.next;
}
}
}
return false;
}
final void addToActiveList(Reference<T> ref)
{
Link<T> link = new Link<T>(ref);
synchronized (lock) {
link.next = activeHead;
activeHead = link;
if (link.next == null) {
lock.notifyAll();
}
}
}
private void scanActiveList()
{
Link<T> prev = null;
Link<T> curr = activeHead;
while (curr != null) {
Reference<T> ref = curr.get();
if (ref == null || !ref.isActive()) {
Link<T> next = curr.next;
if (prev == null) {
activeHead = next;
} else {
prev.next = next;
}
if (ref != null) {
ref.next = head;
ref.queue = ENQUEUED;
head = ref;
}
curr = next;
continue;
}
prev = curr;
curr = curr.next;
}
}
}

View File

@@ -1 +1 @@
61cf80c434091dcb9ff173cae27898942f3a8861
21beaab3280677891e9c48e06d9a2bcbd21e7c24

View File

@@ -186,6 +186,9 @@
<arg path="mscorlib.jar;System.jar;System.Core.jar;System.Data.jar;System.Drawing.jar;System.XML.jar;../runtime/IKVM.Runtime.jar" />
<arg value="@allsources.gen.lst" />
</exec>
<!-- copy the timestamps from the input files, because these timestamps end up in resources.jar and affect deterministics builds -->
<touch file="${OpenJDK.dir}/jdk/src/share/classes/sun/reflect/misc/Trampoline.class" datetime="${file::get-last-write-time(property::get-value('OpenJDK.dir') + '/jdk/src/share/classes/sun/reflect/misc/MethodUtil.java')}" />
<touch file="${OpenJDK.dir}/jdk/src/share/classes/java/lang/invoke/MethodHandleImpl$BindCaller$T.class" datetime="${file::get-last-write-time(property::get-value('OpenJDK.dir') + '/jdk/src/share/classes/java/lang/invoke/MethodHandleImpl.java')}" />
</target>
<target name="classpath">
@@ -226,7 +229,7 @@
<arg value="${OpenJDK.dir}/nashorn/src/jdk/nashorn/internal/objects/*.java" />
</exec>
<exec program="java" useruntimeengine="false">
<arg line="-cp ${OpenJDK.dir}/nashorn/buildtools/nasgen/src" />
<arg value="-Xbootclasspath/p:${OpenJDK.dir}/nashorn/buildtools/nasgen/src${pathsep}${OpenJDK.dir}/nashorn/src" />
<arg value="jdk.nashorn.internal.tools.nasgen.Main" />
<arg value="${OpenJDK.dir}/nashorn/src" />
<arg value="jdk.nashorn.internal.objects" />
@@ -323,6 +326,8 @@
</replacetokens>
</filterchain>
</copy>
<!-- copy the timestamp from the input file, because the timestamp ends up in resources.jar and affects deterministics builds -->
<touch file="MANIFEST.MF" datetime="${file::get-last-write-time('MANIFEST.MF.in')}" />
</target>
<target name="nashorn-version">
@@ -334,6 +339,8 @@
</replacetokens>
</filterchain>
</copy>
<!-- copy the timestamp from the input file, because the timestamp ends up in resources.jar and affects deterministics builds -->
<touch file="resources/nashorn/version.properties" datetime="${file::get-last-write-time('resources/nashorn/version.properties.in')}" />
</target>
<target name="core" depends="version response.gen.txt MANIFEST.MF nashorn-version">

View File

@@ -32,7 +32,6 @@ import cli.System.Security.Permissions.SecurityPermissionAttribute;
import ikvm.lang.Internal;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.lang.reflect.ReflectHelper;
import java.security.ProtectionDomain;
import java.util.ArrayList;
@@ -57,10 +56,13 @@ public final class Unsafe
return theUnsafe;
}
private static native Field createFieldAndMakeAccessible(Class c, String field);
private static native Field copyFieldAndMakeAccessible(Field field);
// this is the intrinsified version of objectFieldOffset(XXX.class.getDeclaredField("xxx"))
public long objectFieldOffset(Class c, String field)
{
return allocateUnsafeFieldId(ReflectHelper.createFieldAndMakeAccessible(c, field));
return allocateUnsafeFieldId(createFieldAndMakeAccessible(c, field));
}
// NOTE we have a really lame (and slow) implementation!
@@ -72,6 +74,15 @@ public final class Unsafe
}
return allocateUnsafeFieldId(field);
}
public long staticFieldOffset(Field field)
{
if(!Modifier.isStatic(field.getModifiers()))
{
throw new IllegalArgumentException();
}
return allocateUnsafeFieldId(field);
}
@Deprecated
public int fieldOffset(Field original)
@@ -81,7 +92,7 @@ public final class Unsafe
static int allocateUnsafeFieldId(Field original)
{
Field copy = ReflectHelper.copyFieldAndMakeAccessible(original);
Field copy = copyFieldAndMakeAccessible(original);
synchronized(fields)
{
int id = fields.size();
@@ -850,6 +861,10 @@ public final class Unsafe
@cli.System.Security.SecurityCriticalAttribute.Annotation
public long allocateMemory(long bytes)
{
if (bytes == 0)
{
return 0;
}
try
{
if (false) throw new cli.System.OutOfMemoryException();
@@ -861,6 +876,26 @@ public final class Unsafe
}
}
@SecurityPermissionAttribute.Annotation(value = SecurityAction.__Enum.LinkDemand, UnmanagedCode = true)
@cli.System.Security.SecurityCriticalAttribute.Annotation
public long reallocateMemory(long address, long bytes)
{
if (bytes == 0)
{
freeMemory(address);
return 0;
}
try
{
if (false) throw new cli.System.OutOfMemoryException();
return Marshal.ReAllocHGlobal(IntPtr.op_Explicit(address), IntPtr.op_Explicit(bytes)).ToInt64();
}
catch (cli.System.OutOfMemoryException x)
{
throw new OutOfMemoryError(x.get_Message());
}
}
@SecurityPermissionAttribute.Annotation(value = SecurityAction.__Enum.LinkDemand, UnmanagedCode = true)
@cli.System.Security.SecurityCriticalAttribute.Annotation
public void freeMemory(long address)
@@ -1126,6 +1161,12 @@ public final class Unsafe
{
return null;
}
@Deprecated
public Object staticFieldBase(Class<?> c)
{
return null;
}
public native boolean shouldBeInitialized(Class<?> c);

View File

@@ -527,8 +527,9 @@ namespace IKVM.Reflection
name = null;
return false;
}
ns = Constructor.DeclaringType.__Namespace;
name = Constructor.DeclaringType.__Name;
TypeName typeName = AttributeType.TypeName;
ns = typeName.Namespace;
name = typeName.Name;
return true;
}

View File

@@ -668,5 +668,85 @@ namespace IKVM.Reflection.Emit
bw.WriteCustomAttributeBlob();
return bb.ToArray();
}
internal KnownCA KnownCA
{
get
{
TypeName typeName = con.DeclaringType.TypeName;
switch (typeName.Namespace)
{
case "System":
switch (typeName.Name)
{
case "SerializableAttribute":
return KnownCA.SerializableAttribute;
case "NonSerializedAttribute":
return KnownCA.NonSerializedAttribute;
}
break;
case "System.Runtime.CompilerServices":
switch (typeName.Name)
{
case "MethodImplAttribute":
return KnownCA.MethodImplAttribute;
case "SpecialNameAttribute":
return KnownCA.SpecialNameAttribute;
}
break;
case "System.Runtime.InteropServices":
switch (typeName.Name)
{
case "DllImportAttribute":
return KnownCA.DllImportAttribute;
case "ComImportAttribute":
return KnownCA.ComImportAttribute;
case "MarshalAsAttribute":
return KnownCA.MarshalAsAttribute;
case "PreserveSigAttribute":
return KnownCA.PreserveSigAttribute;
case "InAttribute":
return KnownCA.InAttribute;
case "OutAttribute":
return KnownCA.OutAttribute;
case "OptionalAttribute":
return KnownCA.OptionalAttribute;
case "StructLayoutAttribute":
return KnownCA.StructLayoutAttribute;
case "FieldOffsetAttribute":
return KnownCA.FieldOffsetAttribute;
}
break;
}
if (typeName.Matches("System.Security.SuppressUnmanagedCodeSecurityAttribute"))
{
return KnownCA.SuppressUnmanagedCodeSecurityAttribute;
}
return KnownCA.Unknown;
}
}
}
// These are the pseudo-custom attributes that are recognized by name by the runtime (i.e. the type identity is not considered).
// The corresponding list in the runtime is at https://github.com/dotnet/coreclr/blob/1afe5ce4f45045d724a4e129df4b816655d486fb/src/md/compiler/custattr_emit.cpp#L38
// Note that we only need to handle a subset of the types, since we don't need the ones that are only used for validation by the runtime.
enum KnownCA
{
Unknown,
DllImportAttribute,
ComImportAttribute,
SerializableAttribute,
NonSerializedAttribute,
MethodImplAttribute,
MarshalAsAttribute,
PreserveSigAttribute,
InAttribute,
OutAttribute,
OptionalAttribute,
StructLayoutAttribute,
FieldOffsetAttribute,
SpecialNameAttribute,
// the following is not part of the runtime known custom attributes, but we handle it here for efficiency and convenience
SuppressUnmanagedCodeSecurityAttribute,
}
}

View File

@@ -39,14 +39,9 @@ namespace IKVM.Reflection.Emit
this.fieldBuilder = fieldBuilder;
}
public override string __Name
internal override TypeName TypeName
{
get { return typeBuilder.__Name; }
}
public override string __Namespace
{
get { return typeBuilder.__Namespace; }
get { return typeBuilder.TypeName; }
}
public override string Name

View File

@@ -97,8 +97,7 @@ namespace IKVM.Reflection.Emit
public void SetCustomAttribute(CustomAttributeBuilder customBuilder)
{
Universe u = typeBuilder.ModuleBuilder.universe;
if (customBuilder.Constructor.DeclaringType == u.System_Runtime_CompilerServices_SpecialNameAttribute)
if (customBuilder.KnownCA == KnownCA.SpecialNameAttribute)
{
attributes |= EventAttributes.SpecialName;
}

View File

@@ -124,28 +124,24 @@ namespace IKVM.Reflection.Emit
public void SetCustomAttribute(CustomAttributeBuilder customBuilder)
{
Universe u = this.Module.universe;
if (customBuilder.Constructor.DeclaringType == u.System_Runtime_InteropServices_FieldOffsetAttribute)
switch (customBuilder.KnownCA)
{
customBuilder = customBuilder.DecodeBlob(this.Module.Assembly);
SetOffset((int)customBuilder.GetConstructorArgument(0));
}
else if (customBuilder.Constructor.DeclaringType == u.System_Runtime_InteropServices_MarshalAsAttribute)
{
FieldMarshal.SetMarshalAsAttribute(typeBuilder.ModuleBuilder, pseudoToken, customBuilder);
attribs |= FieldAttributes.HasFieldMarshal;
}
else if (customBuilder.Constructor.DeclaringType == u.System_NonSerializedAttribute)
{
attribs |= FieldAttributes.NotSerialized;
}
else if (customBuilder.Constructor.DeclaringType == u.System_Runtime_CompilerServices_SpecialNameAttribute)
{
attribs |= FieldAttributes.SpecialName;
}
else
{
typeBuilder.ModuleBuilder.SetCustomAttribute(pseudoToken, customBuilder);
case KnownCA.FieldOffsetAttribute:
SetOffset((int)customBuilder.DecodeBlob(this.Module.Assembly).GetConstructorArgument(0));
break;
case KnownCA.MarshalAsAttribute:
FieldMarshal.SetMarshalAsAttribute(typeBuilder.ModuleBuilder, pseudoToken, customBuilder);
attribs |= FieldAttributes.HasFieldMarshal;
break;
case KnownCA.NonSerializedAttribute:
attribs |= FieldAttributes.NotSerialized;
break;
case KnownCA.SpecialNameAttribute:
attribs |= FieldAttributes.SpecialName;
break;
default:
typeBuilder.ModuleBuilder.SetCustomAttribute(pseudoToken, customBuilder);
break;
}
}

View File

@@ -255,32 +255,27 @@ namespace IKVM.Reflection.Emit
public void SetCustomAttribute(CustomAttributeBuilder customBuilder)
{
Universe u = this.ModuleBuilder.universe;
Type type = customBuilder.Constructor.DeclaringType;
if (type == u.System_Runtime_InteropServices_DllImportAttribute)
switch (customBuilder.KnownCA)
{
attributes |= MethodAttributes.PinvokeImpl;
SetDllImportPseudoCustomAttribute(customBuilder.DecodeBlob(this.Module.Assembly));
}
else if (type == u.System_Runtime_CompilerServices_MethodImplAttribute)
{
SetMethodImplAttribute(customBuilder.DecodeBlob(this.Module.Assembly));
}
else if (type == u.System_Runtime_InteropServices_PreserveSigAttribute)
{
implFlags |= MethodImplAttributes.PreserveSig;
}
else if (type == u.System_Runtime_CompilerServices_SpecialNameAttribute)
{
attributes |= MethodAttributes.SpecialName;
}
else
{
if (type == u.System_Security_SuppressUnmanagedCodeSecurityAttribute)
{
case KnownCA.DllImportAttribute:
SetDllImportPseudoCustomAttribute(customBuilder.DecodeBlob(this.Module.Assembly));
attributes |= MethodAttributes.PinvokeImpl;
break;
case KnownCA.MethodImplAttribute:
SetMethodImplAttribute(customBuilder.DecodeBlob(this.Module.Assembly));
break;
case KnownCA.PreserveSigAttribute:
implFlags |= MethodImplAttributes.PreserveSig;
break;
case KnownCA.SpecialNameAttribute:
attributes |= MethodAttributes.SpecialName;
break;
case KnownCA.SuppressUnmanagedCodeSecurityAttribute:
attributes |= MethodAttributes.HasSecurity;
}
this.ModuleBuilder.SetCustomAttribute(pseudoToken, customBuilder);
goto default;
default:
this.ModuleBuilder.SetCustomAttribute(pseudoToken, customBuilder);
break;
}
}
@@ -382,7 +377,7 @@ namespace IKVM.Reflection.Emit
gtpb = new GenericTypeParameterBuilder[names.Length];
for (int i = 0; i < names.Length; i++)
{
gtpb[i] = new GenericTypeParameterBuilder(names[i], null, this, i);
gtpb[i] = new GenericTypeParameterBuilder(names[i], this, i);
}
return (GenericTypeParameterBuilder[])gtpb.Clone();
}

View File

@@ -468,9 +468,7 @@ namespace IKVM.Reflection.Emit
// HACK we should *not* set the TypeDefId in this case, but 2.0 and 3.5 peverify gives a warning if it is missing (4.5 doesn't)
rec.TypeDefId = type.MetadataToken;
}
rec.TypeName = this.Strings.Add(type.__Name);
string ns = type.__Namespace;
rec.TypeNamespace = ns == null ? 0 : this.Strings.Add(ns);
SetTypeNameAndTypeNamespace(type.TypeName, out rec.TypeName, out rec.TypeNamespace);
if (type.IsNested)
{
rec.Flags = 0;
@@ -484,6 +482,12 @@ namespace IKVM.Reflection.Emit
return 0x27000000 | this.ExportedType.FindOrAddRecord(rec);
}
private void SetTypeNameAndTypeNamespace(TypeName name, out int typeName, out int typeNamespace)
{
typeName = this.Strings.Add(name.Name);
typeNamespace = name.Namespace == null ? 0 : this.Strings.Add(name.Namespace);
}
public void SetCustomAttribute(ConstructorInfo con, byte[] binaryAttribute)
{
SetCustomAttribute(new CustomAttributeBuilder(con, binaryAttribute));
@@ -650,7 +654,7 @@ namespace IKVM.Reflection.Emit
{
foreach (Type type in types)
{
if (type.__Namespace == name.Namespace && type.__Name == name.Name)
if (type.TypeName == name)
{
return type;
}
@@ -662,7 +666,7 @@ namespace IKVM.Reflection.Emit
{
foreach (Type type in types)
{
if (new TypeName(type.__Namespace, type.__Name).ToLowerInvariant() == lowerCaseName)
if (type.TypeName.ToLowerInvariant() == lowerCaseName)
{
return type;
}
@@ -908,9 +912,7 @@ namespace IKVM.Reflection.Emit
{
rec.ResolutionScope = ImportAssemblyRef(type.Assembly);
}
rec.TypeName = this.Strings.Add(type.__Name);
string ns = type.__Namespace;
rec.TypeNameSpace = ns == null ? 0 : this.Strings.Add(ns);
SetTypeNameAndTypeNamespace(type.TypeName, out rec.TypeName, out rec.TypeNamespace);
token = 0x01000000 | this.TypeRef.AddRecord(rec);
}
typeTokens.Add(type, token);
@@ -1220,9 +1222,7 @@ namespace IKVM.Reflection.Emit
rec.Flags = (int)type.Attributes;
// LAMESPEC ECMA says that TypeDefId is a row index, but it should be a token
rec.TypeDefId = type.MetadataToken;
rec.TypeName = this.Strings.Add(type.__Name);
string ns = type.__Namespace;
rec.TypeNamespace = ns == null ? 0 : this.Strings.Add(ns);
SetTypeNameAndTypeNamespace(type.TypeName, out rec.TypeName, out rec.TypeNamespace);
if (type.IsNested)
{
rec.Implementation = declaringTypes[type.DeclaringType];
@@ -1604,8 +1604,7 @@ namespace IKVM.Reflection.Emit
{
TypeRefTable.Record rec = new TypeRefTable.Record();
rec.ResolutionScope = resolutionScope;
rec.TypeName = this.Strings.Add(name);
rec.TypeNameSpace = ns == null ? 0 : this.Strings.Add(ns);
SetTypeNameAndTypeNamespace(new TypeName(ns, name), out rec.TypeName, out rec.TypeNamespace);
return 0x01000000 | this.TypeRef.AddRecord(rec);
}

Some files were not shown because too many files have changed in this diff Show More