Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2025, Oracle and/or its affiliates.
* Copyright (c) 2017, 2026, Oracle and/or its affiliates.
* Copyright (c) 2013, Regents of the University of California
*
* All rights reserved.
Expand Down Expand Up @@ -47,13 +47,11 @@
import com.oracle.truffle.api.dsl.Cached.Exclusive;
import com.oracle.truffle.api.interop.InteropLibrary;
import com.oracle.truffle.api.interop.InvalidArrayIndexException;
import com.oracle.truffle.api.interop.UnsupportedMessageException;
import com.oracle.truffle.api.library.ExportLibrary;
import com.oracle.truffle.api.library.ExportMessage;
import com.oracle.truffle.api.nodes.Node;
import com.oracle.truffle.api.object.Shape;
import com.oracle.truffle.api.profiles.InlinedBranchProfile;
import com.oracle.truffle.api.source.SourceSection;

@SuppressWarnings("truffle-abstract-export")
@ExportLibrary(InteropLibrary.class)
Expand Down Expand Up @@ -82,29 +80,6 @@ public ListOrigin getOrigin() {
return origin;
}

@ExportMessage
public SourceSection getSourceLocation(@Exclusive @Cached GilNode gil) throws UnsupportedMessageException {
boolean mustRelease = gil.acquire();
try {
ListOrigin node = getOrigin();
SourceSection result = null;
if (node != null) {
result = node.getSourceSection();
}
if (result == null) {
throw UnsupportedMessageException.create();
}
return result;
} finally {
gil.release(mustRelease);
}
}

@ExportMessage
public boolean hasSourceLocation() {
return getOrigin() != null && getOrigin().getSourceSection() != null;
}

@ExportMessage
public boolean isArrayElementModifiable(long index,
@Exclusive @Cached IndexNodes.NormalizeIndexCustomMessageNode normalize,
Expand Down Expand Up @@ -235,7 +210,5 @@ public int updateFrom(int newSizeEstimate) {
}

void reportUpdatedCapacity(ArrayBasedSequenceStorage newStore);

SourceSection getSourceSection();
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2022, 2026, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* The Universal Permissive License (UPL), Version 1.0
Expand Down Expand Up @@ -255,11 +255,6 @@ protected int getCapacityEstimate() {
return initialCapacity.estimate();
}

@Override
public SourceSection getSourceSection() {
return null;
}

@Override
public void reportUpdatedCapacity(ArrayBasedSequenceStorage newStore) {
if (CompilerDirectives.inInterpreter()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,6 @@
import com.oracle.graal.python.runtime.sequence.PTupleListBase;
import com.oracle.graal.python.runtime.sequence.storage.BoolSequenceStorage;
import com.oracle.graal.python.runtime.sequence.storage.DoubleSequenceStorage;
import com.oracle.graal.python.runtime.sequence.storage.EmptySequenceStorage;
import com.oracle.graal.python.runtime.sequence.storage.IntSequenceStorage;
import com.oracle.graal.python.runtime.sequence.storage.LongSequenceStorage;
import com.oracle.graal.python.runtime.sequence.storage.ObjectSequenceStorage;
Expand Down Expand Up @@ -1732,19 +1731,11 @@ public static Object perform(VirtualFrame frame,

@Operation(storeBytecodeIndex = false)
public static final class MakeList {
@Specialization(guards = "elements.length == 0")
public static PList doEmpty(@Variadic Object[] elements,
@Bind PBytecodeDSLRootNode rootNode) {
// Common pattern is to create an empty list and then add items.
// We need to start from empty storage, so that we can specialize to, say, int storage
// if only ints are appended to this list
return PFactory.createList(rootNode.getLanguage(), EmptySequenceStorage.INSTANCE);
}

@Specialization(guards = "elements.length > 0")
@Specialization
public static PList perform(@Variadic Object[] elements,
@Bind PBytecodeDSLRootNode rootNode) {
return PFactory.createList(rootNode.getLanguage(), elements);
@Bind PBytecodeDSLRootNode rootNode,
@Cached SequenceFromArrayNode.ListFromArrayNode listFromArrayNode) {
return listFromArrayNode.execute(rootNode.getLanguage(), elements);
}
}

Expand Down Expand Up @@ -1791,8 +1782,9 @@ public static PFrozenSet doNonEmpty(VirtualFrame frame, @Variadic Object[] eleme
public static final class MakeTuple {
@Specialization
public static Object perform(@Variadic Object[] elements,
@Bind PBytecodeDSLRootNode rootNode) {
return PFactory.createTuple(rootNode.getLanguage(), elements);
@Bind PBytecodeDSLRootNode rootNode,
@Cached SequenceFromArrayNode.TupleFromArrayNode tupleFromArrayNode) {
return tupleFromArrayNode.execute(rootNode.getLanguage(), elements);
}
}

Expand Down Expand Up @@ -3432,7 +3424,7 @@ public static final class PreResumeYield {
@Specialization
public static Object doObject(VirtualFrame frame, LocalAccessor currentGeneratorException, LocalAccessor savedException, Object sendValue,
@Bind BytecodeNode bytecode) {
if (savedException != currentGeneratorException) {
if (!savedException.equals(currentGeneratorException)) {
// We cannot pass `null` as savedException, so savedException ==
// currentGeneratorException means "no saveException"
//
Expand Down
Loading
Loading