Skip to content

Commit 30df4e6

Browse files
committed
Move test code
1 parent 6349847 commit 30df4e6

File tree

2 files changed

+28
-36
lines changed

2 files changed

+28
-36
lines changed

src/mono/mono/tests/sgen-bridge-pathologies.cs

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,6 @@ public class NonBridge
1818
public object Link;
1919
}
2020

21-
public class NonBridge2 : NonBridge
22-
{
23-
public object Link2;
24-
}
25-
2621
class Driver {
2722
const int OBJ_COUNT = 200 * 1000;
2823
const int LINK_COUNT = 2;
@@ -238,35 +233,6 @@ static void NestedCycles ()
238233
asyncStreamWriter.Link2 = asyncStateMachineBox;
239234
}
240235

241-
/*
242-
* Simulates a graph where a heavy node has its fanout components
243-
* represented by cycles with back-references to the heavy node and
244-
* references to the same bridge objects.
245-
* This enters a pathological path in the SCC contraction where the
246-
* links to the bridge objects need to be correctly deduplicated. The
247-
* deduplication causes the heavy node to no longer be heavy.
248-
*/
249-
static void FauxHeavyNodeWithCycles ()
250-
{
251-
Bridge fanout = new Bridge ();
252-
253-
// Need enough edges for the node to be considered heavy by bridgeless_color_is_heavy
254-
NonBridge[] fauxHeavyNode = new NonBridge [100];
255-
for (int i = 0; i < fauxHeavyNode.Length; i++) {
256-
NonBridge2 cycle = new NonBridge2 ();
257-
cycle.Link = fanout;
258-
cycle.Link2 = fauxHeavyNode;
259-
fauxHeavyNode[i] = cycle;
260-
}
261-
262-
// Need at least HEAVY_REFS_MIN + 1 fan-in nodes
263-
Bridge[] faninNodes = new Bridge [3];
264-
for (int i = 0; i < faninNodes.Length; i++) {
265-
faninNodes[i] = new Bridge ();
266-
faninNodes[i].Links.Add (fauxHeavyNode);
267-
}
268-
}
269-
270236
static void RunTest (ThreadStart setup)
271237
{
272238
var t = new Thread (setup);
@@ -291,8 +257,6 @@ static int Main ()
291257
RunTest (SetupDeadList);
292258
RunTest (SetupSelfLinks);
293259
RunTest (Spider);
294-
RunTest (NestedCycles);
295-
RunTest (FauxHeavyNodeWithCycles);
296260

297261
for (int i = 0; i < 0; ++i) {
298262
GC.Collect ();

src/tests/GC/Features/Bridge/Bridge.cs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,33 @@ static void NestedCycles()
279279
asyncStreamWriter.Link2 = asyncStateMachineBox;
280280
}
281281

282+
// Simulates a graph where a heavy node has its fanout components
283+
// represented by cycles with back-references to the heavy node and
284+
// references to the same bridge objects.
285+
// This enters a pathological path in the SCC contraction where the
286+
// links to the bridge objects need to be correctly deduplicated. The
287+
// deduplication causes the heavy node to no longer be heavy.
288+
static void FauxHeavyNodeWithCycles()
289+
{
290+
Bridge fanout = new Bridge();
291+
292+
// Need enough edges for the node to be considered heavy by bridgeless_color_is_heavy
293+
NonBridge[] fauxHeavyNode = new NonBridge[100];
294+
for (int i = 0; i < fauxHeavyNode.Length; i++) {
295+
NonBridge2 cycle = new NonBridge2();
296+
cycle.Link = fanout;
297+
cycle.Link2 = fauxHeavyNode;
298+
fauxHeavyNode[i] = cycle;
299+
}
300+
301+
// Need at least HEAVY_REFS_MIN + 1 fan-in nodes
302+
Bridge[] faninNodes = new Bridge[3];
303+
for (int i = 0; i < faninNodes.Length; i++) {
304+
faninNodes[i] = new Bridge();
305+
faninNodes[i].Links.Add(fauxHeavyNode);
306+
}
307+
}
308+
282309
static void RunGraphTest(Action test)
283310
{
284311
Console.WriteLine("Start test {0}", test.Method.Name);
@@ -386,6 +413,7 @@ public static int Main(string[] args)
386413
RunGraphTest(SetupDeadList);
387414
RunGraphTest(SetupSelfLinks);
388415
RunGraphTest(NestedCycles);
416+
RunGraphTest(FauxHeavyNodeWithCycles);
389417
// RunGraphTest(Spider); // Crashes
390418
return 100;
391419
}

0 commit comments

Comments
 (0)