Mercurial > hg > truffle
comparison truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/TruffleLanguage.java @ 22133:c334865b9d42
Make sure TruffleLanguage.createEnv is only called when Accessor.CURRENT_VM is known
author | Jaroslav Tulach <jaroslav.tulach@oracle.com> |
---|---|
date | Fri, 04 Sep 2015 10:39:23 +0200 |
parents | f879b1fe3773 |
children | dc83cc1f94f2 b31dcacfc8ff 3aad794eec0e |
comparison
equal
deleted
inserted
replaced
22132:19205292b0c7 | 22133:c334865b9d42 |
---|---|
22 * or visit www.oracle.com if you need additional information or have any | 22 * or visit www.oracle.com if you need additional information or have any |
23 * questions. | 23 * questions. |
24 */ | 24 */ |
25 package com.oracle.truffle.api; | 25 package com.oracle.truffle.api; |
26 | 26 |
27 import java.io.*; | |
28 import java.lang.annotation.*; | |
29 | |
30 import com.oracle.truffle.api.debug.*; | 27 import com.oracle.truffle.api.debug.*; |
31 import com.oracle.truffle.api.impl.*; | 28 import com.oracle.truffle.api.impl.*; |
32 import com.oracle.truffle.api.instrument.*; | 29 import com.oracle.truffle.api.instrument.*; |
33 import com.oracle.truffle.api.nodes.Node; | 30 import com.oracle.truffle.api.nodes.Node; |
34 import com.oracle.truffle.api.source.*; | 31 import com.oracle.truffle.api.source.*; |
32 import java.io.*; | |
33 import java.lang.annotation.*; | |
35 import java.util.Collections; | 34 import java.util.Collections; |
36 import java.util.Map; | 35 import java.util.Map; |
37 import java.util.WeakHashMap; | 36 import java.util.WeakHashMap; |
38 | 37 |
39 /** | 38 /** |
215 final TruffleLanguage<C> lang; | 214 final TruffleLanguage<C> lang; |
216 final C ctx; | 215 final C ctx; |
217 | 216 |
218 public LangCtx(TruffleLanguage<C> lang, Env env) { | 217 public LangCtx(TruffleLanguage<C> lang, Env env) { |
219 this.lang = lang; | 218 this.lang = lang; |
219 // following call verifies that Accessor.CURRENT_VM is provided | |
220 assert API.findLanguage(null, null) == null; | |
220 this.ctx = lang.createContext(env); | 221 this.ctx = lang.createContext(env); |
221 } | 222 } |
222 | 223 |
223 Object findExportedSymbol(String globalName, boolean onlyExplicit) { | 224 Object findExportedSymbol(String globalName, boolean onlyExplicit) { |
224 return lang.findExportedSymbol(ctx, globalName, onlyExplicit); | 225 return lang.findExportedSymbol(ctx, globalName, onlyExplicit); |