From c72254709b273731f73e65d40edb2606b8f94f0d Mon Sep 17 00:00:00 2001 From: Maoni Stephens Date: Fri, 30 Jan 2015 16:44:15 -0800 Subject: [PATCH 1/2] ported a fix for AV [tfs-changeset: 1408093] --- src/gc/gc.cpp | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/src/gc/gc.cpp b/src/gc/gc.cpp index 9b9d234e083e..e0cd018cfe85 100644 --- a/src/gc/gc.cpp +++ b/src/gc/gc.cpp @@ -16132,8 +16132,18 @@ void gc_heap::enque_pinned_plug (BYTE* plug, if (save_pre_plug_info_p) { +#ifdef SHORT_PLUGS + BOOL is_padded = is_plug_padded (last_object_in_last_plug); + if (is_padded) + clear_plug_padded (last_object_in_last_plug); +#endif //SHORT_PLUGS memcpy (&(m.saved_pre_plug), &(((plug_and_gap*)plug)[-1]), sizeof (gap_reloc_pair)); - memcpy (&(m.saved_pre_plug_reloc), &(m.saved_pre_plug), sizeof (gap_reloc_pair)); +#ifdef SHORT_PLUGS + if (is_padded) + set_plug_padded (last_object_in_last_plug); +#endif //SHORT_PLUGS + + memcpy (&(m.saved_pre_plug_reloc), &(((plug_and_gap*)plug)[-1]), sizeof (gap_reloc_pair)); // If the last object in the last plug is too short, it requires special handling. size_t last_obj_size = plug - last_object_in_last_plug; @@ -16175,8 +16185,19 @@ void gc_heap::save_post_plug_info (BYTE* last_pinned_plug, BYTE* last_object_in_ mark& m = mark_stack_array[mark_stack_tos - 1]; assert (last_pinned_plug == m.first); m.saved_post_plug_info_start = (BYTE*)&(((plug_and_gap*)post_plug)[-1]); + +#ifdef SHORT_PLUGS + BOOL is_padded = is_plug_padded (last_object_in_last_plug); + if (is_padded) + clear_plug_padded (last_object_in_last_plug); +#endif //SHORT_PLUGS memcpy (&(m.saved_post_plug), m.saved_post_plug_info_start, sizeof (gap_reloc_pair)); - memcpy (&(m.saved_post_plug_reloc), &(m.saved_post_plug), sizeof (gap_reloc_pair)); +#ifdef SHORT_PLUGS + if (is_padded) + set_plug_padded (last_object_in_last_plug); +#endif //SHORT_PLUGS + + memcpy (&(m.saved_post_plug_reloc), m.saved_post_plug_info_start, sizeof (gap_reloc_pair)); // This is important - we need to clear all bits here except the last one. m.saved_post_p = TRUE; From e80a41aa9833244b0b3243a45702f3f389dfbff3 Mon Sep 17 00:00:00 2001 From: dotnet-bot Date: Fri, 30 Jan 2015 17:00:49 -0800 Subject: [PATCH 2/2] Update for copyright. [tfs-changeset: 1408109] --- tests/src/JIT/Directed/Arrays/complex1.cs | 4 ++++ tests/src/JIT/Directed/Arrays/simple1.cs | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/tests/src/JIT/Directed/Arrays/complex1.cs b/tests/src/JIT/Directed/Arrays/complex1.cs index d7bf204aee5f..169953e5e77b 100644 --- a/tests/src/JIT/Directed/Arrays/complex1.cs +++ b/tests/src/JIT/Directed/Arrays/complex1.cs @@ -1,3 +1,7 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. +// + using System; // Do a complex 5 dimensional Jagged array. diff --git a/tests/src/JIT/Directed/Arrays/simple1.cs b/tests/src/JIT/Directed/Arrays/simple1.cs index b82ff542e3a9..d529d001da2e 100644 --- a/tests/src/JIT/Directed/Arrays/simple1.cs +++ b/tests/src/JIT/Directed/Arrays/simple1.cs @@ -1,3 +1,7 @@ +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. +// + using System; public // Do a simple 5 dimensional Jagged array.