Reimplementing software building blocks like malloc and free in D
rikki cattermole
rikki at cattermole.co.nz
Sat Aug 11 19:23:10 UTC 2018
On 12/08/2018 6:59 AM, Aruna Maurya wrote:
> 1. If it would have been C++, the above can be implemented by using the
> mmap() syscall to allocate memory from the heap.
> However, something that I am not able to understand in the idea
> description is 'runtime hooks'.
A runtime hook is a function that the compiler injects a call to, to
perform some function. Like allocate a class.
By reimplementing a lot of these primitives, the compiler will be able
to optimize them better e.g. inlining and removing dependencies on other
runtime information.
> 2. Also as far as I can understand, this idea is about implementing the
> above from scratch, and not tweaking the existing codebase. Do let me
> know if I am wrong.
It is modifying existing druntime and with it dmd (frontend) after
developing these building blocks.
This project is just an idea, you can set your own set of goals and
scope in the proposal. For example, you may choose to rewrite the memory
management stuff in libc in D and support it across Windows, Linux and
OSX. Instead of dealing with integration into druntime/dmd.
More information about the Digitalmars-d
mailing list