Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
dotNET Platform
runtime
提交
a19585dd
R
runtime
项目概览
dotNET Platform
/
runtime
12 个月 前同步成功
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
runtime
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
a19585dd
编写于
8月 14, 2023
作者:
Z
Zoltan Varga
提交者:
GitHub
8月 14, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[mono][arm64] Fixed passing/receiving hfa structures with fixed buffers. (#90502)
Fixes
https://github.com/dotnet/runtime/issues/90423
.
上级
09af1614
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
86 addition
and
4 deletion
+86
-4
src/mono/mono/mini/mini-arm64.c
src/mono/mono/mini/mini-arm64.c
+19
-4
src/tests/JIT/Regression/JitBlue/Runtime_90423/Runtime_90423.cs
...sts/JIT/Regression/JitBlue/Runtime_90423/Runtime_90423.cs
+58
-0
src/tests/JIT/Regression/JitBlue/Runtime_90423/Runtime_90423.csproj
...JIT/Regression/JitBlue/Runtime_90423/Runtime_90423.csproj
+9
-0
未找到文件。
src/mono/mono/mini/mini-arm64.c
浏览文件 @
a19585dd
...
...
@@ -28,6 +28,7 @@
#include <mono/utils/mono-hwcap.h>
#include <mono/metadata/abi-details.h>
#include <mono/metadata/tokentype.h>
#include <mono/metadata/marshal-shared.h>
#include "llvm-intrinsics-types.h"
#include "interp/interp.h"
...
...
@@ -1483,7 +1484,7 @@ is_hfa (MonoType *t, int *out_nfields, int *out_esize, int *field_offsets)
gpointer
iter
;
MonoClassField
*
field
;
MonoType
*
ftype
,
*
prev_ftype
=
NULL
;
int
i
,
nfields
=
0
;
int
nfields
=
0
;
klass
=
mono_class_from_mono_type_internal
(
t
);
iter
=
NULL
;
...
...
@@ -1497,8 +1498,22 @@ is_hfa (MonoType *t, int *out_nfields, int *out_esize, int *field_offsets)
int
nested_nfields
,
nested_esize
;
int
nested_field_offsets
[
16
];
if
(
!
is_hfa
(
ftype
,
&
nested_nfields
,
&
nested_esize
,
nested_field_offsets
))
return
FALSE
;
MonoType
*
fixed_etype
;
int
fixed_len
;
if
(
mono_marshal_shared_get_fixed_buffer_attr
(
field
,
&
fixed_etype
,
&
fixed_len
))
{
if
(
fixed_etype
->
type
!=
MONO_TYPE_R4
&&
fixed_etype
->
type
!=
MONO_TYPE_R8
)
return
FALSE
;
if
(
fixed_len
>
16
)
return
FALSE
;
nested_nfields
=
fixed_len
;
nested_esize
=
fixed_etype
->
type
==
MONO_TYPE_R4
?
4
:
8
;
for
(
int
i
=
0
;
i
<
nested_nfields
;
++
i
)
nested_field_offsets
[
i
]
=
i
*
nested_esize
;
}
else
{
if
(
!
is_hfa
(
ftype
,
&
nested_nfields
,
&
nested_esize
,
nested_field_offsets
))
return
FALSE
;
}
if
(
nested_esize
==
4
)
ftype
=
m_class_get_byval_arg
(
mono_defaults
.
single_class
);
else
...
...
@@ -1506,7 +1521,7 @@ is_hfa (MonoType *t, int *out_nfields, int *out_esize, int *field_offsets)
if
(
prev_ftype
&&
prev_ftype
->
type
!=
ftype
->
type
)
return
FALSE
;
prev_ftype
=
ftype
;
for
(
i
=
0
;
i
<
nested_nfields
;
++
i
)
{
for
(
i
nt
i
=
0
;
i
<
nested_nfields
;
++
i
)
{
if
(
nfields
+
i
<
4
)
field_offsets
[
nfields
+
i
]
=
field
->
offset
-
MONO_ABI_SIZEOF
(
MonoObject
)
+
nested_field_offsets
[
i
];
}
...
...
src/tests/JIT/Regression/JitBlue/Runtime_90423/Runtime_90423.cs
0 → 100644
浏览文件 @
a19585dd
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using
System.Runtime.CompilerServices
;
using
System.Runtime.Intrinsics
;
using
System.Runtime.Intrinsics.X86
;
using
Xunit
;
using
System
;
public
class
Runtime_90423
{
public
static
BaconClass
.
BaconStruct
foo
;
[
Fact
]
public
unsafe
static
int
EntryPoint
()
{
foo
=
BaconClass
.
GetBacon
();
for
(
int
i
=
0
;
i
<
BaconClass
.
BaconStruct
.
RESOLUTION
;
i
++)
{
if
(
Math
.
Abs
(
foo
.
table
[
i
]
-
BaconClass
.
foo
.
table
[
i
])
>
float
.
Epsilon
)
return
101
;
}
return
100
;
}
public
class
BaconClass
{
public
unsafe
struct
BaconStruct
{
public
float
length
;
public
const
int
RESOLUTION
=
5
;
public
fixed
float
table
[
RESOLUTION
];
}
public
static
BaconStruct
foo
;
public
unsafe
static
BaconStruct
GetBacon
()
{
const
int
resolution
=
BaconStruct
.
RESOLUTION
;
var
length
=
1
;
BaconStruct
lut
=
new
BaconStruct
()
{
length
=
length
};
foo
=
new
BaconStruct
(){
length
=
length
};
float
[]
bacon
=
new
float
[]
{
1.1f
,
1.2f
,
1.3f
,
1.4f
,
1.5f
};
for
(
int
x
=
0
;
x
<
BaconStruct
.
RESOLUTION
;
x
++)
{
lut
.
table
[
x
]
=
bacon
[
x
];
foo
.
table
[
x
]
=
bacon
[
x
];
}
return
lut
;
}
}
}
src/tests/JIT/Regression/JitBlue/Runtime_90423/Runtime_90423.csproj
0 → 100644
浏览文件 @
a19585dd
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Optimize>True</Optimize>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<ItemGroup>
<Compile Include="$(MSBuildProjectName).cs" />
</ItemGroup>
</Project>
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录