Mercurial > hg > truffle
comparison src/share/vm/runtime/arguments.cpp @ 10270:f944ba972151
8014138: Add VM option to facilitate the writing of CDS tests
Summary: Added the -XX:SharedArchiveFile option.
Reviewed-by: coleenp, ccheung, acorn, dcubed, zgu
author | hseigel |
---|---|
date | Tue, 14 May 2013 09:17:52 -0400 |
parents | 735c995bf1a1 |
children | e484fe2abebd 2958af1d8c5a |
comparison
equal
deleted
inserted
replaced
10269:a9270d9ecb13 | 10270:f944ba972151 |
---|---|
3180 UNSUPPORTED_GC_OPTION(UseConcMarkSweepGC); | 3180 UNSUPPORTED_GC_OPTION(UseConcMarkSweepGC); |
3181 UNSUPPORTED_GC_OPTION(UseParNewGC); | 3181 UNSUPPORTED_GC_OPTION(UseParNewGC); |
3182 } | 3182 } |
3183 #endif // INCLUDE_ALL_GCS | 3183 #endif // INCLUDE_ALL_GCS |
3184 | 3184 |
3185 // Sharing support | |
3186 // Construct the path to the archive | |
3187 static char* get_shared_archive_path() { | |
3188 char *shared_archive_path; | |
3189 if (SharedArchiveFile == NULL) { | |
3190 char jvm_path[JVM_MAXPATHLEN]; | |
3191 os::jvm_path(jvm_path, sizeof(jvm_path)); | |
3192 char *end = strrchr(jvm_path, *os::file_separator()); | |
3193 if (end != NULL) *end = '\0'; | |
3194 size_t jvm_path_len = strlen(jvm_path); | |
3195 size_t file_sep_len = strlen(os::file_separator()); | |
3196 shared_archive_path = NEW_C_HEAP_ARRAY(char, jvm_path_len + | |
3197 file_sep_len + 20, mtInternal); | |
3198 if (shared_archive_path != NULL) { | |
3199 strncpy(shared_archive_path, jvm_path, jvm_path_len + 1); | |
3200 strncat(shared_archive_path, os::file_separator(), file_sep_len); | |
3201 strncat(shared_archive_path, "classes.jsa", 11); | |
3202 } | |
3203 } else { | |
3204 shared_archive_path = NEW_C_HEAP_ARRAY(char, strlen(SharedArchiveFile) + 1, mtInternal); | |
3205 if (shared_archive_path != NULL) { | |
3206 strncpy(shared_archive_path, SharedArchiveFile, strlen(SharedArchiveFile) + 1); | |
3207 } | |
3208 } | |
3209 return shared_archive_path; | |
3210 } | |
3211 | |
3185 // Parse entry point called from JNI_CreateJavaVM | 3212 // Parse entry point called from JNI_CreateJavaVM |
3186 | 3213 |
3187 jint Arguments::parse(const JavaVMInitArgs* args) { | 3214 jint Arguments::parse(const JavaVMInitArgs* args) { |
3188 | |
3189 // Sharing support | |
3190 // Construct the path to the archive | |
3191 char jvm_path[JVM_MAXPATHLEN]; | |
3192 os::jvm_path(jvm_path, sizeof(jvm_path)); | |
3193 char *end = strrchr(jvm_path, *os::file_separator()); | |
3194 if (end != NULL) *end = '\0'; | |
3195 char *shared_archive_path = NEW_C_HEAP_ARRAY(char, strlen(jvm_path) + | |
3196 strlen(os::file_separator()) + 20, mtInternal); | |
3197 if (shared_archive_path == NULL) return JNI_ENOMEM; | |
3198 strcpy(shared_archive_path, jvm_path); | |
3199 strcat(shared_archive_path, os::file_separator()); | |
3200 strcat(shared_archive_path, "classes"); | |
3201 strcat(shared_archive_path, ".jsa"); | |
3202 SharedArchivePath = shared_archive_path; | |
3203 | 3215 |
3204 // Remaining part of option string | 3216 // Remaining part of option string |
3205 const char* tail; | 3217 const char* tail; |
3206 | 3218 |
3207 // If flag "-XX:Flags=flags-file" is used it will be the first option to be processed. | 3219 // If flag "-XX:Flags=flags-file" is used it will be the first option to be processed. |
3287 | 3299 |
3288 // Parse JavaVMInitArgs structure passed in, as well as JAVA_TOOL_OPTIONS and _JAVA_OPTIONS | 3300 // Parse JavaVMInitArgs structure passed in, as well as JAVA_TOOL_OPTIONS and _JAVA_OPTIONS |
3289 jint result = parse_vm_init_args(args); | 3301 jint result = parse_vm_init_args(args); |
3290 if (result != JNI_OK) { | 3302 if (result != JNI_OK) { |
3291 return result; | 3303 return result; |
3304 } | |
3305 | |
3306 // Call get_shared_archive_path() here, after possible SharedArchiveFile option got parsed. | |
3307 SharedArchivePath = get_shared_archive_path(); | |
3308 if (SharedArchivePath == NULL) { | |
3309 return JNI_ENOMEM; | |
3292 } | 3310 } |
3293 | 3311 |
3294 // Delay warning until here so that we've had a chance to process | 3312 // Delay warning until here so that we've had a chance to process |
3295 // the -XX:-PrintWarnings flag | 3313 // the -XX:-PrintWarnings flag |
3296 if (needs_hotspotrc_warning) { | 3314 if (needs_hotspotrc_warning) { |