Card Products
Moderator: horse dream
-
lightupdark
- Posts: 11
- Joined: Sat Aug 29, 2015 2:01 am
- Points :16
-
Contact:
Post
by lightupdark » Sat Oct 17, 2015 2:52 am
How does the java card virtual machine construct the header for the methods?
e.g.
Code: Select all
method_info[1] // @0043= {
// flags : 0
// max_stack : 5
// nargs : 3
// max_locals: 0
/*0045*/ L0: new 0x0003
/*0048*/ dup
/*0049*/ aload_0
/*004a*/ sload_1
/*004b*/ sload_2
/*004c*/ invokespecial 0x0004
/*004f*/ pop
/*0050*/ return
How can we obtain max_stack: 5? Thanks for any help.
Being the best possible version of yourself.
-
UNKNwYSHSA
- Posts: 630
- Joined: Thu May 21, 2015 4:05 am
- Points :3055
-
Contact:
Post
by UNKNwYSHSA » Wed Oct 21, 2015 1:40 am
The stack information for each opcode described in the JCVM specification.
Here's the stack information of the code you given.
Code: Select all
/*0045*/ L0: new 0x0003 // +1 The objectref, a reference to the instance, is pushed onto the operand stack.
/*0048*/ dup // +1 The top word on the operand stack is duplicated and pushed onto the operand stack.
/*0049*/ aload_0 // +1 The objectref in the local variable at <n> is pushed onto the operand stack.
/*004a*/ sload_1 // +1 The value in the local variable at <n> is pushed onto the operand stack.
/*004b*/ sload_2 // +1 Here's the max stack. The value in the local variable at <n> is pushed onto the operand stack.
/*004c*/ invokespecial 0x0004 // The nargs – 1 words of arguments and objectref are popped from the operand stack.
/*004f*/ pop // -1 The top word is popped from the operand stack.
sense and simplicity
Users browsing this forum: No registered users and 27 guests
JavaCard OS : Disclaimer
Board Disclaimer
The views and comments posted in these fora are personal and do not necessarily represent the those of the Management of JavaCard OS.
The Management of JavaCard OS does not, under any circumstances whatsoever, accept any responsibility for any advice, or recommentations, made by, or implied by, any member or guest vistor of JavaCard OS that results in any loss whatsoever in any manner to a member of JavaCard OS, or to any other person.
Furthermore, the Management of JavaCard OS is not, and cannot be, responsible for the content of any other Internet site(s) that have been linked to from JavaCard OS.