#include "config.h"
+#include <stdint.h>
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/utsname.h>
-#include "vm/types.h"
-
#include "mm/memory.h"
#include "native/jni.h"
#include "native/llni.h"
-#include "vm/global.h" /* required by java_lang_String.h */
-#include "native/include/java_lang_String.h"
-
#include "toolbox/list.h"
#include "toolbox/util.h"
+#include "vm/global.h"
#include "vm/properties.h"
-#include "vm/stringlocal.h"
-#include "vm/vm.h"
+#include "vm/string.hpp"
+#include "vm/vm.hpp"
#include "vm/jit/asmpart.h"
#include "vmcore/class.h"
#include "vmcore/method.h"
#include "vmcore/options.h"
-#include "vmcore/system.h"
+#include "vmcore/os.hpp"
/* internal property structure ************************************************/
typedef struct list_properties_entry_t list_properties_entry_t;
struct list_properties_entry_t {
- char *key;
- char *value;
+ const char* key;
+ const char* value;
listnode_t linkage;
};
char *extdirs;
char *endorseddirs;
-# if defined(WITH_CLASSPATH_GNU)
+# if defined(WITH_JAVA_RUNTIME_LIBRARY_GNU_CLASSPATH)
char *cwd;
char *env_user;
char *env_home;
# endif
#endif
-#if defined(WITH_JRE_LAYOUT)
+#if defined(ENABLE_JRE_LAYOUT)
/* SUN also uses a buffer of 4096-bytes (strace is your friend). */
p = MNEW(char, 4096);
Now let's strip two levels. */
- p = system_dirname(p);
- p = system_dirname(p);
+ p = os_dirname(p);
+ p = os_dirname(p);
-# if defined(WITH_CLASSPATH_GNU)
+# if defined(WITH_JAVA_RUNTIME_LIBRARY_GNU_CLASSPATH)
/* Set java.home. */
strcpy(boot_library_path, java_home);
strcat(boot_library_path, "/lib/classpath");
-# elif defined(WITH_CLASSPATH_SUN)
+# elif defined(WITH_JAVA_RUNTIME_LIBRARY_OPENJDK)
/* Find correct java.home. We check if there is a JRE
co-located. */
/* Check if that libjvm.so exists. */
- if (system_access(java_home, F_OK) == 0) {
+ if (os_access(java_home, F_OK) == 0) {
/* Yes, we add /jre to java.home. */
strcpy(java_home, p);
#else
java_home = CACAO_PREFIX;
-# if defined(WITH_CLASSPATH_GNU)
+# if defined(WITH_JAVA_RUNTIME_LIBRARY_GNU_CLASSPATH)
- boot_library_path = CLASSPATH_LIBDIR"/classpath";
+ boot_library_path = JAVA_RUNTIME_LIBRARY_LIBDIR"/classpath";
-# elif defined(WITH_CLASSPATH_SUN)
+# elif defined(WITH_JAVA_RUNTIME_LIBRARY_OPENJDK)
- boot_library_path = CLASSPATH_LIBDIR;
+ boot_library_path = JAVA_RUNTIME_LIBRARY_LIBDIR;
-# elif defined(WITH_CLASSPATH_CLDC1_1)
+# elif defined(WITH_JAVA_RUNTIME_LIBRARY_CLDC1_1)
/* No boot_library_path required. */
strcpy(boot_class_path, p);
}
else {
-#if defined(WITH_JRE_LAYOUT)
-# if defined(WITH_CLASSPATH_GNU)
+#if defined(ENABLE_JRE_LAYOUT)
+# if defined(WITH_JAVA_RUNTIME_LIBRARY_GNU_CLASSPATH)
len =
strlen(java_home) + strlen("/share/cacao/vm.zip:") +
strcat(boot_class_path, java_home);
strcat(boot_class_path, "/share/classpath/glibj.zip");
-# elif defined(WITH_CLASSPATH_SUN)
+# elif defined(WITH_JAVA_RUNTIME_LIBRARY_OPENJDK)
/* This is the bootclasspath taken from HotSpot (see
hotspot/src/share/vm/runtime/os.cpp
# error unknown classpath configuration
# endif
#else
-# if defined(WITH_CLASSPATH_GNU)
+# if defined(WITH_JAVA_RUNTIME_LIBRARY_GNU_CLASSPATH)
len =
strlen(CACAO_VM_ZIP) +
strlen(":") +
- strlen(CLASSPATH_CLASSES) +
+ strlen(JAVA_RUNTIME_LIBRARY_CLASSES) +
strlen("0");
boot_class_path = MNEW(char, len);
strcpy(boot_class_path, CACAO_VM_ZIP);
strcat(boot_class_path, ":");
- strcat(boot_class_path, CLASSPATH_CLASSES);
+ strcat(boot_class_path, JAVA_RUNTIME_LIBRARY_CLASSES);
-# elif defined(WITH_CLASSPATH_SUN)
+# elif defined(WITH_JAVA_RUNTIME_LIBRARY_OPENJDK)
/* This is the bootclasspath taken from HotSpot (see
hotspot/src/share/vm/runtime/os.cpp
(os::set_boot_path)). */
len =
- strlen(CLASSPATH_PREFIX"/lib/resources.jar:") +
- strlen(CLASSPATH_PREFIX"/lib/rt.jar:") +
- strlen(CLASSPATH_PREFIX"/lib/sunrsasign.jar:") +
- strlen(CLASSPATH_PREFIX"/lib/jsse.jar:") +
- strlen(CLASSPATH_PREFIX"/lib/jce.jar:") +
- strlen(CLASSPATH_PREFIX"/lib/charsets.jar:") +
- strlen(CLASSPATH_PREFIX"/classes") +
+ strlen(JAVA_RUNTIME_LIBRARY_PREFIX"/lib/resources.jar:") +
+ strlen(JAVA_RUNTIME_LIBRARY_PREFIX"/lib/rt.jar:") +
+ strlen(JAVA_RUNTIME_LIBRARY_PREFIX"/lib/sunrsasign.jar:") +
+ strlen(JAVA_RUNTIME_LIBRARY_PREFIX"/lib/jsse.jar:") +
+ strlen(JAVA_RUNTIME_LIBRARY_PREFIX"/lib/jce.jar:") +
+ strlen(JAVA_RUNTIME_LIBRARY_PREFIX"/lib/charsets.jar:") +
+ strlen(JAVA_RUNTIME_LIBRARY_PREFIX"/classes") +
strlen("0");
boot_class_path = MNEW(char, len);
- strcpy(boot_class_path, CLASSPATH_PREFIX"/lib/resources.jar:");
- strcat(boot_class_path, CLASSPATH_PREFIX"/lib/rt.jar:");
- strcat(boot_class_path, CLASSPATH_PREFIX"/lib/sunrsasign.jar:");
- strcat(boot_class_path, CLASSPATH_PREFIX"/lib/jsse.jar:");
- strcat(boot_class_path, CLASSPATH_PREFIX"/lib/jce.jar:");
- strcat(boot_class_path, CLASSPATH_PREFIX"/lib/charsets.jar:");
- strcat(boot_class_path, CLASSPATH_PREFIX"/classes");
+ strcpy(boot_class_path, JAVA_RUNTIME_LIBRARY_PREFIX"/lib/resources.jar:");
+ strcat(boot_class_path, JAVA_RUNTIME_LIBRARY_PREFIX"/lib/rt.jar:");
+ strcat(boot_class_path, JAVA_RUNTIME_LIBRARY_PREFIX"/lib/sunrsasign.jar:");
+ strcat(boot_class_path, JAVA_RUNTIME_LIBRARY_PREFIX"/lib/jsse.jar:");
+ strcat(boot_class_path, JAVA_RUNTIME_LIBRARY_PREFIX"/lib/jce.jar:");
+ strcat(boot_class_path, JAVA_RUNTIME_LIBRARY_PREFIX"/lib/charsets.jar:");
+ strcat(boot_class_path, JAVA_RUNTIME_LIBRARY_PREFIX"/classes");
-# elif defined(WITH_CLASSPATH_CLDC1_1)
+# elif defined(WITH_JAVA_RUNTIME_LIBRARY_CLDC1_1)
len =
- strlen(CLASSPATH_CLASSES) +
+ strlen(JAVA_RUNTIME_LIBRARY_CLASSES) +
strlen("0");
boot_class_path = MNEW(char, len);
- strcpy(boot_class_path, CLASSPATH_CLASSES);
+ strcpy(boot_class_path, JAVA_RUNTIME_LIBRARY_CLASSES);
# else
# error unknown classpath configuration
properties_add("java.vm.specification.vendor", "Sun Microsystems Inc.");
properties_add("java.vm.specification.name", "Java Virtual Machine Specification");
properties_add("java.vm.version", VERSION);
- properties_add("java.vm.vendor", "CACAO Team");
+ properties_add("java.vm.vendor", "CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO");
properties_add("java.vm.name", "CACAO");
# if defined(ENABLE_INTRP)
properties_add("java.vm.info", "JIT mode");
}
-# if defined(WITH_CLASSPATH_GNU)
+# if defined(WITH_JAVA_RUNTIME_LIBRARY_GNU_CLASSPATH)
/* Get properties from system. */
properties_add("user.country", "US");
}
-# elif defined(WITH_CLASSPATH_SUN)
+# elif defined(WITH_JAVA_RUNTIME_LIBRARY_OPENJDK)
/* Actually this property is set by OpenJDK, but we need it in
nativevm_preinit(). */
*******************************************************************************/
-void properties_add(char *key, char *value)
+void properties_add(const char *key, const char *value)
{
list_properties_entry_t *pe;
/* search for the entry */
- for (pe = list_first_unsynced(list_properties); pe != NULL;
- pe = list_next_unsynced(list_properties, pe)) {
+ for (pe = list_first(list_properties); pe != NULL;
+ pe = list_next(list_properties, pe)) {
if (strcmp(pe->key, key) == 0) {
/* entry was found, replace the value */
pe->key = key;
pe->value = value;
- list_add_last_unsynced(list_properties, pe);
+ list_add_last(list_properties, pe);
}
*******************************************************************************/
-char *properties_get(char *key)
+const char *properties_get(const char *key)
{
list_properties_entry_t *pe;
- for (pe = list_first_unsynced(list_properties); pe != NULL;
- pe = list_next_unsynced(list_properties, pe)) {
+ for (pe = list_first(list_properties); pe != NULL;
+ pe = list_next(list_properties, pe)) {
if (strcmp(pe->key, key) == 0)
return pe->value;
}
*******************************************************************************/
-void properties_system_add(java_handle_t *p, char *key, char *value)
+void properties_system_add(java_handle_t *p, const char *key, const char *value)
{
classinfo *c;
methodinfo *m;
list_t *l;
list_properties_entry_t *pe;
+ /* For convenience. */
+
l = list_properties;
- for (pe = list_first_unsynced(l); pe != NULL;
- pe = list_next_unsynced(l, pe)) {
+ for (pe = list_first(l); pe != NULL; pe = list_next(l, pe)) {
log_println("[properties_dump: key=%s, value=%s]", pe->key, pe->value);
}
}