Compiler-Duo: Viele Verbesserungen für Clang 17 und LLVM 17
Neben einer Fülle an Details und Korrekturen verstärkt die neue Compiler-Generation von Clang und LLVM 17 die Sprachen C++20, C++23 und C++26.
The Odd operator is beautifully easy after Inc and Dec. I've highlighted to two instructions for the Odd itself and the CPL for NOT. Ignore the references to temp0 which will get optimised away at some point.
Note how the allocator is smart enough to only load the low byte of the 16-bit variable.
I think I'll also add a version that targets a branch. It'll be a lot shorter if optimised.
Almost all the code generation is table driven. Inc and Dec are one of the exceptions that require code. In this case it's a loop to generate the INC or DEC instructions.
Only thing left to do is to generate add or subtract if the offset is too large. For now I'm stabbing at doing this for offset greater than four. Optimising here is much more complex than it might seem. For example you can INC any register whereas ADD requires A.
I'm working my way through 'intrinsics' in the #compiler. These are operations that look like functions or procedures to the programmer but are generated inline code. Examples are Write, Inc, Peek, Poke, Inp, Out, Sizeof and High.
Support for these includes adding an 'Enumerable' type set for the parameters and some flags. Inc and Dec can only accept a variable reference as the first parameter and a constant as the optional second parameter.
I've spent the day upgrading the error reporting in the #compiler. Previously it used simple error codes. It's been bugging me that I can't add more detailed messages, or include extra data such as a type name or variable name.
So here it is reporting the actual variable name it has an issue with.
b := integer(a);
This gives me the hooks I need to call functions within expressions and handle the return value. But typecasts generate inline code so I don't have to do stack frames yet.
I know I posted already about this, but let me #gloat.
When I finally managed to make the first version run (it was written in #elm ) it took seven minutes to compile.
Now it takes less than four seconds.
This is so satisfying. _^
* The #compiler knows how to find all the files of the programs just by passing it the entry point file. This makes unnecessary using a building system in most instances.
* more intelligent errors messages.
This is mad 🤯
It's linter is 50 - 100 times faster than #ESLint...
...and its parser is even 2x faster than #swc
#JS tooling goes brrrrrrrrrrr! 🚀
Anyone forming a team for this OSSF funded competition (2 yr $20M in prizes)?
Teams will need #NLP, #CyberSecurity, #StaticAnalysis and #Compiler expertise. Maybe #OpenSource project and community management experience would help too. This will likely hinge on #GOFAI algorithms like A* search, and graph querying (#AST walking). If you've written a linter you probably have the right stuff.
(Yes, for any other #compiler nerds in the audience, the goal is to fully self-host the SwitchBoard recipe technology.)
The Secret Life of C++: What Your #Compiler Doesn't Want You To Know
“#CPP is filled with strange and wonderful features, with a few more added in C++11. We will explore in detail how these features are implemented under the covers, in terms of the #assembly #code generated.”
Being able to make function calls has been my target for several months so it feel great to finally arrive.
Having said that, Write and WriteLn are special cases that sidestep a few steps required for full function calling. but I'm getting close now.
A new #blog post appears!
Branching is easy - just use the CPU flags. Assignment means converting to $00 or $ff (false or true).
Carry flag to boolean is just SBC A,A. If carry set we get -1 ($ff). If carry clear we get 0. To invert we can CCF (invert carry flag) before or CPL (bitwise invert A) after. 1/n
‘Computer language that anyone can read’ launches Aeternity compiler - Lexon now features a compiler that allows users to translate code... - https://cointelegraph.com/news/lexon-computer-language-that-anyone-can-read-launches-aeternity-compiler #smartcontracts #aeternity #compiler #lexon
Schönen guten Morgen!
Bin dabei, unseren zentralen Steuerrechner am #Röntgen-#Mikroskop neu aufzusetzen. Das System an sich läuft, nur die Steuersoftware nicht. Also, die Software schon, und sie steuert auch, sogar unser Mikroskop.
Aber wir hijacken noch eine ganze #Beamline, und die Kommunikation dahin ist tot.
Später mal analysieren, *wo* das Problem liegt:
omniORB, Tango, C-Bindings, SPEC …
oder eine ungünstige #Compiler-Version …
Jetzt aber erstmal #Frühstück ☕.
Habt einen schönen Tag!
Arenas are super funny to me; folks suddinly rediscovering that array index operations are summa the most well studied and powerful #compiler optimizations out there
*Almos all* of the origimal #FORTRAN compiler from the 50s was around doing this!! (they actually considered normalous expressions trivial to codegen for, parsing 'em was harder)
@Angle my problem is that I'm not convinced "readability" is a teachable concept for a #compiler / #algorithm without doing it the hard (analyse samples, generate model) way. YMMV and maybe someone will do it in code, but it *feels* like the kind of problem humans are just more suited to than computers in the first place. Much like map route solving.
the weird thin about all me #compiler stuff over the last couple years is I cain't hardly use a language unless I've skimmed thru its offisal for-compiler-devs-only spec 🤔🤔🤔🤔🤔
Progress report on rustc_codegen_cranelift (July 2023), https://bjorn3.github.io/2023/07/29/progress-report-july-2023.html.
The goal of this project is to create an alternative codegen backend for the Rust compiler based on Cranelift. This is a progress report of the project.
A wild #blog post appears!
Teaching the Portable C Compiler (PCC) to use Yasm and the Sun assembler as its assembler (instead of the GNU assembler).
#compiler #compilers #c #assembly #assembler #assemblers #unix #bsd #freebsd #netbsd #openbsd #dragonflybsd #linux #solaris #illumos #program #programming #programminglanguage #programminglanguages #opensource #freesoftware
Optionally, if I have enough time and it proves to be really useful: use #symbolic #execution to determine if #decompiled code corresponds to original sources code. It doesn't look trivial at all, as codes written by humans tends to be much more verbose, logical, etc, than codes generated by compilers.
A new #blog post appears!
Installing Oracle Developer Studio 12.6 on OpenIndiana, a tale of lies.
Join me as I install Oracle's proprietary compiler suite on an open source Illumos distro, despite Oracle's best attempts to stop me.
Here’s How To Build A Tiny Compiler From Scratch
A new #blog post appears!
For the #GPU and #compiler folks, looks like the Arm Norway Mali (formerly Falanx) team is recruiting people to work on the Mali GPU and its compiler toolchain. But it seems there are more roles available as well.
Location: Trondheim, Norway
Possibly interesting for some #GameDev folks as well.
The two hardest problems in #compiler development:
1. Escape analysis
2. Lexing float and string constants
#CLanguage « #SectorC is a #C #compiler written in x86-16 assembly that fits within the 512 byte boot sector of an x86 machine. It supports a subset of C that is large enough to write real and interesting programs. It is quite likely the smallest C compiler ever written. » https://xorvoid.com/sectorc.html
“Big Insight #2 is that atoi() behaves as a (bad) hash function on ordinary text. It consumes characters and updates a 16-bit integer. Hashes are perhaps the holy-grail of computer-science. With a good hash, we can just side-step all the hard problems by trading them for an even harder problem (hash collisions), and then we just ignore that harder problem. Brilliant. (sticks fingers in ears) 🤪”
Nice free course by Cornell university for learning a couple of things about compilers and programming languages implementations
Github repo: https://github.com/sampsyo/cs6120
'As I can attest from personal experience, having a #compiler leads to hubris: you start to consider source languages like a hungry person looks at a restaurant menu. "Wouldn't it be nice to ingest that?" That's what we say at restaurants, right, fellow humans?'
from the latest @wingo/log
It's an unfortunate meme IMO that tech Reddit is low-quality. You just have to find interesting subreddits!
I've updated my list for 2023.
I've revisited my #ruby #compiler for the first time in probably a couple of years (with far longer since I wrote an article) and implemented type tagging for integers. Amazingly it took only a couple of hours, and it reduces the memory allocation pressure dramatically to the point where I'm now tempted to try to fix the remaining bugs preventing it from being fully self-hosted and doing some work on it again...
Wasmer is still a great project but its CEO is a danger. Reminder: https://mnt.io/2021/10/04/i-leave-wasmer/. Its toxic behaviour is still very present.
But the project is great. Thanks to the contributors and the brave employees working there!
It's called selecuery.✨
It can transpile X++ select statements into query expressions. If you think "X++" is a typo and you don't have any idea of what I'm talking about, don't worry.😄
Have a look at the video below.
This project is dear to my heart! ❤️ I've started it 2019 for learning #RustLang.
I think, I've been transpiled during this project as well.🤪
Ezno in '23:
This type system is craaaazyyy!🤪
Can't wait for 1.0! :awesome: 🚀
The Scheme code runs very fast in #ChezScheme, so-so in all else I have tried. I wonder how they do it. Maybe a lot of C code (instead of Scheme) in the runtime is part of it?
The generated Mercury is not so fast, but such is life with Mercury. It’s fastish, considering.
I decided to keep going and have added "vmc", the virtual machine compiler: https://sourceforge.net/p/chemoelectric/rosettacode-contributions/ci/default/tree/vmc.dats
The ATS it makes does tail calls. The C uses goto--many more goto than are needed, but optimizers might clean that out. The generated code is in continuation-passing style.
Compiler/virtual machine interpreter - Rosetta Code https://rosettacode.org/wiki/Compiler/virtual_machine_interpreter#Compiler
The thing’s designed to make it relatively easy to handle many other languages. Languages with #goto should be easy to do, for instance: convert the program to one procedure with a lot of goto in it. And #Scheme could be done easily. I have ideas for #ObjectIcon and co-expressions.
inline / notinline:
Ooops, wrong language ... 🙈
I've been contacted by someone who's looking for a mentor in the #compiler area. They're new to compiler design, but they do seem very interested and they've taken a sabbatical to learn about it.
Is someone around here interested to become their mentor?
Boosts appreciated 🙏
A wild #blog post appeared!
As an added bonus, there are instructions in the blog post for how you can get your own GCC with Modula-2 and Rust on your own OpenBSD machine. Just a quick pkg_add away!
Been spending some time in my evenings hacking on a TypeScript library to make it easy to build Wasm modules directly in the browser without needing to muck about with the binary encoding.
Could be useful for defining little DSLs that get compiled to Wasm and run directly in the user's browser.
Nuke the C++ implementation of Zig from orbit using WASI, https://github.com/ziglang/zig/pull/13560.
> The idea is to use a small WASI binary as a stage1 kernel that is committed to source control and therefore can be used to build any commit from source. We provide a minimal WASI interpreter implementation that is built from C source, and then used to translate the Zig self-hosted compiler source code into C code.
#Compiler: Okay, so I’m gonna need you to add these numbers and then multiply these numbers.
CPU: You’re saying you want me to…load an effective address?
I never thought to actually look into "what the #compiler actually does" and just took it as one of the difficult things that I didn't really need to understand.
However, given that I'm now spending more time with #Rust I figured it might be useful to actually take a closer look.
This excellent video is focussed on the Borrow Checker but gives a deeper dive into the various stages the Rust compiler goes through when building code:
I have more projects than I can count. Several involve writing a #compiler or #interpreter; some can be classified as #algorithmicart or #creativecoding; several are math- and game- related; and some miscellaneous ones.
Do is a static (local to this file) function pointer and it's only ever set in NeverCalled. So even though NeverCalled never actually gets executed, the compiler performs the set at compile time as an optimization and this is allowed because there is undefined behavior.
Another #projects entry
I wrote a compiler that converts Winamp visualizer presets to Web Assembly so they can run efficiently and safely in the browser. The fun part is that the compiler itself runs in the browser.
I have more projects than I can count, and way more than I can advance! There's not enough lifetime for them all.
Several other projects can be classified as "algorithmic art" or "creative coding"; when I started some of these, I didn't even know these names.