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

[mono] Simplify of OffsetToStringData as it's done on coreclr #93987

Merged
merged 7 commits into from
Oct 26, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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 @@ -32,8 +32,20 @@
[Obsolete("OffsetToStringData has been deprecated. Use string.GetPinnableReference() instead.")]
public static int OffsetToStringData
{
[Intrinsic]
get => OffsetToStringData;
[NonVersionable]

Check failure on line 35 in src/mono/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.Mono.cs

View check run for this annotation

Azure Pipelines / runtime (Build linux-arm Debug AllSubsets_Mono)

src/mono/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.Mono.cs#L35

src/mono/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.Mono.cs(35,14): error CS0246: (NETCORE_ENGINEERING_TELEMETRY=Build) The type or namespace name 'NonVersionableAttribute' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 35 in src/mono/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.Mono.cs

View check run for this annotation

Azure Pipelines / runtime (Build linux-arm Debug AllSubsets_Mono)

src/mono/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.Mono.cs#L35

src/mono/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.Mono.cs(35,14): error CS0246: (NETCORE_ENGINEERING_TELEMETRY=Build) The type or namespace name 'NonVersionable' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 35 in src/mono/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.Mono.cs

View check run for this annotation

Azure Pipelines / runtime (Build linux-x64 Debug AllSubsets_Mono_LLVMJIT)

src/mono/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.Mono.cs#L35

src/mono/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.Mono.cs(35,14): error CS0246: (NETCORE_ENGINEERING_TELEMETRY=Build) The type or namespace name 'NonVersionableAttribute' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 35 in src/mono/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.Mono.cs

View check run for this annotation

Azure Pipelines / runtime (Build linux-x64 Debug AllSubsets_Mono_LLVMJIT)

src/mono/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.Mono.cs#L35

src/mono/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.Mono.cs(35,14): error CS0246: (NETCORE_ENGINEERING_TELEMETRY=Build) The type or namespace name 'NonVersionable' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 35 in src/mono/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.Mono.cs

View check run for this annotation

Azure Pipelines / runtime (Build linux-arm64 Debug AllSubsets_Mono_LLVMJIT)

src/mono/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.Mono.cs#L35

src/mono/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.Mono.cs(35,14): error CS0246: (NETCORE_ENGINEERING_TELEMETRY=Build) The type or namespace name 'NonVersionableAttribute' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 35 in src/mono/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.Mono.cs

View check run for this annotation

Azure Pipelines / runtime (Build linux-arm64 Debug AllSubsets_Mono_LLVMJIT)

src/mono/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.Mono.cs#L35

src/mono/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.Mono.cs(35,14): error CS0246: (NETCORE_ENGINEERING_TELEMETRY=Build) The type or namespace name 'NonVersionable' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 35 in src/mono/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.Mono.cs

View check run for this annotation

Azure Pipelines / runtime (Build linux_musl-x64 Release AllSubsets_Mono)

src/mono/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.Mono.cs#L35

src/mono/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.Mono.cs(35,14): error CS0246: (NETCORE_ENGINEERING_TELEMETRY=Build) The type or namespace name 'NonVersionableAttribute' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 35 in src/mono/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.Mono.cs

View check run for this annotation

Azure Pipelines / runtime (Build linux_musl-x64 Release AllSubsets_Mono)

src/mono/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.Mono.cs#L35

src/mono/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.Mono.cs(35,14): error CS0246: (NETCORE_ENGINEERING_TELEMETRY=Build) The type or namespace name 'NonVersionable' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 35 in src/mono/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.Mono.cs

View check run for this annotation

Azure Pipelines / runtime (Build Mono Product Build linux arm64 debug)

src/mono/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.Mono.cs#L35

src/mono/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.Mono.cs(35,14): error CS0246: (NETCORE_ENGINEERING_TELEMETRY=Build) The type or namespace name 'NonVersionableAttribute' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 35 in src/mono/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.Mono.cs

View check run for this annotation

Azure Pipelines / runtime (Build Mono Product Build linux arm64 debug)

src/mono/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.Mono.cs#L35

src/mono/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.Mono.cs(35,14): error CS0246: (NETCORE_ENGINEERING_TELEMETRY=Build) The type or namespace name 'NonVersionable' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 35 in src/mono/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.Mono.cs

View check run for this annotation

Azure Pipelines / runtime (Build linux-x64 Release AllSubsets_Mono_LLVMAOT)

src/mono/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.Mono.cs#L35

src/mono/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.Mono.cs(35,14): error CS0246: (NETCORE_ENGINEERING_TELEMETRY=Build) The type or namespace name 'NonVersionableAttribute' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 35 in src/mono/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.Mono.cs

View check run for this annotation

Azure Pipelines / runtime (Build linux-x64 Release AllSubsets_Mono_LLVMAOT)

src/mono/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.Mono.cs#L35

src/mono/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.Mono.cs(35,14): error CS0246: (NETCORE_ENGINEERING_TELEMETRY=Build) The type or namespace name 'NonVersionable' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 35 in src/mono/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.Mono.cs

View check run for this annotation

Azure Pipelines / runtime (Build Mono Product Build linux x64 debug)

src/mono/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.Mono.cs#L35

src/mono/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.Mono.cs(35,14): error CS0246: (NETCORE_ENGINEERING_TELEMETRY=Build) The type or namespace name 'NonVersionableAttribute' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 35 in src/mono/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.Mono.cs

View check run for this annotation

Azure Pipelines / runtime (Build Mono Product Build linux x64 debug)

src/mono/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.Mono.cs#L35

src/mono/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.Mono.cs(35,14): error CS0246: (NETCORE_ENGINEERING_TELEMETRY=Build) The type or namespace name 'NonVersionable' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 35 in src/mono/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.Mono.cs

View check run for this annotation

Azure Pipelines / runtime (Build linux-riscv64 Release AllSubsets_Mono)

src/mono/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.Mono.cs#L35

src/mono/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.Mono.cs(35,14): error CS0246: (NETCORE_ENGINEERING_TELEMETRY=Build) The type or namespace name 'NonVersionableAttribute' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 35 in src/mono/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.Mono.cs

View check run for this annotation

Azure Pipelines / runtime (Build linux-riscv64 Release AllSubsets_Mono)

src/mono/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.Mono.cs#L35

src/mono/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.Mono.cs(35,14): error CS0246: (NETCORE_ENGINEERING_TELEMETRY=Build) The type or namespace name 'NonVersionable' could not be found (are you missing a using directive or an assembly reference?)
vargaz marked this conversation as resolved.
Show resolved Hide resolved
get =>
// Number of bytes from the address pointed to by a reference to
// a String to the first 16-bit character in the String. Skip
// over the MethodTable pointer, & String
// length. Of course, the String reference points to the memory
// after the sync block, so don't count that.
// This property allows C#'s fixed statement to work on Strings.
// On 64 bit platforms, this should be 12 (8+4) and on 32 bit 8 (4+4).
vargaz marked this conversation as resolved.
Show resolved Hide resolved
#if TARGET_64BIT
20;
lambdageek marked this conversation as resolved.
Show resolved Hide resolved
#else // 32
12;
#endif // TARGET_64BIT
}

[MethodImplAttribute(MethodImplOptions.InternalCall)]
Expand Down
11 changes: 1 addition & 10 deletions src/mono/mono/mini/interp/transform.c
Original file line number Diff line number Diff line change
Expand Up @@ -2305,16 +2305,7 @@ interp_handle_intrinsics (TransformData *td, MonoMethod *target_method, MonoClas
*op = MINT_INITBLK;
}
} else if (in_corlib && !strcmp (klass_name_space, "System.Runtime.CompilerServices") && !strcmp (klass_name, "RuntimeHelpers")) {
if (!strcmp (tm, "get_OffsetToStringData")) {
g_assert (csignature->param_count == 0);
int offset = MONO_STRUCT_OFFSET (MonoString, chars);
interp_add_ins (td, MINT_LDC_I4);
WRITE32_INS (td->last_ins, 0, &offset);
push_simple_type (td, STACK_TYPE_I4);
interp_ins_set_dreg (td->last_ins, td->sp [-1].local);
td->ip += 5;
return TRUE;
} else if (!strcmp (tm, "GetHashCode") || !strcmp (tm, "InternalGetHashCode")) {
if (!strcmp (tm, "GetHashCode") || !strcmp (tm, "InternalGetHashCode")) {
*op = MINT_INTRINS_GET_HASHCODE;
} else if (!strcmp (tm, "TryGetHashCode")) {
*op = MINT_INTRINS_TRY_GET_HASHCODE;
Expand Down
5 changes: 1 addition & 4 deletions src/mono/mono/mini/intrinsics.c
Original file line number Diff line number Diff line change
Expand Up @@ -935,10 +935,7 @@ mini_emit_inst_for_method (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSign
} else
return NULL;
} else if (cmethod->klass == runtime_helpers_class) {
if (strcmp (cmethod->name, "get_OffsetToStringData") == 0 && fsig->param_count == 0) {
EMIT_NEW_ICONST (cfg, ins, MONO_STRUCT_OFFSET (MonoString, chars));
return ins;
} else if (!strcmp (cmethod->name, "GetRawData")) {
if (!strcmp (cmethod->name, "GetRawData")) {
int dreg = alloc_preg (cfg);
EMIT_NEW_BIALU_IMM (cfg, ins, OP_PADD_IMM, dreg, args [0]->dreg, MONO_ABI_SIZEOF (MonoObject));
return ins;
Expand Down
Loading