|
237 | 237 | import com.oracle.graal.python.runtime.sequence.PTupleListBase; |
238 | 238 | import com.oracle.graal.python.runtime.sequence.storage.BoolSequenceStorage; |
239 | 239 | import com.oracle.graal.python.runtime.sequence.storage.DoubleSequenceStorage; |
240 | | -import com.oracle.graal.python.runtime.sequence.storage.EmptySequenceStorage; |
241 | 240 | import com.oracle.graal.python.runtime.sequence.storage.IntSequenceStorage; |
242 | 241 | import com.oracle.graal.python.runtime.sequence.storage.LongSequenceStorage; |
243 | 242 | import com.oracle.graal.python.runtime.sequence.storage.ObjectSequenceStorage; |
@@ -1733,19 +1732,11 @@ public static Object perform(VirtualFrame frame, |
1733 | 1732 |
|
1734 | 1733 | @Operation(storeBytecodeIndex = false) |
1735 | 1734 | public static final class MakeList { |
1736 | | - @Specialization(guards = "elements.length == 0") |
1737 | | - public static PList doEmpty(@Variadic Object[] elements, |
1738 | | - @Bind PBytecodeDSLRootNode rootNode) { |
1739 | | - // Common pattern is to create an empty list and then add items. |
1740 | | - // We need to start from empty storage, so that we can specialize to, say, int storage |
1741 | | - // if only ints are appended to this list |
1742 | | - return PFactory.createList(rootNode.getLanguage(), EmptySequenceStorage.INSTANCE); |
1743 | | - } |
1744 | | - |
1745 | | - @Specialization(guards = "elements.length > 0") |
| 1735 | + @Specialization |
1746 | 1736 | public static PList perform(@Variadic Object[] elements, |
1747 | | - @Bind PBytecodeDSLRootNode rootNode) { |
1748 | | - return PFactory.createList(rootNode.getLanguage(), elements); |
| 1737 | + @Bind PBytecodeDSLRootNode rootNode, |
| 1738 | + @Cached SequenceFromArrayNode.ListFromArrayNode listFromArrayNode) { |
| 1739 | + return listFromArrayNode.execute(rootNode.getLanguage(), elements); |
1749 | 1740 | } |
1750 | 1741 | } |
1751 | 1742 |
|
@@ -1792,8 +1783,9 @@ public static PFrozenSet doNonEmpty(VirtualFrame frame, @Variadic Object[] eleme |
1792 | 1783 | public static final class MakeTuple { |
1793 | 1784 | @Specialization |
1794 | 1785 | public static Object perform(@Variadic Object[] elements, |
1795 | | - @Bind PBytecodeDSLRootNode rootNode) { |
1796 | | - return PFactory.createTuple(rootNode.getLanguage(), elements); |
| 1786 | + @Bind PBytecodeDSLRootNode rootNode, |
| 1787 | + @Cached SequenceFromArrayNode.TupleFromArrayNode tupleFromArrayNode) { |
| 1788 | + return tupleFromArrayNode.execute(rootNode.getLanguage(), elements); |
1797 | 1789 | } |
1798 | 1790 | } |
1799 | 1791 |
|
@@ -3433,7 +3425,7 @@ public static final class PreResumeYield { |
3433 | 3425 | @Specialization |
3434 | 3426 | public static Object doObject(VirtualFrame frame, LocalAccessor currentGeneratorException, LocalAccessor savedException, Object sendValue, |
3435 | 3427 | @Bind BytecodeNode bytecode) { |
3436 | | - if (savedException != currentGeneratorException) { |
| 3428 | + if (!savedException.equals(currentGeneratorException)) { |
3437 | 3429 | // We cannot pass `null` as savedException, so savedException == |
3438 | 3430 | // currentGeneratorException means "no saveException" |
3439 | 3431 | // |
|
0 commit comments