Mercurial > hg > truffle
annotate graal/com.oracle.jvmci.compiler/src/com/oracle/jvmci/compiler/CompilerThreadFactory.java @ 21787:2766fee1809a
Use the fact that a range checked array index is not negative to avoid sign-extension of the index register.
author | Roland Schatz <roland.schatz@oracle.com> |
---|---|
date | Mon, 08 Jun 2015 19:32:59 +0200 |
parents | 3d15183f3c93 |
children |
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 */ |
21780
3d15183f3c93
Introduce Compiler interface in jvmci. Use it from jvmci.hotspot.CompilationTask
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21554
diff
changeset
|
23 package com.oracle.jvmci.compiler; |
12614
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 |
21554
b1530a6cce8c
renamed com.oracle.graal.[debug|options|hotspotvmconfig]* modules to com.oracle.jvmci.[debug|options|hotspotvmconfig]* modules (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
14724
diff
changeset
|
27 import com.oracle.jvmci.debug.*; |
12614
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 */ |
21780
3d15183f3c93
Introduce Compiler interface in jvmci. Use it from jvmci.hotspot.CompilationTask
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents:
21554
diff
changeset
|
42 JVMCIDebugConfig getDebugConfig(); |
12614
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 } |