(Jav a card) javacard222vm "Specification (javacard's 2.2.2 specification for virtual machines-Comparison between Chinese and English, chapter 3)

Source: Internet
Author: User

Java card virtualMachine
Java card Virtual Machine StructureStructure

Java card Virtual Machine specifications are very similar in many ways
Java virtual machine.This is of course intentional similarity, design
Java card VM is based on
The
Java Virtual MachineShare all the details, not reiterateThis chapter mainly describes the corresponding Java
Specification for virtual machines. Version 2 provides new information only in
Java card Virtual Machine2. Different virtual machines.

3.1 Data Type and Value
3.1 Data Type and Value
Java card Virtual Machine support data type Java
Virtual Machine: original type and reference typeTwo identical.Similarly,
UseOfValueTwo identical: Original Value and reference

The data type supported by the original Java card virtual machine is Numeric.
Type, boolean type, and return address type.Value types include
The following types:
■ Byte. Its value is an 8-bit signed integer.
■ Short. Its value is a 16-Bit Signed binary complement integer.

Byte: an 8-Bit Signed binary integer
■ Short: A 16-Bit Signed binary integer

Some Java card Virtual Machine implementations can also support additional
Point Type:
■ Integer, whose value is a 32-Bit Signed binary complement integer
Some Java card virtual machines can also support additional Shaping
■ INTEGER: A 32-Bit Signed binary integer.

The supported Boolean types in Java virtual machines are the same.
Value 1 is used to indicate that the true and 0 values are used to represent false values.
The reference types are the same.

3.2 words,
3.2 words
An abstract storage unit defined in the Java card virtual machine is called
Word.This specification does not have the actual size of a forced bit, one word
Specific PlatformUpper.A word is large enough to accommodate a byte value. In short,
Reference or return address.The two words are large enough to hold a single value.
Type

The actual storage value is platform-specific.Yes
Sufficient information. The descriptor component in a cap file is allowed.
Execute the value in the optimization variable and use it for storage

3.3 runtime data Zone
3.3 runtime data domains
Java card Virtual Machine supports only one separate thread.Any
When the Java virtual machine is running, the data area is copied to each thread.
There is only one global copy on the Java card virtual machine,
Java card Virtual Machine heap is not garbage collected.
Allocated from the heapObjectNot necessarily recycled.
This specification does not support local methods.
Native method stack.
Otherwise, the Java virtual

3.4 Context
3.4 Context
And execution
ContextRelated SmallProgramJava card.When the Java card VM uses the current frame,
Enforce security policies for inter-applet businesses.
There is a ing between the context and the package applet's
Definition.A simple method is equivalent to a package when you think about it,
Because the structure of the Java package during compilation and
RuntimeIs there a direct representative?.Therefore, all small application instances in the same package will share
Same

Java card runtime environment also has its own context.Framework object
Execute this Java card re

The context of the currently executed method is known as the current context.
In the Java card Virtual MachineEachThe object has a specific context.Yes
In context, when this is the current object

When the method in one context is successfully stored in another
ContextObject in call a methodThe context switch executed by the Java card virtual machine.After,
The context of the called method becomes the current context.When the method is called
Returns the current context and switches back to the previous

3.53.5 FramesFrame
Java card Virtual Machine framework defined by Java
Virtual MachineIs very similar.Each framework has a set of local variables and an operand stack.
The frame also contains a constant pool, but because all constant pools
MergedIsIn a packageAllClass refers to the current
Class package
Each frame also contains a reference context, in which the current method

3.6 indicates the object
3.6 Object Description
Java card virtual machine does not require a specific
Object or a specific layout of its contentInternal Structure.However
Cap FileCore ComponentsIt is defined to assume some runtime structures of a default structure (for example
Class description), and a dynamic
Allocated objectContent default Layout.Yes
UseInformation of the descriptor component from the CAP FileTo Format objects in any way.

3.7 Special Initialization Method
3.7 Special Initialization Method

Java card VM instances are initialized in the same way.
Java virtual machine.
Java card virtual machines support the same instance initialization method as Java virtual machines.

Java card VM class or interface
Initialization MethodOnly limited support.Is there a general mechanism,
On a Java card VMRun<Clinit> method.Instead, Cap files include
The initialization class data defined in 2.2.4.6, "Class
Initialize"

3.8 exceptions
3.8 exceptions

The exceptions supported by Java card virtual machines are the same.
Abnormal in Java Virtual MachineSupported.
Exception support for Java card virtual machines is the same as exception support for Java virtual machines.

3.9
3.9Binary File FormatBinary File Format

This specification defines two platforms
Java card program developed, distributed, and executed independentlyBinary File Format
Cap file format description file, which contains executableCode, Yes
Download and install it to a Java card device.A cap file is
Java card platform conversion tool, including
Java class of the entire packageConversion form.Java card for the relationship between the file formats
Virtual machines are similar to the relational class file format Java
Virtual

Description file in the exported file format, which contains public
Java card API packageLink information.Client
Package,Conversion of the exported file of a package

3.10 Instruction Set Summary
The Instruction Set of the Java card virtual machine is similar to that of the Java Virtual Machine.
Machine instruction set.A single instruction consists of one byte operation code and zero
Or multiple operands.Java card VM commands
Obtain, decode, and execute a loopPseudo CodeIs the same.The data of the Multi-byte operands is also
Big-Endian byte sequenceEncoding.
3.10
The get-Decode-execution loop is the same. Multi-byte operand large-end encoding.

There are multiple methods, including Java card Virtual Machine Instruction Set
Java virtual machine.Most of the differences are caused
Data TypeOfJava card virtual machine, more importantly, provides limited support.
DifferencesAnother sourceIs 8 bits and 16-
Bit ArchitectureRun onThe Java virtual machine is designed as a 32-bit
Architecture, Java card Virtual Machine objective.The rest of the difference is in one or another way
Java card Virtual Machine with optimized size or performance
Or Java card programOriented.These changes include the inline constant pool.
Add a specific command for multiple versions
To process different data types,Directly inThe operation code or operand of the commandData,
For the currentAnd create compound commands

3.10.1 type and Java card Virtual Machine
3.10.1 type and Java card Virtual Machine

Java card Virtual Machine supports only one subset
Java Virtual MachineSupported types.This subset described in Chapter 2nd.Reflection
InSupported typesThe instruction set, the data type of instruction encoding, they operate.
Compared with Java virtual
Machine,Java card Virtual Machine supports fewer typesTo better support small data types.Lack
Large numeric data typeOfThe supported instruction sets free up more space.This additional
The instruction space has been used for direct support
For short dataArithmetic Operations

Some additional command space is also used to optimize the common
Operation.The type information is encoded in the direct field access instruction, while
Not get an entry at a constant

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.