Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -109,14 +109,15 @@ static JniParamKind ParseSingleType (string sig, ref int i)
/// Encodes a JNI type as its CLR equivalent for [UnmanagedCallersOnly] UCO wrapper signatures.
/// </summary>
/// <remarks>
/// JNI boolean (Z) maps to <c>byte</c> (unsigned, blittable for the JNI ABI).
/// JNI boolean (Z) maps to <c>byte</c> and JNI char (C) maps to <c>ushort</c>,
/// preserving the JNI ABI with blittable UCO parameter types.
/// </remarks>
public static void EncodeClrType (SignatureTypeEncoder encoder, JniParamKind kind)
{
switch (kind) {
case JniParamKind.Boolean: encoder.Byte (); break; // JNI jboolean is unsigned byte; blittable for UCO
case JniParamKind.Byte: encoder.SByte (); break;
case JniParamKind.Char: encoder.Char (); break;
case JniParamKind.Char: encoder.UInt16 (); break;
case JniParamKind.Short: encoder.Int16 (); break;
case JniParamKind.Int: encoder.Int32 (); break;
case JniParamKind.Long: encoder.Int64 (); break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ sealed record UcoMethodData
/// JNI method signature, e.g., "(Landroid/os/Bundle;)V". Used to determine CLR parameter types.
/// </summary>
public required string JniSignature { get; init; }

}

/// <summary>
Expand All @@ -228,6 +229,16 @@ sealed record UcoConstructorData
/// JNI constructor signature, e.g., "(Landroid/content/Context;)V". Used for RegisterNatives registration.
/// </summary>
public required string JniSignature { get; init; }

/// <summary>
/// Managed constructor parameter type names, in declaration order.
/// </summary>
public IReadOnlyList<string> ManagedParameterTypes { get; init; } = [];

/// <summary>
/// True when this Java constructor has a matching managed constructor on the target type.
/// </summary>
public bool HasManagedConstructor { get; init; }
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,8 @@ static void BuildUcoConstructors (JavaPeerInfo peer, JavaPeerProxyData proxy)
ManagedTypeName = peer.ManagedTypeName,
AssemblyName = peer.AssemblyName,
},
ManagedParameterTypes = ctor.ManagedParameterTypes,
HasManagedConstructor = ctor.HasManagedConstructor,
});
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -611,6 +611,12 @@ public void Throw ()
SetStack (0);
}

public void PopValue ()
{
Encoder.OpCode (ILOpCode.Pop);
Pop (1);
}

public void OpCode (ILOpCode code)
{
Encoder.OpCode (code);
Expand Down
Loading