comparison src/share/vm/opto/loopnode.cpp @ 2248:194c9fdee631

7017240: C2: native memory leak in nsk/regression/b4675027 on windows-x86 in comp mode with G1 Summary: Add ResourceMark into PhaseIdealLoop::build_and_optimize(). Reviewed-by: never
author kvn
date Mon, 07 Feb 2011 09:46:01 -0800
parents f95d63e2154a
children 9dc311b8473e
comparison
equal deleted inserted replaced
2247:c52cba2a3359 2248:194c9fdee631
1 /* 1 /*
2 * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
1478 //============================================================================= 1478 //=============================================================================
1479 //----------------------------build_and_optimize------------------------------- 1479 //----------------------------build_and_optimize-------------------------------
1480 // Create a PhaseLoop. Build the ideal Loop tree. Map each Ideal Node to 1480 // Create a PhaseLoop. Build the ideal Loop tree. Map each Ideal Node to
1481 // its corresponding LoopNode. If 'optimize' is true, do some loop cleanups. 1481 // its corresponding LoopNode. If 'optimize' is true, do some loop cleanups.
1482 void PhaseIdealLoop::build_and_optimize(bool do_split_ifs, bool do_loop_pred) { 1482 void PhaseIdealLoop::build_and_optimize(bool do_split_ifs, bool do_loop_pred) {
1483 ResourceMark rm;
1484
1483 int old_progress = C->major_progress(); 1485 int old_progress = C->major_progress();
1484 1486
1485 // Reset major-progress flag for the driver's heuristics 1487 // Reset major-progress flag for the driver's heuristics
1486 C->clear_major_progress(); 1488 C->clear_major_progress();
1487 1489
2011 } 2013 }
2012 } 2014 }
2013 if (_dom_stk == NULL) { 2015 if (_dom_stk == NULL) {
2014 uint init_size = C->unique() / 100; // Guess that 1/100 is a reasonable initial size. 2016 uint init_size = C->unique() / 100; // Guess that 1/100 is a reasonable initial size.
2015 if (init_size < 10) init_size = 10; 2017 if (init_size < 10) init_size = 10;
2016 _dom_stk = new (C->node_arena()) GrowableArray<uint>(C->node_arena(), init_size, 0, 0); 2018 _dom_stk = new GrowableArray<uint>(init_size);
2017 } 2019 }
2018 // Compute new depth for each node. 2020 // Compute new depth for each node.
2019 for (i = 0; i < _idom_size; i++) { 2021 for (i = 0; i < _idom_size; i++) {
2020 uint j = i; 2022 uint j = i;
2021 // Run up the dom tree to find a node with a depth 2023 // Run up the dom tree to find a node with a depth