[a / b / c / d / e / f / g / gif / h / hr / k / m / o / p / r / s / t / u / v / vg / vm / vmg / vr / vrpg / vst / w / wg] [i / ic] [r9k / s4s / vip] [cm / hm / lgbt / y] [3 / aco / adv / an / bant / biz / cgl / ck / co / diy / fa / fit / gd / hc / his / int / jp / lit / mlp / mu / n / news / out / po / pol / pw / qst / sci / soc / sp / tg / toy / trv / tv / vp / vt / wsg / wsr / x / xs] [Settings] [Search] [Mobile] [Home]
Board
Settings Mobile Home
/g/ - Technology

Name
Options
Comment
Verification
4chan Pass users can bypass this verification. [Learn More] [Login]
File
  • Please read the Rules and FAQ before posting.
  • You may highlight syntax and preserve whitespace by using [code] tags.

08/21/20New boards added: /vrpg/, /vmg/, /vst/ and /vm/
05/04/17New trial board added: /bant/ - International/Random
10/04/16New board for 4chan Pass users: /vip/ - Very Important Posts
[Hide] [Show All]


[Advertise on 4chan]


File: 1757175135599.png (111 KB, 930x590)
111 KB
111 KB PNG
Is Tsoding right about Hare?
>>
Who cares?
>>
>>106503054
Yes
>>
>>106503054
>Tsoding
Transsexual overdosing?
>>
>>106503054
Dunno about Hare but QBE is neato.
>>
tsoding is always right, and cute, so yes
>>
>>106505543
Sure it's neat, but the QBE codebase is basically unreadable. It's C with lots of acronyms and no documentation.
Try reading it yourself: https://c9x.me/git/qbe.git/tree/
>>
>>106505734
You get used to it when you read a lot of C codebases.
>>
>>106505809
All the C codebases that are worth reading aren't written like that, this is garbage code written by an academic mind.
You would know this if you had look at any other C code than the old Unix source tree.
>>
>>106505942
>this is garbage code written by an academic mind.
What would you say is the worst written code in the tree? Or the most clear example of academic mind?
>>
>>106505974
>What would you say is the worst written code in the tree?
I tried to understand yacc for a while, it's trash.
>Or the most clear example of academic mind?
What I mean is that academics can't write programs for shit, have many bad practices such as using short variable names because they think it makes their program easier to read. Their programs have a shit structure and this invariably leads to bugs. Not just memory bugs but also logical bugs.
>>
>>106506496
I mean inside QBE tree. Specific files, if you could screenshot the worst code please
>>
>>106506511
Why don't you have a look yourself you lazy bastard, it looks like it's been obfuscated
>>
>>106506606
I want to hear your opinion, and it will only take you 5 minutes
>>
>>106506511
the register allocator for example, the son of a bitch didn't even bother to put in a comment saying which algorithm he's implementing
>>
>>106503054
>Description
>Recreational Programming
>>
>>106506640
Have you seen Hare's code?
https://git.sr.ht/~sircmpwn/hare/tree
>>
>>106506640
also, the problem is not just the code, it's the data structures. If they were clear (descriptive struct field names and comments to describe what's stored, maybe what invariants should be maintained, etc..) you could easily infer what the code is doing.
>>
>>106506664
It's day and night compared to QBE. Just browsing through the code, all the functions, variables, types, fieds names seem pretty descriptive to me. There are a few short comments here and there describing what the functions do, as it should be.
I don't like how the parsing is done though.
>>
>>106505734
I hate academics and mathematicians so much
>>
File: qbe.png (92 KB, 846x1000)
92 KB
92 KB PNG
>>106505734
This is in main.c, slightly more understandable this way, to understand the passes done on each function.

You can see that filluse() is called before every pass basically. This is about the SSA data structure. Each instruction struct has operand fields pointing to (referencing via an index) the variable definitions (variable assignment or temporaries) it uses. For example:
a = 1
b = 2
c = add a, b # c = a + b

So naturally, it contain explicit use -> def chains, which are useful for analysis and transformations. Some passed make use of def->use chains however, and here in QBE it's maintain by an external data structure that must be re-generated. It's easier to manipulate the SSA this way, otherwise every single transformation pass should take care to maintain the def->use chains. def->use chains are a pain because each definition can have multiple users, so each instruction struct requires a vector for storing them. On the other hand, each instruction only need a single use->def chain per operand. Each operand requires a single pointer/reference and that's it.
>>
>>106503054
hare is fugly like Rust and doesn't have the redeeming quality (robust memory safety) that no other language has. it's a memelang, so just pick C, C++, or Rust depending on which satisfies your application.
>>
>>106506496
nta but im glad there is someone else in this world who has looked at the yacc source code, i had to do that for work once and it was retarded.
>>
QBE codebase is visibly a single-person project. I tried to read it and desu I would struggle a lot to decode the cryptic names and algorithms if I didn't know the theory and worked from that to source code. Zero comments, acronyms only, invariances are kind of just assumed and never checked or described.
It's not a fast code, but the competition is pretty low so it is fast enought I guess.
It lacks function inlining, which is one of the most significant optimizations. This is a massive performance loss and reason why I won't take QBE seriously.
The model is that it optimizes single function at a time in isolation. Admittedly this makes the project way less complex.



[Advertise on 4chan]

Delete Post: [File Only] Style:
[Disable Mobile View / Use Desktop Site]

[Enable Mobile View / Use Mobile Site]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.