Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(2)

Delta Between Two Patch Sets: Include/object.h

Issue 29259: Add tp_fastcall to PyTypeObject: support FASTCALL calling convention for all callable objects
Left Patch Set: Created 3 years, 2 months ago
Right Patch Set: Created 3 years, 2 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
LEFTRIGHT
1 #ifndef Py_OBJECT_H 1 #ifndef Py_OBJECT_H
2 #define Py_OBJECT_H 2 #define Py_OBJECT_H
3 #ifdef __cplusplus 3 #ifdef __cplusplus
4 extern "C" { 4 extern "C" {
5 #endif 5 #endif
6 6
7 7
8 /* Object and type object interface */ 8 /* Object and type object interface */
9 9
10 /* 10 /*
(...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after
632 /* Set while the type is being 'readied', to prevent recursive ready calls */ 632 /* Set while the type is being 'readied', to prevent recursive ready calls */
633 #define Py_TPFLAGS_READYING (1UL << 13) 633 #define Py_TPFLAGS_READYING (1UL << 13)
634 634
635 /* Objects support garbage collection (see objimp.h) */ 635 /* Objects support garbage collection (see objimp.h) */
636 #define Py_TPFLAGS_HAVE_GC (1UL << 14) 636 #define Py_TPFLAGS_HAVE_GC (1UL << 14)
637 637
638 /* Bits 15 and 16 were used by Stackless Python, but are now used for tp_fastcal l */ 638 /* Bits 15 and 16 were used by Stackless Python, but are now used for tp_fastcal l */
639 #ifdef STACKLESS 639 #ifdef STACKLESS
640 # error "Stackless is no more supported" 640 # error "Stackless is no more supported"
641 #endif 641 #endif
642 /* Constant kept for backward compatibility */
642 #define Py_TPFLAGS_HAVE_STACKLESS_EXTENSION 0 643 #define Py_TPFLAGS_HAVE_STACKLESS_EXTENSION 0
643 644
644 /* Objects support type attribute cache */ 645 /* Objects support type attribute cache */
645 #define Py_TPFLAGS_HAVE_VERSION_TAG (1UL << 18) 646 #define Py_TPFLAGS_HAVE_VERSION_TAG (1UL << 18)
646 #define Py_TPFLAGS_VALID_VERSION_TAG (1UL << 19) 647 #define Py_TPFLAGS_VALID_VERSION_TAG (1UL << 19)
647 648
648 /* Type is abstract and cannot be instantiated */ 649 /* Type is abstract and cannot be instantiated */
649 #define Py_TPFLAGS_IS_ABSTRACT (1UL << 20) 650 #define Py_TPFLAGS_IS_ABSTRACT (1UL << 20)
650 651
651 /* These flags are used to determine if a type is a subclass. */ 652 /* These flags are used to determine if a type is a subclass. */
652 #define Py_TPFLAGS_LONG_SUBCLASS (1UL << 24) 653 #define Py_TPFLAGS_LONG_SUBCLASS (1UL << 24)
653 #define Py_TPFLAGS_LIST_SUBCLASS (1UL << 25) 654 #define Py_TPFLAGS_LIST_SUBCLASS (1UL << 25)
654 #define Py_TPFLAGS_TUPLE_SUBCLASS (1UL << 26) 655 #define Py_TPFLAGS_TUPLE_SUBCLASS (1UL << 26)
655 #define Py_TPFLAGS_BYTES_SUBCLASS (1UL << 27) 656 #define Py_TPFLAGS_BYTES_SUBCLASS (1UL << 27)
656 #define Py_TPFLAGS_UNICODE_SUBCLASS (1UL << 28) 657 #define Py_TPFLAGS_UNICODE_SUBCLASS (1UL << 28)
657 #define Py_TPFLAGS_DICT_SUBCLASS (1UL << 29) 658 #define Py_TPFLAGS_DICT_SUBCLASS (1UL << 29)
658 #define Py_TPFLAGS_BASE_EXC_SUBCLASS (1UL << 30) 659 #define Py_TPFLAGS_BASE_EXC_SUBCLASS (1UL << 30)
659 #define Py_TPFLAGS_TYPE_SUBCLASS (1UL << 31) 660 #define Py_TPFLAGS_TYPE_SUBCLASS (1UL << 31)
660 661
661 #define Py_TPFLAGS_DEFAULT ( \
662 Py_TPFLAGS_HAVE_STACKLESS_EXTENSION | \
663 Py_TPFLAGS_HAVE_VERSION_TAG | \
664 0)
665
666 /* NOTE: The following flags reuse lower bits (removed as part of the 662 /* NOTE: The following flags reuse lower bits (removed as part of the
667 * Python 3.0 transition). */ 663 * Python 3.0 transition). */
668 664
669 /* Type structure has tp_finalize member (3.4) */ 665 /* Type structure has tp_finalize member (3.4), it can be NULL */
670 #define Py_TPFLAGS_HAVE_FINALIZE (1UL << 0) 666 #define Py_TPFLAGS_HAVE_FINALIZE (1UL << 0)
671 667
672 /* Type structure has tp_fastcall member (3.7) */ 668 /* Type structure has tp_fastcall member (3.7), it can be NULL */
673 #define Py_TPFLAGS_HAVE_FASTCALL (1UL << 15) 669 #define Py_TPFLAGS_HAVE_FASTCALL (1UL << 15)
670
671 #define Py_TPFLAGS_DEFAULT ( \
672 Py_TPFLAGS_HAVE_VERSION_TAG | \
673 Py_TPFLAGS_HAVE_FINALIZE | \
674 Py_TPFLAGS_HAVE_FASTCALL | \
675 0)
674 676
675 #ifdef Py_LIMITED_API 677 #ifdef Py_LIMITED_API
676 #define PyType_HasFeature(t,f) ((PyType_GetFlags(t) & (f)) != 0) 678 #define PyType_HasFeature(t,f) ((PyType_GetFlags(t) & (f)) != 0)
677 #else 679 #else
678 #define PyType_HasFeature(t,f) (((t)->tp_flags & (f)) != 0) 680 #define PyType_HasFeature(t,f) (((t)->tp_flags & (f)) != 0)
679 #endif 681 #endif
680 #define PyType_FastSubclass(t,f) PyType_HasFeature(t,f) 682 #define PyType_FastSubclass(t,f) PyType_HasFeature(t,f)
681
682
683 #ifndef Py_LIMITED_API
684 # define _Py_TYPE_HAS_FASTCALL(type) \
685 (((type)->tp_flags & Py_TPFLAGS_HAVE_FASTCALL) \
686 && ((type)->tp_fastcall != NULL))
687 #endif
688 683
689 684
690 /* 685 /*
691 The macros Py_INCREF(op) and Py_DECREF(op) are used to increment or decrement 686 The macros Py_INCREF(op) and Py_DECREF(op) are used to increment or decrement
692 reference counts. Py_DECREF calls the object's deallocator function when 687 reference counts. Py_DECREF calls the object's deallocator function when
693 the refcount falls to 0; for 688 the refcount falls to 0; for
694 objects that don't contain references to other objects or heap memory 689 objects that don't contain references to other objects or heap memory
695 this can be the standard function free(). Both macros can be used 690 this can be the standard function free(). Both macros can be used
696 wherever a void expression is allowed. The argument must not be a 691 wherever a void expression is allowed. The argument must not be a
697 NULL pointer. If it may be NULL, use Py_XINCREF/Py_XDECREF instead. 692 NULL pointer. If it may be NULL, use Py_XINCREF/Py_XDECREF instead.
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
1081 _PyDebugAllocatorStats(FILE *out, const char *block_name, int num_blocks, 1076 _PyDebugAllocatorStats(FILE *out, const char *block_name, int num_blocks,
1082 size_t sizeof_block); 1077 size_t sizeof_block);
1083 PyAPI_FUNC(void) 1078 PyAPI_FUNC(void)
1084 _PyObject_DebugTypeStats(FILE *out); 1079 _PyObject_DebugTypeStats(FILE *out);
1085 #endif /* ifndef Py_LIMITED_API */ 1080 #endif /* ifndef Py_LIMITED_API */
1086 1081
1087 #ifdef __cplusplus 1082 #ifdef __cplusplus
1088 } 1083 }
1089 #endif 1084 #endif
1090 #endif /* !Py_OBJECT_H */ 1085 #endif /* !Py_OBJECT_H */
LEFTRIGHT

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+