4 ms·
> In terms of where would this work, umm, maybe in an old OS that didn't have the protection, or perhaps dynamically linking libs? Modern OSes all have shared
by marcosdumay 6y ago
> In terms of where would this work, umm, maybe in an old OS that didn't have the protection, or perhaps dynamically linking libs?
Modern OSes all have shared memory functionality. And dynamically linked libs are a complicated thing, so it's both yes and no there, at least on some OSes, while on others it's a clear no :)
> Neither, it's pass by copy from what I recall.
Pass by copy is the same thing as pass by value.
In C and Pascal the definitions are pretty clear, but people insist on using them on other languages where they don't make sense. Let's extend it a bit: is Haskell a pass by value or pass by reference language? What about Prolog?
About breakpoints, they usually have hardware support. But since Java runs on a virtual machine, I have no idea it the buck stops at the JVM or if they use the hardware interface.
- lmilcin 6y agoYes, the value can either be copied or a reference to it can be passed and this determines whether it is pass by value or by reference. It is clear that Java is pass by value but a little bit confusing since everybody is used to thinking about objects as references and this people confuse that these are different references than the ones in "pass by reference". As to breakpoints this is more complicated and will depend on whether the code is interpreted or it has already been compiled. In an interpreted bytecode (before JIT comes and compiles it) the buck stops at JVM as it is the one responsible for actually executing the bytecode. Once JIT comes and compiles the code, the JVM looses ability to stop at a given physical instruction. In this case I think one of two things happen: 1. The function reverts to interpreted (bytecode) version. or, 2. The JVM inserts instruction into the generated bytecode. But I don't know JVM that well to tell which one is used, actually.