From 3e90988a031458571255491cf8a54582d3211236 Mon Sep 17 00:00:00 2001 From: Paley Li Date: Thu, 20 May 2021 15:35:02 +0200 Subject: [PATCH 1/2] Sulong: add exploding loop for writing primitives. Minor: comment edit. --- .../runtime/nodes/vars/AggregateLiteralInPlaceNode.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/sulong/projects/com.oracle.truffle.llvm.runtime/src/com/oracle/truffle/llvm/runtime/nodes/vars/AggregateLiteralInPlaceNode.java b/sulong/projects/com.oracle.truffle.llvm.runtime/src/com/oracle/truffle/llvm/runtime/nodes/vars/AggregateLiteralInPlaceNode.java index e16fb5b8980e..3b1191f9e9c5 100644 --- a/sulong/projects/com.oracle.truffle.llvm.runtime/src/com/oracle/truffle/llvm/runtime/nodes/vars/AggregateLiteralInPlaceNode.java +++ b/sulong/projects/com.oracle.truffle.llvm.runtime/src/com/oracle/truffle/llvm/runtime/nodes/vars/AggregateLiteralInPlaceNode.java @@ -60,10 +60,10 @@ public abstract class AggregateLiteralInPlaceNode extends LLVMStatementNode { private static final ByteArraySupport byteSupport = ByteOrder.nativeOrder() == ByteOrder.BIG_ENDIAN ? ByteArraySupport.bigEndian() : ByteArraySupport.littleEndian(); /** - * This node initializes a block of memory with a with combination of raw bytes and explicit - * store nodes. When executed, it transfers all bytes from {@code data} to the target (using i8 - * and i64 stores as appropriate), except for those covered by a node in {@code stores}. Every - * store node has a corresponding entry in {@code offsets} and {@sizes}. + * This node initializes a block of memory with a combination of raw bytes and explicit store + * nodes. When executed, it transfers all bytes from {@code data} to the target (using i8 and + * i64 stores as appropriate), except for those covered by a node in {@code stores}. Every store + * node has a corresponding entry in {@code offsets} and {@sizes}. */ public AggregateLiteralInPlaceNode(byte[] data, LLVMOffsetStoreNode[] stores, int[] offsets, int[] sizes, int[] bufferOffsets, LLVMGlobal[] descriptors) { assert offsets.length == stores.length + 1 && stores.length == sizes.length; @@ -86,6 +86,7 @@ protected void initialize(VirtualFrame frame, writeObjects(frame, context); } + @ExplodeLoop private void writePrimitives(LLVMContext context, LLVMI8OffsetStoreNode storeI8, LLVMI64OffsetStoreNode storeI64) { int offset = 0; int nextStore = 0; From 87849e27fb1adfa65b2b320afd9b2fc046c9578f Mon Sep 17 00:00:00 2001 From: Lukas Stadler Date: Thu, 20 May 2021 20:15:54 +0200 Subject: [PATCH 2/2] Sulong: amend LLVMContext.getSymbol to check for constant "symbol" --- .../src/com/oracle/truffle/llvm/runtime/LLVMContext.java | 2 +- .../llvm/runtime/nodes/vars/AggregateLiteralInPlaceNode.java | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/sulong/projects/com.oracle.truffle.llvm.runtime/src/com/oracle/truffle/llvm/runtime/LLVMContext.java b/sulong/projects/com.oracle.truffle.llvm.runtime/src/com/oracle/truffle/llvm/runtime/LLVMContext.java index cf51b72a8f4e..0358e666440d 100644 --- a/sulong/projects/com.oracle.truffle.llvm.runtime/src/com/oracle/truffle/llvm/runtime/LLVMContext.java +++ b/sulong/projects/com.oracle.truffle.llvm.runtime/src/com/oracle/truffle/llvm/runtime/LLVMContext.java @@ -665,7 +665,7 @@ public LLVMPointer getSymbol(LLVMSymbol symbol) { BitcodeID bitcodeID = symbol.getBitcodeID(false); int id = bitcodeID.getId(); int index = symbol.getSymbolIndex(false); - if (CompilerDirectives.inCompiledCode() && CompilerDirectives.isPartialEvaluationConstant(this)) { + if (CompilerDirectives.inCompiledCode() && CompilerDirectives.isPartialEvaluationConstant(this) && CompilerDirectives.isPartialEvaluationConstant(symbol)) { if (!symbolAssumptions[id][index].isValid()) { CompilerDirectives.transferToInterpreterAndInvalidate(); } diff --git a/sulong/projects/com.oracle.truffle.llvm.runtime/src/com/oracle/truffle/llvm/runtime/nodes/vars/AggregateLiteralInPlaceNode.java b/sulong/projects/com.oracle.truffle.llvm.runtime/src/com/oracle/truffle/llvm/runtime/nodes/vars/AggregateLiteralInPlaceNode.java index 3b1191f9e9c5..2ecb4cd2e05b 100644 --- a/sulong/projects/com.oracle.truffle.llvm.runtime/src/com/oracle/truffle/llvm/runtime/nodes/vars/AggregateLiteralInPlaceNode.java +++ b/sulong/projects/com.oracle.truffle.llvm.runtime/src/com/oracle/truffle/llvm/runtime/nodes/vars/AggregateLiteralInPlaceNode.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2020, Oracle and/or its affiliates. + * Copyright (c) 2016, 2021, Oracle and/or its affiliates. * * All rights reserved. * @@ -86,7 +86,6 @@ protected void initialize(VirtualFrame frame, writeObjects(frame, context); } - @ExplodeLoop private void writePrimitives(LLVMContext context, LLVMI8OffsetStoreNode storeI8, LLVMI64OffsetStoreNode storeI64) { int offset = 0; int nextStore = 0;