I am writing a simple virtual machine, and I have a question about using access to an object and structure.
Since the starting address of the program is arbitrary for each run, and then the address of each of its objects is also arbitrary.
Thus, the only way I can access an object or its member object is to access the offset from the "base" pointer, which means that there is an arithmetic operation necessary to access something in the program structure.
My question is whether this is done in professional compilers, because obviously this approach adds some overhead at runtime, and I myself canβt think about unloading this process from the runtime due to lack of warranty memory allocation consistency and its address?
source share