1、 Reference numberISO/IEC 20970:2002(E)ISO/IEC 2002INTERNATIONAL STANDARD ISO/IEC20970First edition2002-07-01Information technology Programming languages, their environments and system software interfaces JEFF file format Technologies de linformation Langages de programmation, leurs environnements et
2、 interfaces de logiciel systme Format de fichier JEFF Adopted by INCITS (InterNational Committee for Information Technology Standards) as an American National Standard.Date of ANSI Approval: 12/24/2002Published by American National Standards Institute,25 West 43rd Street, New York, New York 10036Cop
3、yright 2002 by Information Technology Industry Council (ITI).All rights reserved.These materials are subject to copyright claims of International Standardization Organization (ISO), InternationalElectrotechnical Commission (IEC), American National Standards Institute (ANSI), and Information Technolo
4、gy Industry Council(ITI). Not for resale. No part of this publication may be reproduced in any form, including an electronic retrieval system, withoutthe prior written permission of ITI. All requests pertaining to this standard should be submitted to ITI, 1250 Eye Street NW,Washington, DC 20005.Prin
5、ted in the United States of AmericaISO/IEC 20970:2002(E) PDF disclaimer This PDF file may contain embedded typefaces. In accordance with Adobes licensing policy, this file may be printed or viewed but shall not be edited unless the typefaces which are embedded are licensed to and installed on the co
6、mputer performing the editing. In downloading this file, parties accept therein the responsibility of not infringing Adobes licensing policy. The ISO Central Secretariat accepts no liability in this area. Adobe is a trademark of Adobe Systems Incorporated. Details of the software products used to cr
7、eate this PDF file can be found in the General Info relative to the file; the PDF-creation parameters were optimized for printing. Every care has been taken to ensure that the file is suitable for use by ISO member bodies. In the unlikely event that a problem relating to it is found, please inform t
8、he Central Secretariat at the address given below. ISO/IEC 2002 All rights reserved. Unless otherwise specified, no part of this publication may be reproduced or utilized in any form or by any means, electronic or mechanical, including photocopying and microfilm, without permission in writing from e
9、ither ISO at the address below or ISOs member body in the country of the requester. ISO copyright office Case postale 56 CH-1211 Geneva 20 Tel. + 41 22 749 01 11 Fax + 41 22 749 09 47 E-mail copyrightiso.ch Web www.iso.ch Printed in Switzerland ii ISO/IEC 2002 All rights reservedISO/IEC 20970:2002(E
10、) ISO/IEC 2002 All rights reserved iiiContents Page Forewordv 0 Introductionvi 0.1 What is JEFF. vi 0.1.1 Benefits vi 1 Scope and normative references 1 1.1 Scope .1 1.2 Normative references.1 1.3 Definitions.2 2 Data Types 3 2.1 Basic Types3 2.2 Language Types.3 2.3 Strings 3 2.3.1 Definition .3 2.
11、3.2 Comparison.3 2.3.3 Representation3 2.4 Specific Types 4 2.4.1 Access Flags.4 2.4.2 Type Descriptor.5 2.4.3 Offsets.7 3 File Structure 8 3.1 Definitions.8 3.1.1 Fully Qualified Names .8 3.1.2 Internal Classes and External Classes .8 3.1.3 Fields and Methods.8 3.1.4 Field Position.9 3.2 Convention
12、s10 3.2.1 Notations .10 3.2.2 Byte Order.10 3.2.3 Alignment and Padding .10 3.3 Definition of the File Structures 11 3.3.1 File Header11 3.3.2 Class Section 14 3.3.2.1 Class Header .14 3.3.2.2 Interface Table.16 3.3.2.3 Referenced Class Table 16 3.3.2.4 Internal Field Table 17 3.3.2.5 Internal Metho
13、d Table17 3.3.2.6 Referenced Field Table19 3.3.2.7 Referenced Method Table .19 3.3.2.8 Bytecode Block Structure.20 3.3.2.9 Exception Table List.21 3.3.2.10 Constant Data Section.21 3.3.3 Attributes Section 23 3.3.3.1 Attribute Type.24 3.3.3.2 Class Attributes24 3.3.3.3 Attribute Table25 3.3.4 Symbol
14、ic Data Section 25 3.3.5 Constant Data Pool .27 3.3.5.1 Constant Data Pool Structure 27 3.3.5.2 Descriptor.27 3.3.5.3 Method Descriptor28 3.3.6 Digital Signature28 ISO/IEC 20970:2002(E) iv ISO/IEC 2002 All rights reserved4 Bytecodes. 29 4.1 Principles 29 4.2 Translations 29 4.2.1 The tableswitch Opc
15、ode30 4.2.2 The lookupswitch Opcode.30 4.2.3 The new Opcode.31 4.2.4 Opcodes With a Class Operand .31 4.2.5 The newarray Opcode.32 4.2.6 The multianewarray Opcode .32 4.2.7 Field Opcodes .32 4.2.8 Method Opcodes.33 4.2.9 The ldc Opcodes .34 4.2.10 The wide Opcodes .34 4.2.11 The wide iinc Opcode35 4
16、.2.12 Jump Opcodes 35 4.2.13 Long Jump Opcodes .36 4.2.14 The sipush Opcode .36 4.2.15 The newconstarray Opcode 37 4.3 Unchanged Instructions37 4.3.1 One-Byte Instructions37 4.3.2 Two-bytes Instructions 39 4.4 Complete Opcode Mnemonics by Opcode.39 5 Restrictions 41 ISO/IEC 20970:2002(E) ISO/IEC 200
17、2 All rights reserved vForeword ISO (the International Organization for Standardization) and IEC (the International Electrotechnical Commission) form the specialized system for worldwide standardization. National bodies that are members of ISO or IEC participate in the development of International S
18、tandards through technical committees established by the respective organization to deal with particular fields of technical activity. ISO and IEC technical committees collaborate in fields of mutual interest. Other international organizations, governmental and non-governmental, in liaison with ISO
19、and IEC, also take part in the work. In the field of information technology, ISO and IEC have established a joint technical committee, ISO/IEC JTC 1. International Standards are drafted in accordance with the rules given in the ISO/IEC Directives, Part 3. The main task of the joint technical committ
20、ee is to prepare International Standards. Draft International Standards adopted by the joint technical committee are circulated to national bodies for voting. Publication as an International Standard requires approval by at least 75 % of the national bodies casting a vote. Attention is drawn to the
21、possibility that some of the elements of this International Standard may be the subject of patent rights. ISO and IEC shall not be held responsible for identifying any or all such patent rights. ISO/IEC 20970 was prepared by J Consortium and was adopted, under the PAS procedure, by Joint Technical C
22、ommittee ISO/IEC JTC 1, Information technology, in parallel with its approval by national bodies of ISO and IEC. J Consortium, Inc. (“J Consortium”) has granted permission to ISO and IEC to use the trademark JEFF for products that comply with ISO/IEC 20970. Thus, implementers of ISO/IEC 20970 may us
23、e the J Consortiums JEFF trademark in connection with products that fully meet the requirements of ISO/IEC 20970. ISO/IEC 20970:2002(E) vi ISO/IEC 2002 All rights reserved0 Introduction 0.1 What is JEFF This International Standard describes the JEFF File Format. This format is designed to download a
24、nd store on a platform object oriented programs written in portable code. The distribution of applications is not the target of this specification. The goal of this International Standard is to provide a ready-for-execution format allowing programs to be executed directly from static memory, thus av
25、oiding the necessity to recopy classes into dynamic runtime memory for execution. The constraints put on the design of JEFF are the following: Any set of class files must be translatable into a single JEFF file. JEFF must be a ready-for-execution format. A virtual machine can use it efficiently, dir
26、ectly from static memory (ROM, flash memory). No copy in dynamic runtime memory or extra data modification shall be needed. All the standard behaviors and features of a virtual machine such as Java virtual machine must be reproducible using JEFF. In particular, JEFF must facilitate “symbolic linking
27、” of classes. The replacement of a class definition by another class definition having a compatible signature (same class name, same fields and same method signatures) must not require any modifications in the other class definitions. The main consequences of these choices are: A JEFF file can conta
28、in several classes from several packages. The content can be a complete application, parts of it, or only one class. To allow “symbolic linking” of classes, the references between classes must be kept at the symbolic level, even within a single JEFF file. The binary content of a JEFF file is adapted
29、 to be efficiently read by a wide range of processors (with different byte orders, alignments, etc.). JEFF is also a highly efficient format for the dynamic downloading of class definitions to dynamic memory (RAM). 0.1.1 Benefits JEFF is a file format standard, which allows storing on-platform non p
30、re-linked classes in a form that does not require any modification for efficient execution. JEFF exhibits a large range of benefits: The first of these benefits is that classes represented with JEFF can be executed directly from storage memory, without requiring any loading into runtime memory in or
31、der to be translated in a format adequate for execution. This results in a dramatic economy of runtime memory: programs with a size of several hundreds of kilobytes may then be executed with only a few kilobytes of dynamic runtime memory thanks to JEFF. The second benefit of JEFF is the saving of th
32、e processing time usually needed at the start of an execution to load into dynamic memory the stored classes. The third benefit is that JEFF does not require the classes to be pre-linked, hence fully preserving the flexibility of portable code technologies. With JEFF, programs can be updated on-plat
33、form by the mere replacement of some individual classes without requiring to replace the complete program. This provides a decisive advantage over previously proposed “ready-for-execution“ formats providing only pre-linked programs. A last benefit of JEFF is that it allows a compact storage of progr
34、ams, twice smaller than usual class file format, and this without any compression. INTERNATIONAL STANDARD ISO/IEC 20970:2002(E) ISO/IEC 2002 All rights reserved 1Information technology Programming languages, their environments and system software interfaces JEFF file format 1 Scope and normative ref
35、erences 1.1 Scope This International Standard can be used with benefits on all kinds of platform. This International Standards most immediate interest is for deploying portable applications on small footprint devices. This International Standard provides dramatic savings of dynamic memory and execut
36、ion time without sacrificing any of the flexibility usually attached to the use of non-pre-linked portable code. This International Standard is especially important to provide a complete solution to execute portable programs of which code size is bigger than the available dynamic memory. This Intern
37、ational Standard is also very important when fast reactivity of programs is important. By avoiding the extra-processing related to loading into dynamic memory and formatting classes at runtime, this International Standard provides a complete answer to the problem of class-loading slow-down. These be
38、nefits are particularly interesting for small devices supporting financial applications. Such applications are often complex and relying on code of significant size, while the pressure of the market often imposes to these devices to be of a low price and, consequently, to be very small footprint pla
39、tforms. In addition, to not impose unacceptable delays to customers, it is important these applications do not waste time in loading classes into dynamic memory when they are launched but, on the contrary, to be immediately actively processing the transaction with no delay. When using smart cards, t
40、here are also some loose real-time constraints that are better handled if it can be granted that no temporary freezing of processing can occur due to class loading. This International Standard can also be of great benefit for devices dealing with real-time applications. In this case, avoiding the de
41、lays due to class loading can play an important role to satisfy real-time constraints. 1.2 Normative references The following normative documents contain provisions which, through reference in this text, constitute provisions of this International Standard. For dated references, subsequent amendment
42、s to, or revisions of, any of these publications do not apply. However, parties to agreements based on this International Standard are encouraged to investigate the possibility of applying the most recent editions of the normative documents indicated below. For undated references, the latest edition
43、 of the normative document referred to applies. Members of ISO and IEC maintain registers of currently valid International Standards. 1 IEC 60559:1989, Binary floating-point arithmetic for microprocessor systems ISO/IEC 20970:2002(E) 2 ISO/IEC 2002 All rights reserved2 ISO/IEC 10646-1:2000, Informat
44、ion technology Universal Multiple-Octet Coded Character Set (UCS) Part 1: Architecture and Basic Multilingual Plane 3 ISO/IEC 10646-2:2001, Information technology Universal Multiple-Octet Coded Character Set (UCS) Part 2: Supplementary Planes 4 ISO/IEC 10646-1:2000/FDAM 1, Mathematical symbols and o
45、ther characters NOTE This International Standard is a self-contained specification of the JEFF format standard. However, to ease the understanding of this specification, the reading of the following document is recommended as informative reference: The Java Virtual Machine Specification, Second Edit
46、ion, by Tim Lindholm and Frank Yellin, 496 pages, Addison Wesley, April 1999, ISBN 0201432943. 1.3 Definitions For the purposes of this International Standard, the following terms and definitions apply. Class Logical entity that provides a set of related fields and methods. The class is a basic elem
47、ent for object-oriented languages. Package Set of classes bytecode A bytecode is the binary value of the encoding of a JEFF instruction. By extension, bytecode is used to designate the instruction itself. cell 4-octet word used by bytecode interpreters. byte an octet: representation of an unsigned 8
48、-bit value ISO/IEC 20970:2002(E) ISO/IEC 2002 All rights reserved 32 Data Types This chapter describes the data types used by the JEFF format specification. All the values in a JEFF file are stored on one, two, four or eight contiguous bytes. In this document, the expression “null value” is a synony
49、m for a value of zero of the appropriate type. 2.1 Basic Types The types TU1, TU2, and TU4 represent an unsigned one-, two- and four-byte integer, respectively. The types TS1, TS2, and TS4 represent a signed one-, two- and four-byte integer, respectively. 2.2 Language Types The language types are represented internally as follows: Format Types Language Types Format JBYTE byte 8-bit signed integer JSHORT short 16-bit signed integer JINT int 32-bit signed integer JLONG long 64-bit signed integ