Skip to content

Commit 3bb47f2

Browse files
committed
Revert "Fix offset calculation for nested struct, when pinvoke is enabled (#91422)"
This reverts commit 414e1a7.
1 parent 5c7d61b commit 3bb47f2

File tree

7 files changed

+2
-137
lines changed

7 files changed

+2
-137
lines changed

src/mono/mono/mini/mini-amd64.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ collect_field_info_nested (MonoClass *klass, GArray *fields_array, int offset, g
355355
g_assert(info);
356356
for (guint32 i = 0; i < info->num_fields; ++i) {
357357
if (MONO_TYPE_ISSTRUCT (info->fields [i].field->type)) {
358-
collect_field_info_nested (mono_class_from_mono_type_internal (info->fields [i].field->type), fields_array, (offset + info->fields [i].offset), pinvoke, unicode);
358+
collect_field_info_nested (mono_class_from_mono_type_internal (info->fields [i].field->type), fields_array, info->fields [i].offset, pinvoke, unicode);
359359
} else {
360360
guint32 align;
361361
StructFieldInfo f;
@@ -365,7 +365,7 @@ collect_field_info_nested (MonoClass *klass, GArray *fields_array, int offset, g
365365
info->fields [i].mspec,
366366
&align, TRUE, unicode);
367367
f.offset = offset + info->fields [i].offset;
368-
if ((i == info->num_fields - 1) && ((f.size + f.offset) < info->native_size)) {
368+
if (i == info->num_fields - 1 && f.size + f.offset < info->native_size) {
369369
/* This can happen with .pack directives eg. 'fixed' arrays */
370370
if (MONO_TYPE_IS_PRIMITIVE (f.type)) {
371371
/* Replicate the last field to fill out the remaining place, since the code in add_valuetype () needs type information */

src/tests/Interop/StructMarshalling/PInvoke/GameControllerButtonBind.cs

Lines changed: 0 additions & 63 deletions
This file was deleted.

src/tests/Interop/StructMarshalling/PInvoke/MarshalStructAsParamDLL.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1297,8 +1297,3 @@ extern "C" DLL_EXPORT Int32CLongStruct STDMETHODCALLTYPE AddCLongs(Int32CLongStr
12971297
{
12981298
return { lhs.i + rhs.i, lhs.l + rhs.l };
12991299
}
1300-
1301-
extern "C" DLL_EXPORT SDL_GameControllerBindType STDMETHODCALLTYPE getBindType(SDL_GameControllerButtonBind button)
1302-
{
1303-
return button.bindType;
1304-
}

src/tests/Interop/StructMarshalling/PInvoke/MarshalStructAsParamDLL.h

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -974,26 +974,3 @@ struct Int32CLongStruct
974974
int32_t i;
975975
long l;
976976
};
977-
978-
typedef enum
979-
{
980-
SDL_CONTROLLER_BINDTYPE_NONE = 0,
981-
SDL_CONTROLLER_BINDTYPE_BUTTON,
982-
SDL_CONTROLLER_BINDTYPE_AXIS,
983-
SDL_CONTROLLER_BINDTYPE_HAT
984-
} SDL_GameControllerBindType;
985-
986-
typedef struct SDL_GameControllerButtonBind
987-
{
988-
SDL_GameControllerBindType bindType;
989-
union
990-
{
991-
int button;
992-
int axis;
993-
struct {
994-
int hat;
995-
int hat_mask;
996-
} hat;
997-
} value;
998-
999-
} SDL_GameControllerButtonBind;

src/tests/Interop/StructMarshalling/PInvoke/NestedStruct.cs

Lines changed: 0 additions & 27 deletions
This file was deleted.

src/tests/Interop/StructMarshalling/PInvoke/NestedStruct.csproj

Lines changed: 0 additions & 14 deletions
This file was deleted.

src/tests/issues.targets

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4062,9 +4062,6 @@
40624062
<ExcludeList Include="$(XunitTestBinBase)/Interop/MonoAPI/**">
40634063
<Issue>mobile and wasm don't support tests with native libraries. wasm also needs static linking</Issue>
40644064
</ExcludeList>
4065-
<ExcludeList Include="$(XunitTestBinBase)/Interop/StructMarshalling/PInvoke/NestedStruct/**">
4066-
<Issue>https://github.com/dotnet/runtime/issues/64127</Issue>
4067-
</ExcludeList>
40684065
</ItemGroup>
40694066

40704067
<Target Name="GetFilteredExcludeList" Returns="@(FilteredExcludeList)">

0 commit comments

Comments
 (0)