Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/dotnet/runtime.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Dupej <109523496+jandupej@users.noreply.github.com>2022-11-08 18:14:34 +0300
committerGitHub <noreply@github.com>2022-11-08 18:14:34 +0300
commitd0d21fdb83aa7287e2141395ebecd50ae1cc851e (patch)
tree459816becf018303efe35db51351cea47a38bb06
parentc7a40cfb3e00265e75b82e9b8b1da40251b69cfc (diff)
[mono] Added null-checks for LDFLDA on pointers. (#77827)
* Added a null check for LDFLDA with pointers. * Reenabled LDFLDA pointer null-check runtime test for mono. * Added null check for LDFLDA in Mono interpreter. * [mono][interp] LDFLDA fix for null pointers now keeps more optimizations intact.
-rw-r--r--src/mono/mono/mini/interp/transform.c4
-rw-r--r--src/mono/mono/mini/method-to-ir.c2
-rw-r--r--src/tests/issues.targets3
3 files changed, 3 insertions, 6 deletions
diff --git a/src/mono/mono/mini/interp/transform.c b/src/mono/mono/mini/interp/transform.c
index e4fcb8c6f3f..44b10c093c4 100644
--- a/src/mono/mono/mini/interp/transform.c
+++ b/src/mono/mono/mini/interp/transform.c
@@ -6034,12 +6034,12 @@ generate_code (TransformData *td, MonoMethod *method, MonoMethodHeader *header,
/* TODO: metadata-update: implement me. If it's an added field, emit a call to the helper method instead of MINT_LDFLDA_UNSAFE */
g_assert (!m_field_is_from_update (field));
int foffset = m_class_is_valuetype (klass) ? m_field_get_offset (field) - MONO_ABI_SIZEOF (MonoObject) : m_field_get_offset (field);
- if (td->sp->type == STACK_TYPE_O) {
+ if (td->sp->type == STACK_TYPE_O || td->sp->type == STACK_TYPE_I) {
interp_add_ins (td, MINT_LDFLDA);
td->last_ins->data [0] = GINT_TO_UINT16 (foffset);
} else {
int sp_type = td->sp->type;
- g_assert (sp_type == STACK_TYPE_MP || sp_type == STACK_TYPE_I);
+ g_assert (sp_type == STACK_TYPE_MP);
if (foffset) {
interp_add_ins (td, MINT_LDFLDA_UNSAFE);
td->last_ins->data [0] = GINT_TO_UINT16 (foffset);
diff --git a/src/mono/mono/mini/method-to-ir.c b/src/mono/mono/mini/method-to-ir.c
index 2c9c15234b2..16c5c992589 100644
--- a/src/mono/mono/mini/method-to-ir.c
+++ b/src/mono/mono/mini/method-to-ir.c
@@ -10007,7 +10007,7 @@ calli_end:
}
if (il_op == MONO_CEE_LDFLDA) {
- if (sp [0]->type == STACK_OBJ) {
+ if (sp [0]->type == STACK_OBJ || sp [0]->type == STACK_PTR) {
MONO_EMIT_NEW_BIALU_IMM (cfg, OP_COMPARE_IMM, -1, sp [0]->dreg, 0);
MONO_EMIT_NEW_COND_EXC (cfg, EQ, "NullReferenceException");
}
diff --git a/src/tests/issues.targets b/src/tests/issues.targets
index 40707e61173..139689f2ffa 100644
--- a/src/tests/issues.targets
+++ b/src/tests/issues.targets
@@ -1478,9 +1478,6 @@
<ExcludeList Include="$(XunitTestBinBase)/JIT/Regression/JitBlue/GitHub_15291/GitHub_15291/**">
<Issue>Doesn't pass after LLVM AOT compilation.</Issue>
</ExcludeList>
- <ExcludeList Include="$(XunitTestBinBase)/JIT/Regression/JitBlue/Runtime_77640/Runtime_77640/**">
- <Issue>https://github.com/dotnet/runtime/issues/77647</Issue>
- </ExcludeList>
<ExcludeList Include="$(XunitTestBinBase)/JIT/Regression/CLR-x86-JIT/V1-M09.5-PDC/b16928/b16928/**">
<Issue>Doesn't pass after LLVM AOT compilation.</Issue>
</ExcludeList>