jvm - In Java, can operations on object fields bypass the stack? -


java heap stores objects, , stack stores primitive data , object reference.

consider a.a = b.b , a.a , b.b int.

in understanding, jvm first value of a.a heap stack, , put value b.b on heap. seems the way change data on heap put value stack.

my question is: there way operate data on java heap without stack? e.g., copy value of a.a direct b.b without stack operation.

if "it depends on implementation of jvm", question dalvik.

when considering jit, things complicated. think question java compiler, not jvm

if thinking of javac should assume no optimisation , gives in byte code literal translation of code, stack based.

in fact byte code using stack more example suggests. operations like

push b getandpushfield b push popandsetfield 

i.e. instead of 1 stack operation, there notionally 3.

the jit on other hand might optimise away not using register value. depending on processor

// r3 contains a, r7 contains b,  // starts @ 14th byte // b start @ 16th byte movi [r3+14], [r7+16]  

Comments

Popular posts from this blog

Perl - how to grep a block of text from a file -

delphi - How to remove all the grips on a coolbar if I have several coolbands? -

javascript - Animating array of divs; only the final element is modified -