00001 #ifndef _jvalue_h_included_ 00002 #define _jvalue_h_included_ 00003 00004 /*! 00005 * @file jvalue.h 00006 * 00007 * @brief Java aggregate type references for object definitions. 00008 * 00009 * See also <em>The Java Virtual Machine Specification, 00010 * version 2, Section 4</em>, table 4.2. 00011 * 00012 * 00013 * @section Control 00014 * 00015 * \$URL: https://svn.apache.org/path/name/jvalue.h $ \$Id: jvalue.h 0 09/28/2005 dlydick $ 00016 * 00017 * Copyright 2005 The Apache Software Foundation 00018 * or its licensors, as applicable. 00019 * 00020 * Licensed under the Apache License, Version 2.0 ("the License"); 00021 * you may not use this file except in compliance with the License. 00022 * You may obtain a copy of the License at 00023 * 00024 * http://www.apache.org/licenses/LICENSE-2.0 00025 * 00026 * Unless required by applicable law or agreed to in writing, 00027 * software distributed under the License is distributed on an 00028 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 00029 * either express or implied. 00030 * 00031 * See the License for the specific language governing permissions 00032 * and limitations under the License. 00033 * 00034 * @version \$LastChangedRevision: 0 $ 00035 * 00036 * @date \$LastChangedDate: 09/28/2005 $ 00037 * 00038 * @author \$LastChangedBy: dlydick $ 00039 * Original code contributed by Daniel Lydick on 09/28/2005. 00040 * 00041 * @section Reference 00042 * 00043 */ 00044 00045 00046 ARCH_COPYRIGHT_APACHE(jvalue, h, "$URL: https://svn.apache.org/path/name/jvalue.h $ $Id: jvalue.h 0 09/28/2005 dlydick $"); 00047 00048 /*! 00049 * @brief Java aggregate type references for object definitions. 00050 * 00051 * This union contains literally a grand union of all Java data types, 00052 * including both primatives and references types for the purpose of 00053 * allowing all object instance fields to be stored in @link 00054 robject#object_instance_field_data object_instance_field_data@endlink 00055 * as an array in an @link robject object table entry@endlink 00056 * without special treatment. Static fields may be stored in this the 00057 * same way in 00058 * @link rclass#class_static_field_data class_static_field_data@endlink 00059 * of a 00060 * @link rclass class table entry@endlink. (All sub-integer primative 00061 * data types are store inside of @link #jint (jint)@endlink and cast 00062 * in/out at runtime.) 00063 * 00064 * The following types are are casts of _jint, thus: 00065 * @verbatim 00066 jvalue v; ... a composite value 00067 00068 jint i; ... integer primative 00069 00070 jbyte b; ... sub-integer primatives 00071 jboolean z; 00072 jshort s; 00073 jchar c; 00074 00075 jfloat f; ... float is same size as jint 00076 jobjhash o; ... object reference same size 00077 00078 jlong l; ... TWO jint words 00079 jdouble d; ... TWO jint words 00080 00081 (See also spec table 4.6) 00082 00083 i = v._jint; 00084 00085 b = v._jbyte; 00086 z = v._jboolean; 00087 s = v._jshort; 00088 c = v._jchar; 00089 00090 f = v._jfloat; 00091 o = v._jobjhash; 00092 00093 l = v._jlong; 00094 d = v._jlong; 00095 00096 and vice versa: 00097 00098 v._jint = i; 00099 00100 v._jbyte = b; 00101 v._jbyte = b; 00102 v._jboolean = z; 00103 v._jshort = s; 00104 v._jchar = c; 00105 00106 v._jfloat = f; 00107 v._jobjhash = o; 00108 00109 v._jlong = l; 00110 v._jdouble = d; 00111 @endverbatim 00112 * 00113 * Although most of the items in this union are Java primatives, there 00114 * are also contained herein are two members that are @e not primatives, 00115 * namely the object reference hash and the array reference hash. 00116 * By implementing them here, both primative and reference, 00117 * @e all possible Java data types are represented in @e one data 00118 * structure, which is @e very handy for concise object representations 00119 * without @e any redundant data structures in different places. 00120 * 00121 * Notice that for @link #CONFIG_WORDWIDTH32 CONFIG_WORDWIDTH32@endlink 00122 * implementations, the @link #jlong (jlong)@endlink will be the 00123 * longest data type, as an 8-byte integer. Notice @e also that for 00124 * @link #CONFIG_WORDWIDTH64 CONFIG_WORDWIDTH64@endlink implementations, 00125 * this will not change because there are no types such as pointers 00126 * that will change sizes here. Since this typedef will be used 00127 * @e extensively in the runtime environment, this inherent constraint 00128 * can help plan maximum heap sizing. 00129 * 00130 */ 00131 typedef union 00132 { 00133 jbyte _jbyte; /**< Sub-integer primative @link 00134 #jbyte jbyte@endlink */ 00135 jboolean _jboolean; /**< Sub-integer primative @link 00136 #jboolean jboolean@endlink */ 00137 jshort _jshort; /**< Sub-integer primative @link 00138 #jshort jshort@endlink */ 00139 jchar _jchar; /**< Sub-integer primative @link 00140 #jchar jchar@endlink */ 00141 00142 jint _jint; /**< Primative @link #jint jint@endlink, 00143 per tables 4.2/4.6 */ 00144 jlong _jlong; /**< Primative @link #jint jlong@endlink, 00145 per tables 4.2/4.6 */ 00146 jfloat _jfloat; /**< Primative @link #jint jfloat@endlink, 00147 per tables 4.2/4.6 */ 00148 jdouble _jdouble;/**< 00149 Primative @link #jint jdouble@endlink, 00150 per tables 4.2/4.6*/ 00151 00152 jvm_object_hash _jstring;/**< Object hash for the quasi-primative 00153 @c @b java.lang.String . 00154 Except for this one item, table 4.6 is 00155 a subsest of table 4.2. */ 00156 00157 /* 00158 * Implementation of object references and array references. 00159 */ 00160 jvm_object_hash _jarray; /**< Object hash of next lower array dim*/ 00161 jvm_object_hash _jobjhash;/**< Object hash of an arbitrary object*/ 00162 00163 } jvalue; 00164 00165 #endif /* _jvalue_h_included_ */ 00166 00167 00168 /* EOF */ 00169