Appendix C. Porting Rotor
So, you’re thinking of moving the SSCLI code base onto another operating system or targeting a hot new experimental processor. What is involved?
Besides basic portability hygiene, such as using the portability macros found sscli/clr/src/inc/palclr.h and the endian and CPU-specific conditional compilation switches, there are several areas of Rotor that present unique challenges. The PAL, the JIT compiler, and the execution engine each have code that must be modified for every port. To help you make these modifications, many of the spots that have platform-specific code have been written to compile correctly when moved to a new CPU platform, using conditionally compiled code that will either assert or issue a warning when run. The PORTABILITY_ASSERT and PORTABILITY_WARNING macros, defined in clr/src/inc/palclr.h, are used for this purpose, as follows:
#if defined(_X86_)
_ASSERTE(SOMETHINGTOCHECK > SOMEVALUE);
// x86 code here
#elif defined(_AMD64_) || defined(_PPC_)
// other code here
#else
PORTABILITY_ASSERT("Calling convention not specified for new platform");
#endifUsing grep or findstr to search for “PORTABILITY,” “PPC,” “UNIX,” “APPLE,” and other related strings will help find these spots, and indicate the size of the task at hand.
Also important to consider is the toolchain that you will be using: many small incompatibilities and differences exist between compilers (and even versions of the same compiler), and if you propose using a compiler that has ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access