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

jrtypes.h File Reference


Detailed Description

Java architecture types, including those defined by <jni.h>, plus real machine mappings of Java types.

Convenient typedefs of both categories are also defined here.

These definitions distinguish between Java types and real machine types so as to keep the developer organized as to which is which in processing scenarios. The Java types begin with j and the real machine types begin with r.

The main exception to this is the JVM class file definitions from the JVM spec, section 4, as implemented by classfile.h. These are followed without exception. In fact, a number of common type definitions are based on them. The jvm_XXX_index types are typically either direct class file references (such as jvm_object_hash or jvm_field_index) or are real machine definitions that directly support JVM processing structures (such as jvm_class_index or jvm_field_lookup_index).

The other common usage of a prefix is for variables. It is not related to this issue at all. In this situation, the letter p will typically be prefixed to pointers to/of any type in either processing domain.

The use of raw, native, 'C' language types such as int should be restricted to system calls and library references such as open(2) or strcmp(3), respectively-- also the command line main() parameters, which get propagated into argv_XXX() functions. Let the compiler perform any typing and sizing, which is unlikely, but keep all other usages to the Java jTYPEDEF and real machine rTYPEDEF representations. This single exception should be obvious when it occurs, and developers should be aware that this convention is used ubiquitously throughout the code.

Although definitions used by the JNI interface are found here, JNI is kept as a STRICTLY SEPARATE part of the code, and <jni.h> is ONLY used there, namely in the ../include area.

Note:
The only place that JNI definitions are used is in the JniSomeJavaClassWithNativeMethods.c source file as found in its some.java.class.with.native.methods directory. For example, the Java class java.lang.Object has its Java source file stored in jni/src/vendor/product/version/src/java/lang/Object.java, with its native support found in the 'C' source file jni/src/vendor/product/version/src/java_lang_Object.c. The JNI header used to access this native java.lang.Object code is found in the related include directory as jni/src/vendor/product/version/include/java_lang_Object.h.

Control

$URL: https://svn.apache.org/path/name/jrtypes.h $ $Id: jrtypes.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 jrtypes.h.

Go to the source code of this file.

Selected manifest constants.

Common macros used commonly in 'C' code. Only permit use of #define's in constant definition source file, in static initialization, and in selected switch statements.

Most of these constants are found in some /usr/include directories on some platforms, but not others, and not regularly defined between platforms. Also, remove misc. inconsistencies in #define usage amongst compilers.

#define ERROR0   0
 Typically found in <errno.h> or <sys/errno.h>.

Symbols to avoid.

In order to keep away from definitions of TRUE, FALSE, and NULL that may be defined all over the place, these symbols have been replaced in the real machine domain with rtrue, rfalse, and rnull. They have been replaced in the Java virtual machine domain by jtrue, jfalse, and jnull.

#define FALSE   ((rboolean) 0)
 Please use either rfalse for real machine FALSE cases or jfalse for Java virtual machine FALSE cases.
#define FALSE   DO_NOT_USE_FALSE
 Please use either rfalse for real machine FALSE cases or jfalse for Java virtual machine FALSE cases.
#define NULL   ((rvoid *) 0)
 Please use rnull for real machine NULL cases or jnull for Java virtual machine NULL cases.
#define NULL   DO_NOT_USE_NULL
 Please use rnull for real machine NULL cases or jnull for Java virtual machine NULL cases.
#define TRUE   ((rboolean) 1)
 Please use either rtrue for real machine TRUE cases or jtrue for Java virtual machine TRUE cases.
#define TRUE   DO_NOT_USE_TRUE
 Please use either rtrue for real machine TRUE cases or jtrue for Java virtual machine TRUE cases.

Java architecture primative types.

Real machine implementation of Java primative types.

#define JBITS   8
 Number of bits per byte in JVM.
typedef unsigned char jboolean
 Java (boolean).
typedef signed char jbyte
 Java (byte).
typedef unsigned short jchar
 Java (char).
typedef double jdouble
 Java (double).
typedef float jfloat
 Java (float).
typedef signed int jint
 Java (int).
typedef signed long long jlong
 Java (long).
typedef signed short jshort
 Java (short).
typedef void jvoid
 Java (void) is not found in <jni.h> !!! It is used here to be consistent with separation of Java vs real machine data types.

Java Native Interface definitions.

Selected JNI definitions needed by this implementation for JNI interface purposes, but never used in the core code.

#define JNI_FALSE   0
 Defined by <jni.h> (never used in core code).
#define JNI_TRUE   1
 Defined by <jni.h> (never used in core code).

Unsigned equivalents to Java primative types.

Convenient workarounds for unsigned typesthat are really not in Java.

These types are really faux, but are needed for internal implementation convenience or for more refined semantic interpretation of JVM spec fields.

typedef unsigned char jubyte
 Unsigned equivalent of Java (byte).
typedef unsigned int juint
 Unsigned equivalent of Java (int).
typedef unsigned long long julong
 Unsigned equivalent of Java (long).
typedef unsigned short jushort
 Unsigned equivalent of Java (short).

Real machine types.

Real machine abstraction of real machine primative types. With the exception of library(3) and system(2) calls, which use the types mandated in their man pages, all real machine primative types use these abstractions. This should significantly ease portability problems.

typedef unsigned char rboolean
 Boolean for any purpose.
typedef unsigned char rbyte
 8-bit byte for any purpose
typedef signed char rchar
 Normal 8-bit 'C' character.
typedef double rdouble
 Real machine (double).
typedef float rfloat
 Real machine (float).
typedef signed int rint
 Signed 32-bit integer.
typedef signed long long rlong
 Signed 64-bit integer.
typedef signed short rshort
 Signed 16-bit integer.
typedef unsigned int ruint
 Unsigned 32-bit integer.
typedef unsigned long long rulong
 Unsigned 64-bit integer.
typedef unsigned short rushort
 Unsigned 16-bit integer.
typedef void rvoid
 Real machine (void), for pointers, (void *), untyped.

Classfile primative types.

Streams of unsigned bytes in the Java class file.

The definitions of u1 and u2 and u4 are here so a to decouple these ubiquitous symbols from class file work.

Notice that, depending on context, these three definitions may be either signed or unsigned. For this implementation, there will be no further distinction made other than the unsigned declarations of these symbols. In most cases in the spec, usage is unsigned, namely counts, lengths, indices, enumerations, JDK program counter values, etc. The only significant exception is the CONSTANT_Integer_info.bytes structure, which is still not adjusted for real machine byte ordering, also CONSTANT_Float_info.bytes and their (long) and (double) equivalents, having two u4 items.

typedef jubyte u1
 Single byte.
typedef jushort u2
 Two bytes, like an unsigned short.
typedef juint u4
 Four bytes, like an unsigned int.

Java keywords

Real machine implementation of selected Java keywords.

const jboolean jfalse
 Java constant false.
const jvoidjnull
 Java constant null.
const jboolean jtrue
 Java constant true.

Real machine constants.

Real machine implementation of common industry keywords.

Instead of permitting unrestrained and potentially misuse and abuse of the common macros NULL, TRUE, and FALSE, including conflicting definitions in various header files, these symbols have been declared explicitly for this program and stored into global constants. This should also help in development for more accurate typing of expressions, paramters, and return values. A boolean "not initialized" value is also defined.

Use rnull in all cases except static initalization. Use rtrue and $rfalse in all cases except static initialization and while(TRUE) constructions just before end of function definitions (some compilers complain about missing return statements, see several examples). In this manner, it will always be very clear as to whether a NULL pointer is a Java null pointer or a real machine null pointer, likewise a Java boolean or a real machine boolean.

const rboolean rfalse
 Real machine constant FALSE.
const rboolean rneither_true_nor_false
 Real machine constant neither.
const void * rnull
 Real machine constant NULL.
const rboolean rtrue
 Real machine constant TRUE.

Defines

#define CHEAT_AND_ALLOW_NULL_CLASS_INDEX   ((jvm_class_index) 0)
 Permit null class index manifest constant for initializing static and global storage.
#define CHEAT_AND_ALLOW_NULL_OBJECT_HASH   ((jvm_object_hash) 0)
 Permit null object hash manifest constant for initializing static and global storage.
#define CHEAT_AND_ALLOW_NULL_THREAD_INDEX   ((jvm_thread_index) 0)
 Permit null thread index manifest constant for initializing static and global storage.
#define CHEAT_AND_USE_FALSE_TO_INITIALIZE   ((rboolean) 0)
 Permit boolean "false" manifest constant for initializing static and global storage.
#define CHEAT_AND_USE_NULL_TO_INITIALIZE   ((rvoid *) 0)
 Permit null pointer manifest constant for initializing static and global storage.
#define CHEAT_AND_USE_TRUE_TO_INITIALIZE   ((rboolean) 1)
 Permit boolean "true" manifest constant for initializing static and global storage.
#define NEITHER_TRUE_NOR_FALSE   ((rboolean) 2)
 Value for initializing a boolean to "not initialized, that is, neither TRUE nor FALSE".

Functions

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


Define Documentation

#define JBITS   8
 

Number of bits per byte in JVM.

Definition at line 111 of file jrtypes.h.

#define JNI_FALSE   0
 

Defined by <jni.h> (never used in core code).

Definition at line 180 of file jrtypes.h.

#define JNI_TRUE   1
 

Defined by <jni.h> (never used in core code).

Definition at line 183 of file jrtypes.h.

#define ERROR0   0
 

Typically found in <errno.h> or <sys/errno.h>.

Definition at line 335 of file jrtypes.h.

Referenced by heap_get_error_simple().

#define TRUE   DO_NOT_USE_TRUE
 

Please use either rtrue for real machine TRUE cases or jtrue for Java virtual machine TRUE cases.

Definition at line 399 of file jrtypes.h.

#define FALSE   DO_NOT_USE_FALSE
 

Please use either rfalse for real machine FALSE cases or jfalse for Java virtual machine FALSE cases.

Definition at line 402 of file jrtypes.h.

#define NULL   DO_NOT_USE_NULL
 

Please use rnull for real machine NULL cases or jnull for Java virtual machine NULL cases.

Definition at line 396 of file jrtypes.h.

#define NULL   ((rvoid *) 0)
 

Please use rnull for real machine NULL cases or jnull for Java virtual machine NULL cases.

Definition at line 396 of file jrtypes.h.

#define TRUE   ((rboolean) 1)
 

Please use either rtrue for real machine TRUE cases or jtrue for Java virtual machine TRUE cases.

Definition at line 399 of file jrtypes.h.

#define FALSE   ((rboolean) 0)
 

Please use either rfalse for real machine FALSE cases or jfalse for Java virtual machine FALSE cases.

Definition at line 402 of file jrtypes.h.

#define NEITHER_TRUE_NOR_FALSE   ((rboolean) 2)
 

Value for initializing a boolean to "not initialized, that is, neither TRUE nor FALSE".

Definition at line 404 of file jrtypes.h.

#define CHEAT_AND_USE_FALSE_TO_INITIALIZE   ((rboolean) 0)
 

Permit boolean "false" manifest constant for initializing static and global storage.

Definition at line 412 of file jrtypes.h.

#define CHEAT_AND_USE_TRUE_TO_INITIALIZE   ((rboolean) 1)
 

Permit boolean "true" manifest constant for initializing static and global storage.

Definition at line 418 of file jrtypes.h.

#define CHEAT_AND_USE_NULL_TO_INITIALIZE   ((rvoid *) 0)
 

Permit null pointer manifest constant for initializing static and global storage.

Definition at line 424 of file jrtypes.h.

#define CHEAT_AND_ALLOW_NULL_CLASS_INDEX   ((jvm_class_index) 0)
 

Permit null class index manifest constant for initializing static and global storage.

Definition at line 430 of file jrtypes.h.

#define CHEAT_AND_ALLOW_NULL_OBJECT_HASH   ((jvm_object_hash) 0)
 

Permit null object hash manifest constant for initializing static and global storage.

Definition at line 436 of file jrtypes.h.

#define CHEAT_AND_ALLOW_NULL_THREAD_INDEX   ((jvm_thread_index) 0)
 

Permit null thread index manifest constant for initializing static and global storage.

Definition at line 442 of file jrtypes.h.


Typedef Documentation

typedef signed char jbyte
 

Java (byte).

Definition at line 113 of file jrtypes.h.

typedef unsigned char jboolean
 

Java (boolean).

Definition at line 115 of file jrtypes.h.

typedef signed short jshort
 

Java (short).

Definition at line 117 of file jrtypes.h.

typedef unsigned short jchar
 

Java (char).

Definition at line 119 of file jrtypes.h.

typedef signed int jint
 

Java (int).

Definition at line 121 of file jrtypes.h.

typedef signed long long jlong
 

Java (long).

Definition at line 129 of file jrtypes.h.

typedef float jfloat
 

Java (float).

Definition at line 133 of file jrtypes.h.

typedef double jdouble
 

Java (double).

Definition at line 135 of file jrtypes.h.

typedef void jvoid
 

Java (void) is not found in <jni.h> !!! It is used here to be consistent with separation of Java vs real machine data types.

Also defined for our JNI purposes in jlObject.h

Definition at line 137 of file jrtypes.h.

typedef unsigned char jubyte
 

Unsigned equivalent of Java (byte).

Definition at line 202 of file jrtypes.h.

typedef unsigned short jushort
 

Unsigned equivalent of Java (short).

Definition at line 205 of file jrtypes.h.

typedef unsigned int juint
 

Unsigned equivalent of Java (int).

Definition at line 208 of file jrtypes.h.

typedef unsigned long long julong
 

Unsigned equivalent of Java (long).

Definition at line 218 of file jrtypes.h.

typedef jubyte u1
 

Single byte.

Definition at line 250 of file jrtypes.h.

typedef jushort u2
 

Two bytes, like an unsigned short.

Definition at line 252 of file jrtypes.h.

typedef juint u4
 

Four bytes, like an unsigned int.

Definition at line 255 of file jrtypes.h.

typedef signed char rchar
 

Normal 8-bit 'C' character.

Definition at line 273 of file jrtypes.h.

typedef unsigned char rbyte
 

8-bit byte for any purpose

Definition at line 275 of file jrtypes.h.

typedef unsigned char rboolean
 

Boolean for any purpose.

Definition at line 277 of file jrtypes.h.

typedef signed short rshort
 

Signed 16-bit integer.

Definition at line 279 of file jrtypes.h.

typedef unsigned short rushort
 

Unsigned 16-bit integer.

Definition at line 281 of file jrtypes.h.

typedef signed int rint
 

Signed 32-bit integer.

Definition at line 283 of file jrtypes.h.

typedef unsigned int ruint
 

Unsigned 32-bit integer.

Definition at line 285 of file jrtypes.h.

typedef signed long long rlong
 

Signed 64-bit integer.

Definition at line 296 of file jrtypes.h.

typedef unsigned long long rulong
 

Unsigned 64-bit integer.

Definition at line 298 of file jrtypes.h.

typedef float rfloat
 

Real machine (float).

Definition at line 302 of file jrtypes.h.

typedef double rdouble
 

Real machine (double).

Definition at line 305 of file jrtypes.h.

typedef void rvoid
 

Real machine (void), for pointers, (void *), untyped.

Definition at line 308 of file jrtypes.h.


Function Documentation

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


Variable Documentation

const jvoid* jnull
 

Java constant null.

Definition at line 55 of file jrtypes.c.

const jboolean jfalse
 

Java constant false.

Definition at line 57 of file jrtypes.c.

Referenced by jlClass_isArray(), jlClass_isPrimative(), jlThread_currentThread(), jlThread_destroy(), jlThread_interrupt(), jlThread_setPriority(), jlThread_start(), and jlThread_yield().

const jboolean jtrue
 

Java constant true.

Definition at line 59 of file jrtypes.c.

Referenced by jlClass_isArray(), jlThread_destroy(), jlThread_interrupt(), jlThread_interrupted(), jlThread_setPriority(), jlThread_start(), and jlThread_yield().

const void* rnull
 

Real machine constant NULL.

Definition at line 65 of file jrtypes.c.

Referenced by argv_init(), cfattrib_loadattribute(), class_load_from_prchar(), class_load_primative(), class_static_setup(), classfile_allocate_primative(), classfile_loadclassdata(), exit_exception_setup(), field_index_get_class_static_pjvalue(), field_index_get_object_instance_pjvalue(), gc_object_delete_stub(), heap_free_data_bimodal(), heap_get_common_bimodal(), heap_get_common_simple_bimodal(), heap_get_data_bimodal(), heap_init_bimodal(), jvmutil_print_stack_common(), linkage_resolve_class(), manifest_get_main(), object_instance_finalize(), object_new_setup(), object_run_method(), opcode_load_run_throwable(), opcode_run(), thread_init(), thread_new(), timeslice_init(), timeslice_run(), and utf_isarray().

const rboolean rfalse
 

Real machine constant FALSE.

Definition at line 67 of file jrtypes.c.

Referenced by argv_init(), cfattrib_iscodeattribute(), cfattrib_loadattribute(), cfmsgs_typemsg(), class_allocate_slot(), class_get_static_field_data(), classfile_allocate_primative(), classfile_loadclassdata(), field_index_get_object_instance_lookup(), field_index_is_class_static(), field_index_is_object_instance(), gc_class_delete_stub(), gc_class_field_mkref_stub(), gc_class_field_rmref_stub(), gc_class_mkref_from_class_stub(), gc_class_mkref_from_object_stub(), gc_class_new_stub(), gc_class_reload_stub(), gc_class_rmref_from_class_stub(), gc_class_rmref_from_object_stub(), gc_object_field_mkref_stub(), gc_object_field_rmref_stub(), gc_object_mkref_from_class_stub(), gc_object_mkref_from_object_stub(), gc_object_new_stub(), gc_object_rmref_from_class_stub(), gc_object_rmref_from_object_stub(), gc_stack_mkref_from_jvm_stub(), gc_stack_new_stub(), gc_stack_rmref_from_jvm_stub(), heap_free_common_bimodal(), heap_init_bimodal(), jlThread_isAlive(), jvmutil_print_errtype_stack(), jvmutil_print_stack(), jvmutil_print_stack_details(), linkage_resolve_class(), manifest_get_main(), nts_prchar2utf(), nts_prchar2utf_classname(), nts_prchar_isprimativeformatted(), object_allocate_slot(), object_run_method(), objectutil_synchronize(), opcode_load_run_throwable(), opcode_run(), sysDbgMsg(), thread_init(), threadstate_process_blockingevent(), timeslice_init(), timeslice_shutdown(), unicode_cnv2utf(), and utf_isarray().

const rboolean rtrue
 

Real machine constant TRUE.

Definition at line 68 of file jrtypes.c.

Referenced by argv_init(), cfattrib_iscodeattribute(), cfattrib_loadattribute(), class_allocate_slot(), class_get_num_static_fields(), class_get_static_field_lookups(), classfile_allocate_primative(), classfile_loadclassdata(), field_index_get_object_instance_lookup(), field_index_is_class_static(), field_index_is_object_instance(), heap_get_common_simple_bimodal(), heap_init_bimodal(), heap_init_simple(), jlObject_wait4ever(), jlObject_waittimed(), jlThread_checkAccess(), jlThread_countStackFrames(), jlThread_interrupt(), jlThread_interrupted(), jlThread_isDaemon(), jlThread_setDaemon(), jlThread_setPriority(), jlThread_start(), jvmutil_print_stack_common(), jvmutil_print_stack_details(), jvmutil_print_stack_locals(), linkage_resolve_class(), nts_prchar_isprimativeformatted(), object_allocate_slot(), object_init(), object_instance_finalize(), objectutil_synchronize(), opcode_load_run_throwable(), opcode_run(), thread_init(), thread_state_get_name(), threadstate_activate_blocked(), threadstate_activate_blockingevent(), threadstate_activate_start(), threadstate_activate_unblocked(), threadstate_process_blocked(), threadstate_process_new(), threadstate_process_release(), threadstate_process_runnable(), threadstate_process_running(), threadstate_process_start(), threadstate_request_new(), threadstate_request_release(), threadstate_request_runnable(), timeslice_init(), timeslice_run(), timeslice_tick(), utf_pcfs_strcmp(), and utf_utf_isclassformatted().

const rboolean rneither_true_nor_false
 

Real machine constant neither.

Typically used during initialization to indicate a boolean is not ready.

Definition at line 69 of file jrtypes.c.

Referenced by classfile_loadclassdata(), and linkage_resolve_class().


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