Main Page | Namespace List | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

classfile.h File Reference


Detailed Description

Definitions for The Java Virtual Machine Specification, version 2 Chapter 4, The Class File Format.

The Class File Format, from JDK 1.5 revision of this section, entitled ClassFileFormat-final.draft.pdf, has been used to define the contents of this file. Originally, the standard and well-published JDK 1.2 revision was used, and there are a number of intermediate and semi-official documents, but this seems to be the best and most accurate.

ALL definitions that are not explicitly defined in this document, yet are either conveniently placed here due to intrinsic association with those that are in the document, or those needed for late binding into the runtime structures of this implementation, are prefixed with the string token LOCAL_ for ease of identification.

Any field of any data structure that is not documented will have its definition in the JVM specfication itself. The larger structures tend to have at least some notes, but individual fields that are fully described in the JVM spec are likely not to have redundant commentary here.

The JVM specification is available from Sun Microsystems' web site at http://java.sun.com/docs/books/vmspec/index.html and may be read online at http://java.sun.com/docs/books/vmspec/2nd-edition/html/VMSpecTOC.doc.html

The Java 5 class file format is available as a PDF file separately at http://java.sun.com/docs/books/vmspec/2nd-edition/ClassFileFormat-final-draft.pdf and was the basis for the ClassFile structure of this implementation.

Todo:
Need to verify which web document for the Java 5 class file definition is either "official", actually correct, or is the de facto standard.

Control

$URL: https://svn.apache.org/path/name/classfile.h $ $Id: classfile.h 0 09/28/2005 dlydick $

Copyright 2005 The Apache Software Foundation or its licensors, as applicable.

Licensed under the Apache License, Version 2.0 ("the License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

See the License for the specific language governing permissions and limitations under the License.

Version:
$LastChangedRevision: 0 $
Date:
$LastChangedDate: 09/28/2005 $
Author:
$LastChangedBy: dlydick $ Original code contributed by Daniel Lydick on 09/28/2005.

Reference

Definition in file classfile.h.

Go to the source code of this file.

Data Structures

struct  annotation
 The class file annotation structure definition. More...
struct  AnnotationDefault_attribute
 The AnnotationDefault Attribute. More...
struct  array_values
 The class file array_value structure definition. More...
struct  attribute_info
 Attributes of a field, method, or class. More...
struct  attribute_info_dup
 Pad attribute_info structures for proper multi-byte field address boundary alignment. More...
struct  ClassFile
 The ClassFile structure definition. More...
struct  Code_attribute
struct  CONSTANT_Class_info
struct  CONSTANT_Class_info::LOCAL_Class_binding
 Local implementation late binding extensions for CONSTANT_Class_info. More...
struct  CONSTANT_Double_info
struct  CONSTANT_Double_info::LOCAL_Double_binding
 Local implementation late binding extensions for CONSTANT_Double_info. More...
struct  CONSTANT_Fieldref_info
struct  CONSTANT_Fieldref_info::LOCAL_Fieldref_binding
 Local implementation late binding extensions for CONSTANT_Fieldref_info. More...
struct  CONSTANT_Float_info
struct  CONSTANT_Float_info::LOCAL_Float_binding
 Local implementation late binding extensions for CONSTANT_Float_info. More...
struct  CONSTANT_Integer_info
struct  CONSTANT_Integer_info::LOCAL_Integer_binding
 Local implementation late binding extensions for CONSTANT_Integer_info. More...
struct  CONSTANT_InterfaceMethodref_info
struct  CONSTANT_InterfaceMethodref_info::LOCAL_InterfaceMethodref_binding
 Local implementation late binding extensions for CONSTANT_InterfaceMethodref_info. More...
struct  CONSTANT_Long_info
struct  CONSTANT_Long_info::LOCAL_Long_binding
 Local implementation late binding extensions for CONSTANT_Long_info. More...
struct  CONSTANT_Methodref_info
struct  CONSTANT_Methodref_info::LOCAL_Methodref_binding
 Local implementation late binding extensions for CONSTANT_Methodref_info. More...
struct  CONSTANT_NameAndType_info
struct  CONSTANT_NameAndType_info::LOCAL_NameAndType_binding
 Local implementation late binding extensions for CONSTANT_NameAndType_info. More...
struct  CONSTANT_String_info
struct  CONSTANT_String_info::LOCAL_String_binding
 Local implementation late binding extensions for CONSTANT_String_info. More...
struct  CONSTANT_Utf8_info
struct  CONSTANT_Utf8_info::LOCAL_Utf8_binding
 Local implementation late binding extensions for CONSTANT_Utf8_info. More...
struct  ConstantValue_attribute
struct  cp_info
 constant_pool entry. More...
struct  cp_info_dup
 Pad cp_info structures for proper multi-byte field address boundary alignment. More...
struct  Deprecated_attribute
struct  element_value
 The class file element_value structure. More...
struct  element_value_pair
 The class file element_value_pair structure. More...
struct  EnclosingMethod_attribute
struct  enum_const_value
 The class file enum_const_value structure. More...
struct  exception_table_entry
 The class file exception_table structure, here named as exception_table_entry (to avoid naming conflicts in code versus spec requirements). More...
struct  Exceptions_attribute
struct  field_info
 Field table entry. More...
struct  field_info::LOCAL_field_binding
 Local implementation late binding extensions for fields. More...
struct  inner_class_table_entry
 The class file inner_class_table_entry structure (anonymous in spec). More...
struct  InnerClasses_attribute
struct  line_number_table_entry
 The class file line_number_table_entry structure (anonymous in spec). More...
struct  LineNumberTable_attribute
struct  local_variable_table_entry
 The class file local_variable_table_entry structure (anonymous in spec). More...
struct  local_variable_type_table_entry
 The class file local_variable_type_table_entry structure (anonymous in spec). More...
struct  LocalVariableTable_attribute
struct  LocalVariableTypeTable_attribute
struct  method_info
 Method table entry. More...
struct  method_info::LOCAL_method_binding
 Local implementation late binding extensions for methods. More...
struct  parameter_annotation
 The RuntimeVisibleParameterAnnotations Attribute. More...
struct  RuntimeInvisibleAnnotations_attribute
 The RuntimeInvisibleAnnotations Attribute. More...
struct  RuntimeInvisibleParameterAnnotations_attribute
 The RuntimeInvisibleParameterAnnotations Attribute. More...
struct  RuntimeVisibleAnnotations_attribute
struct  RuntimeVisibleParameterAnnotations_attribute
struct  Signature_attribute
struct  SourceFile_attribute
struct  Synthetic_attribute
union  values_union
 The class file values_union structure (anonymous in spec). More...

Table 4.1: Access Flags for Classes

The first definition of all such tokens is found here. Throughout the spec, many of these symbols will be redefined to be the same value. Such redefinitions are commented here in source, but are not redefined per se. There is no "grand union" definition.

For other ACC_xxx definitions, see also table 4.4, 4.5, 4.7, where more definitions are found.

#define ACC_ABSTRACT   0x0400
 Declared abstract ; may not be instantiated.
#define ACC_ANNOTATION   0x2000
 Declared as an annotation type.
#define ACC_ENUM   0x4000
 Declared as an enum type.
#define ACC_FINAL   0x0010
 Declared final;no subclasses allowed.
#define ACC_INTERFACE   0x0200
 Is an interface, not a class.
#define ACC_PUBLIC   0x0001
 Declared public; may be accessed from outside its package.
#define ACC_SUPER   0x0020
 Treat superclass methods specially when invoked by the INVOKESPECIAL instruction.
#define ACC_SYNTHETIC   0x1000
 Declared synthetic ; not present in the source code.
#define LOCAL_ACC_EMPTY   0x0000
 Not defined, empty (not in spec).

Section 4.7: Methods

Table 4.5: Access Flags for methods (New comments, plus new definitions)

typedef struct method_info: See forward references above definition of ClassFile

Defined first in section 4.7 (Methods), possibly later also.

For other ACC_xxx definitions, see also table 4.1, 4.4, 4.7.

#define ACC_BRIDGE   0x0040
 A bridge method, generated by the compiler.
#define ACC_NATIVE   0x0100
 Declared native ; implemented in a language other than Java.
#define ACC_STRICT   0x0800
 Declared strictfp ; floating-point mode is FP-strict.
#define ACC_SYNCHRONIZED   0x0010
 Declared synchronized ; invokation is wrapped in a monitor lock.
#define ACC_VARARGS   0x0080
 Declared with variable number of arguments.

Section 4.6: Fields

Table 4.4: Access Flags for Fields (New comments, plus new definitions)

typedef struct field_info: See forward references above definition of ClassFile.

Defined first in section 4.6 (Fields), possibly later also.

For other ACC_xxx definitions, see also table 4.1, 4.5, 4.7.

#define ACC_PRIVATE   0x0002
 Declared private ; usable only within the defining class.
#define ACC_PROTECTED   0x0004
 Declared protected ; may be accessed within subclasses.
#define ACC_STATIC   0x0008
 Declared static .
#define ACC_TRANSIENT   0x0080
 Declared transient ; not written or read by a persistent object manager.
#define ACC_VOLATILE   0x0040
 Declared volatile ; cannot be cached.

Byte aligned structure entries.

Frame cp_info and attribute_info entries for correct byte alignment on real machine architectures that require it.

The following structure is used for aligning (cp_info) data on 4-byte addresses with the exception of the one-byte tag field. The next one aligns (attribute_info) similarly. Doing this suppresses problem w/ C/C++ compilers where certain architectures yield a SIGSEGV on odd-aligned 16-bit integer accesses or non-4-byte aligned 32-bit integer accesses. For 16-bit accesses, such operations as,

       short x, *p; // (short)
       ...
       p = some_value();
       ...
       x = *p;
  
   and for 32-bit accesses,
  
       int x, *p; // (int), etc.
       ...
       p = some_value();
       ...
       x = *p;
  
   

both produce a SIGSEGV when p is not aligned on an 2- or 4-byte address, respectively.

By introducing the command line option to force structure packing, this situation can occur (e.g.: GCC -fpack-struct option, which suppresses 4-byte structure alignment). Unfortunately, this option is needed in order to properly size the structures in this header file. Yet, some standard library calls fail when compiled like this (like fprintf(3) ), so choose judiciously.

#define ATTRIBUTE_INFO_NUM_EMPTIES   2
 Size of padding for attribute_info structures insize of attribute_info_dup structure.
#define CP_INFO_NUM_EMPTIES   3
 Size of padding for cp_info structures insize of cp_info_dup structure.

Section 4.4.2: Field Descriptors

Table 4.2: BaseType Character Definitions

#define BASETYPE_CHAR_ARRAY   '['
 Reference to one array dimension.
#define BASETYPE_CHAR_B   'B'
 Signed byte.
#define BASETYPE_CHAR_C   'C'
 Unicode character.
#define BASETYPE_CHAR_D   'D'
 Double-precision floating-point value.
#define BASETYPE_CHAR_F   'F'
 Single-precision floating-point value.
#define BASETYPE_CHAR_I   'I'
 Integer.
#define BASETYPE_CHAR_J   'J'
 Long integer.
#define BASETYPE_CHAR_L   'L'
 an instance of class '/class/name'
#define BASETYPE_CHAR_L_TERM   ';'
 terminator for instance of class
#define BASETYPE_CHAR_S   'S'
 Signed short.
#define BASETYPE_CHAR_Z   'Z'
 Boolean, true or false.
#define BASETYPE_STRING_ARRAY   "["
 null-terminated string form of BASETYPE_CHAR_ARRAY
#define BASETYPE_STRING_L   "L"
 null-terminated string form of BASETYPE_CHAR_L
#define BASETYPE_STRING_L_TERM   ";"
 null-terminated string form of BASETYPE_CHAR_L_TERM
#define LOCAL_BASETYPE_ERROR   '?'
 Invalid basetype due to malformed tag or other error (not in spec).

Table 4.8: Additional tag values for annotation attributes

#define BASETYPE_CHAR_AT   '@'
 Annotation type.
#define BASETYPE_CHAR_c   'c'
 Class.
#define BASETYPE_CHAR_e   'e'
 enum constant
#define BASETYPE_CHAR_s   's'
 String.
#define BASETYPE_STRING_CHAR_ARRAY   "[C"
 java.lang.String (jchar)[] value field

Section 4.4.4: Signatures

#define BASETYPE_CHAR_T   'T'
 a type variable signature

JVM spec Section 4.2: The ClassFile structure.

The following structure definition is NOT MEANT TO BE AN EXACT REPRESENTATION OF THE DATA STRUCTURES SHOWN IN THE JAVA CLASS FILE SPECIFICATION! That document contains numerous pseudo-code representations of data structures. Instead, this definition is designed to be an actual real machine implementation of that specification.

Each of the variable-length structures from the spec are stored as arrays of pointers to those structures, which are located in heap allocated memory areas and their length, being always defined in the spec as preceding the variable-length area, tells how many elements are found in each array. For example, ClassFile.constant_pool_count and ClassFile.constant_pool. Each element may, of course, be of variable size according to its actual contents, and this will be reflected by the size of each heap allocation.

Furthermore, any variable or data type marked LOCAL_ in this structure and its subsidiary components is a local implementation extension that is no found in the specification, but is used by the JVM runtime environment to facilitate processing, expecially to expedite class linkages. For example, CONSTANT_Class_info and CONSTANT_Class_info.LOCAL_Class_binding.

#define CLASSFILE_MAGIC   0xCAFEBABE
 Magic number for class files.

Section 4.3: The Internal Form of Fully Qualified Class and Interface Names

#define CLASSNAME_EXTERNAL_DELIMITER_CHAR   '.'
#define CLASSNAME_EXTERNAL_DELIMITER_STRING   "."
#define CLASSNAME_INTERNAL_DELIMITER_CHAR   '/'
#define CLASSNAME_INTERNAL_DELIMITER_STRING   "/"

Section 4.8.3: The Code Attribute

#define CODE_ATTRIBUTE_MAX_LOCALS_BOUNDARY_LONGDOUBLE   2
#define CODE_ATTRIBUTE_MAX_LOCALS_BOUNDARY_OTHERS   1
#define CONSTANT_UTF8_CODE_ATTRIBUTE   "Code"
#define LOCAL_CODE_ATTRIBUTE_ENUM   2
 Not in spec.

Section 4.10.1: Static Constraints

#define CODE_CONSTRAINT_CODE_LENGTH_MAX   65535
#define CODE_CONSTRAINT_CODE_LENGTH_MIN   1
 Array size bounds,bytes.
#define CODE_CONSTRAINT_OP_ANEWARRAY_MAX_DIMS   CONSTANT_MAX_ARRAY_DIMS
#define CODE_CONSTRAINT_OP_INVOKEINTERFACE_PARM4   0
#define CODE_CONSTRAINT_OP_NEWARRAY_TYPE_T_BOOLEAN   4
#define CODE_CONSTRAINT_OP_NEWARRAY_TYPE_T_BYTE   8
#define CODE_CONSTRAINT_OP_NEWARRAY_TYPE_T_CHAR   5
#define CODE_CONSTRAINT_OP_NEWARRAY_TYPE_T_DOUBLE   7
#define CODE_CONSTRAINT_OP_NEWARRAY_TYPE_T_FLOAT   6
#define CODE_CONSTRAINT_OP_NEWARRAY_TYPE_T_INT   10
#define CODE_CONSTRAINT_OP_NEWARRAY_TYPE_T_LONG   11
#define CODE_CONSTRAINT_OP_NEWARRAY_TYPE_T_SHORT   9
#define CODE_CONSTRAINT_START_PC   0
 Start PC location.
#define LOCAL_CONSTANT_UTF8_CLASS_CONSTRUCTOR   "<clinit>"
 Not in spec,but implied.
#define LOCAL_CONSTANT_UTF8_CLASS_CONSTRUCTOR_PARMS   "()V"

Section 4.8.4: The Exceptions Attribute

#define CODE_DEFAULT_CATCH_TYPE   0
 This handler is for all exceptions.
#define CONSTANT_UTF8_EXCEPTIONS_ATTRIBUTE   "Exceptions"
#define LOCAL_EXCEPTIONS_ATTRIBUTE_ENUM   3
 Not in spec.

Table 4.3: ConstantType Definitions

#define CONSTANT_Class   7
#define CONSTANT_Double   6
#define CONSTANT_Fieldref   9
#define CONSTANT_Float   4
#define CONSTANT_Integer   3
#define CONSTANT_InterfaceMethodref   11
#define CONSTANT_Long   5
#define CONSTANT_Methodref   10
#define CONSTANT_NameAndType   12
#define CONSTANT_String   8
#define CONSTANT_Utf8   1

Section 4.5: The Constant Pool

typedef struct cp_info: See fwd refs above typedef ClassFile

See also table 4.3: ConstantType Definitions

#define CONSTANT_CP_DEFAULT_INDEX   0
 References java.lang.Object.
#define CONSTANT_CP_START_INDEX   1
 Ref first constant item.

Section 4.5.1: The CONSTANT_Class_info structure

#define CONSTANT_MAX_ARRAY_DIMS   255
 Highest number of array dimensions.
#define LOCAL_CONSTANT_NO_ARRAY_DIMS   0
 Not stated in spec, but implied.
#define CONSTANT_UTF8_ANNOTATIONDEFAULT_ATTRIBUTE   "AnnotationDefault"
#define LOCAL_ANNOTATIONDEFAULT_ATTRIBUTE_ENUM   17
 Not in spec.

Section 4.8.2: The ConstantValue Attribute

See also table 4.6: Valid ConstantValue Field Types

#define CONSTANT_UTF8_CONSTANTVALUE_ATTRIBUTE   "ConstantValue"
#define CONSTANTVALUE_ATTRIBUTE_LENGTH   2
#define LOCAL_CONSTANTVALUE_ATTRIBUTE_ENUM   1
 Not in spec.

Section 4.8.13: The Deprecated Attribute

#define CONSTANT_UTF8_DEPRECATED_ATTRIBUTE   "Deprecated"
#define DEPRECATED_ATTRIBUTE_LENGTH   0
#define LOCAL_DEPRECATED_ATTRIBUTE_ENUM   12
 Not in spec.

Section 4.8.6: The EnclosingMethod Attribute

#define CONSTANT_UTF8_ENCLOSINGMETHOD_ATTRIBUTE   "EnclosingMethod"
#define ENCLOSINGMETHOD_ATTRIBUTE_LENGTH   4
#define LOCAL_ENCLOSINGMETHOD_ATTRIBUTE_ENUM   5
 Not in spec.

Section 4.8.5: The InnerClasses Attribute

For other ACC_xxx definitions, see also table 4.1, 4.4, 4.5.

#define CONSTANT_UTF8_INNERCLASSES_ATTRIBUTE   "InnerClasses"
#define LOCAL_INNERCLASSES_ATTRIBUTE_ENUM   4
 Not in spec.

Section 4.5.6: The CONSTANT_NameAndType_info structure

#define CONSTANT_UTF8_INSTANCE_CONSTRUCTOR   "<init>"
#define CONSTANT_UTF8_INSTANCE_CONSTRUCTOR_DESCRIPTOR_DEFAULT   "()V"
 (Not in this section of spec, but very relevant)

Section 4.8.10: The LineNumberTable Attribute

#define CONSTANT_UTF8_LINENUMBERTABLE_ATTRIBUTE   "LineNumberTable"
#define LOCAL_LINENUMBERTABLE_ATTRIBUTE_ENUM   9
 Not in spec.

Section 4.8.11: The LocalVariableTable Attribute

#define CONSTANT_UTF8_LOCALVARIABLETABLE_ATTRIBUTE   "LocalVariableTable"
#define LOCAL_LOCALVARIABLETABLE_ATTRIBUTE_ENUM   10
 Not in spec.

Section 4.8.12: The LocalVariableTypeTable Attribute

#define CONSTANT_UTF8_LOCALVARIABLETYPETABLE_ATTRIBUTE   "LocalVariableTypeTable"
#define LOCAL_LOCALVARIABLETYPETABLE_ATTRIBUTE_ENUM   11
 Not in spec.
#define CONSTANT_UTF8_RUNTIMEINVISIBLEANNOTATIONS_ATTRIBUTE   "RuntimeInvisibleAnnotations"
#define LOCAL_RUNTIMEINVISIBLEANNOTATIONS_ATTRIBUTE_ENUM   14
 Not in spec.
#define CONSTANT_UTF8_RUNTIMEINVISIBLEPARAMETERANNOTATIONS_ATTRIBUTE   "RuntimeInvisibleParameterAnnotations"
#define LOCAL_RUNTIMEINVISIBLEPARAMETERANNOTATIONS_ATTRIBUTE_ENUM   16
 Not in spec.

Section 4.8.14: The RuntimeVisibleAnnotations Attribute

Xtodo When implementing RuntimeXxxAnnotations attributes, MAKE SURE to understand the implications of ARCH_ODD2_ADDRESS_SIGSEGV and ARCH_ODD4_ADDRESS_SIGSEGV upon 2- and 4-byte integer storage accesses, respectively.

#define CONSTANT_UTF8_RUNTIMEVISIBLEANNOTATIONS_ATTRIBUTE   "RuntimeVisibleAnnotations"
#define ELEMENT_VALUE(var)   (*(values_union *) &(&var)->_value)
#define LOCAL_RUNTIMEVISIBLEANNOTATIONS_ATTRIBUTE_ENUM   13
 Not in spec.
#define PTR_ELEMENT_VALUE(ptr)   ( (values_union *) &(ptr)->_value)
#define CONSTANT_UTF8_RUNTIMEVISIBLEPARAMETERANNOTATIONS_ATTRIBUTE   "RuntimeVisibleParameterAnnotations"
#define LOCAL_RUNTIMEVISIBLEPARAMETERANNOTATIONS_ATTRIBUTE_ENUM   15
 Not in spec.

Section 4.8.8: The Signature Attribute

#define CONSTANT_UTF8_SIGNATURE_ATTRIBUTE   "Signature"
#define LOCAL_SIGNATURE_ATTRIBUTE_ENUM   6
 Not in spec.
#define SIGNATURE_ATTRIBUTE_LENGTH   2

Section 4.8.9: The SourceFile Attribute

#define CONSTANT_UTF8_SOURCEFILE_ATTRIBUTE   "SourceFile"
#define LOCAL_SOURCEFILE_ATTRIBUTE_ENUM   8
 Not in spec.
#define SOURCEFILE_ATTRIBUTE_LENGTH   2

Section 4.8.7: The Synthetic Attribute

#define CONSTANT_UTF8_SYNTHETIC_ATTRIBUTE   "Synthetic"
#define LOCAL_SYNTHETIC_ATTRIBUTE_ENUM   7
 Not in spec.
#define SYNTHETIC_ATTRIBUTE_LENGTH   0

Section 4.5.5: The CONSTANT_Long_info and

CONSTANT_Double_info structures

#define DOUBLE_IS_NAN(dfpval)
#define DOUBLE_NEGATIVE_INFINITY   0xfff0000000000000L
#define DOUBLE_POSITIVE_INFINITY   0x7ff0000000000000L
#define DPFTYPE_INT   unsigned int
 32-bit value
#define DPFTYPE_LONG   unsigned long long
 64-bit value

Section 4.5.4: The CONSTANT_Integer_info and

CONSTANT_Float_info structures

#define FLOAT_IS_NAN(sfpval)
#define FLOAT_NEGATIVE_INFINITY   0xff800000
#define FLOAT_POSITIVE_INFINITY   0x7f800000
#define SPFTYPE_INT   unsigned int
 32-bit value

Section 4.4: Descriptors-- Section 4.4.1: Grammar Notation

#define GRAMMAR_PARM_CLOSE   ')'
 Open parenthesis for starting a param defn.
#define GRAMMAR_PARM_OPEN   '('
 Open parenthesis for starting a param defn.

Section 4.8.1: Defining and Naming new Attributes

typedef struct attribute_info: See forward references above definition of ClassFile

#define LOCAL_CONSTANT_UTF8_UNKNOWN_ATTRIBUTE   "Unknown"
 Not in spec.
#define LOCAL_UNKNOWN_ATTRIBUTE_ENUM   0
 Not in spec.

Section 4.4.3: Method Descriptors

#define METHOD_CHAR_CLOSE_PARM   ')'
 Open parameter list.
#define METHOD_CHAR_OPEN_PARM   '('
 Open parameter list.
#define METHOD_CHAR_VOID   'V'
 No return type, instead: (rvoid) fn(p1,p2,.
#define METHOD_PARM_MAX   255
 Max length of method descriptor string.
#define METHOD_STRING_CLOSE_PARM   ")"
 null-terminated string form of METHOD_CHAR_OPEN_PARM
#define METHOD_STRING_OPEN_PARM   "("
 null-terminated string form of METHOD_CHAR_OPEN_PARM
#define METHOD_STRING_VOID   "V"
 null-terminated string form of METHOD_CHAR_VOID

Section 4.5.2: The CONSTANT_Fieldref_info, CONSTANT_Methodref_info, and CONSTANT_InterfaceMethodref_info structures

#define METHOD_CHAR_INIT   '<'
 Special character for naming of an object constructor method name, that is, the <init> method, and the class constructor method name, that is, the <clinit> method.

Section 4.5.7: Support for the CONSTANT_Utf8_info structure

  • SINGLE-BYTE UTF-8 FORMAT: Range of 7-bit ASCII (ANSI alphabet 5), but without the NUL character 0x00

  • DOUBLE-BYTE UTF-8 FORMAT: Range of 8th bit on ASCII (plus 7-bit ASCII NUL character: '\u0000', namely '\u0080' through '\u00ff', then extending on up 3 more bits, thus adding '\u100' through '\u07ff'.

  • TRIPLE-BYTE UTF-8 FORMAT:: Character ranges '\u0800' through '\uFFFF'

  • HEXTUPLE-BYTE UTF-16 FORMAT: There is a typographical error in spec section 4.5.7 describing describing 21-bit character encoding. Therefore, this format has not been implemented pending proper resolution. It probably is correct to assume that the spurious "-1" in the second byte of the first triple should say "(bits 20-16)" instead of "(bits 20-16)-1". This needs to be researched and implemented for full spec compliance.

  • OTHER UTFx FORMATS: The JVM does not (yet) recognized these.

Todo:
: Clarify the hextuple-byte UTF-16 encoding requirements, per above commentary.


#define UNICODE_DOUBLE_MAX   0x07ff
 '\u07ff', Unicode representation
#define UNICODE_DOUBLE_MIN   0x0080
 '\u0080', Unicode representation
#define UNICODE_DOUBLE_NUL   0x0000
 '\u0000', Unicode representation
#define UNICODE_SINGLE_MAX   0x007f
 '\u007f', Unicode representation
#define UNICODE_SINGLE_MIN   0x0001
 '\u0001', Unicode representation
#define UNICODE_TRIPLE_MAX   0xffff
 '\uffff', Unicode representation
#define UNICODE_TRIPLE_MIN   0x0800
 '\u0800', Unicode representation
#define UTF8_DOUBLE_FIRST_MASK0   0x1f
 Bottom 5 bits contain data bits 10-6.
#define UTF8_DOUBLE_FIRST_MASK1   0xe0
 Top 3 bits of first byte.
#define UTF8_DOUBLE_FIRST_SHIFT   6
 Move first byte up to bits 10-6.
#define UTF8_DOUBLE_FIRST_VAL   0xc0
 Top 3 bits are '110'.
#define UTF8_DOUBLE_MAX   0x07ff
 '\u07ff', UTF-8 representation
#define UTF8_DOUBLE_MIN   0x0080
 '\u0080', UTF-8 representation
#define UTF8_DOUBLE_NUL   0x0000
 '\u0000', UTF-8 representation
#define UTF8_DOUBLE_SECOND_MASK0   0x3f
 Bottom 6 bits contain data bits 0-5.
#define UTF8_DOUBLE_SECOND_MASK1   0xc0
 Top 2 bits of second byte.
#define UTF8_DOUBLE_SECOND_VAL   0x80
 Top 2 bits are '10'.
#define UTF8_SINGLE_MASK0   0x7f
 Bits 0-6 contain data (except != 0, or NUL).
#define UTF8_SINGLE_MASK1   0x80
 Bit 7 must be clear.
#define UTF8_SINGLE_MAX   0x7f
 '\u007f', UTF-8 representation
#define UTF8_SINGLE_MIN   0x01
 '\u0001', UTF-8 representation
#define UTF8_TRIPLE_FIRST_MASK0   0x0f
#define UTF8_TRIPLE_FIRST_MASK1   0xf0
#define UTF8_TRIPLE_FIRST_SHIFT   12
#define UTF8_TRIPLE_FIRST_VAL   0xe0
#define UTF8_TRIPLE_MAX   0xffff
 '\uffff', UTF-8 representation
#define UTF8_TRIPLE_MIN   0x0800
 '\u0800', UTF-8 representation
#define UTF8_TRIPLE_SECOND_MASK0   0x3f
#define UTF8_TRIPLE_SECOND_MASK1   0xc0
#define UTF8_TRIPLE_SECOND_SHIFT   6
#define UTF8_TRIPLE_SECOND_VAL   0x80
#define UTF8_TRIPLE_THIRD_MASK0   0x3f
#define UTF8_TRIPLE_THIRD_MASK1   0xc0
#define UTF8_TRIPLE_THIRD_VAL   0x80

Forbidden UTF values.

No byte in bytes[] may contain these values because they present certain parsing problems in the Java subset of UTF-8.

#define UTF8_FORBIDDEN_MAX   0xff
 Max of forbidden range.
#define UTF8_FORBIDDEN_MIN   0xf0
 Min of range for 4-byte UTF values,etc.
#define UTF8_FORBIDDEN_ZERO   0x00
 Looks suspiciously like ASCII NUL.

Define range of supported class file versions

#define VERSION_MAJOR_HIGH   VERSION_MAJOR_JDK5
#define VERSION_MAJOR_LOW   VERSION_MAJOR_JDK1
#define VERSION_MINOR_HIGH   0
#define VERSION_MINOR_LOW   0

List of all class file versions

#define VERSION_MAJOR_JDK1   45
#define VERSION_MAJOR_JDK2   46
#define VERSION_MAJOR_JDK3   47
#define VERSION_MAJOR_JDK4   48
#define VERSION_MAJOR_JDK5   49

Defines

#define CONSTANT_UTF8_JAVA_LANG_OBJECT   "java/lang/Object"
 Root Java language object name.
#define VERSION_MINOR_DEFAULT   0
 Default minor version number for primative pseudo-classes.

Enumerations

enum  classfile_attribute_enum {
  LOCAL_UNKNOWN_ATTRIBUTE, LOCAL_CONSTANTVALUE_ATTRIBUTE, LOCAL_CODE_ATTRIBUTE, LOCAL_EXCEPTIONS_ATTRIBUTE,
  LOCAL_INNERCLASSES_ATTRIBUTE, LOCAL_ENCLOSINGMETHOD_ATTRIBUTE, LOCAL_SYNTHETIC_ATTRIBUTE, LOCAL_SIGNATURE_ATTRIBUTE,
  LOCAL_SOURCEFILE_ATTRIBUTE, LOCAL_LINENUMBERTABLE_ATTRIBUTE, LOCAL_LOCALVARIABLETABLE_ATTRIBUTE, LOCAL_LOCALVARIABLETYPETABLE_ATTRIBUTE,
  LOCAL_DEPRECATED_ATTRIBUTE, LOCAL_RUNTIMEVISIBLEANNOTATIONS_ATTRIBUTE, LOCAL_RUNTIMEINVISIBLEANNOTATIONS_ATTRIBUTE, LOCAL_RUNTIMEVISIBLEPARAMETERANNOTATIONS_ATTRIBUTE,
  LOCAL_RUNTIMEINVISIBLEPARAMETERANNOTATIONS_ATTRIBUTE, LOCAL_ANNOTATIONDEFAULT_ATTRIBUTE
}
 Section 4.10.2: Structural Constraints Section 4.11: Verification of class Files Section 4.11.1: Verification by Type Inference Section 4.11.1.1: The Process of Verification by Type InferenceSection 4.11.1.2: The Bytecode VerifierSection 4.11.1.3: Values of Types long and doubleSection 4.11.1.4: Instance Initialization Methods and Newly Created ObjectsSection 4.11.1.5: Exception HandlersSection 4.9.6: Exceptions and finally -- Removed from this JVM 1.5 edition, possibly from 1.4.Section 4.12: Limitations of the Java Virtual MachineAttribute enumeration. More...

Functions

 ARCH_COPYRIGHT_APACHE (classfile, h,"$URL: https://svn.apache.org/path/name/classfile.h $ $Id: classfile.h 0 09/28/2005 dlydick $")
classfile_attribute_enum cfattrib_atr2enum (ClassFile *pcfs, u2 attribute_attribute_name_index)
 Map UTF8 string names for attributes in a constant_pool to LOCAL_xxx_ATTRIBUTE constants for the purpose of switch(int) instead of switch("string") code constructions.
rboolean cfattrib_iscodeattribute (ClassFile *pcfs, u2 attribute_attribute_name_index)
 Short version of cfattrib_atr2enum(), but only check if an index refers to a Code_attribute area.
u1cfattrib_loadattribute (ClassFile *pcfs, attribute_info_dup **dst, attribute_info *src)
 Load an attribute and verify that it has either valid contents or is ignored as an unknown attribute.
rvoid cfattrib_unloadattribute (ClassFile *pcfs, attribute_info_dup *dst)
 UnLoad an attribute and free its heap area.
rvoid cfmsgs_atrmsg (rchar *fn, ClassFile *pcfs, attribute_info_dup *atr)
 Display details of what an attribute entry contains.
rvoid cfmsgs_show_constant_pool (ClassFile *pcfs)
 Show all entries in the constant pool.
rvoid cfmsgs_typemsg (rchar *fn, ClassFile *pcfs, u2 idx)
ClassFileclassfile_allocate_primative (jvm_basetype basetype)
 Build up empty JVM class file structure for use by Java primative data types.
ClassFileclassfile_loadclassdata (u1 *classfile_image)
 Parse an in-memory JVM class file, create structures to point to various parts of it, per JVM spec pseuco-code structures.
u1classfile_readclassfile (rchar *filename)
 Read a JVM class file.
u1classfile_readjarfile (rchar *filename)
 Read an entire JAR file into temporary disk area and load up one class file from it.
rvoid classfile_unloadclassdata (ClassFile *pcfs)
 Release all heap allocated to a fully loaded ClassFile structure.


Define Documentation

#define CP_INFO_NUM_EMPTIES   3
 

Size of padding for cp_info structures insize of cp_info_dup structure.

Definition at line 169 of file classfile.h.

Referenced by classfile_loadclassdata().

#define ATTRIBUTE_INFO_NUM_EMPTIES   2
 

Size of padding for attribute_info structures insize of attribute_info_dup structure.

Definition at line 192 of file classfile.h.

#define CLASSFILE_MAGIC   0xCAFEBABE
 

Magic number for class files.

Definition at line 535 of file classfile.h.

Referenced by classfile_allocate_primative(), and classfile_loadclassdata().

#define VERSION_MAJOR_JDK1   45
 

Definition at line 547 of file classfile.h.

#define VERSION_MAJOR_JDK2   46
 

Definition at line 548 of file classfile.h.

Referenced by classfile_allocate_primative().

#define VERSION_MAJOR_JDK3   47
 

Definition at line 549 of file classfile.h.

#define VERSION_MAJOR_JDK4   48
 

Definition at line 550 of file classfile.h.

#define VERSION_MAJOR_JDK5   49
 

Definition at line 551 of file classfile.h.

#define VERSION_MINOR_DEFAULT   0
 

Default minor version number for primative pseudo-classes.

Definition at line 559 of file classfile.h.

Referenced by classfile_allocate_primative().

#define VERSION_MAJOR_LOW   VERSION_MAJOR_JDK1
 

Definition at line 568 of file classfile.h.

Referenced by classfile_loadclassdata().

#define VERSION_MINOR_LOW   0
 

Definition at line 569 of file classfile.h.

#define VERSION_MAJOR_HIGH   VERSION_MAJOR_JDK5
 

Definition at line 570 of file classfile.h.

Referenced by classfile_loadclassdata().

#define VERSION_MINOR_HIGH   0
 

Definition at line 571 of file classfile.h.

Referenced by classfile_loadclassdata().

#define LOCAL_ACC_EMPTY   0x0000
 

Not defined, empty (not in spec).

Definition at line 594 of file classfile.h.

Referenced by object_new_setup().

#define ACC_PUBLIC   0x0001
 

Declared public; may be accessed from outside its package.

Definition at line 596 of file classfile.h.

Referenced by classfile_loadclassdata().

#define ACC_FINAL   0x0010
 

Declared final;no subclasses allowed.

Definition at line 599 of file classfile.h.

Referenced by classfile_loadclassdata().

#define ACC_SUPER   0x0020
 

Treat superclass methods specially when invoked by the INVOKESPECIAL instruction.

Definition at line 602 of file classfile.h.

Referenced by classfile_loadclassdata().

#define ACC_INTERFACE   0x0200
 

Is an interface, not a class.

Definition at line 606 of file classfile.h.

Referenced by classfile_loadclassdata(), and thread_new().

#define ACC_ABSTRACT   0x0400
 

Declared abstract ; may not be instantiated.

Definition at line 608 of file classfile.h.

Referenced by classfile_loadclassdata().

#define ACC_SYNTHETIC   0x1000
 

Declared synthetic ; not present in the source code.

Definition at line 611 of file classfile.h.

Referenced by classfile_allocate_primative(), and classfile_loadclassdata().

#define ACC_ANNOTATION   0x2000
 

Declared as an annotation type.

Definition at line 614 of file classfile.h.

Referenced by classfile_loadclassdata().

#define ACC_ENUM   0x4000
 

Declared as an enum type.

Definition at line 616 of file classfile.h.

Referenced by classfile_loadclassdata().

#define CONSTANT_UTF8_JAVA_LANG_OBJECT   "java/lang/Object"
 

Root Java language object name.

Definition at line 626 of file classfile.h.

#define CLASSNAME_EXTERNAL_DELIMITER_CHAR   '.'
 

Definition at line 636 of file classfile.h.

Referenced by classpath_external2internal_classname_inplace(), and jvmutil_print_stack_common().

#define CLASSNAME_EXTERNAL_DELIMITER_STRING   "."
 

Definition at line 637 of file classfile.h.

#define CLASSNAME_INTERNAL_DELIMITER_CHAR   '/'
 

Definition at line 639 of file classfile.h.

Referenced by classpath_external2internal_classname_inplace().

#define CLASSNAME_INTERNAL_DELIMITER_STRING   "/"
 

Definition at line 640 of file classfile.h.

#define GRAMMAR_PARM_OPEN   '('
 

Open parenthesis for starting a param defn.

Definition at line 652 of file classfile.h.

#define GRAMMAR_PARM_CLOSE   ')'
 

Open parenthesis for starting a param defn.

Definition at line 654 of file classfile.h.

#define BASETYPE_CHAR_B   'B'
 

Signed byte.

Definition at line 669 of file classfile.h.

Referenced by method_return_type(), and nts_prchar_isprimativeformatted().

#define BASETYPE_CHAR_C   'C'
 

Unicode character.

Definition at line 670 of file classfile.h.

Referenced by method_return_type(), and nts_prchar_isprimativeformatted().

#define BASETYPE_CHAR_D   'D'
 

Double-precision floating-point value.

Definition at line 671 of file classfile.h.

Referenced by method_return_type(), and nts_prchar_isprimativeformatted().

#define BASETYPE_CHAR_F   'F'
 

Single-precision floating-point value.

Definition at line 673 of file classfile.h.

Referenced by method_return_type(), and nts_prchar_isprimativeformatted().

#define BASETYPE_CHAR_I   'I'
 

Integer.

Definition at line 675 of file classfile.h.

Referenced by method_return_type(), and nts_prchar_isprimativeformatted().

#define BASETYPE_CHAR_J   'J'
 

Long integer.

Definition at line 676 of file classfile.h.

Referenced by method_return_type(), and nts_prchar_isprimativeformatted().

#define BASETYPE_CHAR_L   'L'
 

an instance of class '/class/name'

For internal use only.

L/class/name; includes _CHAR_ and _STRING_ forms

Definition at line 684 of file classfile.h.

Referenced by method_return_type(), and nts_prchar2utf_classname().

#define BASETYPE_STRING_L   "L"
 

null-terminated string form of BASETYPE_CHAR_L

Definition at line 685 of file classfile.h.

#define BASETYPE_CHAR_L_TERM   ';'
 

terminator for instance of class

Definition at line 688 of file classfile.h.

Referenced by nts_prchar2prchar_unformatted_classname(), nts_prchar2utf_classname(), utf_pcfs_strcmp(), and utf_utf_isclassformatted().

#define BASETYPE_STRING_L_TERM   ";"
 

null-terminated string form of BASETYPE_CHAR_L_TERM

Definition at line 690 of file classfile.h.

#define BASETYPE_CHAR_S   'S'
 

Signed short.

Definition at line 695 of file classfile.h.

Referenced by method_return_type(), and nts_prchar_isprimativeformatted().

#define BASETYPE_CHAR_Z   'Z'
 

Boolean, true or false.

Definition at line 696 of file classfile.h.

Referenced by method_return_type(), and nts_prchar_isprimativeformatted().

#define BASETYPE_CHAR_ARRAY   '['
 

Reference to one array dimension.

Definition at line 698 of file classfile.h.

Referenced by method_return_type(), nts_prchar2utf_classname(), and utf_classname_strcmp().

#define BASETYPE_STRING_ARRAY   "["
 

null-terminated string form of BASETYPE_CHAR_ARRAY

Definition at line 700 of file classfile.h.

#define LOCAL_BASETYPE_ERROR   '?'
 

Invalid basetype due to malformed tag or other error (not in spec).

Definition at line 703 of file classfile.h.

Referenced by classfile_loadclassdata(), linkage_resolve_class(), method_return_type(), and object_new_setup().

#define METHOD_CHAR_VOID   'V'
 

No return type, instead: (rvoid) fn(p1,p2,.

..)

Definition at line 716 of file classfile.h.

Referenced by method_return_type().

#define METHOD_STRING_VOID   "V"
 

null-terminated string form of METHOD_CHAR_VOID

Definition at line 718 of file classfile.h.

#define METHOD_PARM_MAX   255
 

Max length of method descriptor string.

Definition at line 721 of file classfile.h.

#define METHOD_CHAR_OPEN_PARM   '('
 

Open parameter list.

Definition at line 724 of file classfile.h.

#define METHOD_STRING_OPEN_PARM   "("
 

null-terminated string form of METHOD_CHAR_OPEN_PARM

Definition at line 725 of file classfile.h.

#define METHOD_CHAR_CLOSE_PARM   ')'
 

Open parameter list.

Definition at line 728 of file classfile.h.

Referenced by method_return_type().

#define METHOD_STRING_CLOSE_PARM   ")"
 

null-terminated string form of METHOD_CHAR_OPEN_PARM

Definition at line 729 of file classfile.h.

#define BASETYPE_CHAR_T   'T'
 

a type variable signature

Definition at line 742 of file classfile.h.

#define CONSTANT_CP_DEFAULT_INDEX   0
 

References java.lang.Object.

Definition at line 758 of file classfile.h.

Referenced by cfmsgs_typemsg(), classfile_loadclassdata(), jvmutil_print_stack_common(), and thread_new().

#define CONSTANT_CP_START_INDEX   1
 

Ref first constant item.

Definition at line 760 of file classfile.h.

Referenced by classfile_loadclassdata(), and linkage_resolve_class().

#define CONSTANT_Class   7
 

Definition at line 771 of file classfile.h.

Referenced by cfmsgs_typemsg(), classfile_allocate_primative(), classfile_loadclassdata(), linkage_resolve_class(), and opcode_run().

#define CONSTANT_Fieldref   9
 

Definition at line 772 of file classfile.h.

Referenced by cfmsgs_typemsg(), classfile_loadclassdata(), linkage_resolve_class(), and opcode_run().

#define CONSTANT_Methodref   10
 

Definition at line 773 of file classfile.h.

Referenced by cfmsgs_typemsg(), classfile_loadclassdata(), linkage_resolve_class(), and opcode_run().

#define CONSTANT_InterfaceMethodref   11
 

Definition at line 774 of file classfile.h.

Referenced by cfmsgs_typemsg(), classfile_loadclassdata(), and linkage_resolve_class().

#define CONSTANT_String   8
 

Definition at line 775 of file classfile.h.

Referenced by cfmsgs_typemsg(), classfile_loadclassdata(), and linkage_resolve_class().

#define CONSTANT_Integer   3
 

Definition at line 776 of file classfile.h.

Referenced by cfmsgs_typemsg(), classfile_loadclassdata(), and linkage_resolve_class().

#define CONSTANT_Float   4
 

Definition at line 777 of file classfile.h.

Referenced by cfmsgs_typemsg(), classfile_loadclassdata(), and linkage_resolve_class().

#define CONSTANT_Long   5
 

Definition at line 778 of file classfile.h.

Referenced by cfmsgs_typemsg(), classfile_loadclassdata(), and linkage_resolve_class().

#define CONSTANT_Double   6
 

Definition at line 779 of file classfile.h.

Referenced by cfmsgs_typemsg(), classfile_loadclassdata(), and linkage_resolve_class().

#define CONSTANT_NameAndType   12
 

Definition at line 780 of file classfile.h.

Referenced by cfmsgs_typemsg(), classfile_loadclassdata(), and linkage_resolve_class().

#define CONSTANT_Utf8   1
 

Definition at line 781 of file classfile.h.

Referenced by cfmsgs_typemsg(), class_load_primative(), classfile_allocate_primative(), classfile_loadclassdata(), linkage_resolve_class(), method_find_by_cp_entry(), nts_prchar2utf(), nts_prchar2utf_classname(), and unicode_cnv2utf().

#define CONSTANT_MAX_ARRAY_DIMS   255
 

Highest number of array dimensions.

Definition at line 819 of file classfile.h.

Referenced by utf_classname_strcmp().

#define LOCAL_CONSTANT_NO_ARRAY_DIMS   0
 

Not stated in spec, but implied.

Definition at line 822 of file classfile.h.

Referenced by class_load_primative(), class_static_setup(), object_new_setup(), and opcode_load_run_throwable().

#define METHOD_CHAR_INIT   '<'
 

Special character for naming of an object constructor method name, that is, the <init> method, and the class constructor method name, that is, the <clinit> method.

Definition at line 991 of file classfile.h.

#define SPFTYPE_INT   unsigned int
 

32-bit value

Definition at line 1107 of file classfile.h.

#define FLOAT_POSITIVE_INFINITY   0x7f800000
 

Definition at line 1115 of file classfile.h.

#define FLOAT_NEGATIVE_INFINITY   0xff800000
 

Definition at line 1116 of file classfile.h.

#define FLOAT_IS_NAN sfpval   ) 
 

Value:

(((0x7f800001 <= (SPFTYPE_INT) sfpval) &&    \
      (0x7fffffff >= (SPFTYPE_INT) sfpval))      \
                                                || \
     ((0xff800001 <= (SPFTYPE_INT) sfpval) &&    \
      (0xffffffff >= (SPFTYPE_INT) sfpval)))

Definition at line 1118 of file classfile.h.

#define DPFTYPE_LONG   unsigned long long
 

64-bit value

Definition at line 1197 of file classfile.h.

#define DPFTYPE_INT   unsigned int
 

32-bit value

Definition at line 1198 of file classfile.h.

#define DOUBLE_POSITIVE_INFINITY   0x7ff0000000000000L
 

Definition at line 1206 of file classfile.h.

#define DOUBLE_NEGATIVE_INFINITY   0xfff0000000000000L
 

Definition at line 1207 of file classfile.h.

#define DOUBLE_IS_NAN dfpval   ) 
 

Value:

(((0x7ff00000000000001 <= (DPFTYPE_LONG) dfpval) &&   \
      (0x7fffffffffffffffL >= (DPFTYPE_LONG) dfpval))  || \
                                                                \
     ((0xfff0000000000001L <= (DPFTYPE_INT) dfpval) &&        \
      (0xffffffffffffffffL >= (DPFTYPE_INT) dfpval)))

Definition at line 1209 of file classfile.h.

#define CONSTANT_UTF8_INSTANCE_CONSTRUCTOR   "<init>"
 

Definition at line 1255 of file classfile.h.

#define CONSTANT_UTF8_INSTANCE_CONSTRUCTOR_DESCRIPTOR_DEFAULT   "()V"
 

(Not in this section of spec, but very relevant)

Definition at line 1257 of file classfile.h.

#define UTF8_SINGLE_MIN   0x01
 

'\u0001', UTF-8 representation

Definition at line 1317 of file classfile.h.

Referenced by unicode_cnv2utf().

#define UTF8_SINGLE_MAX   0x7f
 

'\u007f', UTF-8 representation

Definition at line 1318 of file classfile.h.

Referenced by unicode_cnv2utf(), and utf_utf2unicode().

#define UTF8_SINGLE_MASK1   0x80
 

Bit 7 must be clear.

Definition at line 1320 of file classfile.h.

#define UTF8_SINGLE_MASK0   0x7f
 

Bits 0-6 contain data (except != 0, or NUL).

Definition at line 1321 of file classfile.h.

Referenced by unicode_cnv2utf().

#define UNICODE_SINGLE_MIN   0x0001
 

'\u0001', Unicode representation

Definition at line 1324 of file classfile.h.

#define UNICODE_SINGLE_MAX   0x007f
 

'\u007f', Unicode representation

Definition at line 1326 of file classfile.h.

#define UTF8_DOUBLE_NUL   0x0000
 

'\u0000', UTF-8 representation

Definition at line 1332 of file classfile.h.

#define UTF8_DOUBLE_MIN   0x0080
 

'\u0080', UTF-8 representation

Definition at line 1333 of file classfile.h.

#define UTF8_DOUBLE_MAX   0x07ff
 

'\u07ff', UTF-8 representation

Definition at line 1334 of file classfile.h.

#define UNICODE_DOUBLE_NUL   0x0000
 

'\u0000', Unicode representation

Definition at line 1336 of file classfile.h.

Referenced by unicode_cnv2utf().

#define UNICODE_DOUBLE_MIN   0x0080
 

'\u0080', Unicode representation

Definition at line 1338 of file classfile.h.

Referenced by unicode_cnv2utf().

#define UNICODE_DOUBLE_MAX   0x07ff
 

'\u07ff', Unicode representation

Definition at line 1340 of file classfile.h.

Referenced by unicode_cnv2utf().

#define UTF8_DOUBLE_FIRST_MASK1   0xe0
 

Top 3 bits of first byte.

Definition at line 1346 of file classfile.h.

#define UTF8_DOUBLE_FIRST_VAL   0xc0
 

Top 3 bits are '110'.

Definition at line 1347 of file classfile.h.

Referenced by unicode_cnv2utf(), and utf_utf2unicode().

#define UTF8_DOUBLE_FIRST_MASK0   0x1f
 

Bottom 5 bits contain data bits 10-6.

Definition at line 1349 of file classfile.h.

Referenced by unicode_cnv2utf(), and utf_utf2unicode().

#define UTF8_DOUBLE_FIRST_SHIFT   6
 

Move first byte up to bits 10-6.

Definition at line 1351 of file classfile.h.

Referenced by unicode_cnv2utf(), and utf_utf2unicode().

#define UTF8_DOUBLE_SECOND_MASK1   0xc0
 

Top 2 bits of second byte.

Definition at line 1357 of file classfile.h.

#define UTF8_DOUBLE_SECOND_VAL   0x80
 

Top 2 bits are '10'.

Definition at line 1358 of file classfile.h.

Referenced by unicode_cnv2utf(), and utf_utf2unicode().

#define UTF8_DOUBLE_SECOND_MASK0   0x3f
 

Bottom 6 bits contain data bits 0-5.

Definition at line 1360 of file classfile.h.

Referenced by unicode_cnv2utf(), and utf_utf2unicode().

#define UTF8_TRIPLE_MIN   0x0800
 

'\u0800', UTF-8 representation

Definition at line 1366 of file classfile.h.

#define UTF8_TRIPLE_MAX   0xffff
 

'\uffff', UTF-8 representation

Definition at line 1367 of file classfile.h.

#define UNICODE_TRIPLE_MIN   0x0800
 

'\u0800', Unicode representation

Definition at line 1369 of file classfile.h.

#define UNICODE_TRIPLE_MAX   0xffff
 

'\uffff', Unicode representation

Definition at line 1371 of file classfile.h.

#define UTF8_TRIPLE_FIRST_MASK1   0xf0
 

Definition at line 1377 of file classfile.h.

#define UTF8_TRIPLE_FIRST_VAL   0xe0
 

Definition at line 1378 of file classfile.h.

Referenced by unicode_cnv2utf(), and utf_utf2unicode().

#define UTF8_TRIPLE_FIRST_MASK0   0x0f
 

Definition at line 1380 of file classfile.h.

Referenced by unicode_cnv2utf(), and utf_utf2unicode().

#define UTF8_TRIPLE_FIRST_SHIFT   12
 

Definition at line 1382 of file classfile.h.

Referenced by unicode_cnv2utf(), and utf_utf2unicode().

#define UTF8_TRIPLE_SECOND_MASK1   0xc0
 

Definition at line 1388 of file classfile.h.

#define UTF8_TRIPLE_SECOND_VAL   0x80
 

Definition at line 1389 of file classfile.h.

Referenced by unicode_cnv2utf(), and utf_utf2unicode().

#define UTF8_TRIPLE_SECOND_MASK0   0x3f
 

Definition at line 1391 of file classfile.h.

Referenced by unicode_cnv2utf(), and utf_utf2unicode().

#define UTF8_TRIPLE_SECOND_SHIFT   6
 

Definition at line 1393 of file classfile.h.

Referenced by unicode_cnv2utf(), and utf_utf2unicode().

#define UTF8_TRIPLE_THIRD_MASK1   0xc0
 

Definition at line 1399 of file classfile.h.

#define UTF8_TRIPLE_THIRD_VAL   0x80
 

Definition at line 1400 of file classfile.h.

Referenced by unicode_cnv2utf(), and utf_utf2unicode().

#define UTF8_TRIPLE_THIRD_MASK0   0x3f
 

Definition at line 1402 of file classfile.h.

Referenced by unicode_cnv2utf(), and utf_utf2unicode().

#define UTF8_FORBIDDEN_ZERO   0x00
 

Looks suspiciously like ASCII NUL.

Definition at line 1457 of file classfile.h.

#define UTF8_FORBIDDEN_MIN   0xf0
 

Min of range for 4-byte UTF values,etc.

Definition at line 1460 of file classfile.h.

#define UTF8_FORBIDDEN_MAX   0xff
 

Max of forbidden range.

Definition at line 1462 of file classfile.h.

#define ACC_PRIVATE   0x0002
 

Declared private ; usable only within the defining class.

Definition at line 1487 of file classfile.h.

Referenced by classfile_loadclassdata().

#define ACC_PROTECTED   0x0004
 

Declared protected ; may be accessed within subclasses.

Definition at line 1490 of file classfile.h.

Referenced by classfile_loadclassdata().

#define ACC_STATIC   0x0008
 

Declared static .

Definition at line 1493 of file classfile.h.

Referenced by class_get_static_field_data(), class_get_static_field_lookups(), classfile_loadclassdata(), and linkage_resolve_class().

#define ACC_VOLATILE   0x0040
 

Declared volatile ; cannot be cached.

Definition at line 1498 of file classfile.h.

Referenced by classfile_loadclassdata().

#define ACC_TRANSIENT   0x0080
 

Declared transient ; not written or read by a persistent object manager.

Definition at line 1501 of file classfile.h.

Referenced by classfile_loadclassdata().

#define ACC_SYNCHRONIZED   0x0010
 

Declared synchronized ; invokation is wrapped in a monitor lock.

Definition at line 1537 of file classfile.h.

Referenced by classfile_loadclassdata(), and opcode_run().

#define ACC_BRIDGE   0x0040
 

A bridge method, generated by the compiler.

Definition at line 1541 of file classfile.h.

Referenced by classfile_loadclassdata().

#define ACC_VARARGS   0x0080
 

Declared with variable number of arguments.

Definition at line 1544 of file classfile.h.

Referenced by classfile_loadclassdata().

#define ACC_NATIVE   0x0100
 

Declared native ; implemented in a language other than Java.

Definition at line 1547 of file classfile.h.

Referenced by classfile_loadclassdata(), linkage_resolve_class(), and opcode_run().

#define ACC_STRICT   0x0800
 

Declared strictfp ; floating-point mode is FP-strict.

Definition at line 1553 of file classfile.h.

Referenced by classfile_loadclassdata().

#define LOCAL_CONSTANT_UTF8_UNKNOWN_ATTRIBUTE   "Unknown"
 

Not in spec.

Definition at line 1573 of file classfile.h.

#define LOCAL_UNKNOWN_ATTRIBUTE_ENUM   0
 

Not in spec.

Definition at line 1576 of file classfile.h.

#define CONSTANT_UTF8_CONSTANTVALUE_ATTRIBUTE   "ConstantValue"
 

Definition at line 1599 of file classfile.h.

Referenced by cfattrib_atr2enum().

#define CONSTANTVALUE_ATTRIBUTE_LENGTH   2
 

Definition at line 1601 of file classfile.h.

#define LOCAL_CONSTANTVALUE_ATTRIBUTE_ENUM   1
 

Not in spec.

Definition at line 1602 of file classfile.h.

#define CONSTANT_UTF8_CODE_ATTRIBUTE   "Code"
 

Definition at line 1660 of file classfile.h.

Referenced by cfattrib_atr2enum(), and cfattrib_iscodeattribute().

#define LOCAL_CODE_ATTRIBUTE_ENUM   2
 

Not in spec.

Definition at line 1662 of file classfile.h.

#define CODE_ATTRIBUTE_MAX_LOCALS_BOUNDARY_LONGDOUBLE   2
 

Definition at line 1665 of file classfile.h.

#define CODE_ATTRIBUTE_MAX_LOCALS_BOUNDARY_OTHERS   1
 

Definition at line 1667 of file classfile.h.

#define CONSTANT_UTF8_EXCEPTIONS_ATTRIBUTE   "Exceptions"
 

Definition at line 1691 of file classfile.h.

Referenced by cfattrib_atr2enum().

#define LOCAL_EXCEPTIONS_ATTRIBUTE_ENUM   3
 

Not in spec.

Definition at line 1693 of file classfile.h.

#define CODE_DEFAULT_CATCH_TYPE   0
 

This handler is for all exceptions.

Definition at line 1695 of file classfile.h.

#define CONSTANT_UTF8_INNERCLASSES_ATTRIBUTE   "InnerClasses"
 

Definition at line 1738 of file classfile.h.

Referenced by cfattrib_atr2enum().

#define LOCAL_INNERCLASSES_ATTRIBUTE_ENUM   4
 

Not in spec.

Definition at line 1740 of file classfile.h.

#define CONSTANT_UTF8_ENCLOSINGMETHOD_ATTRIBUTE   "EnclosingMethod"
 

Definition at line 1790 of file classfile.h.

Referenced by cfattrib_atr2enum().

#define ENCLOSINGMETHOD_ATTRIBUTE_LENGTH   4
 

Definition at line 1792 of file classfile.h.

#define LOCAL_ENCLOSINGMETHOD_ATTRIBUTE_ENUM   5
 

Not in spec.

Definition at line 1794 of file classfile.h.

#define CONSTANT_UTF8_SYNTHETIC_ATTRIBUTE   "Synthetic"
 

Definition at line 1814 of file classfile.h.

Referenced by cfattrib_atr2enum().

#define SYNTHETIC_ATTRIBUTE_LENGTH   0
 

Definition at line 1816 of file classfile.h.

#define LOCAL_SYNTHETIC_ATTRIBUTE_ENUM   7
 

Not in spec.

Definition at line 1818 of file classfile.h.

#define CONSTANT_UTF8_SIGNATURE_ATTRIBUTE   "Signature"
 

Definition at line 1838 of file classfile.h.

Referenced by cfattrib_atr2enum().

#define SIGNATURE_ATTRIBUTE_LENGTH   2
 

Definition at line 1840 of file classfile.h.

#define LOCAL_SIGNATURE_ATTRIBUTE_ENUM   6
 

Not in spec.

Definition at line 1842 of file classfile.h.

#define CONSTANT_UTF8_SOURCEFILE_ATTRIBUTE   "SourceFile"
 

Definition at line 1863 of file classfile.h.

Referenced by cfattrib_atr2enum().

#define SOURCEFILE_ATTRIBUTE_LENGTH   2
 

Definition at line 1865 of file classfile.h.

#define LOCAL_SOURCEFILE_ATTRIBUTE_ENUM   8
 

Not in spec.

Definition at line 1867 of file classfile.h.

#define CONSTANT_UTF8_LINENUMBERTABLE_ATTRIBUTE   "LineNumberTable"
 

Definition at line 1905 of file classfile.h.

Referenced by cfattrib_atr2enum().

#define LOCAL_LINENUMBERTABLE_ATTRIBUTE_ENUM   9
 

Not in spec.

Definition at line 1907 of file classfile.h.

#define CONSTANT_UTF8_LOCALVARIABLETABLE_ATTRIBUTE   "LocalVariableTable"
 

Definition at line 1950 of file classfile.h.

Referenced by cfattrib_atr2enum().

#define LOCAL_LOCALVARIABLETABLE_ATTRIBUTE_ENUM   10
 

Not in spec.

Definition at line 1952 of file classfile.h.

#define CONSTANT_UTF8_LOCALVARIABLETYPETABLE_ATTRIBUTE   "LocalVariableTypeTable"
 

Definition at line 1994 of file classfile.h.

Referenced by cfattrib_atr2enum().

#define LOCAL_LOCALVARIABLETYPETABLE_ATTRIBUTE_ENUM   11
 

Not in spec.

Definition at line 1997 of file classfile.h.

#define CONSTANT_UTF8_DEPRECATED_ATTRIBUTE   "Deprecated"
 

Definition at line 2017 of file classfile.h.

Referenced by cfattrib_atr2enum().

#define DEPRECATED_ATTRIBUTE_LENGTH   0
 

Definition at line 2019 of file classfile.h.

#define LOCAL_DEPRECATED_ATTRIBUTE_ENUM   12
 

Not in spec.

Definition at line 2021 of file classfile.h.

#define ELEMENT_VALUE var   )     (*(values_union *) &(&var)->_value)
 

Definition at line 2096 of file classfile.h.

#define PTR_ELEMENT_VALUE ptr   )     ( (values_union *) &(ptr)->_value)
 

Definition at line 2097 of file classfile.h.

#define CONSTANT_UTF8_RUNTIMEVISIBLEANNOTATIONS_ATTRIBUTE   "RuntimeVisibleAnnotations"
 

Definition at line 2176 of file classfile.h.

Referenced by cfattrib_atr2enum().

#define LOCAL_RUNTIMEVISIBLEANNOTATIONS_ATTRIBUTE_ENUM   13
 

Not in spec.

Definition at line 2179 of file classfile.h.

#define CONSTANT_UTF8_RUNTIMEINVISIBLEANNOTATIONS_ATTRIBUTE   "RuntimeInvisibleAnnotations"
 

Definition at line 2204 of file classfile.h.

Referenced by cfattrib_atr2enum().

#define LOCAL_RUNTIMEINVISIBLEANNOTATIONS_ATTRIBUTE_ENUM   14
 

Not in spec.

Definition at line 2207 of file classfile.h.

#define CONSTANT_UTF8_RUNTIMEVISIBLEPARAMETERANNOTATIONS_ATTRIBUTE   "RuntimeVisibleParameterAnnotations"
 

Definition at line 2241 of file classfile.h.

Referenced by cfattrib_atr2enum().

#define LOCAL_RUNTIMEVISIBLEPARAMETERANNOTATIONS_ATTRIBUTE_ENUM   15
 

Not in spec.

Definition at line 2244 of file classfile.h.

#define CONSTANT_UTF8_RUNTIMEINVISIBLEPARAMETERANNOTATIONS_ATTRIBUTE   "RuntimeInvisibleParameterAnnotations"
 

Definition at line 2270 of file classfile.h.

Referenced by cfattrib_atr2enum().

#define LOCAL_RUNTIMEINVISIBLEPARAMETERANNOTATIONS_ATTRIBUTE_ENUM   16
 

Not in spec.

Definition at line 2273 of file classfile.h.

#define CONSTANT_UTF8_ANNOTATIONDEFAULT_ATTRIBUTE   "AnnotationDefault"
 

Definition at line 2297 of file classfile.h.

Referenced by cfattrib_atr2enum().

#define LOCAL_ANNOTATIONDEFAULT_ATTRIBUTE_ENUM   17
 

Not in spec.

Definition at line 2299 of file classfile.h.

#define BASETYPE_CHAR_s   's'
 

String.

Definition at line 2312 of file classfile.h.

#define BASETYPE_CHAR_e   'e'
 

enum constant

Definition at line 2313 of file classfile.h.

#define BASETYPE_CHAR_c   'c'
 

Class.

Definition at line 2314 of file classfile.h.

#define BASETYPE_CHAR_AT   '@'
 

Annotation type.

Definition at line 2315 of file classfile.h.

#define BASETYPE_STRING_CHAR_ARRAY   "[C"
 

java.lang.String (jchar)[] value field

Definition at line 2318 of file classfile.h.

#define CODE_CONSTRAINT_CODE_LENGTH_MIN   1
 

Array size bounds,bytes.

Definition at line 2341 of file classfile.h.

#define CODE_CONSTRAINT_CODE_LENGTH_MAX   65535
 

Definition at line 2342 of file classfile.h.

#define CODE_CONSTRAINT_START_PC   0
 

Start PC location.

Definition at line 2344 of file classfile.h.

Referenced by object_run_method(), and opcode_run().

#define LOCAL_CONSTANT_UTF8_CLASS_CONSTRUCTOR   "<clinit>"
 

Not in spec,but implied.

Definition at line 2346 of file classfile.h.

Referenced by class_load_from_prchar().

#define LOCAL_CONSTANT_UTF8_CLASS_CONSTRUCTOR_PARMS   "()V"
 

Definition at line 2348 of file classfile.h.

Referenced by class_load_from_prchar().

#define CODE_CONSTRAINT_OP_INVOKEINTERFACE_PARM4   0
 

Definition at line 2350 of file classfile.h.

#define CODE_CONSTRAINT_OP_ANEWARRAY_MAX_DIMS   CONSTANT_MAX_ARRAY_DIMS
 

Definition at line 2351 of file classfile.h.

#define CODE_CONSTRAINT_OP_NEWARRAY_TYPE_T_BOOLEAN   4
 

Definition at line 2353 of file classfile.h.

#define CODE_CONSTRAINT_OP_NEWARRAY_TYPE_T_CHAR   5
 

Definition at line 2354 of file classfile.h.

#define CODE_CONSTRAINT_OP_NEWARRAY_TYPE_T_FLOAT   6
 

Definition at line 2355 of file classfile.h.

#define CODE_CONSTRAINT_OP_NEWARRAY_TYPE_T_DOUBLE   7
 

Definition at line 2356 of file classfile.h.

#define CODE_CONSTRAINT_OP_NEWARRAY_TYPE_T_BYTE   8
 

Definition at line 2357 of file classfile.h.

#define CODE_CONSTRAINT_OP_NEWARRAY_TYPE_T_SHORT   9
 

Definition at line 2358 of file classfile.h.

#define CODE_CONSTRAINT_OP_NEWARRAY_TYPE_T_INT   10
 

Definition at line 2359 of file classfile.h.

#define CODE_CONSTRAINT_OP_NEWARRAY_TYPE_T_LONG   11
 

Definition at line 2360 of file classfile.h.


Enumeration Type Documentation

enum classfile_attribute_enum
 

Section 4.10.2: Structural Constraints Section 4.11: Verification of class Files Section 4.11.1: Verification by Type Inference Section 4.11.1.1: The Process of Verification by Type InferenceSection 4.11.1.2: The Bytecode VerifierSection 4.11.1.3: Values of Types long and doubleSection 4.11.1.4: Instance Initialization Methods and Newly Created ObjectsSection 4.11.1.5: Exception HandlersSection 4.9.6: Exceptions and finally -- Removed from this JVM 1.5 edition, possibly from 1.4.Section 4.12: Limitations of the Java Virtual MachineAttribute enumeration.

Enumeration of all ClassFile attribute types. Gather the LOCAL_xxx_ATTRIBUTE_ENUM values from all over the file into one place for use in compiling a single enumeration type. These LOCAL_xxx_ATTRIBUTE_ENUM values were defined in the immediate proximity to the attribute they help describe, but this is difficult for creating an enumeration type. Here near the end of the file, each one is defined, so the enumeration type can be created. Once created, the xxx_ENUM version is undefined. Thus the xxx_ENUM is known only locally in this file, while the xxx version is known as part of the enumeration type.

Enumerator:
LOCAL_UNKNOWN_ATTRIBUTE  Not in spec.
LOCAL_CONSTANTVALUE_ATTRIBUTE  Not in spec.
LOCAL_CODE_ATTRIBUTE  Not in spec.
LOCAL_EXCEPTIONS_ATTRIBUTE  Not in spec.
LOCAL_INNERCLASSES_ATTRIBUTE  Not in spec.
LOCAL_ENCLOSINGMETHOD_ATTRIBUTE  Not in spec.
LOCAL_SYNTHETIC_ATTRIBUTE  Not in spec.
LOCAL_SIGNATURE_ATTRIBUTE  Not in spec.
LOCAL_SOURCEFILE_ATTRIBUTE  Not in spec.
LOCAL_LINENUMBERTABLE_ATTRIBUTE  Not in spec.
LOCAL_LOCALVARIABLETABLE_ATTRIBUTE  Not in spec.
LOCAL_LOCALVARIABLETYPETABLE_ATTRIBUTE  Not in spec.
LOCAL_DEPRECATED_ATTRIBUTE  Not in spec.
LOCAL_RUNTIMEVISIBLEANNOTATIONS_ATTRIBUTE  Not in spec.
LOCAL_RUNTIMEINVISIBLEANNOTATIONS_ATTRIBUTE  Not in spec.
LOCAL_RUNTIMEVISIBLEPARAMETERANNOTATIONS_ATTRIBUTE 
LOCAL_RUNTIMEINVISIBLEPARAMETERANNOTATIONS_ATTRIBUTE 
LOCAL_ANNOTATIONDEFAULT_ATTRIBUTE  Not in spec.

Definition at line 2438 of file classfile.h.


Function Documentation

ARCH_COPYRIGHT_APACHE classfile  ,
,
"$URL: https://svn.apache.org/path/name/classfile.h $ $Id: classfile.h 0 09/28/2005 dlydick $" 
 

ClassFile* classfile_allocate_primative jvm_basetype  basetype  ) 
 

Build up empty JVM class file structure for use by Java primative data types.

Each primative data type needs a minimal class definition to avoid having special cases for class processing logic. Also, treating primatives like classes can provide convenient information on data size types, like (jlong) versus (jint). This can be provided by the base type information, which is passed in here when creating these minimal classes.

The constant pool for such a minima class looks like this:

Todo:
Need to take a hard look at the requirements for java.lang.Class and see if this is sufficient or even accurately implemented.
Parameters:
basetype One of the primative base types BASETYPE_CHAR_x
Returns:
(ClassFile *) to heap-allocated area, used throughtout life of JVM, then released.

For internal use only.

INITIALIZE TO ZEROES all fields so there are automatic rnull pointers in case of failure along the way.

< Magic number for class files

Since java.lang.Object is implied, don't need this slot.

< Declared synthetic ; not present in the source code.

Todo:
Needs more thought
Todo:
Is this assumption valid/meaningful?

Definition at line 121 of file classfile.c.

References ACC_SYNTHETIC, ClassFile::access_flags, ClassFile::attributes, ClassFile::attributes_count, CONSTANT_Utf8_info::bytes, CLASSFILE_MAGIC, CONSTANT_Class, ClassFile::constant_pool, ClassFile::constant_pool_count, CONSTANT_Utf8, ClassFile::fields, ClassFile::fields_count, HEAP_GET_DATA, ClassFile::interfaces, ClassFile::interfaces_count, CONSTANT_Utf8_info::length, ClassFile::magic, ClassFile::major_version, ClassFile::methods, ClassFile::methods_count, ClassFile::minor_version, CONSTANT_Class_info::name_index, PTR_THIS_CP_Class, PTR_THIS_CP_Utf8, rfalse, rnull, rtrue, ClassFile::super_class, CONSTANT_Class_info::tag, CONSTANT_Utf8_info::tag, ClassFile::this_class, VERSION_MAJOR_JDK2, and VERSION_MINOR_DEFAULT.

ClassFile* classfile_loadclassdata u1 pclassfile_image  ) 
 

Parse an in-memory JVM class file, create structures to point to various parts of it, per JVM spec pseuco-code structures.

Interpret the class file data and load up the data structures which access it, such as the fully qualified class names, the code area, etc.

Todo:
Need a much better way to free partially built class structure when an error occurs. The current scheme is only piecemeal and will leave orphaned memory blocks lying around when something is freed that has the pointer to it, case in point, the constant_pool[] table when freeing the main ClassFile structure block on error. The partial solutions of adding heap pointer parameters to LOAD_SYSCALL_FAILURE() and GENERIC_FAILURExxx() macros is not useful here since so many allocations are done in this function.
Parameters:
pclassfile_image Null-terminated ASCII string, pathname of file.
Returns:
Complete class file structure, fully loaded with the real instantiation of the JVM spec pseudo-code structures. If error detected, rnull is returned and perror("msg") may be called to report the system call problem that caused the particular failure more. Status of heap areas will be undefined since a failure like this should be fatal to program execution.
< Convenient alias for DML5

< Magic number for class files

< Magic number for class files

< Convenient alias for DML1

< Convenient alias for DML5

< Convenient alias for DML5

< Convenient alias for DML1

< Convenient alias for DML1

< Convenient alias for DML1

Todo:
Throw UnsupportedClassVersionError for bad versions
< Convenient alias for DML5

< References java.lang.Object < Ref first constant item

< Ref first constant item

< Size of padding for cp_info structures insize of cp_info_dup structure

< Convenient alias for DML1

< Size of padding for cp_info structures insize of cp_info_dup structure

< Convenient alias for DML1

< Invalid basetype due to malformed tag or other error (not in spec)

< Size of padding for cp_info structures insize of cp_info_dup structure

< Convenient alias for DML1

< Convenient alias for DML1

< Size of padding for cp_info structures insize of cp_info_dup structure

< Convenient alias for DML1

< Convenient alias for DML1

< Size of padding for cp_info structures insize of cp_info_dup structure

< Convenient alias for DML1

< Size of padding for cp_info structures insize of cp_info_dup structure

< Size of padding for cp_info structures insize of cp_info_dup structure

< Size of padding for cp_info structures insize of cp_info_dup structure

< Size of padding for cp_info structures insize of cp_info_dup structure

< Size of padding for cp_info structures insize of cp_info_dup structure

< Convenient alias for DML1

< Convenient alias for DML1

< Size of padding for cp_info structures insize of cp_info_dup structure

< Size of padding for cp_info structures insize of cp_info_dup structure

Todo:
Need better and more complete heap free here
< Convenient alias for DML5

< Declared public; may be accessed from outside its package.

< Declared final;no subclasses allowed

< Treat superclass methods specially when invoked by the INVOKESPECIAL instruction

< Is an interface, not a class.

< Declared abstract ; may not be instantiated.

< Declared synthetic ; not present in the source code.

< Declared as an annotation type

< Declared as an enum type

< Convenient alias for DML5

Todo:
Need to free constant_pool[0..n] also if failure
< Convenient alias for DML1

< Convenient alias for DML5

< Convenient alias for DML1

Todo:
HEAP_FREE_METHOD(pcfs->constan_pool[0..n]);
< Convenient alias for DML5

< Convenient alias for DML5

< Declared public; may be accessed from outside its package.

< Declared private ; usable only within the defining class.

< Declared protected ; may be accessed within subclasses.

< Declared static .

< Declared final;no subclasses allowed

< Declared volatile ; cannot be cached

< Declared transient ; not written or read by a persistent object manager

< Declared synthetic ; not present in the source code.

< Declared as an enum type

< Convenient alias for DML1

< Convenient alias for DML1

< Convenient alias for DML1

< Convenient alias for DML5

< Declared public; may be accessed from outside its package.

< Declared private ; usable only within the defining class.

< Declared protected ; may be accessed within subclasses.

< Declared static .

< Declared final;no subclasses allowed

< Declared synchronized ; invokation is wrapped in a monitor lock.

< A bridge method, generated by the compiler.

< Declared with variable number of arguments.

< Declared native ; implemented in a language other than Java.

< Declared abstract ; may not be instantiated.

< Declared strictfp ; floating-point mode is FP-strict

< Declared synthetic ; not present in the source code.

< Convenient alias for DML1

< Convenient alias for DML1

< Convenient alias for DML1

< Convenient alias for DML5

< Convenient alias for DML1

Todo:
Throw VerifyError for classes w/ questionable contents

Definition at line 345 of file classfile.c.

References ACC_ABSTRACT, ACC_ANNOTATION, ACC_BRIDGE, ACC_ENUM, ACC_FINAL, ACC_INTERFACE, ACC_NATIVE, ACC_PRIVATE, ACC_PROTECTED, ACC_PUBLIC, ACC_STATIC, ACC_STRICT, ACC_SUPER, ACC_SYNCHRONIZED, ACC_SYNTHETIC, ACC_TRANSIENT, ACC_VARARGS, ACC_VOLATILE, method_info::access_flags, field_info::access_flags, ClassFile::access_flags, attribute_info_dup::ai, ALLOC_CF_ITEM, ALLOC_CP_INFO, attribute_info::attribute_name_index, ClassFile::attributes, method_info::attributes, field_info::attributes, ClassFile::attributes_count, method_info::attributes_count, field_info::attributes_count, cfattrib_atr2enum(), cfattrib_loadattribute(), cfmsgs_show_constant_pool(), cfmsgs_typemsg(), CLASSFILE_MAGIC, method_info::LOCAL_method_binding::codeatridxJVM, CONSTANT_Class, CONSTANT_CP_DEFAULT_INDEX, CONSTANT_CP_START_INDEX, CONSTANT_Double, CONSTANT_Fieldref, CONSTANT_Float, CONSTANT_Integer, CONSTANT_InterfaceMethodref, CONSTANT_Long, CONSTANT_Methodref, CONSTANT_NameAndType, ClassFile::constant_pool, ClassFile::constant_pool_count, CONSTANT_String, CONSTANT_Utf8, CP_INFO_NUM_EMPTIES, CP_ITEM_SWAP_U2, CP_ITEM_SWAP_U4, CP_TAG, CPIDX_RANGE_CHECK, CPTYPEIDX_RANGE_CHECK, method_info::descriptor_index, field_info::descriptor_index, DMLNORM, method_info::LOCAL_method_binding::excpatridxJVM, ClassFile::fields, ClassFile::fields_count, FILL_INFO_DUP0, FILL_INFO_DUP1, FILL_INFO_DUP2, field_info::LOCAL_field_binding::fluidxJVM, GENERIC_FAILURE1_PTR, GETRI4, GETRS2, HEAP_FREE_METHOD, HEAP_GET_METHOD, ClassFile::interfaces, ClassFile::interfaces_count, jvm_attribute_index_bad, jvm_class_index_null, jvm_field_index_bad, jvm_method_index_bad, jvm_native_method_ordinal_null, LOAD_SYSCALL_FAILURE, LOCAL_ANNOTATIONDEFAULT_ATTRIBUTE, LOCAL_BASETYPE_ERROR, LOCAL_CODE_ATTRIBUTE, LOCAL_CONSTANTVALUE_ATTRIBUTE, LOCAL_DEPRECATED_ATTRIBUTE, LOCAL_ENCLOSINGMETHOD_ATTRIBUTE, LOCAL_EXCEPTIONS_ATTRIBUTE, field_info::LOCAL_field_binding, LOCAL_INNERCLASSES_ATTRIBUTE, LOCAL_LINENUMBERTABLE_ATTRIBUTE, LOCAL_LOCALVARIABLETABLE_ATTRIBUTE, LOCAL_LOCALVARIABLETYPETABLE_ATTRIBUTE, method_info::LOCAL_method_binding, LOCAL_RUNTIMEINVISIBLEANNOTATIONS_ATTRIBUTE, LOCAL_RUNTIMEINVISIBLEPARAMETERANNOTATIONS_ATTRIBUTE, LOCAL_RUNTIMEVISIBLEANNOTATIONS_ATTRIBUTE, LOCAL_RUNTIMEVISIBLEPARAMETERANNOTATIONS_ATTRIBUTE, LOCAL_SIGNATURE_ATTRIBUTE, LOCAL_SOURCEFILE_ATTRIBUTE, LOCAL_SYNTHETIC_ATTRIBUTE, LOCAL_UNKNOWN_ATTRIBUTE, MACHINE_JINT_SWAP, MACHINE_JSHORT_SWAP, ClassFile::magic, ClassFile::major_version, MAKE_PU2, MAKE_PU4, ClassFile::methods, ClassFile::methods_count, ClassFile::minor_version, method_info::name_index, field_info::name_index, method_info::LOCAL_method_binding::nmordJVM, PTR_THIS_CP_Class, PTR_THIS_CP_Fieldref, PTR_THIS_CP_InterfaceMethodref, PTR_THIS_CP_Methodref, PTR_THIS_CP_Utf8, rfalse, rneither_true_nor_false, rnull, rtrue, ClassFile::super_class, sysDbgMsg(), ClassFile::this_class, VERSION_MAJOR_HIGH, VERSION_MAJOR_LOW, and VERSION_MINOR_HIGH.

rvoid classfile_unloadclassdata ClassFile pcfs  ) 
 

Release all heap allocated to a fully loaded ClassFile structure.

Parameters:
pcfs Pointer to a ClassFile structure with all its pieces
Returns:
rvoid Whether it succeeds or fails, returning anything does not make much sense. This is similar to free(3) not returning anything even when a bad pointer was passed in.
< References java.lang.Object

Definition at line 1493 of file classfile.c.

u1* classfile_readclassfile rchar filename  ) 
 

Read a JVM class file.

If a valid class file is read, return pointer to memory area containing its Java class image.

< Convenient alias for DML1

< Convenient alias for DML1

< Convenient alias for DML1

< Convenient alias for DML5

Definition at line 1700 of file classfile.c.

u1* classfile_readjarfile rchar filename  ) 
 

Read an entire JAR file into temporary disk area and load up one class file from it.

If a valid JAR file is read, return pointer to memory area containing the JAva class image of the startup class that was specified in Jar Manifest file. In the future, all classes in the JAR file will be available for loading from the temporary disk area via CLASSPATH.

< Convenient size for a system(3) call

< Convenient size for a system(3) call

< Convenient size for a system(3) call

Todo:
Need a version of this that works on MS Windows

Todo:
Check `pwd` overflow and rnull returned

Definition at line 1763 of file classfile.c.

u1* cfattrib_loadattribute ClassFile pcfs,
attribute_info_dup **  dst,
attribute_info src
 

Load an attribute and verify that it has either valid contents or is ignored as an unknown attribute.

If the attribute index is valid at all (for either a known or even an unknown but properly formed attribute), it will be copied into its destination area.

Parameters:
pcfs Pointer to (partially) parsed ClassFile area
dst Pointer to a attribute_info_dup[] address telling where in the heap this attribute will be copied from the source area.
src Pointer to an attribute in class file image. This data will be stored in the heap at location *dst .
Returns:
Point to first byte past this attribute, or rnull if parsing problem. If there is a problem, dst will contain a valid heap pointer only if there is a valid attribute_name_index, else it will also be rnull.
< Convenient alias for DML5

< Convenient alias for DML5

< Convenient alias for DML1

Todo:
Delete this when TODO: items below satisfied
Todo:
Verify "ConstantValue" attribute contents
Todo:
Verify "Code" attribute contents
Todo:
Verify "Exceptions" attribute contents
Todo:
Verify "InnerClasses" attribute contents
Todo:
"EnclosingMethod" attribute has nothing to verify
Todo:
"Signature" attribute has nothing to verify
Todo:
"Synthetic" attribute has nothing to verify
Todo:
Verify "SourceFile" attribute contents
Todo:
Verify "LineNumberTable" attribute contents
Todo:
Verify "LocalVariableTable" attribute contents
Todo:
Verify "LocalVariableTypeTable" attribute contents
Todo:
"Deprecated" attribute has nothing to verify
Todo:
Verify "RuntimeVisibleAnnotations" attribute contents
Todo:
Verify "RuntimeInvisibleAnnotations" attribute contents
Todo:
Verify "RuntimeVisibleParameterAnnotations" contents
Todo:
Verify "RuntimeInvisibleParameterAnnotations" contents
Todo:
"AnnotationDefault" attribute has nothing to verify

Todo:
Ignore unrecognized attribute. There really should not be anything to do here since the return value already points to the next attribute.

Definition at line 304 of file cfattrib.c.

References attribute_info::attribute_length, attribute_info::attribute_name_index, cfattrib_atr2enum(), cfattrib_loadattribute(), cfmsgs_typemsg(), ClassFile::constant_pool_count, DMLNORM, FILL_INFO_DUP0, FILL_INFO_DUP1, GENERIC_FAILURE_PTR, GETRI4, GETRS2, HEAP_GET_METHOD, attribute_info::info, LOAD_SYSCALL_FAILURE_ATTRIB, LOCAL_ANNOTATIONDEFAULT_ATTRIBUTE, LOCAL_CODE_ATTRIBUTE, LOCAL_CONSTANTVALUE_ATTRIBUTE, LOCAL_DEPRECATED_ATTRIBUTE, LOCAL_ENCLOSINGMETHOD_ATTRIBUTE, LOCAL_EXCEPTIONS_ATTRIBUTE, LOCAL_INNERCLASSES_ATTRIBUTE, LOCAL_LINENUMBERTABLE_ATTRIBUTE, LOCAL_LOCALVARIABLETABLE_ATTRIBUTE, LOCAL_LOCALVARIABLETYPETABLE_ATTRIBUTE, LOCAL_RUNTIMEINVISIBLEANNOTATIONS_ATTRIBUTE, LOCAL_RUNTIMEINVISIBLEPARAMETERANNOTATIONS_ATTRIBUTE, LOCAL_RUNTIMEVISIBLEANNOTATIONS_ATTRIBUTE, LOCAL_RUNTIMEVISIBLEPARAMETERANNOTATIONS_ATTRIBUTE, LOCAL_SIGNATURE_ATTRIBUTE, LOCAL_SOURCEFILE_ATTRIBUTE, LOCAL_SYNTHETIC_ATTRIBUTE, LOCAL_UNKNOWN_ATTRIBUTE, MACHINE_JINT_SWAP, MACHINE_JSHORT_SWAP, MAKE_PU2, PTR_DST_AI, rfalse, rnull, rtrue, and sysDbgMsg().

Referenced by cfattrib_loadattribute(), and classfile_loadclassdata().

rvoid cfattrib_unloadattribute ClassFile pcfs,
attribute_info_dup dst
 

UnLoad an attribute and free its heap area.

Parameters:
pcfs Pointer to (partially) parsed ClassFile area
dst Pointer to a attribute_info_dup allocation where this attribute is stored in the heap
Returns:
rvoid Whether it succeeds or fails, returning anything does not make much sense. This is similar to free(3) not returning anything even when a bad pointer was passed in.

Definition at line 705 of file cfattrib.c.

classfile_attribute_enum cfattrib_atr2enum ClassFile pcfs,
u2  attribute_name_index
 

Map UTF8 string names for attributes in a constant_pool to LOCAL_xxx_ATTRIBUTE constants for the purpose of switch(int) instead of switch("string") code constructions.

Returns:
enumeration constant from classfile_attribute_enum

Definition at line 106 of file cfattrib.c.

References CMP_ATTRIBUTE, CONSTANT_UTF8_ANNOTATIONDEFAULT_ATTRIBUTE, CONSTANT_UTF8_CODE_ATTRIBUTE, CONSTANT_UTF8_CONSTANTVALUE_ATTRIBUTE, CONSTANT_UTF8_DEPRECATED_ATTRIBUTE, CONSTANT_UTF8_ENCLOSINGMETHOD_ATTRIBUTE, CONSTANT_UTF8_EXCEPTIONS_ATTRIBUTE, CONSTANT_UTF8_INNERCLASSES_ATTRIBUTE, CONSTANT_UTF8_LINENUMBERTABLE_ATTRIBUTE, CONSTANT_UTF8_LOCALVARIABLETABLE_ATTRIBUTE, CONSTANT_UTF8_LOCALVARIABLETYPETABLE_ATTRIBUTE, CONSTANT_UTF8_RUNTIMEINVISIBLEANNOTATIONS_ATTRIBUTE, CONSTANT_UTF8_RUNTIMEINVISIBLEPARAMETERANNOTATIONS_ATTRIBUTE, CONSTANT_UTF8_RUNTIMEVISIBLEANNOTATIONS_ATTRIBUTE, CONSTANT_UTF8_RUNTIMEVISIBLEPARAMETERANNOTATIONS_ATTRIBUTE, CONSTANT_UTF8_SIGNATURE_ATTRIBUTE, CONSTANT_UTF8_SOURCEFILE_ATTRIBUTE, CONSTANT_UTF8_SYNTHETIC_ATTRIBUTE, LOCAL_ANNOTATIONDEFAULT_ATTRIBUTE, LOCAL_CODE_ATTRIBUTE, LOCAL_CONSTANTVALUE_ATTRIBUTE, LOCAL_DEPRECATED_ATTRIBUTE, LOCAL_ENCLOSINGMETHOD_ATTRIBUTE, LOCAL_EXCEPTIONS_ATTRIBUTE, LOCAL_INNERCLASSES_ATTRIBUTE, LOCAL_LINENUMBERTABLE_ATTRIBUTE, LOCAL_LOCALVARIABLETABLE_ATTRIBUTE, LOCAL_LOCALVARIABLETYPETABLE_ATTRIBUTE, LOCAL_RUNTIMEINVISIBLEANNOTATIONS_ATTRIBUTE, LOCAL_RUNTIMEINVISIBLEPARAMETERANNOTATIONS_ATTRIBUTE, LOCAL_RUNTIMEVISIBLEANNOTATIONS_ATTRIBUTE, LOCAL_RUNTIMEVISIBLEPARAMETERANNOTATIONS_ATTRIBUTE, LOCAL_SIGNATURE_ATTRIBUTE, LOCAL_SOURCEFILE_ATTRIBUTE, LOCAL_SYNTHETIC_ATTRIBUTE, and LOCAL_UNKNOWN_ATTRIBUTE.

Referenced by attribute_enum_common_find(), cfattrib_loadattribute(), and classfile_loadclassdata().

rboolean cfattrib_iscodeattribute ClassFile pcfs,
u2  attribute_name_index
 

Short version of cfattrib_atr2enum(), but only check if an index refers to a Code_attribute area.

Returns:
rtrue if this attribute is indeed a CONSTANT_UTF8_CODE_ATTRIBUTE, otherwise rfalse.

Definition at line 217 of file cfattrib.c.

References CMP_ATTRIBUTE, CONSTANT_UTF8_CODE_ATTRIBUTE, rfalse, and rtrue.

rvoid cfmsgs_typemsg rchar fn,
ClassFile pcfs,
u2  idx
 

rvoid cfmsgs_show_constant_pool ClassFile pcfs  ) 
 

Show all entries in the constant pool.

Parameters:
pcfs ClassFile to dump contents
Returns:
rvoid
< Ref first constant item

< Ref first constant item

Definition at line 514 of file cfmsgs.c.

Referenced by classfile_loadclassdata(), and linkage_resolve_class().

rvoid cfmsgs_atrmsg rchar fn,
ClassFile pcfs,
attribute_info_dup atr
 

Display details of what an attribute entry contains.

Parameters:
fn Function name message for sysErrMsg()
pcfs ClassFile to dump contents
atr Pointer to an attribute area. WARNING: This pointer MUST be 4-byte aligned to suppress SIGSEGV. Such logic is already taken care of by virtue of it being an (attribute_info_dup *) type instead of as (attribute_info *). This processing happens in cfattrib_loadattribute() after reading an attribute from the class file and storing it into the heap, which is properly aligned.
Returns:
rvoid The atr->ai.attribute_index constant_pool entry must be valid for this to produce any meaningful results.
< Convenient size for any stdio msg

Todo:
Verify (jlong) retrieval of bytes for both -m32 and -m64 compilations.
Todo:
Above logic works, logic below needs testing:
Todo:
Make format string properly reflect 64-bit (rlong)/(jlong)
< Convenient alias for DML5

Todo:
Verify (jfloat) retrieval of bytes for both -m32 and -m64 compilations.
< Convenient alias for DML5

Todo:
Verify (jdouble) retrieval of bytes for both -m32 and -m64 compilations.
Todo:
Above logic works, 64-bit logic below needs testing:
Todo:
Make format string properly reflect 64-bit (double)/(jdouble)
< Convenient alias for DML5

Todo:
Verify (jint) retrieval of bytes for both -m32 and -m64 compilations.
< Convenient alias for DML5

< Convenient alias for DML5

< Convenient alias for DML5

< Not in spec

< Convenient alias for DML5

< Convenient alias for DML5

< Convenient alias for DML5

< Convenient alias for DML5

< Convenient alias for DML5

< Convenient alias for DML5

< Convenient alias for DML5

< Convenient alias for DML5

< Convenient alias for DML5

< Convenient alias for DML5

< Convenient alias for DML5

< Convenient alias for DML5

< Convenient alias for DML5

< Convenient alias for DML5

< Convenient alias for DML5

< Convenient alias for DML5

< Convenient alias for DML5

< Not in spec

Definition at line 558 of file cfmsgs.c.


Generated on Fri Sep 30 19:00:03 2005 by  doxygen 1.4.4