3 ms·
The memory allocation feature feels more like it would be part of whatever memory allocation library is used than something that should be baked into the langua
by Sanddancer 11y ago
The memory allocation feature feels more like it would be part of whatever memory allocation library is used than something that should be baked into the language. For example, jemalloc allows for the kind of alignment that is discussed here and is done at runtime, and doesn't require specific behavior from the lower levels. Any language is going to need a runtime because you can't put in every feature that every user will need, and a malloc doesn't seem like a huge issue, especially with one already written that an implementation can crib from.
- nabla9 11y agoMemory allocation feature asked is not a language feature. It has to be baked into web assembly if you want to use portable byte masking with pointers. It's very low level implementation level detail that enables fast execution of dynamically typed languages. Boxing has high cost and it consumes memory. Type tags embedded in pointers can be very fast. For that to work, you need objects that are aligned with power-of-two byte boundaries. Adding this feature enables efficient execution strategy for scripting and dynamic languages.
- Sanddancer 11y agoThe primary target of WebAssembly is strongly-typed pre-compiled languages, where the kinds of features you want would just lead to slowdowns and excessive memory consumption. There is no hardware currently out there that is a tagged architecture, so expecting them to bend backwards is not a realistic option.
- nabla9 11y agoYou don't need tagged architecture if you allocate memory by power-of-two regions.