Coroutine stack cleanups

48 views
Skip to first unread message

Kuba Sunderland-Ober

unread,
Jun 28, 2023, 5:32:54 PM6/28/23
to KiCad Developers
I ran across COROUTINE and noted that it could be cleaned up, and guard pages could be supported on all platforms too.

Would that be something worth doing? I experimented with custom deleters for the m_stack pointer and they seem to make things less verbose and should make all platforms take the same code path, adapted for various incarnations of mmap/virtualalloc/virtualprotect without treating Windows specially.

Cheers, Kuba

Jon Evans

unread,
Jun 28, 2023, 5:55:17 PM6/28/23
to dev...@kicad.org
I'm not clear on how all platforms can take the same codepath since there is some fundamentally platform-specific code in here?

Anyway, my own personal thoughts are that anyone looking to work on this area:

1) should be prepared to do their own testing on at least Windows + arm64 Mac + amd64 Linux
2) should pay careful attention to not degrading the developer experience: we already have some pain here around debuggers and sanitizers, and we want to at least not make it worse than it is today.

-Jon

--
You received this message because you are subscribed to the Google Groups "KiCad Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to devlist+u...@kicad.org.
To view this discussion on the web visit https://groups.google.com/a/kicad.org/d/msgid/devlist/3d093521-5ed0-42af-94db-265485e6474an%40kicad.org.

Kuba Sunderland-Ober

unread,
Jun 28, 2023, 6:16:29 PM6/28/23
to KiCad Developers, j...@craftyjon.com
Fundamentally, on all platforms it allocates an area, then protects a part of it, and eventually deallocates. The specific OS API differs, but that's what I want to abstract away into a small platform-specific section, so that rest of it would be platform-agnostic. I guess I now have an excuse to get that arm64 Mac :)

I'm all for good developer experience :) The Valgrind, ASAN and TSAN hooks would be unaffected.

Cheers, Kuba

Mark Roszko

unread,
Jun 28, 2023, 6:51:59 PM6/28/23
to dev...@kicad.org, j...@craftyjon.com
Changes need to be tested on Windows arm64 too btw :P

(We have arm64 windows nightlies and 8.0 will see stable arm64 windows builds)

Libcontext was an awkward hack to get around the disaster of boost::context making major API changes that didn't match between every distro/platform for years because of how everyone lags behind. Nowadays boost::context seems stable but the concern does exist for something so core.

It wouldn't nessacarily be bad to clean it up a little. Do be warned due to incomplete cmake support for arm64 Windows assembler, there's a hack in the cmake to make the compiler work until the msvc and vcpkg baseline for cmake moves up and I can be bothered to update the packaging systems.

However on the topic of guard pages. I added it on Windows because we have sentry reporting. We will most likely never use sentry on Linux so having guard pages does basically nothing as the program will still crash. Even on Windows with guard pages, it will still crash.


Reply all
Reply to author
Forward
0 new messages