OMG I was trying to fix some dumb java asm thing I was making while playing this in the background and didn't realize the method was static cuz I stayed up all night xD. When u mention static invocation doesn't have a this pointer it made me realize that is whats wrong. My dumbass didn't realize it was static for ages and thought maybe it was somehow making the first local var index the first method param. Thank you so much idk how long I would of been stuck with that
Nice talk! Short question: <a href="#" class="seekto" data-time="1920">32:00</a>: Instruction Index 8: Why is the long variable l2 loaded from constant pool index #3? I thought it should have been #4 Follow up question: How does the constant pool for this particular example look like? Thanks you!
From the sparse explanation about arguments on calls and return values it remains unclear to me weather the VM implements the return stack separately from the data/calculation stack or there is some hidden is going on in the shades. So what is it then for real about argument passing and return addresses on the stack? Another aspect unclear to me: In <a href="#" class="seekto" data-time="1901">31:41</a> arguments come as arguments in local variables, but when the call is presented (<a href="#" class="seekto" data-time="2049">34:09</a>) the arguments are provided by pushing on the stack, instead of of being passed as arguments in the locals registers. What is it now for real? On the stack or as arguments or in the locals registers? Just wondering ...
@<a href="#" class="seekto" data-time="511">8:31</a> I don't understand.. Why he said the program does not use CPU register? Only use the stack to add two numbers together? How is that possible?
There is iload instruction, which takes 1 byte operand. The operand is locals index. So instead of iload_4 (1-byte instruction) it will be iload 4 (1-byte instruction + 1-byte operand).
If I understand this correctly, unlike in C, the references are not to memory addresses but to stuff like classes. Thus the limit is not to the amount of memory you can address, but to the number of classes you can reference, and that number is never gonna get to the max you can address with 32 bits
This Java Bytecode is Like C. Your God: Nothing Better Than C. Its Very Portable. Works on X86, ARM, PowerPC, Sparc. The Dalvik / Android Byte Code is Like C++. Less Portable. Will Only work on Sony's ARM CPU's and Intel. Wont work Well on PowerPC, Sparc.