|
71 | 71 | import org.graalvm.polyglot.io.ByteSequence;
|
72 | 72 |
|
73 | 73 | import com.oracle.graal.python.PythonLanguage;
|
| 74 | +import com.oracle.graal.python.annotations.ArgumentClinic; |
74 | 75 | import com.oracle.graal.python.builtins.Builtin;
|
75 | 76 | import com.oracle.graal.python.builtins.CoreFunctions;
|
76 | 77 | import com.oracle.graal.python.builtins.Python3Core;
|
|
112 | 113 | import com.oracle.graal.python.nodes.function.PythonBuiltinBaseNode;
|
113 | 114 | import com.oracle.graal.python.nodes.function.PythonBuiltinNode;
|
114 | 115 | import com.oracle.graal.python.nodes.function.builtins.PythonBinaryBuiltinNode;
|
| 116 | +import com.oracle.graal.python.nodes.function.builtins.PythonBinaryClinicBuiltinNode; |
115 | 117 | import com.oracle.graal.python.nodes.function.builtins.PythonTernaryBuiltinNode;
|
116 | 118 | import com.oracle.graal.python.nodes.function.builtins.PythonUnaryBuiltinNode;
|
| 119 | +import com.oracle.graal.python.nodes.function.builtins.clinic.ArgumentClinicProvider; |
117 | 120 | import com.oracle.graal.python.nodes.object.GetClassNode;
|
118 | 121 | import com.oracle.graal.python.nodes.statement.AbstractImportNode;
|
119 | 122 | import com.oracle.graal.python.nodes.subscript.GetItemNode;
|
@@ -650,33 +653,40 @@ protected static boolean isType(Object obj, Env env, InteropLibrary lib) {
|
650 | 653 |
|
651 | 654 | }
|
652 | 655 |
|
653 |
| - @Builtin(name = "dis", minNumOfPositionalArgs = 1, doc = "Helper to disassemble code objects if running with the bytecode interpreter") |
| 656 | + @Builtin(name = "dis", minNumOfPositionalArgs = 1, parameterNames = {"obj", "quickened"}, doc = "Helper to disassemble code objects if running with the bytecode interpreter") |
| 657 | + @ArgumentClinic(name = "quickened", conversion = ArgumentClinic.ClinicConversion.Boolean, defaultValue = "false") |
654 | 658 | @GenerateNodeFactory
|
655 |
| - public abstract static class BCIDisNode extends PythonUnaryBuiltinNode { |
| 659 | + public abstract static class BCIDisNode extends PythonBinaryClinicBuiltinNode { |
656 | 660 | @Specialization
|
657 |
| - Object doMethod(PMethod method) { |
| 661 | + Object doMethod(PMethod method, boolean quickened) { |
658 | 662 | final Object function = method.getFunction();
|
659 | 663 | if (function instanceof PFunction) {
|
660 |
| - return doFunction((PFunction) function); |
| 664 | + return doFunction((PFunction) function, quickened); |
661 | 665 | }
|
662 | 666 | return PNone.NONE;
|
663 | 667 | }
|
664 | 668 |
|
665 | 669 | @Specialization
|
666 |
| - Object doFunction(PFunction function) { |
667 |
| - return doCode(function.getCode()); |
| 670 | + Object doFunction(PFunction function, boolean quickened) { |
| 671 | + return doCode(function.getCode(), quickened); |
668 | 672 | }
|
669 | 673 |
|
670 | 674 | @Specialization
|
671 | 675 | @TruffleBoundary
|
672 |
| - Object doCode(PCode code) { |
673 |
| - return toTruffleStringUncached(code.toDisassembledString()); |
| 676 | + Object doCode(PCode code, boolean quickened) { |
| 677 | + return toTruffleStringUncached(code.toDisassembledString(quickened)); |
674 | 678 | }
|
675 | 679 |
|
676 |
| - @Specialization(guards = {"!isCode(value)", "!isPFunction(value)", "!isMethod(value)"}) |
677 |
| - Object doObject(@SuppressWarnings("unused") Object value) { |
| 680 | + @Fallback |
| 681 | + @SuppressWarnings("unused") |
| 682 | + Object doObject(Object value, Object quickened) { |
678 | 683 | return PNone.NONE;
|
679 | 684 | }
|
| 685 | + |
| 686 | + @Override |
| 687 | + protected ArgumentClinicProvider getArgumentClinic() { |
| 688 | + return GraalPythonModuleBuiltinsClinicProviders.BCIDisNodeClinicProviderGen.INSTANCE; |
| 689 | + } |
680 | 690 | }
|
681 | 691 |
|
682 | 692 | @Builtin(name = "super", minNumOfPositionalArgs = 1, doc = "Returns HostAdapter instance of the object or None")
|
|
0 commit comments