#include "native/vm/nativevm.hpp"
#include "vm/class.hpp"
+#include "vm/exceptions.hpp"
#include "vm/initialize.hpp"
#include "vm/method.hpp"
#include "vm/options.h"
#include "vm/os.hpp"
#if defined(WITH_JAVA_RUNTIME_LIBRARY_OPENJDK)
-# include "mm/memory.h"
+# include "mm/memory.hpp"
# include "native/native.hpp"
# include "native/vm/openjdk/hpi.hpp"
+# include "toolbox/sequence.hpp"
+
# include "vm/globals.hpp"
# include "vm/properties.hpp"
# include "vm/utf8.h"
Properties& properties = vm->get_properties();
const char* boot_library_path = properties.get("sun.boot.library.path");
- size_t len =
- os::strlen(boot_library_path) +
- os::strlen("/libjava.so") +
- os::strlen("0");
-
- char* p = MNEW(char, len);
+ // Use sequence builder to assemble library path.
+ SequenceBuilder sb;
- os::strcpy(p, boot_library_path);
- os::strcat(p, "/libjava.so");
+ sb.cat(boot_library_path);
+ sb.cat("/libjava.so");
- utf* u = utf_new_char(p);
+ // XXX This should actually be sb.export_symbol()
+ utf* u = utf_new_char(sb.c_str());
NativeLibrary nl(u);
void* handle = nl.open();
if (handle == NULL)
- os::abort("nativevm_init: failed to open libjava.so at: %s", p);
-
- MFREE(p, char, len);
+ os::abort("nativevm_init: failed to open libjava.so at: %s", sb.c_str());
NativeLibraries& nls = vm->get_nativelibraries();
nls.add(nl);
HPI& hpi = vm->get_hpi();
hpi.initialize();
+ _Jv_sun_misc_Perf_init();
_Jv_sun_misc_Unsafe_init();
# else
*******************************************************************************/
-void nativevm_init(void)
+bool nativevm_init(void)
{
TRACESUBSYSTEMINITIALIZATION("nativevm_init");
false);
if (m == NULL)
- os::abort("nativevm_init: Error resolving java.lang.System.initializeSystemClass()");
+ return false;
(void) vm_call_method(m, NULL);
+ if (exceptions_get_exception() != NULL)
+ return false;
+
# else
# error unknown classpath configuration
# endif
#else
# error unknown Java configuration
#endif
+
+ return true;
}