Mercurial > hg > graal-jvmci-8
annotate graal/com.oracle.jvmci.meta/src/com/oracle/jvmci/meta/LocationIdentity.java @ 21630:9cc3571ef51d
Add getProfilingInfo(boolean includeNormal, boolean includeOSR) to ResolvedJavaMethod
author | Gilles Duboscq <gilles.m.duboscq@oracle.com> |
---|---|
date | Fri, 29 May 2015 14:46:49 +0200 |
parents | 48c1ebd24120 |
children |
rev | line source |
---|---|
9792
06dc2d2324d6
pulled LocationIdentity into a top level class and moved it to the api.meta project
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1 /* |
06dc2d2324d6
pulled LocationIdentity into a top level class and moved it to the api.meta project
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
2 * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. |
06dc2d2324d6
pulled LocationIdentity into a top level class and moved it to the api.meta project
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
06dc2d2324d6
pulled LocationIdentity into a top level class and moved it to the api.meta project
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
4 * |
06dc2d2324d6
pulled LocationIdentity into a top level class and moved it to the api.meta project
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
06dc2d2324d6
pulled LocationIdentity into a top level class and moved it to the api.meta project
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
06dc2d2324d6
pulled LocationIdentity into a top level class and moved it to the api.meta project
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
06dc2d2324d6
pulled LocationIdentity into a top level class and moved it to the api.meta project
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
8 * |
06dc2d2324d6
pulled LocationIdentity into a top level class and moved it to the api.meta project
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
06dc2d2324d6
pulled LocationIdentity into a top level class and moved it to the api.meta project
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
06dc2d2324d6
pulled LocationIdentity into a top level class and moved it to the api.meta project
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
06dc2d2324d6
pulled LocationIdentity into a top level class and moved it to the api.meta project
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
06dc2d2324d6
pulled LocationIdentity into a top level class and moved it to the api.meta project
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
06dc2d2324d6
pulled LocationIdentity into a top level class and moved it to the api.meta project
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
14 * |
06dc2d2324d6
pulled LocationIdentity into a top level class and moved it to the api.meta project
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
06dc2d2324d6
pulled LocationIdentity into a top level class and moved it to the api.meta project
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
06dc2d2324d6
pulled LocationIdentity into a top level class and moved it to the api.meta project
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
06dc2d2324d6
pulled LocationIdentity into a top level class and moved it to the api.meta project
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
18 * |
06dc2d2324d6
pulled LocationIdentity into a top level class and moved it to the api.meta project
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
06dc2d2324d6
pulled LocationIdentity into a top level class and moved it to the api.meta project
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
06dc2d2324d6
pulled LocationIdentity into a top level class and moved it to the api.meta project
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
21 * questions. |
06dc2d2324d6
pulled LocationIdentity into a top level class and moved it to the api.meta project
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
22 */ |
21556
48c1ebd24120
renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21390
diff
changeset
|
23 package com.oracle.jvmci.meta; |
9792
06dc2d2324d6
pulled LocationIdentity into a top level class and moved it to the api.meta project
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
24 |
18317
c83efc00f6cc
made LocationIdentity values support .equals() instead of identity (i.e. '==') for equality comparisons (and as hash map keys)
Doug Simon <doug.simon@oracle.com>
parents:
18307
diff
changeset
|
25 import java.util.*; |
c83efc00f6cc
made LocationIdentity values support .equals() instead of identity (i.e. '==') for equality comparisons (and as hash map keys)
Doug Simon <doug.simon@oracle.com>
parents:
18307
diff
changeset
|
26 |
21017
66d45b977e44
Add missing //JaCoCo Exclude directives.
Roland Schatz <roland.schatz@oracle.com>
parents:
19852
diff
changeset
|
27 // JaCoCo Exclude |
66d45b977e44
Add missing //JaCoCo Exclude directives.
Roland Schatz <roland.schatz@oracle.com>
parents:
19852
diff
changeset
|
28 |
9792
06dc2d2324d6
pulled LocationIdentity into a top level class and moved it to the api.meta project
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
29 /** |
06dc2d2324d6
pulled LocationIdentity into a top level class and moved it to the api.meta project
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
30 * Marker interface for location identities. Apart from the special values {@link #ANY_LOCATION} and |
06dc2d2324d6
pulled LocationIdentity into a top level class and moved it to the api.meta project
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
31 * {@link #FINAL_LOCATION}, a different location identity of two memory accesses guarantees that the |
06dc2d2324d6
pulled LocationIdentity into a top level class and moved it to the api.meta project
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
32 * two accesses do not interfere. |
18317
c83efc00f6cc
made LocationIdentity values support .equals() instead of identity (i.e. '==') for equality comparisons (and as hash map keys)
Doug Simon <doug.simon@oracle.com>
parents:
18307
diff
changeset
|
33 * |
c83efc00f6cc
made LocationIdentity values support .equals() instead of identity (i.e. '==') for equality comparisons (and as hash map keys)
Doug Simon <doug.simon@oracle.com>
parents:
18307
diff
changeset
|
34 * Clients of {@link LocationIdentity} must use {@link #equals(Object)}, not {@code ==}, when |
c83efc00f6cc
made LocationIdentity values support .equals() instead of identity (i.e. '==') for equality comparisons (and as hash map keys)
Doug Simon <doug.simon@oracle.com>
parents:
18307
diff
changeset
|
35 * comparing two {@link LocationIdentity} values for equality. Likewise, they must not use |
c83efc00f6cc
made LocationIdentity values support .equals() instead of identity (i.e. '==') for equality comparisons (and as hash map keys)
Doug Simon <doug.simon@oracle.com>
parents:
18307
diff
changeset
|
36 * {@link IdentityHashMap}s with {@link LocationIdentity} values as keys. |
9792
06dc2d2324d6
pulled LocationIdentity into a top level class and moved it to the api.meta project
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
37 */ |
19851
426461951938
Convert LocationIdentity from an interface into an abstract class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19831
diff
changeset
|
38 public abstract class LocationIdentity { |
9792
06dc2d2324d6
pulled LocationIdentity into a top level class and moved it to the api.meta project
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
39 |
06dc2d2324d6
pulled LocationIdentity into a top level class and moved it to the api.meta project
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
40 /** |
06dc2d2324d6
pulled LocationIdentity into a top level class and moved it to the api.meta project
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
41 * Denotes any location. A write to such a location kills all values in a memory map during an |
06dc2d2324d6
pulled LocationIdentity into a top level class and moved it to the api.meta project
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
42 * analysis of memory accesses. A read from this location cannot be moved or coalesced with |
06dc2d2324d6
pulled LocationIdentity into a top level class and moved it to the api.meta project
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
43 * other reads because its interaction with other reads is not known. |
06dc2d2324d6
pulled LocationIdentity into a top level class and moved it to the api.meta project
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
44 */ |
19852
3d0116ec99c5
Create utilities LocationIdentity#isAny, LocationIdentity#isSingle, LocationIdentity#any, LocationIdentity#overlaps.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19851
diff
changeset
|
45 private static final LocationIdentity ANY_LOCATION = NamedLocationIdentity.mutable("ANY_LOCATION"); |
9792
06dc2d2324d6
pulled LocationIdentity into a top level class and moved it to the api.meta project
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
46 |
06dc2d2324d6
pulled LocationIdentity into a top level class and moved it to the api.meta project
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
47 /** |
18231
70df63b02309
Use LocationIdentity.isImmutable instead of testing against FINAL_LOCATION
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14019
diff
changeset
|
48 * Denotes the location of a value that is guaranteed to be unchanging. |
9792
06dc2d2324d6
pulled LocationIdentity into a top level class and moved it to the api.meta project
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
49 */ |
19851
426461951938
Convert LocationIdentity from an interface into an abstract class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19831
diff
changeset
|
50 public static final LocationIdentity FINAL_LOCATION = NamedLocationIdentity.immutable("FINAL_LOCATION"); |
9792
06dc2d2324d6
pulled LocationIdentity into a top level class and moved it to the api.meta project
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
51 |
14019
9d864856336a
support canonicalization of arraylength in ReadNode
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
9792
diff
changeset
|
52 /** |
9d864856336a
support canonicalization of arraylength in ReadNode
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
9792
diff
changeset
|
53 * Denotes the location of the length field of a Java array. |
9d864856336a
support canonicalization of arraylength in ReadNode
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
9792
diff
changeset
|
54 */ |
19851
426461951938
Convert LocationIdentity from an interface into an abstract class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19831
diff
changeset
|
55 public static final LocationIdentity ARRAY_LENGTH_LOCATION = NamedLocationIdentity.immutable("[].length"); |
18231
70df63b02309
Use LocationIdentity.isImmutable instead of testing against FINAL_LOCATION
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14019
diff
changeset
|
56 |
19852
3d0116ec99c5
Create utilities LocationIdentity#isAny, LocationIdentity#isSingle, LocationIdentity#any, LocationIdentity#overlaps.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19851
diff
changeset
|
57 public static LocationIdentity any() { |
3d0116ec99c5
Create utilities LocationIdentity#isAny, LocationIdentity#isSingle, LocationIdentity#any, LocationIdentity#overlaps.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19851
diff
changeset
|
58 return ANY_LOCATION; |
3d0116ec99c5
Create utilities LocationIdentity#isAny, LocationIdentity#isSingle, LocationIdentity#any, LocationIdentity#overlaps.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19851
diff
changeset
|
59 } |
3d0116ec99c5
Create utilities LocationIdentity#isAny, LocationIdentity#isSingle, LocationIdentity#any, LocationIdentity#overlaps.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19851
diff
changeset
|
60 |
18231
70df63b02309
Use LocationIdentity.isImmutable instead of testing against FINAL_LOCATION
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14019
diff
changeset
|
61 /** |
70df63b02309
Use LocationIdentity.isImmutable instead of testing against FINAL_LOCATION
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14019
diff
changeset
|
62 * Denotes a location is unchanging in all cases. Not that this is different than the Java |
70df63b02309
Use LocationIdentity.isImmutable instead of testing against FINAL_LOCATION
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14019
diff
changeset
|
63 * notion of final which only requires definite assignment. |
70df63b02309
Use LocationIdentity.isImmutable instead of testing against FINAL_LOCATION
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14019
diff
changeset
|
64 */ |
21390
f9024b74dd9e
Allow subclasses of LocationIdentity to provide immuatability information
Christian Wimmer <christian.wimmer@oracle.com>
parents:
21017
diff
changeset
|
65 public abstract boolean isImmutable(); |
19852
3d0116ec99c5
Create utilities LocationIdentity#isAny, LocationIdentity#isSingle, LocationIdentity#any, LocationIdentity#overlaps.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19851
diff
changeset
|
66 |
3d0116ec99c5
Create utilities LocationIdentity#isAny, LocationIdentity#isSingle, LocationIdentity#any, LocationIdentity#overlaps.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19851
diff
changeset
|
67 public final boolean isMutable() { |
21390
f9024b74dd9e
Allow subclasses of LocationIdentity to provide immuatability information
Christian Wimmer <christian.wimmer@oracle.com>
parents:
21017
diff
changeset
|
68 return !isImmutable(); |
18231
70df63b02309
Use LocationIdentity.isImmutable instead of testing against FINAL_LOCATION
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
14019
diff
changeset
|
69 } |
19831
6b73ce815fc2
Add a new algorithm for latest possible schedule. Fix earliest possible schedule for the case of floating reads. Add scheduling test cases.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18584
diff
changeset
|
70 |
19852
3d0116ec99c5
Create utilities LocationIdentity#isAny, LocationIdentity#isSingle, LocationIdentity#any, LocationIdentity#overlaps.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19851
diff
changeset
|
71 public final boolean isAny() { |
3d0116ec99c5
Create utilities LocationIdentity#isAny, LocationIdentity#isSingle, LocationIdentity#any, LocationIdentity#overlaps.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19851
diff
changeset
|
72 return this == ANY_LOCATION; |
3d0116ec99c5
Create utilities LocationIdentity#isAny, LocationIdentity#isSingle, LocationIdentity#any, LocationIdentity#overlaps.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19851
diff
changeset
|
73 } |
3d0116ec99c5
Create utilities LocationIdentity#isAny, LocationIdentity#isSingle, LocationIdentity#any, LocationIdentity#overlaps.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19851
diff
changeset
|
74 |
3d0116ec99c5
Create utilities LocationIdentity#isAny, LocationIdentity#isSingle, LocationIdentity#any, LocationIdentity#overlaps.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19851
diff
changeset
|
75 public final boolean isSingle() { |
3d0116ec99c5
Create utilities LocationIdentity#isAny, LocationIdentity#isSingle, LocationIdentity#any, LocationIdentity#overlaps.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19851
diff
changeset
|
76 return this != ANY_LOCATION; |
3d0116ec99c5
Create utilities LocationIdentity#isAny, LocationIdentity#isSingle, LocationIdentity#any, LocationIdentity#overlaps.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19851
diff
changeset
|
77 } |
3d0116ec99c5
Create utilities LocationIdentity#isAny, LocationIdentity#isSingle, LocationIdentity#any, LocationIdentity#overlaps.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19851
diff
changeset
|
78 |
3d0116ec99c5
Create utilities LocationIdentity#isAny, LocationIdentity#isSingle, LocationIdentity#any, LocationIdentity#overlaps.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19851
diff
changeset
|
79 public final boolean overlaps(LocationIdentity other) { |
3d0116ec99c5
Create utilities LocationIdentity#isAny, LocationIdentity#isSingle, LocationIdentity#any, LocationIdentity#overlaps.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
19851
diff
changeset
|
80 return isAny() || other.isAny() || this.equals(other); |
19831
6b73ce815fc2
Add a new algorithm for latest possible schedule. Fix earliest possible schedule for the case of floating reads. Add scheduling test cases.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18584
diff
changeset
|
81 } |
9792
06dc2d2324d6
pulled LocationIdentity into a top level class and moved it to the api.meta project
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
82 } |