Mercurial > hg > graal-compiler
annotate src/share/vm/c1/c1_Compiler.cpp @ 1751:2528b5bd749c
6980262: Memory leak when exception is thrown in static initializer
Summary: Use resource memory instead of c-heap for the exception message
Reviewed-by: phh, jmasa
author | kamg |
---|---|
date | Fri, 27 Aug 2010 15:05:28 -0400 |
parents | b812ff5abc73 |
children | 2d26b0046e0d f95d63e2154a |
rev | line source |
---|---|
0 | 1 /* |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
2 * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved. |
0 | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | |
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 | |
7 * published by the Free Software Foundation. | |
8 * | |
9 * This code is distributed in the hope that it will be useful, but WITHOUT | |
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
12 * version 2 for more details (a copy is included in the LICENSE file that | |
13 * accompanied this code). | |
14 * | |
15 * You should have received a copy of the GNU General Public License version | |
16 * 2 along with this work; if not, write to the Free Software Foundation, | |
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
18 * | |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
25 #include "incls/_precompiled.incl" | |
26 #include "incls/_c1_Compiler.cpp.incl" | |
27 | |
28 volatile int Compiler::_runtimes = uninitialized; | |
29 | |
30 Compiler::Compiler() { | |
31 } | |
32 | |
33 | |
34 Compiler::~Compiler() { | |
35 Unimplemented(); | |
36 } | |
37 | |
38 | |
1584 | 39 void Compiler::initialize_all() { |
40 BufferBlob* buffer_blob = CompilerThread::current()->get_buffer_blob(); | |
41 Arena* arena = new Arena(); | |
42 Runtime1::initialize(buffer_blob); | |
43 FrameMap::initialize(); | |
44 // initialize data structures | |
45 ValueType::initialize(arena); | |
46 // Instruction::initialize(); | |
47 // BlockBegin::initialize(); | |
48 GraphBuilder::initialize(); | |
49 // note: to use more than one instance of LinearScan at a time this function call has to | |
50 // be moved somewhere outside of this constructor: | |
51 Interval::initialize(arena); | |
52 } | |
53 | |
54 | |
0 | 55 void Compiler::initialize() { |
56 if (_runtimes != initialized) { | |
1584 | 57 initialize_runtimes( initialize_all, &_runtimes); |
0 | 58 } |
59 mark_initialized(); | |
60 } | |
61 | |
62 | |
1584 | 63 BufferBlob* Compiler::build_buffer_blob() { |
64 // setup CodeBuffer. Preallocate a BufferBlob of size | |
65 // NMethodSizeLimit plus some extra space for constants. | |
66 int code_buffer_size = Compilation::desired_max_code_buffer_size() + | |
67 Compilation::desired_max_constant_size(); | |
68 BufferBlob* blob = BufferBlob::create("Compiler1 temporary CodeBuffer", | |
69 code_buffer_size); | |
70 guarantee(blob != NULL, "must create initial code buffer"); | |
71 return blob; | |
72 } | |
73 | |
74 | |
0 | 75 void Compiler::compile_method(ciEnv* env, ciMethod* method, int entry_bci) { |
1584 | 76 // Allocate buffer blob once at startup since allocation for each |
77 // compilation seems to be too expensive (at least on Intel win32). | |
78 BufferBlob* buffer_blob = CompilerThread::current()->get_buffer_blob(); | |
79 if (buffer_blob == NULL) { | |
80 buffer_blob = build_buffer_blob(); | |
81 CompilerThread::current()->set_buffer_blob(buffer_blob); | |
82 } | |
0 | 83 |
84 if (!is_initialized()) { | |
85 initialize(); | |
86 } | |
87 // invoke compilation | |
88 { | |
89 // We are nested here because we need for the destructor | |
90 // of Compilation to occur before we release the any | |
91 // competing compiler thread | |
92 ResourceMark rm; | |
1584 | 93 Compilation c(this, env, method, entry_bci, buffer_blob); |
0 | 94 } |
95 } | |
96 | |
97 | |
98 void Compiler::print_timers() { | |
99 Compilation::print_timers(); | |
100 } |