flipboard.social is one of the many independent Mastodon servers you can use to participate in the fediverse.
Welcome to Flipboard on Mastodon. A place for our community of curators and enthusiasts to inform and inspire each other. If you'd like to join please request an invitation via the sign-up page.

Administered by:

Server stats:

1.2K
active users

#compiler

6 posts5 participants0 posts today

I just made a post about the intricacies of the coding language I'm developing. This post is meant to notify people because I forgot to include the hash tags in my original post, so I don't think many people saw it.

I highly encourage everyone to check out my last post. It's got a lot of info on there I'd hate to go to waste

#Apple M1 / M2 / M3 Core Support Might Soon Be Merged For The #GCC #Compiler
When it comes to compiler support for #AppleSilicon and their hardware at large, Apple has long been focused on the LLVM/Clang toolchain given their long history with it, employing many of the developers, and Xcode being based on LLVM. The GNU Compiler Collection (GCC) though may soon see upstream support for the newer Apple Cores
phoronix.com/news/Apple-Cores-

www.phoronix.comApple M1 / M2 / M3 Core Support Might Soon Be Merged For The GCC Compiler

This is some frackin' dark #compiler magic.
godbolt.org/z/6ans5YGnW

When I pay attention, I'm used to seeing `-Os` nibble at the edges to make the program's footprint smaller -- remove dead code, remove functions that don't get called, inline called-once functions, etc.

I'm not surprised that it was able to achieve some amazing compression given the structure of the `switch` statements (and the pattern of values in the nested array) -- but wow. It replaced both 34-entry jump tables with a single 34-element array, and replaced the nested array with code to compute the array's elements. When I say it like that, it seems (as I said) not surprising, but it's still frickin' amazing.

(For those wondering why I use this implementation instead of the commented-out simpler implementation, it's starter code for an assignment in which students need to scan a matrix keypad, replacing the library call -- giving them this in the starter code gets better results than giving them the simpler version in the starter code.)

godbolt.orgCompiler Explorer - C #define KEYPAD (1) char cowpi_get_keypress(void); uint8_t cowpi_debounce_byte(uint8_t byte, uint8_t device); static const uint8_t keys[4][4] = { {0x1, 0x2, 0x3, 0xA}, {0x4, 0x5, 0x6, 0xB}, {0x7, 0x8, 0x9, 0xC}, {0xF, 0x0, 0xE, 0xD} }; uint8_t get_keypress(void) { int8_t row, column; char key = cowpi_get_keypress(); switch (key) { case '1': case '2': case '3': case 'A': row = 0; break; case '4': case '5': case '6': case 'B': row = 1; break; case '7': case '8': case '9': case 'C': row = 2; break; case '*': case '#': case '0': case 'D': row = 3; break; default: row = -1; } switch (key) { case '1': case '4': case '7': case '*': column = 0; break; case '2': case '5': case '8': case '0': column = 1; break; case '3': case '6': case '9': case '#': column = 2; break; case 'A': case 'B': case 'C': case 'D': column = 3; break; default: column = -1; } if (row == -1 || column == -1) { return cowpi_debounce_byte(0xFF, KEYPAD); } else { return cowpi_debounce_byte(keys[row][column], KEYPAD); } } // uint8_t simpler_implementation(void) { // char key = cowpi_get_keypress(); // uint8_t value; // if ('0' <= key && key <= '9') { // value = key - '0'; // } else if (key == '#') { // value = 0xE; // } else if (key == '*') { // value = 0xF; // } else { // value = 0xFF; // } // return cowpi_debounce_byte(value, KEYPAD); // }

#dailyreport #rust #linux #gentoo #opensource #compiler
#security
I compiled Rust from sources with alternative compiler
Mrustc (C++) without any binary blobs.

As you may know Rust compiler distributed as Rust sources
meant to be build by older "snapshot" of itself. Which
violate open source paradigm.

I was able to solve this in Gentoo GNU/Linux OS with
reproducible way. First I compile Rust 1.74 version and
then in chain I compile all versions to 1.84.

All steps took approximately 8 hours, but after it is fast
to compile new version, without blobs.

#dailyreport #rust #linux #gentoo #opensource #compiler
I compiled Rust from sources with alternative compiler
Mrustc without any binary blobs.

As you may know Rust compiler distributed as Rust sources
meant to be build by older "snapshot" of itself. Which
violate open source paradigm.

I was able to solve this in Gentoo GNU/Linux OS with
reproducible way. First I compile Rust 1.74 version and
then in chain I compile all versions to 1.84.

All steps took aproximately 8 hours, but after it is fast
to compile new version, without blobs.