Site Tools


Sidebar

Smart Card Solution

User Manual

JavaCard API Samples

Java Card Specification

Knowledge Sharing

javacard:jcvm:7.5.78_putstatic_t

7.5.78 putstatic_<t>

Set static field in class

Format

putstatic_

indexbyte1

indexbyte2

Forms

putstatic_a = 127 (0x7f) putstatic_b = 128 (0x80) putstatic_s = 129 (0x81) putstatic_i = 130 (0x82)

Stack

…, value → …

OR

…, value.word1, value.word2 → …

Description

The unsigned indexbyte1 and indexbyte2 are used to construct an index into the constant pool of the current package ( Section 3.5, Frames), where the value of the index is (indexbyte1 « 8) | indexbyte2. The constant pool item at the index must be of type CONSTANT_StaticFieldref ( Section 6.7.3, CONSTANT_StaticFieldref and CONSTANT_StaticMethodref), a reference to a static field. If the field is final, it must be declared in the current class.

The item must resolve to a field with a type that matches t, as follows:

  • a field must be of type reference
  • b field must be of type byte or type boolean
  • s field must be of type short
  • i field must be of type int

value must be of a type that is assignment compatible with the field descriptor (t) type.

The width of a class field is determined by the field type specified in the instruction. The item is resolved, determining the class field. The value is popped from the operand stack. If the field is of type byte or type boolean, the value is truncated to a byte. The field is set to the value.

Notes

In some circumstances, the putstatic_a instruction may throw a SecurityException if the current context ( Section 3.4, Contexts) is not the owning context ( Section 3.4, Contexts) of the object being stored in the field. The exact circumstances when the exception will be thrown are specified in Chapter 6 of the Runtime Environment Specification, Java Card Platform, Version 2.2.2.

If a virtual machine does not support the int data type, the putstatic_i instruction will not be available.

javacard/jcvm/7.5.78_putstatic_t.txt · Last modified: 2017/05/13 04:10 (external edit)