Skip to content
This repository has been archived by the owner on Aug 22, 2019. It is now read-only.

Commit

Permalink
Fix type of vtable in LLVMLangStartInternal and add gate check for Ru…
Browse files Browse the repository at this point in the history
…st 1.27.1.
  • Loading branch information
anatol1234 committed Jul 13, 2018
1 parent b857fca commit 817c22c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ matrix:
- libc++1
- libc++-dev
- env: LLVM_VER=3.9 GATE_TAGS='sulongBasic' COMPILE_COMMAND='mx build'
language: rust
rust: 1.27.1
addons:
apt:
sources:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@
import com.oracle.truffle.llvm.runtime.pointer.LLVMNativePointer;
import com.oracle.truffle.llvm.runtime.pointer.LLVMPointer;
import com.oracle.truffle.llvm.runtime.types.FunctionType;
import com.oracle.truffle.llvm.runtime.types.PointerType;
import com.oracle.truffle.llvm.runtime.types.PrimitiveType;
import com.oracle.truffle.llvm.runtime.types.StructureType;
import com.oracle.truffle.llvm.runtime.types.Type;

Expand Down Expand Up @@ -88,19 +90,19 @@ protected long doOp(StackPointer stackPointer, LLVMFunctionDescriptor main, long
public abstract static class LLVMLangStartInternal extends LLVMStart {

@TruffleBoundary
protected LangStartVtableType createLangStartVtable(Type vtableType) {
protected LangStartVtableType createLangStartVtable() {
DataLayout dataSpecConverter = getContextReference().get().getDataSpecConverter();
return LangStartVtableType.create(dataSpecConverter, vtableType);
return LangStartVtableType.create(dataSpecConverter);
}

@Specialization
@SuppressWarnings("unused")
protected long doOp(StackPointer stackPointer, LLVMNativePointer mainPointer, LLVMGlobal vtable, long argc, LLVMPointer argv,
protected long doOp(StackPointer stackPointer, LLVMNativePointer mainPointer, LLVMPointer vtable, long argc, LLVMPointer argv,
@Cached("createToNativeWithTarget()") LLVMToNativeNode toNative,
@Cached("getClosureDispatchNode()") LLVMClosureDispatchNode fnDispatchNode,
@Cached("getClosureDispatchNode()") LLVMClosureDispatchNode dropInPlaceDispatchNode) {
LLVMMemory memory = getLLVMMemory();
LangStartVtableType langStartVtable = createLangStartVtable(vtable.getPointeeType());
LangStartVtableType langStartVtable = createLangStartVtable();
LLVMNativePointer vtablePointer = toNative.executeWithTarget(vtable);
LLVMNativePointer fn = readFn(memory, vtablePointer, langStartVtable);
LLVMNativePointer dropInPlace = readDropInPlace(memory, vtablePointer, langStartVtable);
Expand Down Expand Up @@ -138,8 +140,10 @@ long readDropInPlace(LLVMMemory memory, long address) {
return memory.getFunctionPointer(LLVMNativePointer.create(address));
}

static LangStartVtableType create(DataLayout datalayout, Type vtableType) {
return new LangStartVtableType(datalayout, (StructureType) vtableType);
static LangStartVtableType create(DataLayout datalayout) {
StructureType type = new StructureType(false, new Type[]{new PointerType(PrimitiveType.I64), PrimitiveType.I64, PrimitiveType.I64, new PointerType(PrimitiveType.I64),
new PointerType(PrimitiveType.I64), new PointerType(PrimitiveType.I64)});
return new LangStartVtableType(datalayout, type);
}

}
Expand Down

0 comments on commit 817c22c

Please sign in to comment.