Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove DllExport #485

Merged
merged 1 commit into from
Feb 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
40 changes: 0 additions & 40 deletions src/IKVM.Java/local/ikvm/lang/DllExport.java

This file was deleted.

29 changes: 0 additions & 29 deletions src/IKVM.Runtime/ClassFile.Method.cs
Original file line number Diff line number Diff line change
Expand Up @@ -203,31 +203,6 @@ internal sealed partial class Method : FieldOrMethod
flags |= FLAG_MASK_INTERNAL;
}
}
else if (annot[1].Equals("Likvm/lang/DllExport;"))
{
string name = null;
int? ordinal = null;
for (int j = 2; j < annot.Length; j += 2)
{
if (annot[j].Equals("name") && annot[j + 1] is string)
name = (string)annot[j + 1];
else if (annot[j].Equals("ordinal") && annot[j + 1] is int)
ordinal = (int)annot[j + 1];
}
if (name != null && ordinal != null)
{
if (!IsStatic)
{
classFile.context.StaticCompiler.IssueMessage(Message.DllExportMustBeStaticMethod, classFile.Name, this.Name, this.Signature);
}
else
{
low ??= new LowFreqData();
low.DllExportName = name;
low.DllExportOrdinal = ordinal.Value;
}
}
}
else if (annot[1].Equals("Likvm/internal/InterlockedCompareAndSet;"))
{
string field = null;
Expand Down Expand Up @@ -347,10 +322,6 @@ protected override void ValidateSig(ClassFile classFile, string descriptor)

#if IMPORTER

internal string DllExportName => low == null ? null : low.DllExportName;

internal int DllExportOrdinal => low == null ? -1 : low.DllExportOrdinal;

internal string InterlockedCompareAndSetField => low == null ? null : low.InterlockedCompareAndSetField;

#endif
Expand Down
5 changes: 1 addition & 4 deletions src/IKVM.Runtime/RuntimeByteCodeJavaType.FinishContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -681,16 +681,13 @@ internal Type FinishImpl()
}

AddMethodParameterInfo(m, methods[i], mb, out var parameterNames);

#if IMPORTER
if (methods[i].HasCallerID)
{
context.AttributeHelper.SetEditorBrowsableNever(mb);
EmitCallerIDStub(methods[i], parameterNames);
}
if (m.DllExportName != null && wrapper.classLoader.TryEnableUnmanagedExports())
{
mb.__AddUnmanagedExport(m.DllExportName, m.DllExportOrdinal);
}
#endif
}

Expand Down
17 changes: 0 additions & 17 deletions src/IKVM.Tools.Importer/CompilerClassLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3169,23 +3169,6 @@ internal override void IssueMessage(Message msgId, params string[] values)
Context.StaticCompiler.IssueMessage(options, msgId, values);
}

internal bool TryEnableUnmanagedExports()
{
// we only support -platform:x86 and -platform:x64
// (currently IKVM.Reflection doesn't support unmanaged exports for ARM)
if ((options.imageFileMachine == ImageFileMachine.I386 && (options.pekind & PortableExecutableKinds.Required32Bit) != 0) || options.imageFileMachine == ImageFileMachine.AMD64)
{
// when you add unmanaged exports, the ILOnly flag MUST NOT be set or the DLL will fail to load
options.pekind &= ~PortableExecutableKinds.ILOnly;
return true;
}
else
{
Context.StaticCompiler.IssueMessage(Message.DllExportRequiresSupportedPlatform);
return false;
}
}

internal override bool WarningLevelHigh
{
get { return options.warningLevelHigh; }
Expand Down
7 changes: 0 additions & 7 deletions src/IKVM.Tools.Importer/IkvmImporterInternal.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1554,13 +1554,6 @@ internal static void IssueMessage(StaticCompiler compiler, CompilerOptions optio
msg = "Ignoring @ikvm.lang.Internal annotation on interface method" + Environment.NewLine +
" (\"{0}.{1}{2}\")";
break;
case Message.DllExportMustBeStaticMethod:
msg = "Ignoring @ikvm.lang.DllExport annotation on non-static method" + Environment.NewLine +
" (\"{0}.{1}{2}\")";
break;
case Message.DllExportRequiresSupportedPlatform:
msg = "Ignoring @ikvm.lang.DllExport annotation due to unsupported target platform";
break;
case Message.NonPrimaryAssemblyReference:
msg = "Referenced assembly \"{0}\" is not the primary assembly of a shared class loader group, please reference primary assembly \"{1}\" instead";
break;
Expand Down
2 changes: 0 additions & 2 deletions src/IKVM.Tools.Importer/Message.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ internal enum Message
LegacySearchRule = 126,
AssemblyLocationIgnored = 127,
InterfaceMethodCantBeInternal = 128,
DllExportMustBeStaticMethod = 129,
DllExportRequiresSupportedPlatform = 130,
DuplicateAssemblyReference = 132,
UnableToResolveType = 133,
StubsAreDeprecated = 134,
Expand Down
7 changes: 0 additions & 7 deletions src/IKVM.Tools.Importer/StaticCompiler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -367,13 +367,6 @@ internal void IssueMessage(CompilerOptions options, Message msgId, params string
msg = "Ignoring @ikvm.lang.Internal annotation on interface method" + Environment.NewLine +
" (\"{0}.{1}{2}\")";
break;
case Message.DllExportMustBeStaticMethod:
msg = "Ignoring @ikvm.lang.DllExport annotation on non-static method" + Environment.NewLine +
" (\"{0}.{1}{2}\")";
break;
case Message.DllExportRequiresSupportedPlatform:
msg = "Ignoring @ikvm.lang.DllExport annotation due to unsupported target platform";
break;
case Message.NonPrimaryAssemblyReference:
msg = "Referenced assembly \"{0}\" is not the primary assembly of a shared class loader group, please reference primary assembly \"{1}\" instead";
break;
Expand Down