File tree 1 file changed +15
-4
lines changed
1 file changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -481,12 +481,23 @@ gc_maybe_untrack(PyObject *op)
481
481
#define BUFFER_HI 16
482
482
#define BUFFER_LO 8
483
483
484
- #if !(defined(__GNUC__ ) || defined(__clang__ ))
485
- #undef GC_ENABLE_PREFETCH_INSTRUCTIONS
484
+ #ifdef GC_ENABLE_PREFETCH_INSTRUCTIONS
485
+ #if (defined(__GNUC__ ) || defined(__clang__ ))
486
+ #define USE_BUILTIN_PREFETCH 1
487
+ #elif (defined(__cplusplus ) && (__cplusplus >= 201103 ))
488
+ #if defined(_MSC_VER )
489
+ #include <instrin.h>
490
+ #else
491
+ #include <xmmintrin.h>
492
+ #endif
493
+ #define USE_MM_PREFETCH 1
486
494
#endif
495
+ #endif // GC_ENABLE_PREFETCH_INSTRUCTIONS
487
496
488
- #ifdef GC_ENABLE_PREFETCH_INSTRUCTIONS
497
+ #if defined( USE_BUILTIN_PREFETCH )
489
498
#define prefetch (ptr ) __builtin_prefetch(ptr, 1, 3)
499
+ #elif defined(USE_MM_PREFETCH )
500
+ #define prefetch (ptr ) __mm_prefetch(ptr, _MM_HINT_T0)
490
501
#else
491
502
#define prefetch (ptr )
492
503
#endif
@@ -514,7 +525,7 @@ gc_mark_stack_push(_PyObjectStack *ms, PyObject *op)
514
525
static inline void
515
526
gc_mark_buffer_push (PyObject * op , struct gc_mark_args * args )
516
527
{
517
- #if Py_DEBUG
528
+ #ifdef Py_DEBUG
518
529
Py_ssize_t buf_used = args -> enqueued - args -> dequeued ;
519
530
assert (buf_used < BUFFER_SIZE );
520
531
#endif
You can’t perform that action at this time.
0 commit comments