Hacker News new | past | comments | ask | show | jobs | submit login

What are the proper abstractions necessary?



Most simple cases of instructions seem straightforward to just go ahead and emit the bytes for. Then when you start to use more addressing modes you realise it gets to be a lot of code and it turns out there's a common pattern for everything.

Here's a concrete example from an industrial assembler.

Almost every simple instruction boils down this helper method which is parameterised by a bunch of flags and can then deal with all of them.

https://github.com/oracle/graal/blob/f3a3576493f87abdea1045d...

Even that looks complicated! But writing this per instruction (the simple case) would be insanely complicated.


Ideally, the common fields and patterns noted by the manufacturer in the ISA description would be implemented, and then the remainder of the logic can be (relatively) simple table-lookup.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: