Mercurial > hg > graal-compiler
annotate graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/typesystem/ImplicitCastData.java @ 11828:1d64bfb3f481
new PrintAfterCompilation option, simplify PrintCompilation output
author | Lukas Stadler <lukas.stadler@jku.at> |
---|---|
date | Mon, 30 Sep 2013 14:02:07 +0200 |
parents | 2fb276f5e3e9 |
children | 5f022aa41631 |
rev | line source |
---|---|
11468
79d4c4b2d6db
Truffle-DSL: added ImplicitCast api classes. (non functional yet)
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
1 /* |
79d4c4b2d6db
Truffle-DSL: added ImplicitCast api classes. (non functional yet)
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
2 * Copyright (c) 2012, 2012, Oracle and/or its affiliates. All rights reserved. |
79d4c4b2d6db
Truffle-DSL: added ImplicitCast api classes. (non functional yet)
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
79d4c4b2d6db
Truffle-DSL: added ImplicitCast api classes. (non functional yet)
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
4 * |
79d4c4b2d6db
Truffle-DSL: added ImplicitCast api classes. (non functional yet)
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
79d4c4b2d6db
Truffle-DSL: added ImplicitCast api classes. (non functional yet)
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
79d4c4b2d6db
Truffle-DSL: added ImplicitCast api classes. (non functional yet)
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
79d4c4b2d6db
Truffle-DSL: added ImplicitCast api classes. (non functional yet)
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
8 * |
79d4c4b2d6db
Truffle-DSL: added ImplicitCast api classes. (non functional yet)
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
79d4c4b2d6db
Truffle-DSL: added ImplicitCast api classes. (non functional yet)
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
79d4c4b2d6db
Truffle-DSL: added ImplicitCast api classes. (non functional yet)
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
79d4c4b2d6db
Truffle-DSL: added ImplicitCast api classes. (non functional yet)
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
79d4c4b2d6db
Truffle-DSL: added ImplicitCast api classes. (non functional yet)
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
13 * accompanied this code). |
79d4c4b2d6db
Truffle-DSL: added ImplicitCast api classes. (non functional yet)
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
14 * |
79d4c4b2d6db
Truffle-DSL: added ImplicitCast api classes. (non functional yet)
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
79d4c4b2d6db
Truffle-DSL: added ImplicitCast api classes. (non functional yet)
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
79d4c4b2d6db
Truffle-DSL: added ImplicitCast api classes. (non functional yet)
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
79d4c4b2d6db
Truffle-DSL: added ImplicitCast api classes. (non functional yet)
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
18 * |
79d4c4b2d6db
Truffle-DSL: added ImplicitCast api classes. (non functional yet)
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
79d4c4b2d6db
Truffle-DSL: added ImplicitCast api classes. (non functional yet)
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
79d4c4b2d6db
Truffle-DSL: added ImplicitCast api classes. (non functional yet)
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
21 * questions. |
79d4c4b2d6db
Truffle-DSL: added ImplicitCast api classes. (non functional yet)
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
22 */ |
79d4c4b2d6db
Truffle-DSL: added ImplicitCast api classes. (non functional yet)
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
23 package com.oracle.truffle.dsl.processor.typesystem; |
79d4c4b2d6db
Truffle-DSL: added ImplicitCast api classes. (non functional yet)
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
24 |
79d4c4b2d6db
Truffle-DSL: added ImplicitCast api classes. (non functional yet)
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
25 import com.oracle.truffle.dsl.processor.template.*; |
79d4c4b2d6db
Truffle-DSL: added ImplicitCast api classes. (non functional yet)
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
26 |
79d4c4b2d6db
Truffle-DSL: added ImplicitCast api classes. (non functional yet)
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
27 public class ImplicitCastData extends TemplateMethod { |
79d4c4b2d6db
Truffle-DSL: added ImplicitCast api classes. (non functional yet)
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
28 |
11545
2fb276f5e3e9
Truffle-DSL: implemented implicit casts.
Christian Humer <christian.humer@gmail.com>
parents:
11468
diff
changeset
|
29 private final TypeData sourceType; |
2fb276f5e3e9
Truffle-DSL: implemented implicit casts.
Christian Humer <christian.humer@gmail.com>
parents:
11468
diff
changeset
|
30 private final TypeData targetType; |
2fb276f5e3e9
Truffle-DSL: implemented implicit casts.
Christian Humer <christian.humer@gmail.com>
parents:
11468
diff
changeset
|
31 |
2fb276f5e3e9
Truffle-DSL: implemented implicit casts.
Christian Humer <christian.humer@gmail.com>
parents:
11468
diff
changeset
|
32 public ImplicitCastData(TemplateMethod method, TypeData sourceType, TypeData targetType) { |
11468
79d4c4b2d6db
Truffle-DSL: added ImplicitCast api classes. (non functional yet)
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
33 super(method); |
11545
2fb276f5e3e9
Truffle-DSL: implemented implicit casts.
Christian Humer <christian.humer@gmail.com>
parents:
11468
diff
changeset
|
34 this.sourceType = sourceType; |
2fb276f5e3e9
Truffle-DSL: implemented implicit casts.
Christian Humer <christian.humer@gmail.com>
parents:
11468
diff
changeset
|
35 this.targetType = targetType; |
2fb276f5e3e9
Truffle-DSL: implemented implicit casts.
Christian Humer <christian.humer@gmail.com>
parents:
11468
diff
changeset
|
36 } |
2fb276f5e3e9
Truffle-DSL: implemented implicit casts.
Christian Humer <christian.humer@gmail.com>
parents:
11468
diff
changeset
|
37 |
2fb276f5e3e9
Truffle-DSL: implemented implicit casts.
Christian Humer <christian.humer@gmail.com>
parents:
11468
diff
changeset
|
38 public TypeData getSourceType() { |
2fb276f5e3e9
Truffle-DSL: implemented implicit casts.
Christian Humer <christian.humer@gmail.com>
parents:
11468
diff
changeset
|
39 return sourceType; |
2fb276f5e3e9
Truffle-DSL: implemented implicit casts.
Christian Humer <christian.humer@gmail.com>
parents:
11468
diff
changeset
|
40 } |
2fb276f5e3e9
Truffle-DSL: implemented implicit casts.
Christian Humer <christian.humer@gmail.com>
parents:
11468
diff
changeset
|
41 |
2fb276f5e3e9
Truffle-DSL: implemented implicit casts.
Christian Humer <christian.humer@gmail.com>
parents:
11468
diff
changeset
|
42 public TypeData getTargetType() { |
2fb276f5e3e9
Truffle-DSL: implemented implicit casts.
Christian Humer <christian.humer@gmail.com>
parents:
11468
diff
changeset
|
43 return targetType; |
2fb276f5e3e9
Truffle-DSL: implemented implicit casts.
Christian Humer <christian.humer@gmail.com>
parents:
11468
diff
changeset
|
44 } |
2fb276f5e3e9
Truffle-DSL: implemented implicit casts.
Christian Humer <christian.humer@gmail.com>
parents:
11468
diff
changeset
|
45 |
2fb276f5e3e9
Truffle-DSL: implemented implicit casts.
Christian Humer <christian.humer@gmail.com>
parents:
11468
diff
changeset
|
46 @Override |
2fb276f5e3e9
Truffle-DSL: implemented implicit casts.
Christian Humer <christian.humer@gmail.com>
parents:
11468
diff
changeset
|
47 public int compareTo(TemplateMethod o) { |
2fb276f5e3e9
Truffle-DSL: implemented implicit casts.
Christian Humer <christian.humer@gmail.com>
parents:
11468
diff
changeset
|
48 if (o instanceof ImplicitCastData) { |
2fb276f5e3e9
Truffle-DSL: implemented implicit casts.
Christian Humer <christian.humer@gmail.com>
parents:
11468
diff
changeset
|
49 // implicit casts are ordered by source type since |
2fb276f5e3e9
Truffle-DSL: implemented implicit casts.
Christian Humer <christian.humer@gmail.com>
parents:
11468
diff
changeset
|
50 // its also the order in which they are checked. |
2fb276f5e3e9
Truffle-DSL: implemented implicit casts.
Christian Humer <christian.humer@gmail.com>
parents:
11468
diff
changeset
|
51 TypeData otherSourceType = ((ImplicitCastData) o).getSourceType(); |
2fb276f5e3e9
Truffle-DSL: implemented implicit casts.
Christian Humer <christian.humer@gmail.com>
parents:
11468
diff
changeset
|
52 return this.sourceType.compareTo(otherSourceType); |
2fb276f5e3e9
Truffle-DSL: implemented implicit casts.
Christian Humer <christian.humer@gmail.com>
parents:
11468
diff
changeset
|
53 } |
2fb276f5e3e9
Truffle-DSL: implemented implicit casts.
Christian Humer <christian.humer@gmail.com>
parents:
11468
diff
changeset
|
54 return super.compareTo(o); |
11468
79d4c4b2d6db
Truffle-DSL: added ImplicitCast api classes. (non functional yet)
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
55 } |
79d4c4b2d6db
Truffle-DSL: added ImplicitCast api classes. (non functional yet)
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
56 |
79d4c4b2d6db
Truffle-DSL: added ImplicitCast api classes. (non functional yet)
Christian Humer <christian.humer@gmail.com>
parents:
diff
changeset
|
57 } |