00001 #ifndef _jvmcfg_h_included_ 00002 #define _jvmcfg_h_included_ 00003 00004 /*! 00005 * @file jvmcfg.h 00006 * 00007 * @brief Sizes of JVM items, max number of classes, objects, threads, 00008 * etc., and other general program configuration. 00009 * 00010 * Notice that the maximum number of items is also dependent 00011 * on the data type that contains counts of that item. For 00012 * example, since the thread index is an 00013 * <b><code>(unsigned short)</code></b>, 00014 * there can be no more than 2^16 threads in the system. 00015 * 00016 * 00017 * @par NOTES FOR JAVA NATIVE INTERFACE 00018 * 00019 * In order to keep this implementation @e absolutely independent 00020 * of @e any implementation of <jni.h> and subsidiary header files, 00021 * the following typedefs have been redefined in the JNI portion 00022 * of these header files: 00023 * 00024 * jvm_object_hash ...found in @link jvm/include/jlObject.h 00025 jlObject.h@endlink 00026 * 00027 * jvm_thread_index ...found in @link jvm/include/jlThread.h 00028 jlThread.h@endlink 00029 * 00030 * jvm_class_index ...found in @link jvm/include/jlClass.h 00031 jlClass.h@endlink 00032 * 00033 * These types are used for function prototypes for JNI code. 00034 * 00035 * 00036 * @todo Add proper searching for 'rt.jar' file and '-bootclasspath'. 00037 * For the moment, they are defined in 00038 * @link config.h config.h@endlink as the 00039 * @link #CONFIG_HACKED_RTJARFILE CONFIG_HACKED_RTJARFILE@endlink 00040 * and @link #CONFIG_HACKED_BOOTCLASSPATH 00041 CONFIG_HACKED_BOOTCLASSPATH@endlink 00042 * pre-processor symbols and are implemented in 00043 * @link jvm/src/classpath.c classpath.c@endlink 00044 * in this way. 00045 * 00046 * 00047 * 00048 * @section Control 00049 * 00050 * \$URL: https://svn.apache.org/path/name/jvmcfg.h $ \$Id: jvmcfg.h 0 09/28/2005 dlydick $ 00051 * 00052 * Copyright 2005 The Apache Software Foundation 00053 * or its licensors, as applicable. 00054 * 00055 * Licensed under the Apache License, Version 2.0 ("the License"); 00056 * you may not use this file except in compliance with the License. 00057 * You may obtain a copy of the License at 00058 * 00059 * http://www.apache.org/licenses/LICENSE-2.0 00060 * 00061 * Unless required by applicable law or agreed to in writing, 00062 * software distributed under the License is distributed on an 00063 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 00064 * either express or implied. 00065 * 00066 * See the License for the specific language governing permissions 00067 * and limitations under the License. 00068 * 00069 * @version \$LastChangedRevision: 0 $ 00070 * 00071 * @date \$LastChangedDate: 09/28/2005 $ 00072 * 00073 * @author \$LastChangedBy: dlydick $ 00074 * Original code contributed by Daniel Lydick on 09/28/2005. 00075 * 00076 * @todo Need to evaluate if and when and how to phase out use of the 00077 * configuration variables @link #CONFIG_HACKED_RTJARFILE 00078 CONFIG_HACKED_RTJARFILE@endlink and 00079 @link #CONFIG_HACKED_BOOTCLASSPATH 00080 CONFIG_HACKED_BOOTCLASSPATH@endlink 00081 * 00082 * @internal Decide whether or not to use the 00083 * @link #CONFIG_HACKED_RTJARFILE CONFIG_HACKED_xxx@endlink definitions 00084 * from @link config.h config.h@endlink. Consider two fragments of 00085 * source code showing with/without comment possibility (immediately 00086 * follows this note in the source code). 00087 * 00088 * @section Reference 00089 * 00090 */ 00091 00092 ARCH_COPYRIGHT_APACHE(jvmcfg, h, "$URL: https://svn.apache.org/path/name/jvmcfg.h $ $Id: jvmcfg.h 0 09/28/2005 dlydick $"); 00093 00094 00095 #include "jrtypes.h" 00096 00097 00098 /* 00099 #undef CONFIG_HACKED_BOOTCLASSPATH 00100 */ 00101 00102 /* 00103 #undef CONFIG_HACKED_RTJARFILE 00104 */ 00105 00106 00107 /*! 00108 * @name OS File system conventions. 00109 * 00110 * @brief Conventions for OS file systems (see also 00111 * @link jvm/src/classfile.h classfile.h@endlink 00112 * for @link #CLASSFILE_EXTENSION_DEFAULT 00113 CLASSFILE_EXTENSION_xxx@endlink definitions). 00114 * 00115 * @verbatim 00116 00117 Unix style: /path/name1/name2/filename.extension 00118 00119 Windows style: c:\path\name1\name2\filename.extension 00120 00121 * @endverbatim 00122 */ 00123 00124 /*@{ */ /* Begin grouped definitions */ 00125 00126 #ifdef CONFIG_WINDOWS 00127 #define JVMCFG_PATHNAME_DELIMITER_CHAR '\\' 00128 #define JVMCFG_PATHNAME_DELIMITER_STRING "\\" 00129 00130 #define JVMCFG_EXTENSION_DELIMITER_CHAR '.' 00131 #define JVMCFG_EXTENSION_DELIMITER_STRING "." 00132 00133 #else 00134 #define JVMCFG_PATHNAME_DELIMITER_CHAR '/' 00135 #define JVMCFG_PATHNAME_DELIMITER_STRING "/" 00136 00137 #define JVMCFG_EXTENSION_DELIMITER_CHAR '.' 00138 #define JVMCFG_EXTENSION_DELIMITER_STRING "." 00139 00140 #endif 00141 00142 /*@} */ /* End of grouped definitions */ 00143 00144 00145 /*! 00146 * @brief Descriptor for strings. 00147 * 00148 * Use this descriptor for manually loading startup class 00149 * @c @b java.lang.String objects. 00150 * 00151 * Resolves to "Ljava/lang/String;" 00152 * 00153 */ 00154 #define JVMCFG_MANUAL_STRING_DESCRIPTOR \ 00155 BASETYPE_STRING_L JVMCLASS_JAVA_LANG_STRING BASETYPE_STRING_L_TERM 00156 00157 00158 /*! 00159 * @name Individual command line tokens 00160 * 00161 */ 00162 00163 /*@{ */ /* Begin grouped definitions */ 00164 00165 /*! 00166 * @brief Command line declaring that startup class is in a @b JAR file 00167 * and the name of that file. 00168 * 00169 */ 00170 #define JVMCFG_JARFILE_STARTCLASS_PARM "-jar" 00171 00172 00173 /*! 00174 * @brief Command line option to show command line help. 00175 * 00176 */ 00177 #define JVMCFG_COMMAND_LINE_HELP_PARM "-help" 00178 00179 00180 /*! 00181 * @brief Command line option to show software license. 00182 * 00183 */ 00184 #define JVMCFG_COMMAND_LINE_LICENSE_PARM "-license" 00185 00186 00187 /*! 00188 * @brief Command line option to show program version number. 00189 * 00190 */ 00191 #define JVMCFG_COMMAND_LINE_VERSION_PARM "-version" 00192 00193 00194 /*! 00195 * @brief Command line option to show program copyright message. 00196 * 00197 */ 00198 #define JVMCFG_COMMAND_LINE_COPYRIGHT_PARM "-copyright" 00199 00200 00201 /*! 00202 * @brief Command line option to show program options. 00203 * 00204 */ 00205 #define JVMCFG_COMMAND_LINE_SHOW_PARM "-show" 00206 00207 /*@} */ /* End of grouped definitions */ 00208 00209 00210 /*! 00211 * @name Environment variable names 00212 * 00213 * @brief Environment variables used by Java. 00214 * 00215 * Each one of these may be overridden from the command line. 00216 */ 00217 00218 /*@{ */ /* Begin grouped definitions */ 00219 00220 #define JVMCFG_ENVIRONMENT_VARIABLE_JAVA_HOME "JAVA_HOME" 00221 #define JVMCFG_ENVIRONMENT_VARIABLE_CLASSPATH "CLASSPATH" 00222 #define JVMCFG_ENVIRONMENT_VARIABLE_BOOTCLASSPATH "BOOTCLASSPATH" 00223 00224 /*@} */ /* End of grouped definitions */ 00225 00226 00227 /*! 00228 * @name Default environment variable definitions 00229 * 00230 */ 00231 00232 /*@{ */ /* Begin grouped definitions */ 00233 00234 /*! 00235 * @internal Hard-coded @b CLASSPATH for test purposes. 00236 * Set to any desired value and uncomment for use. 00237 */ 00238 /* #define JVMCFG_HARDCODED_TEST_CLASSPATH \ 00239 "/tmp:/usr/tmp:/usr/local/tmp" 00240 */ 00241 00242 00243 /*! 00244 * @brief Default @b JAVA_HOME . 00245 * 00246 * Set the default value of the @b JAVA_HOME environment 00247 * variable to an @link #rnull rnull@endlink pointer. 00248 */ 00249 #define JVMCFG_JAVA_HOME_DEFAULT rnull 00250 00251 00252 /*! 00253 * @brief Default @b CLASSPATH to current directory only. 00254 * 00255 */ 00256 #define JVMCFG_CLASSPATH_DEFAULT ((const rchar *) ".") 00257 00258 /*! 00259 * @brief Default @b BOOTCLASSPATH to our temp area. 00260 * 00261 * This area starts out empty, meaning that nothing will be found 00262 * there to boot from, but a default of some sort is needed. May 00263 * be overridden by 00264 * @link #JVMCFG_BOOTCLASSPATH_FULL_PARM -Xbootclasspath@endlink. 00265 * 00266 */ 00267 #define JVMCFG_BOOTCLASSPATH_DEFAULT tmparea_get() 00268 00269 /*@} */ /* End of grouped definitions */ 00270 00271 00272 /*! 00273 * @name -Xjava_home token and its aliases 00274 * 00275 * @brief Command line options defining @b JAVA_HOME instead. 00276 * of the environment variable 00277 * 00278 */ 00279 00280 /*@{ */ /* Begin grouped definitions */ 00281 00282 #define JVMCFG_JAVA_HOME_ABBREV_PARM "-Xjh" 00283 #define JVMCFG_JAVA_HOME_MID_PARM "-Xjavahome" 00284 #define JVMCFG_JAVA_HOME_FULL_PARM "-Xjava_home" 00285 00286 /*@} */ /* End of grouped definitions */ 00287 00288 00289 /*! 00290 * @name -classpath token and its alises 00291 * 00292 * @brief Command line options defining @b CLASSPATH instead of 00293 * using the environment variable. 00294 * 00295 */ 00296 00297 /*@{ */ /* Begin grouped definitions */ 00298 00299 #define JVMCFG_CLASSPATH_ABBREV_PARM "-cp" 00300 #define JVMCFG_CLASSPATH_FULL_PARM "-classpath" 00301 00302 /*@} */ /* End of grouped definitions */ 00303 00304 00305 /*! 00306 * @name -Xbootclasspath token and its aliases 00307 * 00308 * @brief Command line options defining @b BOOTCLASSPATH instead of 00309 * using the environment variable. 00310 * 00311 */ 00312 00313 /*@{ */ /* Begin grouped definitions */ 00314 00315 #define JVMCFG_BOOTCLASSPATH_ABBREV_PARM "-Xbcp" 00316 #define JVMCFG_BOOTCLASSPATH_FULL_PARM "-Xbootclasspath" 00317 00318 /*@} */ /* End of grouped definitions */ 00319 00320 00321 /*! 00322 * @name -Xdebug_level token and its aliases 00323 * 00324 * @brief Command line options defining debug message level. 00325 * 00326 */ 00327 00328 /*@{ */ /* Begin grouped definitions */ 00329 00330 #define JVMCFG_DEBUGMSGLEVEL_ABBREV_PARM "-Xdebug" 00331 #define JVMCFG_DEBUGMSGLEVEL_MID_PARM "-Xdebuglevel" 00332 #define JVMCFG_DEBUGMSGLEVEL_FULL_PARM "-Xdebug_level" 00333 00334 /*@} */ /* End of grouped definitions */ 00335 00336 00337 /*! 00338 * @name Native method support 00339 * 00340 */ 00341 00342 /*@{ */ /* Begin grouped definitions */ 00343 00344 /*! 00345 * @brief Native method registration method name. 00346 * 00347 */ 00348 #define JVMCFG_REGISTER_NATIVES_METHOD "registerNatives" 00349 00350 /*! 00351 * @brief Native method registration method descriptor. 00352 * 00353 * Resolves to "()V" 00354 * 00355 */ 00356 #define JVMCFG_REGISTER_NATIVES_PARMS \ 00357 METHOD_STRING_OPEN_PARM \ 00358 METHOD_STRING_CLOSE_PARM \ 00359 METHOD_STRING_VOID 00360 00361 00362 /*! 00363 * @brief Native method unregistration method name. 00364 * 00365 */ 00366 #define JVMCFG_UNREGISTER_NATIVES_METHOD "unregisterNatives" 00367 00368 /*! 00369 * @brief Native method unregistration method descriptor. 00370 * 00371 * Resolves to "()V" 00372 * 00373 */ 00374 #define JVMCFG_UNREGISTER_NATIVES_PARMS \ 00375 METHOD_STRING_OPEN_PARM \ 00376 METHOD_STRING_CLOSE_PARM \ 00377 METHOD_STRING_VOID 00378 00379 /*! 00380 * @brief Ignore native method calls. 00381 * 00382 * If ignored, then return the same default value as is 00383 * default for field initializations (namely, zero, 00384 * @link #jfalse jfalse@endlink, @link #jnull jnull@endlink, etc.) 00385 * If not ignored, then attempt to run them. In both 00386 * cases, produce a return value as appropriate. 00387 * 00388 */ 00389 #define JVMCFG_IGNORE_NATIVE_METHOD_CALLS rtrue 00390 00391 /*@} */ /* End of grouped definitions */ 00392 00393 00394 /*! 00395 * @name main() method support 00396 * 00397 */ 00398 00399 /*@{ */ /* Begin grouped definitions */ 00400 00401 /*! 00402 * @brief Startup class' @c @b main() method name. 00403 * 00404 */ 00405 #define JVMCFG_MAIN_METHOD "main" 00406 00407 /*! 00408 * @brief Startup class' @c @b main() method parameter list. 00409 * 00410 * Resolves to "([Ljava/lang/String;)V" 00411 * 00412 */ 00413 #define JVMCFG_MAIN_PARMS METHOD_STRING_OPEN_PARM \ 00414 BASETYPE_STRING_ARRAY \ 00415 BASETYPE_STRING_L \ 00416 JVMCLASS_JAVA_LANG_STRING \ 00417 BASETYPE_STRING_L_TERM \ 00418 METHOD_STRING_CLOSE_PARM \ 00419 METHOD_STRING_VOID 00420 00421 /*! 00422 * @brief Startup class' @c @b main() method local variable index 00423 * for @c @b args[] 00424 * 00425 */ 00426 #define JVMCFG_MAIN_PARM_ARGV_INDEX 0 00427 00428 /*@} */ /* End of grouped definitions */ 00429 00430 00431 /*! 00432 * @name Exception handling support. 00433 * 00434 */ 00435 00436 /*@{ */ /* Begin grouped definitions */ 00437 00438 /*! 00439 * @brief Constructor to use for basic exception handling. 00440 * 00441 */ 00442 #define JVMCFG_EXCEPTION_DEFAULT_CONSTRUCTOR_DESCRIPTOR \ 00443 METHOD_STRING_OPEN_PARM \ 00444 METHOD_STRING_CLOSE_PARM \ 00445 METHOD_STRING_VOID 00446 00447 00448 /*! 00449 * @brief Uncaught exception method name. 00450 * 00451 */ 00452 #define JVMCFG_UNCAUGHT_EXCEPTION_METHOD "uncaughtException" 00453 00454 /*! 00455 * @brief Uncaught exception method parameter list. 00456 * 00457 * Resolves to "([Ljava/lang/Thread;[Ljava/lang/Throwable;)V" 00458 * 00459 */ 00460 #define JVMCFG_UNCAUGHT_EXCEPTION_PARMS METHOD_STRING_OPEN_PARM \ 00461 BASETYPE_STRING_ARRAY \ 00462 BASETYPE_STRING_L \ 00463 JVMCLASS_JAVA_LANG_THREAD \ 00464 BASETYPE_STRING_L_TERM \ 00465 BASETYPE_STRING_ARRAY \ 00466 BASETYPE_STRING_L \ 00467 JVMCLASS_JAVA_LANG_THROWABLE \ 00468 BASETYPE_STRING_L_TERM \ 00469 METHOD_STRING_CLOSE_PARM \ 00470 METHOD_STRING_VOID 00471 00472 /*@} */ /* End of grouped definitions */ 00473 00474 00475 /*! 00476 * @name Object finalization support. 00477 * 00478 */ 00479 00480 /*@{ */ /* Begin grouped definitions */ 00481 00482 /*! 00483 * Object finalize method name. 00484 */ 00485 #define JVMCFG_FINALIZE_OBJECT_METHOD "finalize" 00486 00487 /*! 00488 * Object finalize method descriptor. 00489 * 00490 * Resolves to "()V" 00491 * 00492 */ 00493 #define JVMCFG_FINALIZE_OBJECT_PARMS \ 00494 METHOD_STRING_OPEN_PARM \ 00495 METHOD_STRING_CLOSE_PARM \ 00496 METHOD_STRING_VOID 00497 00498 /*@} */ /* End of grouped definitions */ 00499 00500 00501 /*! 00502 * @name Array dimension support. 00503 * 00504 */ 00505 00506 /*@{ */ /* Begin grouped definitions */ 00507 00508 /*! 00509 * @brief Spec-defined number of array dimensions 00510 */ 00511 #define JVMCFG_MAX_ARRAY_DIMS CONSTANT_MAX_ARRAY_DIMS 00512 00513 /*! 00514 * @brief Array dimension type. 00515 */ 00516 typedef jubyte jvm_array_dim; 00517 00518 /*@} */ /* End of grouped definitions */ 00519 00520 00521 /*! 00522 * @name Interval timer support. 00523 * 00524 */ 00525 00526 /*@{ */ /* Begin grouped definitions */ 00527 00528 /*! 00529 * @brief JVM interval timer enable. 00530 * 00531 * When @link #rtrue rtrue@endlink, the timer runs normally. 00532 * Set it @link #rfalse rfalse@endlink typically only for debugging 00533 * the JVM outer loop logic or for debugging the interval timer logic 00534 * itself. 00535 * 00536 * @warning See warning about use of 00537 * @link #timeslice_tick() timeslice_tick()@endlink 00538 * and high-speed interval timing. 00539 * 00540 * @todo Make sure to enable the time slicer for normal JVM operation. 00541 * It may be handy to disable it for debugging, but no threading 00542 * will occur in the JVM outer loop until it is enabled! 00543 * 00544 */ 00545 #define JVMCFG_TIMESLICE_PERIOD_ENABLE rfalse 00546 00547 /*! 00548 * @brief JVM interval timer period (seconds) 00549 * 00550 * This value is typically zero (0) for normal operation. 00551 * Set it to any convenient number of seconds for debugging 00552 * the JVM outer loop. 00553 * 00554 * Setting both timer values to zero will disable the interval 00555 * timer completely. 00556 * 00557 * @warning See warning about use of 00558 * @link #timeslice_tick() timeslice_tick()@endlink 00559 * and high-speed interval timing. 00560 * 00561 */ 00562 #define JVMCFG_TIMESLICE_PERIOD_SECONDS 0 00563 00564 /*! 00565 * @brief JVM interval timer period (microseconds) 00566 * 00567 * For correct operation of the JVM interval timer at 1 kHz, 00568 * set this value to one thousand (1000). This will guarantee 00569 * that timer periods such as 00570 * @link java.lang.Thread.sleep() sleep()@endlink and 00571 * @link java.lang.Object.wait() wait()@endlink will work 00572 * according to their definitions. This value may be set 00573 * to some other value for debug purposes. 00574 * 00575 * Setting both timer values to zero will disable the interval 00576 * timer completely. 00577 * 00578 * @warning See warning about use of 00579 * @link #timeslice_tick() timeslice_tick()@endlink 00580 * and high-speed interval timing. 00581 * 00582 */ 00583 #define JVMCFG_TIMESLICE_PERIOD_MICROSECONDS 1000 /* 1000 := 1 ms*/ 00584 00585 00586 /*! 00587 * @brief Minimum number of seconds before 00588 * @link #timeslice_tick() timeslice_tick()@endlink starts 00589 * printing a short message at every timer tick. 00590 * 00591 * Print "timeslice_tick: tick" at every interval timer event. 00592 * If set to a non-zero value, typically for debug purposes, 00593 * @link #timeslice_tick() timeslice_tick()@endlink will start 00594 * reporting timer events through a standard error message 00595 * via @link #sysDbgMsg() sysDbgMsg()@endlink after the defined 00596 * number of seconds. It is effectively a delay value to enable 00597 * this message, but only after a certain run time has passed. 00598 * When using this facility, <em>absolutely sure</em> that the 00599 * value of @link #JVMCFG_TIMESLICE_PERIOD_SECONDS 00600 JVMCFG_TIMESLICE_PERIOD_SECONDS@endlink is large enough 00601 * that these reports do not overwhelm the standard error resource 00602 * and prohibit productive work. 00603 * 00604 * A value of zero (0) disables this facility. 00605 * 00606 */ 00607 #define JVMCFG_TIMESLICE_DEBUG_REPORT_MIN_SECONDS 0 00608 00609 /*@} */ /* End of grouped definitions */ 00610 00611 00612 /*! 00613 * @name Thread table support. 00614 * 00615 * @brief JVM Thread model definitions. 00616 * 00617 * @note Thread groups are supported by the class library. 00618 * 00619 * @note The @link #JVMCFG_NULL_THREAD JVMCFG_NULL_THREAD@endlink 00620 * is @e never used at run time. 00621 * 00622 * @note The @link #JVMCFG_SYSTEM_THREAD JVMCFG_SYSTEM_THREAD@endlink 00623 * will @e never be used within the context of the JVM execution 00624 * engine. Its purpose is ONLY for internal administration. 00625 * THEREFORE: there will @e never be a 00626 * @c @b java.lang.Thread object created for it! 00627 * 00628 */ 00629 00630 /*@{ */ /* Begin grouped definitions */ 00631 00632 #define JVMCFG_MAX_THREADS 1000 /* Total possible threads */ 00633 #ifdef I_AM_JVMCFG_C 00634 #define JVMCFG_NULL_THREAD 0 /* Never allocated */ 00635 #endif 00636 #define JVMCFG_SYSTEM_THREAD 1 /* System thread */ 00637 #define JVMCFG_GC_THREAD 2 /* Garbage collector thread */ 00638 #define JVMCFG_FIRST_THREAD 3 /* First allocatable thread */ 00639 00640 /* 00641 * Thread indices all use this type 00642 * 00643 * (See parallel definition for use 00644 * in public interface in 00645 * @link jvm/include/jlThread.h 00646 jlThread.h@endlink) 00647 */ 00648 typedef rushort jvm_thread_index; 00649 00650 /* Real machine NULL index for threads */ 00651 extern const jvm_thread_index jvm_thread_index_null; 00652 00653 #define JVMCFG_THREAD_NAME_SYSTEM "system" /* system thread */ 00654 #define JVMCFG_THREAD_NAME_GC "gc" /* Garbage collector thread*/ 00655 00656 /*@} */ /* End of grouped definitions */ 00657 00658 00659 /*! 00660 * @name Class file support 00661 * 00662 */ 00663 00664 /*@{ */ /* Begin grouped definitions */ 00665 00666 /*! 00667 * @brief Constant pool indices all use this type 00668 */ 00669 typedef u2 jvm_constant_pool_index; 00670 00671 /*! 00672 * @brief Real machine NULL constant_pool index 00673 */ 00674 extern const jvm_constant_pool_index jvm_constant_pool_index_null; 00675 00676 00677 /*! 00678 * @internal Due to the way the JVM spec defines the 00679 * @link ClassFile#interfaces interfaces@endlink 00680 * member as an array of @link #u2 u2@endlink, 00681 * it is technically a bad thing to redefine 00682 * such data type. However, in order to be consistent with all 00683 * of the other array index definitions, this will be done anyway: 00684 * 00685 */ 00686 00687 /*! 00688 * @brief Interface table indices all use this type 00689 * 00690 */ 00691 typedef u2 jvm_interface_index; 00692 00693 /*! 00694 * @brief Real machine BAD interface table index 00695 * 00696 */ 00697 extern const jvm_interface_index jvm_interface_index_bad; 00698 00699 /*! 00700 * @brief Bad interface slot, usually "not found" 00701 * 00702 */ 00703 #define JVMCFG_BAD_INTERFACE 65535 00704 00705 /*@} */ /* End of grouped definitions */ 00706 00707 00708 /*! 00709 * @name Class table support 00710 * 00711 */ 00712 00713 /*@{ */ /* Begin grouped definitions */ 00714 00715 /*! 00716 * @brief Max number of class allocations 00717 * 00718 */ 00719 #define JVMCFG_MAX_CLASSES 200 00720 00721 #ifdef I_AM_JVMCFG_C 00722 00723 /*! 00724 * @brief Null class slot coincides with hash 0 00725 * 00726 */ 00727 #define JVMCFG_NULL_CLASS 0 00728 #endif 00729 00730 /*! 00731 * @brief First object slot to allocate 00732 * 00733 */ 00734 #define JVMCFG_FIRST_CLASS 1 00735 00736 /*! 00737 * @brief Class indices all use this type 00738 * 00739 */ 00740 typedef rushort jvm_class_index; 00741 00742 /*! 00743 * @brief Real machine NULL index for classes 00744 */ 00745 extern const jvm_class_index jvm_class_index_null; 00746 00747 /*! 00748 * @brief Method table indices all use this type 00749 * 00750 */ 00751 typedef u2 jvm_method_index; 00752 00753 /*! 00754 * @brief Real machine BAD index for methods 00755 * 00756 */ 00757 extern const jvm_method_index jvm_method_index_bad; 00758 00759 /*! 00760 * @brief Bad method slot, usually "not found" 00761 * 00762 */ 00763 #define JVMCFG_BAD_METHOD 65535 00764 00765 00766 /*! 00767 * @brief Field table indices all use this type 00768 * 00769 */ 00770 typedef u2 jvm_field_index; 00771 00772 /*! 00773 * @brief Real machine NULL index for fields 00774 * 00775 */ 00776 extern const jvm_field_index jvm_field_index_bad; 00777 00778 /*! 00779 * @brief Bad field slot, usually "not found" 00780 * 00781 */ 00782 #define JVMCFG_BAD_FIELD 65535 00783 00784 /*! 00785 * @brief Field table lookups all use this type 00786 * 00787 */ 00788 typedef u2 jvm_field_lookup_index; 00789 00790 /*! 00791 * @brief Real machine NULL index for field lookups 00792 * 00793 */ 00794 extern const jvm_field_lookup_index jvm_field_lookup_index_bad; 00795 00796 /*! 00797 * @brief Bad lookup slot, usually "not found" 00798 * 00799 */ 00800 #define JVMCFG_BAD_FIELD_LOOKUP 65535 00801 00802 /*! 00803 * @brief Attribute table indices all use this type 00804 * 00805 */ 00806 typedef u2 jvm_attribute_index; 00807 00808 /*! 00809 * @brief Real machine NULL index for attributes 00810 * 00811 */ 00812 extern const jvm_attribute_index jvm_attribute_index_bad; 00813 00814 /*! 00815 * @brief Real machine marker for native method 00816 * 00817 */ 00818 extern const jvm_attribute_index jvm_attribute_index_native; 00819 00820 /*! 00821 * @brief Ordinal number for local native method 00822 * 00823 */ 00824 typedef unsigned int jvm_native_method_ordinal; 00825 00826 /*! 00827 * @brief Real machine NULL ordinal number for local native methods 00828 * 00829 */ 00830 extern const jvm_native_method_ordinal jvm_native_method_ordinal_null; 00831 00832 /*! 00833 * @brief Null local method slot, usually "not found". 00834 * 00835 * See also parallel definition 00836 * @link jvm/include/jlObject.h JLOBJECT_NMO_NULL@endlink 00837 * 00838 */ 00839 #define JVMCFG_JLOBJECT_NMO_NULL 0 00840 00841 /*! 00842 * @brief Real machine reserved ordinal number for registering 00843 * local native methods 00844 * 00845 */ 00846 extern 00847 const jvm_native_method_ordinal jvm_native_method_ordinal_register; 00848 00849 /*! 00850 * @brief Reserved local method slot for the 00851 * registration of @e local native methods. 00852 * 00853 * See also parallel definition 00854 * @link jvm/include/jlObject.h JLOBJECT_NMO_REGISTER@endlink 00855 * 00856 */ 00857 #define JVMCFG_JLOBJECT_NMO_REGISTER 1 00858 00859 /*! 00860 * @brief Real machine reserved ordinal number 00861 * for <em>un</em>-registering local native methods 00862 * 00863 */ 00864 extern 00865 const jvm_native_method_ordinal jvm_native_method_ordinal_unregister; 00866 00867 /*! 00868 * @brief Reserved local method slot for the 00869 * un-registration of @e local native methods. 00870 * 00871 * See also parallel definition 00872 * @link jvm/include/jlObject.h JLOBJECT_NMO_UNREGISTER@endlink 00873 * 00874 */ 00875 #define JVMCFG_JLOBJECT_NMO_UNREGISTER 2 00876 00877 /*! 00878 * @brief Bad attribute slot,usually "not found" 00879 * 00880 */ 00881 #define JVMCFG_BAD_ATTRIBUTE 65535 00882 00883 /*! 00884 * @brief Native method slot,no code attribute 00885 * 00886 */ 00887 #define JVMCFG_NATIVE_METHOD_ATTRIBUTE 65534 00888 00889 /*! 00890 * @brief UTF8 string table indices all use this type 00891 * 00892 */ 00893 typedef u2 jvm_utf_string_index; 00894 00895 /*! 00896 * @brief Unicode string table indices all use this type 00897 * 00898 */ 00899 typedef u2 jvm_unicode_string_index; 00900 00901 /*! 00902 * @brief Real machine BAD index for Unicode 00903 * 00904 */ 00905 extern const jvm_unicode_string_index jvm_unicode_string_index_bad; 00906 00907 /*! 00908 * @brief Bad unicode string slot, usually "not found" 00909 * 00910 */ 00911 #define JVMCFG_BAD_UNICODE_STRING 65535 00912 00913 /*@} */ /* End of grouped definitions */ 00914 00915 00916 /*! 00917 * @name Object table support 00918 * 00919 */ 00920 00921 /*@{ */ /* Begin grouped definitions */ 00922 00923 /*! 00924 * @brief Max number of object allocations 00925 * 00926 */ 00927 #define JVMCFG_MAX_OBJECTS 1000 00928 00929 #ifdef I_AM_JVMCFG_C 00930 /*! 00931 * @brief Null object slot coincides w/hash 0 00932 * 00933 */ 00934 #define JVMCFG_NULL_OBJECT 0 00935 #endif 00936 00937 /*! 00938 * @brief First object slot to allocate 00939 * 00940 */ 00941 #define JVMCFG_FIRST_OBJECT 1 00942 00943 /*! 00944 * @brief Object reference, corresponding to the 00945 * JNI type @c @b jobject 00946 * 00947 * See parallel definition for use in public interface in 00948 * @link jvm/include/jlObject.h jlObject.h@endlink 00949 * 00950 */ 00951 typedef ruint jvm_object_hash; 00952 00953 /*! 00954 * @brief Real machine NULL hash 00955 * 00956 */ 00957 extern const jvm_object_hash jvm_object_hash_null; 00958 00959 /*! 00960 * @brief Holds spec @link #ACC_PUBLIC ACC_xxx@endlink bit masks 00961 * 00962 */ 00963 typedef u2 jvm_access_flags; 00964 00965 /*! 00966 * @brief Holds object data type, such as @c @b I == Integer 00967 * 00968 */ 00969 typedef u1 jvm_basetype; 00970 00971 /*@} */ /* End of grouped definitions */ 00972 00973 00974 /*! 00975 * @name Stack size definitions 00976 * 00977 */ 00978 00979 /*@{ */ /* Begin grouped definitions */ 00980 00981 /*! 00982 * @brief Arbitrary max stack size, in bytes 00983 * 00984 * This value @e must be in increments of 4 bytes! 00985 * 00986 * @warning This value @e must be in increments of 4 bytes! (Get it?) 00987 * 00988 */ 00989 #define JVMCFG_STACK_SIZE (8 * 1024 * sizeof(jint)) 00990 00991 /*! 00992 * @brief Maximum stack pointer value 00993 * 00994 */ 00995 #define JVMCFG_MAX_SP (JVMCFG_STACK_SIZE - sizeof(jint)) 00996 00997 /*! 00998 * @brief Empty stack pointer value 00999 * 01000 */ 01001 #define JVMCFG_NULL_SP 0 01002 01003 /*! 01004 * @brief Stack pointer type 01005 * 01006 */ 01007 typedef jushort jvm_sp; 01008 01009 /*@} */ /* End of grouped definitions */ 01010 01011 01012 /*! 01013 * @name Program counter definitions 01014 * 01015 */ 01016 01017 /*@{ */ /* Begin grouped definitions */ 01018 01019 /*! 01020 * @brief Program counter offset into code area of a method 01021 * 01022 * This data type is used in jvm_pc. 01023 * 01024 */ 01025 typedef juint jvm_pc_offset; 01026 01027 /*! 01028 * @brief Invalid program counter offset 01029 * 01030 */ 01031 extern jvm_pc_offset jvm_pc_offset_bad; 01032 01033 /*@} */ /* End of grouped definitions */ 01034 01035 01036 /*! 01037 * @name Debug levels for sysDbgMsg(). 01038 * 01039 * @brief Set increasingly verbose debug message levels for sysDbgMsg(). 01040 * 01041 * Notice that the lowest debug message level setting 01042 * @link #DML0 DML0@endlink indicates that a message using 01043 * it is probablt a good candidate to be changed to the 01044 * unconditional sysErrMsg() function instead. 01045 * 01046 * @see jvmutil_set_dml() 01047 * 01048 * @see jvmutil_get_dml() 01049 * 01050 * @see sysDbgMsg() 01051 * 01052 */ 01053 01054 /*@{ */ /* Begin grouped definitions */ 01055 01056 typedef enum 01057 { 01058 DML0 = 0, /**< Only @e VITAL debug messages */ 01059 DML1 = 1, /**< Minimum amount of debug messages */ 01060 DML2 = 2, 01061 DML3 = 3, 01062 DML4 = 4, 01063 DML5 = 5, /**< Average amount of debug messages */ 01064 DML6 = 6, 01065 DML7 = 7, 01066 DML8 = 8, 01067 DML9 = 9, 01068 DML10 = 10 /**< Absolutely ALL debug messages */ 01069 01070 } jvm_debug_level_enum; 01071 01072 #define DMLOFF DML0 /**< Convenient alias for 01073 @link #DML0 DML0@endlink */ 01074 #define DMLMIN DML1 /**< Convenient alias for 01075 @link #DML0 DML1@endlink */ 01076 #define DMLNORM DML5 /**< Convenient alias for 01077 @link #DML0 DML5@endlink */ 01078 #define DMLMAX DML10 /**< Convenient alias for 01079 @link #DML0 DML10@endlink */ 01080 01081 01082 #define DMLDEFAULT DMLNORM /**< Initial debug level, may be 01083 * changed by command line parameter. 01084 */ 01085 01086 /*@} */ /* End of grouped definitions */ 01087 01088 01089 /*! 01090 * @name Arbitrary max buffer sizes 01091 * 01092 */ 01093 01094 /*@{ */ /* Begin grouped definitions */ 01095 01096 #define JVMCFG_STDIO_BFR 1024 /**< Convenient size for any stdio msg */ 01097 #define JVMCFG_PATH_MAX 1024 /**< Convenient size for any disk path */ 01098 #define JVMCFG_SCRIPT_MAX 1024 /**< Convenient size for a 01099 @c @b system(3) call */ 01100 01101 /*@} */ /* End of grouped definitions */ 01102 01103 01104 /*! 01105 * @name Standard I/O definitions 01106 * 01107 * The definitions of printf, fprint, and sprintf will co-opt @e all 01108 * usual standard I/O operations and encourage the use of the local 01109 * version of these functions. See 01110 *@link jvm/src/stdio.c stdio.c@endlink 01111 * for details on why this is so. 01112 * 01113 */ 01114 01115 /*@{ */ /* Begin grouped definitions */ 01116 01117 /*! 01118 * @brief Enable stderr debug messages using sysDbgMsg() format messages 01119 * 01120 * When disabled, @e no debug message will display. 01121 * The debug levels, including the default level 01122 * @link #DMLDEFAULT DMLDEFAULT@endlink, are defined in 01123 * @link jvm/src/util.h util.h@endlink. 01124 * 01125 */ 01126 #define JVMCFG_DEBUG_MESSAGE_ENABLE rtrue 01127 01128 /* Only defined in @link jvm/src/stdio.c stdio.c@endlink */ 01129 #ifndef SUPPRESS_STDIO_REDIRECTION 01130 01131 #define printf _printfLocal 01132 #define fprintf _fprintfLocal 01133 #define sprintf _sprintfLocal 01134 01135 #endif 01136 01137 /*! 01138 * @brief When desired, persuade Eclipse to flush its stdio buffers 01139 * better by invoking @c @b sleep(3) for <= 1 second (with arg of '1'). 01140 * 01141 */ 01142 #if 0 01143 #define JVMCFG_DEBUG_ECLIPSE_FLUSH_STDIO_BETTER sleep(1) 01144 #else 01145 #define JVMCFG_DEBUG_ECLIPSE_FLUSH_STDIO_BETTER 01146 #endif 01147 01148 /*! 01149 * @brief Same thing as @link #JVMCFG_DEBUG_ECLIPSE_FLUSH_STDIO_BETTER 01150 JVMCFG_DEBUG_ECLIPSE_FLUSH_STDIO_BETTER@endlink, but at end of 01151 * JVM run before exit, try to persuade Eclipse to flush @e all 01152 * standard I/O buffers before quitting JVM. 01153 * 01154 */ 01155 #define JVMCFG_DEBUG_ECLIPSE_FLUSH_STDIO_BETTER_EXIT sleep(1) 01156 01157 /*@} */ /* End of grouped definitions */ 01158 01159 01160 /*! 01161 * @name Initialization roll call globals 01162 * 01163 * Each of these symbols tracks a phase of jvm_init() in case there 01164 * is an error at some point and jvm_shutdown() needs to be called. 01165 * When that happens, only those initializion phases that were 01166 * complete are reversed and cleaned up. 01167 * 01168 */ 01169 01170 /*@{ */ /* Begin grouped definitions */ 01171 01172 extern rboolean jvm_timeslice_initialized; 01173 extern rboolean jvm_thread_initialized; 01174 extern rboolean jvm_class_initialized; 01175 extern rboolean jvm_object_initialized; 01176 extern rboolean jvm_argv_initialized; 01177 extern rboolean jvm_classpath_initialized; 01178 extern rboolean jvm_tmparea_initialized; 01179 extern rboolean jvm_heap_initialized; 01180 extern rboolean jvm_model_initialized; 01181 01182 /*@} */ /* End of grouped definitions */ 01183 01184 /*! 01185 * @name Temporary disk area script support 01186 * 01187 * @brief Shell scripts to support selected temporary area operations. 01188 * 01189 * Notice that @c @b mkdir(2) is used for creating this directory, but 01190 * that a shell script fragment @link 01191 #JVMCFG_TMPAREA_REMOVE_SCRIPT JVMCFG_TMPAREA_REMOVE_SCRIPT@endlink 01192 * is used for removing it. 01193 */ 01194 01195 /*@{ */ /* Begin grouped definitions */ 01196 01197 /*! 01198 * @brief Temporary area default when no @b TMPDIR environment variable 01199 */ 01200 #define JVMCFG_TMPAREA_DEFAULT "/tmp" 01201 01202 /*! 01203 * @brief Remove temporary directory 01204 */ 01205 #define JVMCFG_TMPAREA_REMOVE_SCRIPT "rm -rf %s" 01206 01207 /*@} */ /* End of grouped definitions */ 01208 01209 01210 /*! 01211 * @name JAR file structural items 01212 * 01213 * 01214 * @todo Write and implement DOS/Windows version of these scripts. 01215 * Perhaps a two- or three-line .BAT file is the thing to do? 01216 * 01217 */ 01218 01219 /*@{ */ /* Begin grouped definitions */ 01220 01221 #ifdef CONFIG_WINDOWS 01222 01223 /* Need Windows equivalents here... */ 01224 01225 #else 01226 01227 #define JVMCFG_JARFILE_DATA_EXTRACT_SCRIPT \ 01228 "chdir %s; %s/bin/jar -xf %s%c%s %s; chmod -R +w ." 01229 01230 #define JVMCFG_JARFILE_MANIFEST_EXTRACT_SCRIPT \ 01231 "chdir %s; %s/bin/jar -xf %s; chmod -R +w ." 01232 01233 #endif 01234 01235 #define JVMCFG_JARFILE_MANIFEST_FILENAME "META-INF/MANIFEST.MF" 01236 01237 #define JVMCFG_JARFILE_MANIFEST_MAIN_CLASS "Main-Class:" 01238 01239 #define JVMCFG_JARFILE_MANIFEST_LINE_MAX 72 01240 01241 /*@} */ /* End of grouped definitions */ 01242 01243 #endif /* _jvmcfg_h_included_ */ 01244 01245 01246 /* EOF */ 01247