Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[23.0] Synchronization with upstream 23.0 branch for July CPU release #541

Merged
merged 91 commits into from
Jul 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
91 commits
Select commit Hold shift + click to select a range
0860c27
Fix handling of JavaTimeSupplementary resource bundles
pejovica Apr 27, 2023
381aa78
Add new publications
LesiaChaban Jun 7, 2023
d7cd709
Update publications.md
LesiaChaban Jun 12, 2023
1316238
Accentuate that tools are for GraalVM languages
olyagpl Jun 6, 2023
f35a575
Refactor GraalVM Overview page for graalvm.org website
olyagpl Jun 6, 2023
69304e3
Refactor overview and support docs for Oracle GraalVM at OHC
olyagpl Jun 6, 2023
fdc7497
Refactor GraalVM installation guides for graalvm.org website
olyagpl Jun 6, 2023
f3df9e3
Refactor GraalVM installation guides for OHC
olyagpl Jun 6, 2023
0d144f4
Rename filenames to installation.md and update rel paths
olyagpl Jun 6, 2023
d4443a6
Change /native-image/guides/ to /guides/; Review reference-manuals.md
olyagpl Jun 6, 2023
2a013c6
Review languages.md
olyagpl Jun 6, 2023
4465022
Revert /getting-started/ permalink back because it is now hardcoded f…
olyagpl Jun 7, 2023
f9a382c
Follow reviewers suggestions
olyagpl Jun 7, 2023
28e748f
Revert Installation to Getting Started
olyagpl Jun 7, 2023
cae0b12
Change filenames from installation-<os>.md to <os>.md; Update rel paths
olyagpl Jun 7, 2023
6f6c113
Remove extra information in CE installation guides
olyagpl Jun 7, 2023
077b3cb
Use regular docs layout for everything except NI Guides
olyagpl Jun 7, 2023
9da5292
Revert filename change because it is not propagated to docs in other …
olyagpl Jun 8, 2023
5de951b
Use an absolute path for OHC links
olyagpl Jun 8, 2023
c28f4d4
Improve CE install guides
olyagpl Jun 12, 2023
581d3a9
Improve Get Started with GraalVM
olyagpl Jun 12, 2023
4aba7f2
Update GraalVM overview
olyagpl Jun 12, 2023
4399ceb
Update and remove duplicate publication
LesiaChaban Jun 12, 2023
1346312
[GR-46437] Documentation backport: Update Academic Publications page …
LesiaChaban Jun 14, 2023
8327d16
[GR-46515] Documentation backport: Refactor GraalVM Intro and Getting…
LesiaChaban Jun 15, 2023
45e0cdc
update to jvmci-23.0-b13
marwan-hallaoui Jun 16, 2023
8a8f802
[GR-46641] Update to jvmci-23.0-b13.
marwan-hallaoui Jun 19, 2023
4c223dd
[GR-46669] The org.graalvm.truffle:truffle-api JAR contains JDK-19 sp…
tzezula Jun 19, 2023
0fd9297
Fix InteropLibrary#asBigInteger JavaDoc.
jchalou Jun 14, 2023
9e9cf16
[GR-46649] Backport 23.0 : Fix InteropLibrary#asBigInteger JavaDoc.
marwan-hallaoui Jun 21, 2023
ea9bb6d
Revert links to language docs
olyagpl Jun 16, 2023
b29f1ba
Update Java reference title
olyagpl Jun 16, 2023
b657f8b
Use absolute links to sieve.js and agent-fib.js
olyagpl Jun 20, 2023
9505383
Make links open in a new tab
olyagpl Jun 21, 2023
fe80cf6
Replace invalid links to OHC
LesiaChaban Jun 14, 2023
0e1479e
Use absolute links
olyagpl Jun 22, 2023
05f99c3
Rewrite Oracle GraalVM on OCI Compute Instances guide"
olyagpl Jun 16, 2023
b897640
Synchronize the message about GraalVM support at OCI
olyagpl Jun 16, 2023
cedfc4c
Update Oracle GraalVM in OCI DevOps Build Pipelines guide
olyagpl Jun 16, 2023
2499a84
Review OCI Code Editor and Cloud Shell guides
olyagpl Jun 16, 2023
3010a61
Correct the JAVA_HOME command
olyagpl Jun 20, 2023
2b087d2
Revert "Review OCI Code Editor and Cloud Shell guides"
olyagpl Jun 20, 2023
e5caec8
Improve user experience at OHC
olyagpl Jun 20, 2023
11cbff5
Follow review comments
sachin-pikle Jun 21, 2023
e7e0412
Minor text changes
sachin-pikle Jun 22, 2023
11e9508
Minor text changes
sachin-pikle Jun 22, 2023
9aa427c
Minor text change
sachin-pikle Jun 22, 2023
c9a9a8b
Add summary
olyagpl Jun 22, 2023
48a5c80
[GR-46706] [GR-46761] [GR-45056] [GR-46651] Documentation backport: U…
LesiaChaban Jun 23, 2023
9462813
Fix absolute link
LesiaChaban Jun 23, 2023
d529d3e
[GR-45056] Documentation backport: Fix absolute link in the Traversin…
LesiaChaban Jun 23, 2023
a5b812e
Enhance AES performance.
mur47x111 Jun 23, 2023
a8a5766
fix traceID bug
roberttoyonaga Jun 14, 2023
9b5e55f
remove debugging print
roberttoyonaga Jun 14, 2023
aa99b44
unused imports
marwan-hallaoui Jun 27, 2023
b3ddcaa
use import
roberttoyonaga Jun 14, 2023
bcf5725
Cleanups.
christianhaeubl Jun 15, 2023
fa86f48
fix style
marwan-hallaoui Jun 28, 2023
2d8303e
[GR-46864] Backports 23.0 : Fix JFR constant pool IDs.
marwan-hallaoui Jun 28, 2023
0c1341a
Rename subtitles to avoid duplication in TOC
olyagpl Jun 27, 2023
52e9da0
Fix erroneous shift in java.lang.StringCoding.implEncodeISOArray intr…
djoooooe Apr 12, 2023
00a5a9f
update to jvmci-23.0-b14
marwan-hallaoui Jun 27, 2023
ade4902
[GR-46776] Update to jvmci-23.0-b14.
marwan-hallaoui Jun 30, 2023
04fe861
Merge branch 'cpu/graal-vm/23.0' into release/graal-vm/23.0
marwan-hallaoui Jul 3, 2023
471abba
[GR-45498] Fix erroneous shift in java.lang.StringCoding.implEncodeIS…
djoooooe Jul 4, 2023
9af61a0
[GR-46830] Enhance AES performance.
mur47x111 Jul 4, 2023
62e9753
[GR-46669] The org.graalvm.truffle:truffle-api JAR contains JDK-19 sp…
tzezula Jul 5, 2023
24482db
[GR-46707] Documentation backport: Rename subtitles to avoid duplicat…
LesiaChaban Jul 5, 2023
48a36b1
[GR-46198] Backport to 23.0.1: Fix handling of JavaTimeSupplementary …
pejovica Jul 6, 2023
1a3eb55
Make graal-sdk artefact JDK 11+ compatible
jerboaa Jun 19, 2023
1d90d9f
[GR-47084] Change the compliance of com.oracle.svm.core.annotate and …
ansalond Jul 7, 2023
b828f52
Improve AWT hint to check for JNI accessed classes.
fniephaus Jun 29, 2023
65390b6
Document `--exclude-config`.
fniephaus Jul 6, 2023
d3461b4
Print link to build output docs if links disabled.
fniephaus Jul 6, 2023
b266319
Always include (class|module)path in error message.
fniephaus Jul 6, 2023
767295a
[GR-46907] [GR-46594] [GR-47030] [GR-47081] [GR-47111] GR-47112] Back…
fniephaus Jul 7, 2023
bb8edf2
GR-47149 : make release GraalVM 23.0.1
marwan-hallaoui Jul 11, 2023
f61e1b4
Revert "GR-47149 : make release GraalVM 23.0.1"
marwan-hallaoui Jul 13, 2023
6b774e6
Update GraalVM CE Container Images guide
LesiaChaban Jun 21, 2023
972f921
Review GraalVM CE Container Images guide
LesiaChaban Jul 3, 2023
1394b7d
Review GraalVM CE Container Images guide
LesiaChaban Jul 3, 2023
b22f294
Follow Mohamed Ez Zarghilli comment
LesiaChaban Jul 4, 2023
a0b3ae5
Add Native Image Getting Started on Windows Steps
olyagpl Jun 27, 2023
7bf39d7
Remove redundant image files
olyagpl Jun 27, 2023
9dd75ca
Recommend the latest Visual Studio version
olyagpl Jun 28, 2023
a597361
Update required GraalVM support version in Native Image JFR doc
olyagpl Jul 10, 2023
2b94ebe
Follow review comment
olyagpl Jul 12, 2023
53b4528
Mark Jipher as a supported feature
olyagpl Jul 13, 2023
983647a
[GR-46712] [GR-44581] [GR-47130] Documentation backport: Update Graal…
LesiaChaban Jul 13, 2023
e2f01b1
Merge branch 'cpu/graal-vm/23.0' into release/graal-vm/23.0
marwan-hallaoui Jul 20, 2023
74f4d06
Merge 'oracle/release/graal-vm/23.0' into 2023-07-21-23.0-CPU-sync
zakkak Jul 21, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -238,16 +238,17 @@ public void emitCode(CompilationResultBuilder crb, AArch64MacroAssembler masm) {
// Setup the counter
masm.neon.moveVI(ASIMDSize.FullReg, ElementSize.Word, v4, 0);
masm.neon.moveVI(ASIMDSize.FullReg, ElementSize.Word, v5, 1);
masm.neon.insXX(ElementSize.Word, v4, 3, v5, 3);
// v4 contains { 0, 0, 0, 1 }
masm.neon.insXX(ElementSize.Word, v4, 2, v5, 2);
// v4 contains { 0, 1 }

// Load the counter into v0
// 128-bit big-endian increment
masm.fldr(128, v0, AArch64Address.createBaseRegisterOnlyAddress(128, counter));
masm.neon.rev32VV(ASIMDSize.FullReg, ElementSize.Byte, v16, v0);
masm.neon.addVVV(ASIMDSize.FullReg, ElementSize.Word, v16, v16, v4);
masm.neon.rev32VV(ASIMDSize.FullReg, ElementSize.Byte, v16, v16);
// Save the incremented counter back
masm.neon.rev64VV(ASIMDSize.FullReg, ElementSize.Byte, v16, v0);
beAdd128x64(masm, v16, v16, v4, v5);
masm.neon.rev64VV(ASIMDSize.FullReg, ElementSize.Byte, v16, v16);
masm.fstr(128, v16, AArch64Address.createBaseRegisterOnlyAddress(128, counter));
// Previous counter value is in v0
// v4 contains { 0, 1 }

// We have fewer than bulk_width blocks of data left. Encrypt
// them one by one until there is less than a full block
Expand Down Expand Up @@ -277,9 +278,9 @@ public void emitCode(CompilationResultBuilder crb, AArch64MacroAssembler masm) {

// Increment the counter, store it back
masm.neon.orrVVV(ASIMDSize.FullReg, v0, v16, v16);
masm.neon.rev32VV(ASIMDSize.FullReg, ElementSize.Byte, v16, v16);
masm.neon.addVVV(ASIMDSize.FullReg, ElementSize.Word, v16, v16, v4);
masm.neon.rev32VV(ASIMDSize.FullReg, ElementSize.Byte, v16, v16);
masm.neon.rev64VV(ASIMDSize.FullReg, ElementSize.Byte, v16, v16);
beAdd128x64(masm, v16, v16, v4, v5);
masm.neon.rev64VV(ASIMDSize.FullReg, ElementSize.Byte, v16, v16);
// Save the incremented counter back
masm.fstr(128, v16, AArch64Address.createBaseRegisterOnlyAddress(128, counter));

Expand Down Expand Up @@ -311,6 +312,22 @@ public void emitCode(CompilationResultBuilder crb, AArch64MacroAssembler masm) {
masm.mov(32, result, savedLen);
}

// Big-endian 128-bit + 64-bit -> 128-bit addition.
// Inputs: 128-bits. in is preserved.
// The least-significant 64-bit word is in the upper dword of each vector.
// inc (the 64-bit increment) is preserved. Its lower dword must be zero.
// Output: result
private static void beAdd128x64(AArch64MacroAssembler masm, Register result, Register in, Register inc, Register tmp) {
// Add inc to the least-significant dword of input
masm.neon.addVVV(ASIMDSize.FullReg, ElementSize.DoubleWord, result, in, inc);
// Check for result overflowing
masm.neon.cmhiVVV(ASIMDSize.FullReg, ElementSize.DoubleWord, tmp, inc, result);
// Swap LSD of comparison result to MSD and MSD == 0 (must be!) to LSD
masm.neon.extVVV(ASIMDSize.FullReg, tmp, tmp, tmp, 0x08);
// Subtract -1 from MSD if there was an overflow
masm.neon.subVVV(ASIMDSize.FullReg, ElementSize.DoubleWord, result, result, tmp);
}

private static void emitCTRLargeBlock(AArch64MacroAssembler masm, int bulkWidth, Register in, Register out, Register counter,
Register usedPtr, Register len, Register used, Register offset, Register keylen) {
GraalError.guarantee(bulkWidth == 4 || bulkWidth == 8, "bulk_width must be 4 or 8");
Expand All @@ -337,20 +354,20 @@ private static void emitCTRLargeBlock(AArch64MacroAssembler masm, int bulkWidth,
// v0 contains the first counter
masm.fldr(128, v0, AArch64Address.createBaseRegisterOnlyAddress(128, counter));
// v16 contains byte-reversed counter
masm.neon.rev32VV(ASIMDSize.FullReg, ElementSize.Byte, v16, v0);
masm.neon.rev64VV(ASIMDSize.FullReg, ElementSize.Byte, v16, v0);

// AES/CTR loop
masm.bind(labelCTRLoop);

// Setup the counters
masm.neon.moveVI(ASIMDSize.FullReg, ElementSize.Word, v8, 0);
masm.neon.moveVI(ASIMDSize.FullReg, ElementSize.Word, v9, 1);
masm.neon.insXX(ElementSize.Word, v8, 3, v9, 3);
// v8 contains { 0, 0, 0, 1 }
masm.neon.insXX(ElementSize.Word, v8, 2, v9, 2);
// v8 contains { 0, 1 }

for (int i = 0; i < bulkWidth; i++) {
masm.neon.rev32VV(ASIMDSize.FullReg, ElementSize.Byte, asFloatRegister(v0, i), v16);
masm.neon.addVVV(ASIMDSize.FullReg, ElementSize.Word, v16, v16, v8);
masm.neon.rev64VV(ASIMDSize.FullReg, ElementSize.Byte, asFloatRegister(v0, i), v16);
beAdd128x64(masm, v16, v16, v8, v9);
}

masm.neon.ld1MultipleVVVV(ASIMDSize.FullReg, ElementSize.Byte, v8, v9, v10, v11,
Expand Down Expand Up @@ -381,7 +398,7 @@ private static void emitCTRLargeBlock(AArch64MacroAssembler masm, int bulkWidth,
masm.cbnz(32, len, labelCTRLoop);

// Save the counter back where it goes
masm.neon.rev32VV(ASIMDSize.FullReg, ElementSize.Byte, v16, v16);
masm.neon.rev64VV(ASIMDSize.FullReg, ElementSize.Byte, v16, v16);
masm.fstr(128, v16, AArch64Address.createBaseRegisterOnlyAddress(128, counter));

masm.neon.ld1MultipleVVVV(ASIMDSize.FullReg, ElementSize.Byte, v8, v9, v10, v11,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
import org.graalvm.compiler.core.common.calc.Condition;
import org.graalvm.compiler.core.common.memory.BarrierType;
import org.graalvm.compiler.core.common.memory.MemoryOrderMode;
import org.graalvm.compiler.nodes.ComputeObjectAddressNode;
import org.graalvm.compiler.nodes.ConstantNode;
import org.graalvm.compiler.nodes.NamedLocationIdentity;
import org.graalvm.compiler.nodes.NodeView;
Expand Down Expand Up @@ -90,7 +89,6 @@
import jdk.vm.ci.code.Architecture;
import jdk.vm.ci.code.CodeUtil;
import jdk.vm.ci.meta.JavaKind;
import jdk.vm.ci.meta.MetaAccessProvider;
import jdk.vm.ci.meta.ResolvedJavaMethod;

public class AArch64GraphBuilderPlugins implements TargetGraphBuilderPlugins {
Expand Down Expand Up @@ -507,55 +505,39 @@ private static void registerStringCodingPlugins(InvocationPlugins plugins, Repla
@Override
public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode sa, ValueNode sp,
ValueNode da, ValueNode dp, ValueNode len) {
MetaAccessProvider metaAccess = b.getMetaAccess();
int byteArrayBaseOffset = metaAccess.getArrayBaseOffset(JavaKind.Byte);

ValueNode srcOffset = AddNode.create(ConstantNode.forInt(byteArrayBaseOffset), new LeftShiftNode(sp, ConstantNode.forInt(2)), NodeView.DEFAULT);
ValueNode dstOffset = AddNode.create(ConstantNode.forInt(byteArrayBaseOffset), dp, NodeView.DEFAULT);

ComputeObjectAddressNode src = b.add(new ComputeObjectAddressNode(sa, srcOffset));
ComputeObjectAddressNode dst = b.add(new ComputeObjectAddressNode(da, dstOffset));

b.addPush(JavaKind.Int, new EncodeArrayNode(src, dst, len, ISO_8859_1, JavaKind.Byte));
return true;
try (InvocationPluginHelper helper = new InvocationPluginHelper(b, targetMethod)) {
int charElementShift = CodeUtil.log2(b.getMetaAccess().getArrayIndexScale(JavaKind.Char));
ValueNode src = helper.arrayElementPointer(sa, JavaKind.Byte, LeftShiftNode.create(sp, ConstantNode.forInt(charElementShift), NodeView.DEFAULT));
ValueNode dst = helper.arrayElementPointer(da, JavaKind.Byte, dp);
b.addPush(JavaKind.Int, new EncodeArrayNode(src, dst, len, ISO_8859_1, JavaKind.Byte));
return true;
}
}
});
r.register(new InvocationPlugin("implEncodeAsciiArray", char[].class, int.class, byte[].class, int.class, int.class) {
@Override
public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode sa, ValueNode sp,
ValueNode da, ValueNode dp, ValueNode len) {
MetaAccessProvider metaAccess = b.getMetaAccess();
int charArrayBaseOffset = metaAccess.getArrayBaseOffset(JavaKind.Char);
int byteArrayBaseOffset = metaAccess.getArrayBaseOffset(JavaKind.Byte);

int charElementShift = CodeUtil.log2(metaAccess.getArrayIndexScale(JavaKind.Char));

ValueNode srcOffset = AddNode.create(ConstantNode.forInt(charArrayBaseOffset), new LeftShiftNode(sp, ConstantNode.forInt(charElementShift)), NodeView.DEFAULT);
ValueNode dstOffset = AddNode.create(ConstantNode.forInt(byteArrayBaseOffset), dp, NodeView.DEFAULT);

ComputeObjectAddressNode src = b.add(new ComputeObjectAddressNode(sa, srcOffset));
ComputeObjectAddressNode dst = b.add(new ComputeObjectAddressNode(da, dstOffset));

b.addPush(JavaKind.Int, new EncodeArrayNode(src, dst, len, ASCII, JavaKind.Char));
return true;
try (InvocationPluginHelper helper = new InvocationPluginHelper(b, targetMethod)) {
ValueNode src = helper.arrayElementPointer(sa, JavaKind.Char, sp);
ValueNode dst = helper.arrayElementPointer(da, JavaKind.Byte, dp);
b.addPush(JavaKind.Int, new EncodeArrayNode(src, dst, len, ASCII, JavaKind.Char));
return true;
}
}
});
r.register(new InvocationPlugin("hasNegatives", byte[].class, int.class, int.class) {
@Override
public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode ba, ValueNode off, ValueNode len) {
try (InvocationPluginHelper helper = new InvocationPluginHelper(b, targetMethod)) {
MetaAccessProvider metaAccess = b.getMetaAccess();
int byteArrayBaseOffset = metaAccess.getArrayBaseOffset(JavaKind.Byte);
helper.intrinsicRangeCheck(off, Condition.LT, ConstantNode.forInt(0));
helper.intrinsicRangeCheck(len, Condition.LT, ConstantNode.forInt(0));

ValueNode arrayLength = b.add(new ArrayLengthNode(ba));
ValueNode limit = b.add(AddNode.create(off, len, NodeView.DEFAULT));
helper.intrinsicRangeCheck(arrayLength, Condition.LT, limit);

ValueNode arrayOffset = AddNode.create(ConstantNode.forInt(byteArrayBaseOffset), off, NodeView.DEFAULT);
ComputeObjectAddressNode array = b.add(new ComputeObjectAddressNode(ba, arrayOffset));

ValueNode array = helper.arrayElementPointer(ba, JavaKind.Byte, off);
b.addPush(JavaKind.Boolean, new HasNegativesNode(array, len));
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
import org.graalvm.compiler.core.common.calc.Condition;
import org.graalvm.compiler.core.common.memory.BarrierType;
import org.graalvm.compiler.core.common.memory.MemoryOrderMode;
import org.graalvm.compiler.nodes.ComputeObjectAddressNode;
import org.graalvm.compiler.nodes.ConstantNode;
import org.graalvm.compiler.nodes.NamedLocationIdentity;
import org.graalvm.compiler.nodes.NodeView;
Expand Down Expand Up @@ -101,7 +100,6 @@
import jdk.vm.ci.code.Architecture;
import jdk.vm.ci.code.CodeUtil;
import jdk.vm.ci.meta.JavaKind;
import jdk.vm.ci.meta.MetaAccessProvider;
import jdk.vm.ci.meta.ResolvedJavaMethod;

public class AMD64GraphBuilderPlugins implements TargetGraphBuilderPlugins {
Expand Down Expand Up @@ -597,35 +595,27 @@ private static void registerStringCodingPlugins(InvocationPlugins plugins, Repla
@Override
public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode sa, ValueNode sp,
ValueNode da, ValueNode dp, ValueNode len) {
MetaAccessProvider metaAccess = b.getMetaAccess();
int byteArrayBaseOffset = metaAccess.getArrayBaseOffset(JavaKind.Byte);

ValueNode srcOffset = AddNode.create(ConstantNode.forInt(byteArrayBaseOffset), new LeftShiftNode(sp, ConstantNode.forInt(2)), NodeView.DEFAULT);
ValueNode dstOffset = AddNode.create(ConstantNode.forInt(byteArrayBaseOffset), dp, NodeView.DEFAULT);

ComputeObjectAddressNode src = b.add(new ComputeObjectAddressNode(sa, srcOffset));
ComputeObjectAddressNode dst = b.add(new ComputeObjectAddressNode(da, dstOffset));

b.addPush(JavaKind.Int, new EncodeArrayNode(src, dst, len, ISO_8859_1, JavaKind.Byte));
return true;
try (InvocationPluginHelper helper = new InvocationPluginHelper(b, targetMethod)) {
int charElementShift = CodeUtil.log2(b.getMetaAccess().getArrayIndexScale(JavaKind.Char));
ValueNode src = helper.arrayElementPointer(sa, JavaKind.Byte, LeftShiftNode.create(sp, ConstantNode.forInt(charElementShift), NodeView.DEFAULT));
ValueNode dst = helper.arrayElementPointer(da, JavaKind.Byte, dp);
b.addPush(JavaKind.Int, new EncodeArrayNode(src, dst, len, ISO_8859_1, JavaKind.Byte));
return true;
}
}
});
r.register(new InvocationPlugin("hasNegatives", byte[].class, int.class, int.class) {
@Override
public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode ba, ValueNode off, ValueNode len) {
try (InvocationPluginHelper helper = new InvocationPluginHelper(b, targetMethod)) {
MetaAccessProvider metaAccess = b.getMetaAccess();
int byteArrayBaseOffset = metaAccess.getArrayBaseOffset(JavaKind.Byte);
helper.intrinsicRangeCheck(off, Condition.LT, ConstantNode.forInt(0));
helper.intrinsicRangeCheck(len, Condition.LT, ConstantNode.forInt(0));

ValueNode arrayLength = b.add(new ArrayLengthNode(ba));
ValueNode limit = b.add(AddNode.create(off, len, NodeView.DEFAULT));
helper.intrinsicRangeCheck(arrayLength, Condition.LT, limit);

ValueNode arrayOffset = AddNode.create(ConstantNode.forInt(byteArrayBaseOffset), off, NodeView.DEFAULT);
ComputeObjectAddressNode array = b.add(new ComputeObjectAddressNode(ba, arrayOffset));

ValueNode array = helper.arrayElementPointer(ba, JavaKind.Byte, off);
b.addPush(JavaKind.Boolean, new HasNegativesNode(array, len));
return true;
}
Expand All @@ -635,20 +625,12 @@ public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Rec
@Override
public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode sa, ValueNode sp,
ValueNode da, ValueNode dp, ValueNode len) {
MetaAccessProvider metaAccess = b.getMetaAccess();
int charArrayBaseOffset = metaAccess.getArrayBaseOffset(JavaKind.Char);
int byteArrayBaseOffset = metaAccess.getArrayBaseOffset(JavaKind.Byte);

int charElementShift = CodeUtil.log2(metaAccess.getArrayIndexScale(JavaKind.Char));

ValueNode srcOffset = AddNode.create(ConstantNode.forInt(charArrayBaseOffset), new LeftShiftNode(sp, ConstantNode.forInt(charElementShift)), NodeView.DEFAULT);
ValueNode dstOffset = AddNode.create(ConstantNode.forInt(byteArrayBaseOffset), dp, NodeView.DEFAULT);

ComputeObjectAddressNode src = b.add(new ComputeObjectAddressNode(sa, srcOffset));
ComputeObjectAddressNode dst = b.add(new ComputeObjectAddressNode(da, dstOffset));

b.addPush(JavaKind.Int, new EncodeArrayNode(src, dst, len, ASCII, JavaKind.Char));
return true;
try (InvocationPluginHelper helper = new InvocationPluginHelper(b, targetMethod)) {
ValueNode src = helper.arrayElementPointer(sa, JavaKind.Char, sp);
ValueNode dst = helper.arrayElementPointer(da, JavaKind.Byte, dp);
b.addPush(JavaKind.Int, new EncodeArrayNode(src, dst, len, ASCII, JavaKind.Char));
return true;
}
}
});

Expand Down
Loading