Mercurial > hg > graal-jvmci-8
annotate graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/CompilerThreadFactory.java @ 14724:c3ec1e4494b8
update BenchmarkCounters (add TimedDynamicCounters, fix -XX:+GraalCountersExcludeCompiler)
author | Lukas Stadler <lukas.stadler@oracle.com> |
---|---|
date | Mon, 24 Mar 2014 13:31:39 +0100 |
parents | 47ac1df40fc2 |
children | b1530a6cce8c |
rev | line source |
---|---|
12614
47ac1df40fc2
refactored creation of Graal and Truffle compiler threads into a single facility
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1 /* |
47ac1df40fc2
refactored creation of Graal and Truffle compiler threads into a single facility
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
2 * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. |
47ac1df40fc2
refactored creation of Graal and Truffle compiler threads into a single facility
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
47ac1df40fc2
refactored creation of Graal and Truffle compiler threads into a single facility
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
4 * |
47ac1df40fc2
refactored creation of Graal and Truffle compiler threads into a single facility
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
47ac1df40fc2
refactored creation of Graal and Truffle compiler threads into a single facility
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
47ac1df40fc2
refactored creation of Graal and Truffle compiler threads into a single facility
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
47ac1df40fc2
refactored creation of Graal and Truffle compiler threads into a single facility
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
8 * |
47ac1df40fc2
refactored creation of Graal and Truffle compiler threads into a single facility
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
47ac1df40fc2
refactored creation of Graal and Truffle compiler threads into a single facility
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
47ac1df40fc2
refactored creation of Graal and Truffle compiler threads into a single facility
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
47ac1df40fc2
refactored creation of Graal and Truffle compiler threads into a single facility
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
47ac1df40fc2
refactored creation of Graal and Truffle compiler threads into a single facility
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
47ac1df40fc2
refactored creation of Graal and Truffle compiler threads into a single facility
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
14 * |
47ac1df40fc2
refactored creation of Graal and Truffle compiler threads into a single facility
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
47ac1df40fc2
refactored creation of Graal and Truffle compiler threads into a single facility
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
47ac1df40fc2
refactored creation of Graal and Truffle compiler threads into a single facility
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
47ac1df40fc2
refactored creation of Graal and Truffle compiler threads into a single facility
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
18 * |
47ac1df40fc2
refactored creation of Graal and Truffle compiler threads into a single facility
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
47ac1df40fc2
refactored creation of Graal and Truffle compiler threads into a single facility
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
47ac1df40fc2
refactored creation of Graal and Truffle compiler threads into a single facility
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
21 * questions. |
47ac1df40fc2
refactored creation of Graal and Truffle compiler threads into a single facility
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
22 */ |
47ac1df40fc2
refactored creation of Graal and Truffle compiler threads into a single facility
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
23 package com.oracle.graal.compiler; |
47ac1df40fc2
refactored creation of Graal and Truffle compiler threads into a single facility
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
24 |
47ac1df40fc2
refactored creation of Graal and Truffle compiler threads into a single facility
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
25 import java.util.concurrent.*; |
47ac1df40fc2
refactored creation of Graal and Truffle compiler threads into a single facility
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
26 |
47ac1df40fc2
refactored creation of Graal and Truffle compiler threads into a single facility
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
27 import com.oracle.graal.debug.*; |
47ac1df40fc2
refactored creation of Graal and Truffle compiler threads into a single facility
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
28 |
47ac1df40fc2
refactored creation of Graal and Truffle compiler threads into a single facility
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
29 /** |
47ac1df40fc2
refactored creation of Graal and Truffle compiler threads into a single facility
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
30 * Facility for creating {@linkplain CompilerThread compiler threads}. |
47ac1df40fc2
refactored creation of Graal and Truffle compiler threads into a single facility
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
31 */ |
47ac1df40fc2
refactored creation of Graal and Truffle compiler threads into a single facility
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
32 public class CompilerThreadFactory implements ThreadFactory { |
47ac1df40fc2
refactored creation of Graal and Truffle compiler threads into a single facility
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
33 |
47ac1df40fc2
refactored creation of Graal and Truffle compiler threads into a single facility
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
34 /** |
47ac1df40fc2
refactored creation of Graal and Truffle compiler threads into a single facility
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
35 * Capability to get a thread-local debug configuration for the current thread. |
47ac1df40fc2
refactored creation of Graal and Truffle compiler threads into a single facility
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
36 */ |
47ac1df40fc2
refactored creation of Graal and Truffle compiler threads into a single facility
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
37 public interface DebugConfigAccess { |
47ac1df40fc2
refactored creation of Graal and Truffle compiler threads into a single facility
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
38 /** |
47ac1df40fc2
refactored creation of Graal and Truffle compiler threads into a single facility
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
39 * Get a thread-local debug configuration for the current thread. This will be null if |
47ac1df40fc2
refactored creation of Graal and Truffle compiler threads into a single facility
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
40 * debugging is {@linkplain Debug#isEnabled() disabled}. |
47ac1df40fc2
refactored creation of Graal and Truffle compiler threads into a single facility
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
41 */ |
47ac1df40fc2
refactored creation of Graal and Truffle compiler threads into a single facility
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
42 GraalDebugConfig getDebugConfig(); |
47ac1df40fc2
refactored creation of Graal and Truffle compiler threads into a single facility
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
43 } |
47ac1df40fc2
refactored creation of Graal and Truffle compiler threads into a single facility
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
44 |
47ac1df40fc2
refactored creation of Graal and Truffle compiler threads into a single facility
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
45 protected final String threadNamePrefix; |
47ac1df40fc2
refactored creation of Graal and Truffle compiler threads into a single facility
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
46 protected final DebugConfigAccess debugConfigAccess; |
47ac1df40fc2
refactored creation of Graal and Truffle compiler threads into a single facility
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
47 |
47ac1df40fc2
refactored creation of Graal and Truffle compiler threads into a single facility
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
48 public CompilerThreadFactory(String threadNamePrefix, DebugConfigAccess debugConfigAccess) { |
47ac1df40fc2
refactored creation of Graal and Truffle compiler threads into a single facility
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
49 this.threadNamePrefix = threadNamePrefix; |
47ac1df40fc2
refactored creation of Graal and Truffle compiler threads into a single facility
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
50 this.debugConfigAccess = debugConfigAccess; |
47ac1df40fc2
refactored creation of Graal and Truffle compiler threads into a single facility
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
51 } |
47ac1df40fc2
refactored creation of Graal and Truffle compiler threads into a single facility
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
52 |
47ac1df40fc2
refactored creation of Graal and Truffle compiler threads into a single facility
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
53 public Thread newThread(Runnable r) { |
47ac1df40fc2
refactored creation of Graal and Truffle compiler threads into a single facility
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
54 return new CompilerThread(r, threadNamePrefix, debugConfigAccess); |
47ac1df40fc2
refactored creation of Graal and Truffle compiler threads into a single facility
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
55 } |
47ac1df40fc2
refactored creation of Graal and Truffle compiler threads into a single facility
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
56 } |