use of com.oracle.svm.core.annotate.Substitute in project graal by oracle.
the class LoggerSubstitutions method findResourceBundle.
@Substitute
private ResourceBundle findResourceBundle(String name, boolean useCallersClassLoader) {
/* TODO: the method was originally synchronized. */
if (name == null) {
return null;
}
/* Same caching as in original implementation. */
Locale currentLocale = Locale.getDefault();
if (catalog != null && currentLocale.equals(catalogLocale) && name.equals(catalogName)) {
return catalog;
}
/*
* Call our (also substituted) resource bundle lookup, without any references to
* ClassLoader.
*/
catalog = ResourceBundle.getBundle(name, currentLocale);
catalogName = name;
catalogLocale = currentLocale;
return catalog;
}
use of com.oracle.svm.core.annotate.Substitute in project graal by oracle.
the class DynamicHub method getResourceAsStream.
@Substitute
private InputStream getResourceAsStream(String resourceName) {
final String path = resolveName(getName(), resourceName);
List<byte[]> arr = Resources.get(path);
return arr == null ? null : new ByteArrayInputStream(arr.get(0));
}
use of com.oracle.svm.core.annotate.Substitute in project graal by oracle.
the class CharsetSubstitutions method availableCharsets.
@Substitute
private static SortedMap<String, Charset> availableCharsets() {
TreeMap<String, Charset> result = new TreeMap<>(ASCIICaseInsensitiveComparator.CASE_INSENSITIVE_ORDER);
Map<String, Charset> charsets = ImageSingletons.lookup(LocalizationSupport.class).charsets;
for (Charset charset : charsets.values()) {
result.put(charset.name(), charset);
}
return Collections.unmodifiableSortedMap(result);
}
use of com.oracle.svm.core.annotate.Substitute in project graal by oracle.
the class Target_com_oracle_truffle_api_nodes_Node method get.
@Substitute
public static NodeClass get(Class<?> clazz) {
CompilerAsserts.neverPartOfCompilation();
NodeClass nodeClass = (NodeClass) DynamicHub.fromClass(clazz).getMetaType();
if (nodeClass == null) {
throw shouldNotReachHere("Unknown node class: " + clazz.getName());
}
return nodeClass;
}
use of com.oracle.svm.core.annotate.Substitute in project graal by oracle.
the class Target_com_oracle_truffle_nfi_impl_NFIContext method loadLibrary.
@Substitute
@TruffleBoundary
static long loadLibrary(@SuppressWarnings("unused") long nativeContext, String name, int flags) {
PointerBase ret = PosixUtils.dlopen(name, flags);
if (ret.equal(WordFactory.zero())) {
CompilerDirectives.transferToInterpreter();
String error = PosixUtils.dlerror();
throw new UnsatisfiedLinkError(error);
}
return ret.rawValue();
}
Aggregations