Skip to content

restructure nlr.h for undefined archtectures #2216

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 14, 2019
Merged
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
49 changes: 27 additions & 22 deletions py/nlr.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,33 +36,38 @@

// If MICROPY_NLR_SETJMP is not enabled then auto-detect the machine arch
#if !defined(MICROPY_NLR_SETJMP) || !MICROPY_NLR_SETJMP
#define MICROPY_NLR_SETJMP (0)
// A lot of nlr-related things need different treatment on Windows
#if defined(_WIN32) || defined(__CYGWIN__)
#define MICROPY_NLR_OS_WINDOWS 1
#else
#define MICROPY_NLR_OS_WINDOWS 0
#endif
#if defined(__i386__)
#define MICROPY_NLR_X86 (1)
#define MICROPY_NLR_NUM_REGS (6)
#elif defined(__x86_64__)
#define MICROPY_NLR_X64 (1)
#if MICROPY_NLR_OS_WINDOWS
#define MICROPY_NLR_NUM_REGS (10)
#if defined(_WIN32) || defined(__CYGWIN__)
#define MICROPY_NLR_OS_WINDOWS 1
#else
#define MICROPY_NLR_NUM_REGS (8)
#define MICROPY_NLR_OS_WINDOWS 0
#endif
#elif defined(__thumb2__) || defined(__thumb__) || defined(__arm__)
#define MICROPY_NLR_THUMB (1)
#define MICROPY_NLR_NUM_REGS (10)
#elif defined(__xtensa__)
#define MICROPY_NLR_XTENSA (1)
#define MICROPY_NLR_NUM_REGS (10)
#else
#define MICROPY_NLR_SETJMP (1)
#if defined(__i386__)
#define MICROPY_NLR_X86 (1)
#define MICROPY_NLR_NUM_REGS (6)
#elif defined(__x86_64__)
#define MICROPY_NLR_X64 (1)
#if MICROPY_NLR_OS_WINDOWS
#define MICROPY_NLR_NUM_REGS (10)
#else
#define MICROPY_NLR_NUM_REGS (8)
#endif
#elif defined(__thumb2__) || defined(__thumb__) || defined(__arm__)
#define MICROPY_NLR_THUMB (1)
#define MICROPY_NLR_NUM_REGS (10)
#elif defined(__xtensa__)
#define MICROPY_NLR_XTENSA (1)
#define MICROPY_NLR_NUM_REGS (10)
#else
#define MICROPY_NLR_SETJMP (1)
//#warning "No native NLR support for this arch, using setjmp implementation"
#endif
#endif

// If MICROPY_NLR_SETJMP is not defined above - define/disable it here

#if !defined(MICROPY_NLR_SETJMP)
#define MICROPY_NLR_SETJMP (0)
#endif

#if MICROPY_NLR_SETJMP
Expand Down