Skip to content

Commit

Permalink
Do not use rebind in StringConcatFactory
Browse files Browse the repository at this point in the history
OpenJ9 does not support MethodHandle.rebind. So, its usage has been temporarily
removed from StringConcatFactory until OpenJ9 supports OpenJDK MethodHandles.

Fixes: eclipse-openj9/openj9#9771

Signed-off-by: Babneet Singh <[email protected]>
  • Loading branch information
babsingh committed Jun 24, 2020
1 parent b4c0560 commit 64624cb
Showing 1 changed file with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* ===========================================================================
* (c) Copyright IBM Corp. 2020, 2020 All Rights Reserved.
* ===========================================================================
*/

package java.lang.invoke;

Expand Down Expand Up @@ -646,7 +651,7 @@ public MethodHandle apply(Class<?> c) {
MethodHandle prepend = JLA.stringConcatHelper("prepend",
methodType(long.class, long.class, byte[].class,
Wrapper.asPrimitiveType(c), String.class));
return prepend.rebind();
return prepend;
}
};

Expand All @@ -663,7 +668,7 @@ public MethodHandle apply(Class<?> c) {
public MethodHandle apply(Class<?> c) {
MethodHandle mix = JLA.stringConcatHelper("mix",
methodType(long.class, long.class, Wrapper.asPrimitiveType(c)));
return mix.rebind();
return mix;
}
};

Expand All @@ -673,7 +678,7 @@ private static MethodHandle simpleConcat() {
if (mh == null) {
MethodHandle simpleConcat = JLA.stringConcatHelper("simpleConcat",
methodType(String.class, Object.class, Object.class));
SIMPLE_CONCAT = mh = simpleConcat.rebind();
SIMPLE_CONCAT = mh = simpleConcat;
}
return mh;
}
Expand All @@ -684,7 +689,7 @@ private static MethodHandle newString() {
if (mh == null) {
MethodHandle newString = JLA.stringConcatHelper("newString",
methodType(String.class, byte[].class, long.class));
NEW_STRING = mh = newString.rebind();
NEW_STRING = mh = newString;
}
return mh;
}
Expand All @@ -695,7 +700,7 @@ private static MethodHandle newArrayWithSuffix(String suffix) {
if (mh == null) {
MethodHandle newArrayWithSuffix = JLA.stringConcatHelper("newArrayWithSuffix",
methodType(byte[].class, String.class, long.class));
NEW_ARRAY_SUFFIX = mh = newArrayWithSuffix.rebind();
NEW_ARRAY_SUFFIX = mh = newArrayWithSuffix;
}
return MethodHandles.insertArguments(mh, 0, suffix);
}
Expand Down

0 comments on commit 64624cb

Please sign in to comment.