Skip to content

Commit a0f2118

Browse files
committed
WebImage: simplify disabling TruffleString SIMD intrinsics
1 parent 6965600 commit a0f2118

File tree

4 files changed

+16
-314
lines changed

4 files changed

+16
-314
lines changed

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/truffle/substitutions/TruffleInvocationPlugins.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,15 @@
9797
public class TruffleInvocationPlugins {
9898

9999
public static void register(Architecture architecture, InvocationPlugins plugins) {
100+
register(architecture, plugins, true);
101+
}
102+
103+
public static void register(Architecture architecture, InvocationPlugins plugins, boolean registerSIMDIntrinsics) {
100104
if (architecture instanceof AMD64 || architecture instanceof AArch64) {
101-
registerTStringPlugins(plugins, architecture);
102-
registerArrayUtilsPlugins(plugins);
105+
if (registerSIMDIntrinsics) {
106+
registerTStringPlugins(plugins, architecture);
107+
registerArrayUtilsPlugins(plugins);
108+
}
103109
registerExactMathPlugins(plugins);
104110
}
105111
registerFramePlugins(plugins);

substratevm/src/com.oracle.svm.truffle/src/com/oracle/svm/truffle/TruffleBaseFeature.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,14 @@ public void cleanup() {
497497
@Override
498498
public void registerInvocationPlugins(Providers providers, Plugins plugins, ParsingReason reason) {
499499
StaticObjectSupport.registerInvocationPlugins(plugins, reason);
500-
TruffleInvocationPlugins.register(providers.getLowerer().getTarget().arch, plugins.getInvocationPlugins());
500+
501+
/*
502+
* SIMD intrinsics for TruffleString and ArrayUtils are implemented for AMD64 and AARCH64
503+
* only, so they need to be turned off when compiling for WebImage.
504+
*/
505+
Class<?> webImageFeature = ReflectionUtil.lookupClass(true, "com.oracle.svm.webimage.truffle.WebImageTruffleFeature");
506+
boolean registerSIMDIntrinsics = webImageFeature == null || !ImageSingletons.contains(webImageFeature);
507+
TruffleInvocationPlugins.register(providers.getLowerer().getTarget().arch, plugins.getInvocationPlugins(), registerSIMDIntrinsics);
501508

502509
/*
503510
* We need to constant-fold Profile.isProfilingEnabled already during static analysis, so

truffle/src/com.oracle.truffle.api.strings/src/com/oracle/truffle/api/strings/TSCodeRange.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ final class TSCodeRange {
7575
*/
7676
private static final int FLAG_IMPRECISE = 1 << 5;
7777
private static final int MASK_ORDINAL_MULTIBYTE = MASK_ORDINAL | FLAG_MULTIBYTE;
78-
private static final int MASK_FOREIGN_ENDIAN_MULTIBYTE = FLAG_FOREIGN_ENDIAN | FLAG_MULTIBYTE;
7978

8079
/**
8180
* All codepoints are ASCII (0x00 - 0x7f).
@@ -137,10 +136,6 @@ static boolean isForeignEndian(int codeRange) {
137136
return (codeRange & FLAG_FOREIGN_ENDIAN) != 0;
138137
}
139138

140-
public static boolean isForeignEndianFixedWidth(int codeRange) {
141-
return (codeRange & MASK_FOREIGN_ENDIAN_MULTIBYTE) == FLAG_FOREIGN_ENDIAN;
142-
}
143-
144139
static boolean isFixedWidth(int codeRange) {
145140
return (codeRange & FLAG_MULTIBYTE) == 0;
146141
}

0 commit comments

Comments
 (0)