src/java.base/share/native/libjli/java.c

Print this page




 152 
 153 #define ARG_CHECK(AC_arg_count, AC_failure_message, AC_questionable_arg) \
 154     do { \
 155         if (AC_arg_count < 1) { \
 156             JLI_ReportErrorMessage(AC_failure_message, AC_questionable_arg); \
 157             printUsage = JNI_TRUE; \
 158             *pret = 1; \
 159             return JNI_TRUE; \
 160         } \
 161     } while (JNI_FALSE)
 162 
 163 /*
 164  * Running Java code in primordial thread caused many problems. We will
 165  * create a new thread to invoke JVM. See 6316197 for more information.
 166  */
 167 static jlong threadStackSize    = 0;  /* stack size of the new thread */
 168 static jlong maxHeapSize        = 0;  /* max heap size */
 169 static jlong initialHeapSize    = 0;  /* inital heap size */
 170 
 171 /*







 172  * Entry point.
 173  */
 174 int
 175 JLI_Launch(int argc, char ** argv,              /* main argc, argc */
 176         int jargc, const char** jargv,          /* java args */
 177         int appclassc, const char** appclassv,  /* app classpath */
 178         const char* fullversion,                /* full version defined */
 179         const char* dotversion,                 /* dot version defined */
 180         const char* pname,                      /* program name */
 181         const char* lname,                      /* launcher name */
 182         jboolean javaargs,                      /* JAVA_ARGS */
 183         jboolean cpwildcard,                    /* classpath wildcard*/
 184         jboolean javaw,                         /* windows-only javaw */
 185         jint ergo                               /* ergonomics class policy */
 186 )
 187 {
 188     int mode = LM_UNKNOWN;
 189     char *what = NULL;
 190     char *cpath = 0;
 191     char *main_class = NULL;


 756     if (numOptions >= maxOptions) {
 757         if (options == 0) {
 758             maxOptions = 4;
 759             options = JLI_MemAlloc(maxOptions * sizeof(JavaVMOption));
 760         } else {
 761             JavaVMOption *tmp;
 762             maxOptions *= 2;
 763             tmp = JLI_MemAlloc(maxOptions * sizeof(JavaVMOption));
 764             memcpy(tmp, options, numOptions * sizeof(JavaVMOption));
 765             JLI_MemFree(options);
 766             options = tmp;
 767         }
 768     }
 769     options[numOptions].optionString = str;
 770     options[numOptions++].extraInfo = info;
 771 
 772     if (JLI_StrCCmp(str, "-Xss") == 0) {
 773         jlong tmp;
 774         if (parse_size(str + 4, &tmp)) {
 775             threadStackSize = tmp;








 776         }
 777     }
 778 
 779     if (JLI_StrCCmp(str, "-Xmx") == 0) {
 780         jlong tmp;
 781         if (parse_size(str + 4, &tmp)) {
 782             maxHeapSize = tmp;
 783         }
 784     }
 785 
 786     if (JLI_StrCCmp(str, "-Xms") == 0) {
 787         jlong tmp;
 788         if (parse_size(str + 4, &tmp)) {
 789            initialHeapSize = tmp;
 790         }
 791     }
 792 }
 793 
 794 static void
 795 SetClassPath(const char *s)




 152 
 153 #define ARG_CHECK(AC_arg_count, AC_failure_message, AC_questionable_arg) \
 154     do { \
 155         if (AC_arg_count < 1) { \
 156             JLI_ReportErrorMessage(AC_failure_message, AC_questionable_arg); \
 157             printUsage = JNI_TRUE; \
 158             *pret = 1; \
 159             return JNI_TRUE; \
 160         } \
 161     } while (JNI_FALSE)
 162 
 163 /*
 164  * Running Java code in primordial thread caused many problems. We will
 165  * create a new thread to invoke JVM. See 6316197 for more information.
 166  */
 167 static jlong threadStackSize    = 0;  /* stack size of the new thread */
 168 static jlong maxHeapSize        = 0;  /* max heap size */
 169 static jlong initialHeapSize    = 0;  /* inital heap size */
 170 
 171 /*
 172  * A minimum -Xss stack size suitable for all platforms.
 173  */
 174 #ifndef STACK_SIZE_MINIMUM
 175 #define STACK_SIZE_MINIMUM (32 * KB)
 176 #endif 
 177 
 178 /*
 179  * Entry point.
 180  */
 181 int
 182 JLI_Launch(int argc, char ** argv,              /* main argc, argc */
 183         int jargc, const char** jargv,          /* java args */
 184         int appclassc, const char** appclassv,  /* app classpath */
 185         const char* fullversion,                /* full version defined */
 186         const char* dotversion,                 /* dot version defined */
 187         const char* pname,                      /* program name */
 188         const char* lname,                      /* launcher name */
 189         jboolean javaargs,                      /* JAVA_ARGS */
 190         jboolean cpwildcard,                    /* classpath wildcard*/
 191         jboolean javaw,                         /* windows-only javaw */
 192         jint ergo                               /* ergonomics class policy */
 193 )
 194 {
 195     int mode = LM_UNKNOWN;
 196     char *what = NULL;
 197     char *cpath = 0;
 198     char *main_class = NULL;


 763     if (numOptions >= maxOptions) {
 764         if (options == 0) {
 765             maxOptions = 4;
 766             options = JLI_MemAlloc(maxOptions * sizeof(JavaVMOption));
 767         } else {
 768             JavaVMOption *tmp;
 769             maxOptions *= 2;
 770             tmp = JLI_MemAlloc(maxOptions * sizeof(JavaVMOption));
 771             memcpy(tmp, options, numOptions * sizeof(JavaVMOption));
 772             JLI_MemFree(options);
 773             options = tmp;
 774         }
 775     }
 776     options[numOptions].optionString = str;
 777     options[numOptions++].extraInfo = info;
 778 
 779     if (JLI_StrCCmp(str, "-Xss") == 0) {
 780         jlong tmp;
 781         if (parse_size(str + 4, &tmp)) {
 782             threadStackSize = tmp;
 783             /*
 784              * Make sure the thread stack size is big enough that we won't get a stack
 785              * overflow before the JVM startup code can check to make sure the stack
 786              * is big enough.
 787              */
 788             if (threadStackSize < STACK_SIZE_MINIMUM) {
 789               threadStackSize = STACK_SIZE_MINIMUM;
 790             }
 791         }
 792     }
 793 
 794     if (JLI_StrCCmp(str, "-Xmx") == 0) {
 795         jlong tmp;
 796         if (parse_size(str + 4, &tmp)) {
 797             maxHeapSize = tmp;
 798         }
 799     }
 800 
 801     if (JLI_StrCCmp(str, "-Xms") == 0) {
 802         jlong tmp;
 803         if (parse_size(str + 4, &tmp)) {
 804            initialHeapSize = tmp;
 805         }
 806     }
 807 }
 808 
 809 static void
 810 SetClassPath(const char *s)