Mercurial > hg > graal-jvmci-8
comparison src/share/vm/runtime/arguments.cpp @ 4155:394404b2d9bd
Removed strict requirement for GRAAL environment variable. It only needs to be set now if the graal directory is not in the directory hierarchy of GraalVM JDK.
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Wed, 21 Dec 2011 11:25:27 +0100 |
parents | 04b9a2566eec |
children | 2af849af1723 |
comparison
equal
deleted
inserted
replaced
4154:9a4f210abb5e | 4155:394404b2d9bd |
---|---|
2009 return check_memory_size(*long_arg, min_size); | 2009 return check_memory_size(*long_arg, min_size); |
2010 } | 2010 } |
2011 | 2011 |
2012 // Parse JavaVMInitArgs structure | 2012 // Parse JavaVMInitArgs structure |
2013 | 2013 |
2014 static void prepend_to_graal_classpath(SysClassPath &cp, const char* graal_dir, const char* project) { | |
2015 const int BUFFER_SIZE = 1024; | |
2016 char path[BUFFER_SIZE]; | |
2017 | |
2018 sprintf(path, "%s/%s/bin", graal_dir, project); | |
2019 DIR* dir = os::opendir(path); | |
2020 if (dir == NULL) { | |
2021 jio_fprintf(defaultStream::output_stream(), "Error while starting Graal VM: The Graal class directory %s could not be opened.\n", path); | |
2022 vm_exit(1); | |
2023 } | |
2024 os::closedir(dir); | |
2025 cp.add_prefix(path); | |
2026 } | |
2027 | |
2028 // Walk up the directory hierarchy starting from JAVA_HOME looking | |
2029 // for a directory named "graal". If found, then the full path to | |
2030 // this directory is returned in graal_dir. | |
2031 static bool find_graal_dir(char* graal_dir) { | |
2032 strcpy(graal_dir, Arguments::get_java_home()); | |
2033 char* end = graal_dir + strlen(graal_dir); | |
2034 while (end != graal_dir) { | |
2035 strcat(graal_dir, "/graal"); | |
2036 DIR* dir = os::opendir(graal_dir); | |
2037 if (dir != NULL) { | |
2038 os::closedir(dir); | |
2039 return true; | |
2040 } | |
2041 *end = 0; | |
2042 while (end != graal_dir) { | |
2043 if (*end == '/') { | |
2044 *end = 0; | |
2045 break; | |
2046 } | |
2047 end--; | |
2048 } | |
2049 } | |
2050 return false; | |
2051 } | |
2052 | |
2014 jint Arguments::parse_vm_init_args(const JavaVMInitArgs* args) { | 2053 jint Arguments::parse_vm_init_args(const JavaVMInitArgs* args) { |
2015 // For components of the system classpath. | 2054 // For components of the system classpath. |
2016 SysClassPath scp(Arguments::get_sysclasspath()); | 2055 SysClassPath scp(Arguments::get_sysclasspath()); |
2017 bool scp_assembly_required = false; | 2056 bool scp_assembly_required = false; |
2018 | 2057 |
2041 if (PrintVMOptions) { | 2080 if (PrintVMOptions) { |
2042 tty->print_cr("Running Graal VM... "); | 2081 tty->print_cr("Running Graal VM... "); |
2043 } | 2082 } |
2044 const int BUFFER_SIZE = 1024; | 2083 const int BUFFER_SIZE = 1024; |
2045 char graal_dir[BUFFER_SIZE]; | 2084 char graal_dir[BUFFER_SIZE]; |
2046 char temp[BUFFER_SIZE]; | |
2047 if (!os::getenv("GRAAL", graal_dir, sizeof(graal_dir))) { | 2085 if (!os::getenv("GRAAL", graal_dir, sizeof(graal_dir))) { |
2048 jio_fprintf(defaultStream::output_stream(), "Error while starting Graal VM: The GRAAL environment variable needs to point to the directory containing the Graal projects.\n"); | 2086 if (find_graal_dir(graal_dir) == false) { |
2049 vm_exit(0); | 2087 jio_fprintf(defaultStream::output_stream(), "Error while starting Graal VM: The GRAAL environment variable needs to point to the directory containing the Graal projects.\n"); |
2088 vm_exit(0); | |
2089 } | |
2050 } | 2090 } |
2051 if (PrintVMOptions) tty->print_cr("GRAAL=%s", graal_dir); | 2091 if (PrintVMOptions) tty->print_cr("GRAAL=%s", graal_dir); |
2052 SysClassPath scp_compiler(Arguments::get_sysclasspath()); | 2092 |
2053 sprintf(temp, "%s/com.oracle.max.cri/bin", graal_dir); | 2093 SysClassPath scp_compiler(Arguments::get_sysclasspath()); |
2054 scp_compiler.add_prefix(temp); | 2094 prepend_to_graal_classpath(scp_compiler, graal_dir, "com.oracle.max.cri"); |
2055 sprintf(temp, "%s/com.oracle.max.criutils/bin", graal_dir); | 2095 prepend_to_graal_classpath(scp_compiler, graal_dir, "com.oracle.max.criutils"); |
2056 scp_compiler.add_prefix(temp); | 2096 prepend_to_graal_classpath(scp_compiler, graal_dir, "com.oracle.max.base"); |
2057 sprintf(temp, "%s/com.oracle.max.base/bin", graal_dir); | 2097 prepend_to_graal_classpath(scp_compiler, graal_dir, "com.oracle.max.asmdis"); |
2058 scp_compiler.add_prefix(temp); | 2098 prepend_to_graal_classpath(scp_compiler, graal_dir, "com.oracle.max.asm"); |
2059 sprintf(temp, "%s/com.oracle.max.asmdis/bin", graal_dir); | 2099 prepend_to_graal_classpath(scp_compiler, graal_dir, "com.oracle.max.graal.graph"); |
2060 scp_compiler.add_prefix(temp); | 2100 prepend_to_graal_classpath(scp_compiler, graal_dir, "com.oracle.max.graal.compiler"); |
2061 sprintf(temp, "%s/com.oracle.max.asm/bin", graal_dir); | 2101 prepend_to_graal_classpath(scp_compiler, graal_dir, "com.oracle.max.graal.nodes"); |
2062 scp_compiler.add_prefix(temp); | 2102 prepend_to_graal_classpath(scp_compiler, graal_dir, "com.oracle.max.graal.snippets"); |
2063 sprintf(temp, "%s/com.oracle.max.graal.graph/bin", graal_dir); | 2103 prepend_to_graal_classpath(scp_compiler, graal_dir, "com.oracle.max.graal.hotspot"); |
2064 scp_compiler.add_prefix(temp); | 2104 scp_compiler.expand_endorsed(); |
2065 sprintf(temp, "%s/com.oracle.max.graal.compiler/bin", graal_dir); | 2105 |
2066 scp_compiler.add_prefix(temp); | 2106 Arguments::set_compilerclasspath(scp_compiler.combined_path()); |
2067 sprintf(temp, "%s/com.oracle.max.graal.nodes/bin", graal_dir); | |
2068 scp_compiler.add_prefix(temp); | |
2069 sprintf(temp, "%s/com.oracle.max.graal.snippets/bin", graal_dir); | |
2070 scp_compiler.add_prefix(temp); | |
2071 sprintf(temp, "%s/com.oracle.max.graal.criutils/bin", graal_dir); | |
2072 scp_compiler.add_prefix(temp); | |
2073 sprintf(temp, "%s/com.oracle.max.graal.hotspot/bin", graal_dir); | |
2074 scp_compiler.add_prefix(temp); | |
2075 scp_compiler.expand_endorsed(); | |
2076 Arguments::set_compilerclasspath(scp_compiler.combined_path()); | |
2077 } | 2107 } |
2078 | 2108 |
2079 if (AggressiveOpts) { | 2109 if (AggressiveOpts) { |
2080 // Insert alt-rt.jar between user-specified bootclasspath | 2110 // Insert alt-rt.jar between user-specified bootclasspath |
2081 // prefix and the default bootclasspath. os::set_boot_path() | 2111 // prefix and the default bootclasspath. os::set_boot_path() |