Bit addressing
Posted: 2022-05-12, 13:18:06
Hello, I was wondering whether FowardCom should let bits be the smallest addressable unit rather than bytes. I don't know the hardware or ISA implications, but I thought it could improve space and performance for software in a lot of scenarios. Yes, it would reduce the maximum addressable space by a factor of 8, limiting byte addresses to 61 bits, but who is ever going to need more than 288230 terabytes of addressable space on a single machine? For reference, current x86_64 machines only allow 48 bits worth of addressable bytes (I read on Wikipedia that current CPUs error if the upper 16 bits are not the same as the 17th bit). On historic machines, bit addressing would have severely limited addressable space, but with 64 bit pointers I'd think there's plenty of room. Was bit addressing never considered only because pointers used to be too small?
Some advantages I can think of:
Some advantages I can think of:
- Booleans could take only 1 bit of space (if not padded, obviously). Of course, this is already doable for some cases with bit tricks but bools are typically bytes just because current computers happen to use byte addressing. Bit addressing would significantly reduce friction in this area. (Stack space, arrays of bools, etc.)
- Many bitwise operations could be eliminated/optimized, since extracting or changing a bit would not necessitate operating on bytes.
- Succinct data structures could (presumably) be significantly faster. Ironically, this would eliminate the need for many (mostly static) pointer-based structures. The succinct renaissance could be upon us. Here's a paper explaining the basic idea and the fundamental operations these structures rely on: http://www.eecs.tufts.edu/~aloupis/comp ... actice.pdf
- Maybe FowardCom could directly support the 5 fundamental operations as instructions on the hardware?
- If data and code gets smaller by any of the above benefits, that's better for caches, improving execution speed overall.
- Code written for byte addressable hardware could still work. Either all relevant operations could be shifted 3 positions, or the compiler could insert bitshifts before and after a pointer is modified, or maybe the uppermost 3 bits of a pointer would be used to specify bit positions, rather than the lowest 3? If x86 pointers are taken as a reference, maybe the 3 uppermost bits would be inverted if the 17th bit is set? I'm just throwing out ideas, not sure which of these would be most appropriate, but I'm hoping it's the simplest one. Another idea: Might it be useful to express pointers with a decimal point, and allow 3 bits after the decimal point to specify the bit position?