Our Online Store have the new products: RFID antenna board. Currently it can work with JC10M24R and JCOP4 card chips.
Compared with normal cards, the antenna board module has a smaller size and fixed holes, which is easy to integrate in the IOT(Internet Of Things) project.

Question about java card method header

Card Products

Moderator: horse dream

lightupdark
Posts: 11
Joined: Sat Aug 29, 2015 2:01 am
Points :16
Contact:

Question about java card method header

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.

User avatar
UNKNwYSHSA
Posts: 630
Joined: Thu May 21, 2015 4:05 am
Points :3053
Contact:

Re: Question about java card method header

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

Post Reply Previous topicNext topic

Who is online

Users browsing this forum: No registered users and 19 guests

JavaCard OS : Disclaimer