Mercurial > hg > truffle
annotate truffle/com.oracle.truffle.api.vm/src/com/oracle/truffle/api/vm/LanguageCache.java @ 22137:1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
author | Jaroslav Tulach <jaroslav.tulach@oracle.com> |
---|---|
date | Wed, 09 Sep 2015 16:03:49 +0200 |
parents | f879b1fe3773 |
children | ffadd23c63c8 |
rev | line source |
---|---|
22117
fab555eab36e
Returning back the LanguageCache concept just making sure it has static final boolean field that eliminates the reflection part when ahead of time compilation is on.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
1 /* |
fab555eab36e
Returning back the LanguageCache concept just making sure it has static final boolean field that eliminates the reflection part when ahead of time compilation is on.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
2 * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. |
fab555eab36e
Returning back the LanguageCache concept just making sure it has static final boolean field that eliminates the reflection part when ahead of time compilation is on.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
fab555eab36e
Returning back the LanguageCache concept just making sure it has static final boolean field that eliminates the reflection part when ahead of time compilation is on.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
4 * |
fab555eab36e
Returning back the LanguageCache concept just making sure it has static final boolean field that eliminates the reflection part when ahead of time compilation is on.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
fab555eab36e
Returning back the LanguageCache concept just making sure it has static final boolean field that eliminates the reflection part when ahead of time compilation is on.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
fab555eab36e
Returning back the LanguageCache concept just making sure it has static final boolean field that eliminates the reflection part when ahead of time compilation is on.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. Oracle designates this |
fab555eab36e
Returning back the LanguageCache concept just making sure it has static final boolean field that eliminates the reflection part when ahead of time compilation is on.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
8 * particular file as subject to the "Classpath" exception as provided |
fab555eab36e
Returning back the LanguageCache concept just making sure it has static final boolean field that eliminates the reflection part when ahead of time compilation is on.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
9 * by Oracle in the LICENSE file that accompanied this code. |
fab555eab36e
Returning back the LanguageCache concept just making sure it has static final boolean field that eliminates the reflection part when ahead of time compilation is on.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
10 * |
fab555eab36e
Returning back the LanguageCache concept just making sure it has static final boolean field that eliminates the reflection part when ahead of time compilation is on.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
11 * This code is distributed in the hope that it will be useful, but WITHOUT |
fab555eab36e
Returning back the LanguageCache concept just making sure it has static final boolean field that eliminates the reflection part when ahead of time compilation is on.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
fab555eab36e
Returning back the LanguageCache concept just making sure it has static final boolean field that eliminates the reflection part when ahead of time compilation is on.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
fab555eab36e
Returning back the LanguageCache concept just making sure it has static final boolean field that eliminates the reflection part when ahead of time compilation is on.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
14 * version 2 for more details (a copy is included in the LICENSE file that |
fab555eab36e
Returning back the LanguageCache concept just making sure it has static final boolean field that eliminates the reflection part when ahead of time compilation is on.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
15 * accompanied this code). |
fab555eab36e
Returning back the LanguageCache concept just making sure it has static final boolean field that eliminates the reflection part when ahead of time compilation is on.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
16 * |
fab555eab36e
Returning back the LanguageCache concept just making sure it has static final boolean field that eliminates the reflection part when ahead of time compilation is on.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
17 * You should have received a copy of the GNU General Public License version |
fab555eab36e
Returning back the LanguageCache concept just making sure it has static final boolean field that eliminates the reflection part when ahead of time compilation is on.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
18 * 2 along with this work; if not, write to the Free Software Foundation, |
fab555eab36e
Returning back the LanguageCache concept just making sure it has static final boolean field that eliminates the reflection part when ahead of time compilation is on.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
fab555eab36e
Returning back the LanguageCache concept just making sure it has static final boolean field that eliminates the reflection part when ahead of time compilation is on.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
20 * |
fab555eab36e
Returning back the LanguageCache concept just making sure it has static final boolean field that eliminates the reflection part when ahead of time compilation is on.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
fab555eab36e
Returning back the LanguageCache concept just making sure it has static final boolean field that eliminates the reflection part when ahead of time compilation is on.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
22 * or visit www.oracle.com if you need additional information or have any |
fab555eab36e
Returning back the LanguageCache concept just making sure it has static final boolean field that eliminates the reflection part when ahead of time compilation is on.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
23 * questions. |
fab555eab36e
Returning back the LanguageCache concept just making sure it has static final boolean field that eliminates the reflection part when ahead of time compilation is on.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
24 */ |
fab555eab36e
Returning back the LanguageCache concept just making sure it has static final boolean field that eliminates the reflection part when ahead of time compilation is on.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
25 package com.oracle.truffle.api.vm; |
fab555eab36e
Returning back the LanguageCache concept just making sure it has static final boolean field that eliminates the reflection part when ahead of time compilation is on.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
26 |
fab555eab36e
Returning back the LanguageCache concept just making sure it has static final boolean field that eliminates the reflection part when ahead of time compilation is on.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
27 import com.oracle.truffle.api.TruffleLanguage; |
22137
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
28 import static com.oracle.truffle.api.vm.TruffleVM.LOG; |
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
29 import java.io.IOException; |
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
30 import java.io.InputStream; |
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
31 import java.net.URL; |
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
32 import java.util.Collections; |
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
33 import java.util.Enumeration; |
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
34 import java.util.LinkedHashMap; |
22117
fab555eab36e
Returning back the LanguageCache concept just making sure it has static final boolean field that eliminates the reflection part when ahead of time compilation is on.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
35 import java.util.Map; |
22137
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
36 import java.util.Properties; |
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
37 import java.util.Set; |
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
38 import java.util.TreeSet; |
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
39 import java.util.logging.Level; |
22117
fab555eab36e
Returning back the LanguageCache concept just making sure it has static final boolean field that eliminates the reflection part when ahead of time compilation is on.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
40 |
fab555eab36e
Returning back the LanguageCache concept just making sure it has static final boolean field that eliminates the reflection part when ahead of time compilation is on.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
41 /** |
fab555eab36e
Returning back the LanguageCache concept just making sure it has static final boolean field that eliminates the reflection part when ahead of time compilation is on.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
42 * Ahead-of-time initialization. If the JVM is started with -Dcom.oracle.truffle.aot=true, it |
fab555eab36e
Returning back the LanguageCache concept just making sure it has static final boolean field that eliminates the reflection part when ahead of time compilation is on.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
43 * populates cache with languages found in application classloader. |
fab555eab36e
Returning back the LanguageCache concept just making sure it has static final boolean field that eliminates the reflection part when ahead of time compilation is on.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
44 */ |
fab555eab36e
Returning back the LanguageCache concept just making sure it has static final boolean field that eliminates the reflection part when ahead of time compilation is on.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
45 final class LanguageCache { |
22137
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
46 static final boolean PRELOAD; |
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
47 private static final Map<String, LanguageCache> CACHE; |
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
48 private TruffleLanguage<?> language; |
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
49 private final String className; |
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
50 private final Set<String> mimeTypes; |
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
51 private final String name; |
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
52 private final String version; |
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
53 |
22117
fab555eab36e
Returning back the LanguageCache concept just making sure it has static final boolean field that eliminates the reflection part when ahead of time compilation is on.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
54 static { |
22137
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
55 Map<String, LanguageCache> map = null; |
22117
fab555eab36e
Returning back the LanguageCache concept just making sure it has static final boolean field that eliminates the reflection part when ahead of time compilation is on.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
56 if (Boolean.getBoolean("com.oracle.truffle.aot")) { // NOI18N |
22137
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
57 map = languages(); |
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
58 for (LanguageCache info : map.values()) { |
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
59 info.getImpl(true); |
22117
fab555eab36e
Returning back the LanguageCache concept just making sure it has static final boolean field that eliminates the reflection part when ahead of time compilation is on.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
60 } |
fab555eab36e
Returning back the LanguageCache concept just making sure it has static final boolean field that eliminates the reflection part when ahead of time compilation is on.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
61 } |
fab555eab36e
Returning back the LanguageCache concept just making sure it has static final boolean field that eliminates the reflection part when ahead of time compilation is on.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
62 CACHE = map; |
fab555eab36e
Returning back the LanguageCache concept just making sure it has static final boolean field that eliminates the reflection part when ahead of time compilation is on.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
63 PRELOAD = CACHE != null; |
fab555eab36e
Returning back the LanguageCache concept just making sure it has static final boolean field that eliminates the reflection part when ahead of time compilation is on.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
64 } |
fab555eab36e
Returning back the LanguageCache concept just making sure it has static final boolean field that eliminates the reflection part when ahead of time compilation is on.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
65 |
22137
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
66 LanguageCache(String prefix, Properties info, TruffleLanguage<?> language) { |
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
67 this.className = info.getProperty(prefix + "className"); |
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
68 this.name = info.getProperty(prefix + "name"); |
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
69 this.version = info.getProperty(prefix + "version"); |
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
70 TreeSet<String> ts = new TreeSet<>(); |
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
71 for (int i = 0;; i++) { |
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
72 String mt = info.getProperty(prefix + "mimeType." + i); |
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
73 if (mt == null) { |
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
74 break; |
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
75 } |
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
76 ts.add(mt); |
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
77 } |
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
78 this.mimeTypes = Collections.unmodifiableSet(ts); |
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
79 this.language = language; |
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
80 } |
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
81 |
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
82 private static ClassLoader loader() { |
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
83 ClassLoader l = TruffleVM.class.getClassLoader(); |
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
84 if (l == null) { |
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
85 l = ClassLoader.getSystemClassLoader(); |
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
86 } |
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
87 return l; |
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
88 } |
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
89 |
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
90 private static TruffleLanguage<?> find(String name, ClassLoader loader) throws NoSuchFieldException, IllegalAccessException, ClassNotFoundException { |
22117
fab555eab36e
Returning back the LanguageCache concept just making sure it has static final boolean field that eliminates the reflection part when ahead of time compilation is on.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
91 if (PRELOAD) { |
22137
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
92 return CACHE.get(name).language; |
22117
fab555eab36e
Returning back the LanguageCache concept just making sure it has static final boolean field that eliminates the reflection part when ahead of time compilation is on.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
93 } else { |
fab555eab36e
Returning back the LanguageCache concept just making sure it has static final boolean field that eliminates the reflection part when ahead of time compilation is on.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
94 Class<?> langClazz = Class.forName(name, true, loader); |
fab555eab36e
Returning back the LanguageCache concept just making sure it has static final boolean field that eliminates the reflection part when ahead of time compilation is on.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
95 return (TruffleLanguage<?>) langClazz.getField("INSTANCE").get(null); |
fab555eab36e
Returning back the LanguageCache concept just making sure it has static final boolean field that eliminates the reflection part when ahead of time compilation is on.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
96 } |
fab555eab36e
Returning back the LanguageCache concept just making sure it has static final boolean field that eliminates the reflection part when ahead of time compilation is on.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
97 } |
22137
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
98 |
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
99 static Map<String, LanguageCache> languages() { |
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
100 if (PRELOAD) { |
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
101 return CACHE; |
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
102 } |
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
103 ClassLoader loader = loader(); |
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
104 Map<String, LanguageCache> map = new LinkedHashMap<>(); |
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
105 Enumeration<URL> en; |
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
106 try { |
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
107 en = loader.getResources("META-INF/truffle/language"); |
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
108 } catch (IOException ex) { |
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
109 throw new IllegalStateException("Cannot read list of Truffle languages", ex); |
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
110 } |
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
111 while (en.hasMoreElements()) { |
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
112 URL u = en.nextElement(); |
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
113 Properties p; |
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
114 try { |
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
115 p = new Properties(); |
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
116 try (InputStream is = u.openStream()) { |
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
117 p.load(is); |
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
118 } |
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
119 } catch (IOException ex) { |
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
120 LOG.log(Level.CONFIG, "Cannot process " + u + " as language definition", ex); |
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
121 continue; |
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
122 } |
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
123 for (int cnt = 1;; cnt++) { |
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
124 String prefix = "language" + cnt + "."; |
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
125 if (p.getProperty(prefix + "name") == null) { |
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
126 break; |
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
127 } |
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
128 LanguageCache l = new LanguageCache(prefix, p, null); |
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
129 for (String mimeType : l.getMimeTypes()) { |
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
130 map.put(mimeType, l); |
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
131 } |
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
132 } |
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
133 } |
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
134 return map; |
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
135 } |
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
136 |
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
137 Set<String> getMimeTypes() { |
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
138 return mimeTypes; |
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
139 } |
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
140 |
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
141 String getName() { |
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
142 return name; |
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
143 } |
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
144 |
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
145 String getVersion() { |
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
146 return version; |
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
147 } |
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
148 |
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
149 TruffleLanguage<?> getImpl(boolean create) { |
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
150 if (PRELOAD) { |
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
151 return language; |
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
152 } |
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
153 if (create) { |
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
154 try { |
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
155 language = LanguageCache.find(className, loader()); |
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
156 } catch (Exception ex) { |
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
157 throw new IllegalStateException("Cannot initialize " + getName() + " language with implementation " + className, ex); |
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
158 } |
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
159 } |
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
160 return language; |
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
161 } |
1957c49a979d
(Re)Introducing LanguageCache - e.g. data that hold the essential static information about Truffle languages. Pre-initializing the data if AOT property is specified. Use mx -J-Dcom.oracle.truffle.aot=true unittest to validate proper behavior of AOT mode.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
22128
diff
changeset
|
162 |
22117
fab555eab36e
Returning back the LanguageCache concept just making sure it has static final boolean field that eliminates the reflection part when ahead of time compilation is on.
Jaroslav Tulach <jaroslav.tulach@oracle.com>
parents:
diff
changeset
|
163 } |