* src/native/vm/openjdk/hpi.c: Moved to C++.
authorChristian Thalinger <twisti@complang.tuwien.ac.at>
Wed, 10 Sep 2008 08:31:41 +0000 (10:31 +0200)
committerChristian Thalinger <twisti@complang.tuwien.ac.at>
Wed, 10 Sep 2008 08:31:41 +0000 (10:31 +0200)
* src/native/vm/openjdk/hpi.h: Likewise.
* src/native/vm/openjdk/hpi.cpp: New file.
* src/native/vm/openjdk/hpi.hpp: Likewise.
* src/native/vm/nativevm.c,
src/native/vm/openjdk/Makefile.am,
src/native/vm/openjdk/jvm.cpp,
src/vm/vm.hpp: Related changes.

--HG--
rename : src/native/vm/openjdk/hpi.c => src/native/vm/openjdk/hpi.cpp
rename : src/native/vm/openjdk/hpi.h => src/native/vm/openjdk/hpi.hpp

src/native/vm/nativevm.c
src/native/vm/openjdk/Makefile.am
src/native/vm/openjdk/hpi.c [deleted file]
src/native/vm/openjdk/hpi.cpp [new file with mode: 0644]
src/native/vm/openjdk/hpi.h [deleted file]
src/native/vm/openjdk/hpi.hpp [new file with mode: 0644]
src/native/vm/openjdk/jvm.cpp
src/vm/vm.hpp

index 9f9880f47afd1817f5c31a5bb4156138217255b9..86935623e53700a5f96befa080611b06af7c8192 100644 (file)
@@ -40,7 +40,7 @@
 
 # include "native/native.hpp"
 
-# include "native/vm/openjdk/hpi.h"
+# include "native/vm/openjdk/hpi.hpp"
 
 # include "vm/globals.hpp"
 # include "vm/properties.hpp"
@@ -129,7 +129,7 @@ void nativevm_preinit(void)
 
        /* Initialize the HPI. */
 
-       hpi_initialize();
+       HPI_initialize();
 
        _Jv_sun_misc_Unsafe_init();
 
index 97f30a7bb931e4df2cc44b445af25882bd1fe81c..1e5bfd3bd19ff7cab27660b9c572ac09b8e0c953 100644 (file)
@@ -29,8 +29,8 @@ noinst_LTLIBRARIES = \
        libnativevmcore.la
 
 libnativevmcore_la_SOURCES = \
-       hpi.c \
-       hpi.h \
+       hpi.cpp \
+       hpi.hpp \
        jvm.cpp \
        management.cpp \
        management.hpp
diff --git a/src/native/vm/openjdk/hpi.c b/src/native/vm/openjdk/hpi.c
deleted file mode 100644 (file)
index 3f4eeb7..0000000
+++ /dev/null
@@ -1,203 +0,0 @@
-/* src/native/vm/openjdk/hpi.c - HotSpot HPI interface functions
-
-   Copyright (C) 2008
-   CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
-
-   This file is part of CACAO.
-
-   This program is free software; you can redistribute it and/or
-   modify it under the terms of the GNU General Public License as
-   published by the Free Software Foundation; either version 2, or (at
-   your option) any later version.
-
-   This program is distributed in the hope that it will be useful, but
-   WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-   02110-1301, USA.
-
-*/
-
-
-#include "config.h"
-
-// Include our JNI header before the HPI headers, because the HPI
-// headers include jni.h and we want to override the typedefs in
-// jni.h.
-#include "native/jni.hpp"
-
-// We include hpi_md.h before hpi.h as the latter includes the former.
-#include INCLUDE_HPI_MD_H
-#include INCLUDE_HPI_H
-
-#include "mm/memory.h"
-
-#include "native/native.hpp"
-
-#include "native/vm/openjdk/hpi.h"
-
-#include "vm/options.h"
-#include "vm/os.hpp"
-#include "vm/properties.hpp"
-#include "vm/utf8.h"
-#include "vm/vm.hpp"
-
-
-/* VM callback functions ******************************************************/
-
-static vm_calls_t callbacks = {
-       /* TODO What should we use here? */
-/*   jio_fprintf, */
-/*   unimplemented_panic, */
-/*   unimplemented_monitorRegister, */
-       NULL,
-       NULL,
-       NULL,
-       
-       NULL, /* unused */
-       NULL, /* unused */
-       NULL  /* unused */
-};
-
-
-/* HPI interfaces *************************************************************/
-
-GetInterfaceFunc      hpi_get_interface = NULL;
-HPI_FileInterface    *hpi_file          = NULL;
-HPI_SocketInterface  *hpi_socket        = NULL;
-HPI_LibraryInterface *hpi_library       = NULL;
-HPI_SystemInterface  *hpi_system        = NULL;
-
-
-/* hpi_initialize **************************************************************
-
-   Initialize the Host Porting Interface (HPI).
-
-*******************************************************************************/
-
-void hpi_initialize(void)
-{
-       const char* boot_library_path;
-       int   len;
-       char* p;
-       utf*  u;
-       void* handle;
-       void* dll_initialize;
-       int   result;
-
-    jint (JNICALL * DLL_Initialize)(GetInterfaceFunc *, void *);
-
-       TRACESUBSYSTEMINITIALIZATION("hpi_init");
-
-       /* Load libhpi.so */
-
-       boot_library_path = Properties_get("sun.boot.library.path");
-
-       len =
-               os_strlen(boot_library_path) +
-               os_strlen("/native_threads/libhpi.so") +
-               os_strlen("0");
-
-       p = MNEW(char, len);
-
-       os_strcpy(p, boot_library_path);
-       os_strcat(p, "/native_threads/libhpi.so");
-
-       u = utf_new_char(p);
-
-    if (opt_TraceHPI)
-               log_println("hpi_init: Loading HPI %s ", p);
-
-       MFREE(p, char, len);
-
-       handle = native_library_open(u);
-
-       if (handle == NULL)
-               if (opt_TraceHPI)
-                       vm_abort("hpi_init: HPI open failed");
-
-       /* Resolve the DLL_Initialize function from the library. */
-
-       dll_initialize = os_dlsym(handle, "DLL_Initialize");
-
-    DLL_Initialize = (jint (JNICALL *)(GetInterfaceFunc *, void *)) (intptr_t) dll_initialize;
-
-    if (opt_TraceHPI && DLL_Initialize == NULL)
-               log_println("hpi_init: HPI dlsym of DLL_Initialize failed: %s", os_dlerror());
-
-    if (DLL_Initialize == NULL ||
-        (*DLL_Initialize)(&hpi_get_interface, &callbacks) < 0) {
-
-        if (opt_TraceHPI)
-                       vm_abort("hpi_init: HPI DLL_Initialize failed");
-    }
-
-       native_library_add(u, NULL, handle);
-
-    if (opt_TraceHPI)
-               log_println("hpi_init: HPI loaded successfully");
-
-       /* Resolve the interfaces. */
-       /* NOTE: The intptr_t-case is only to prevent the a compiler
-          warning with -O2: warning: dereferencing type-punned pointer
-          will break strict-aliasing rules */
-
-       result = (*hpi_get_interface)((void **) (intptr_t) &hpi_file, "File", 1);
-
-       if (result != 0)
-               vm_abort("hpi_init: Can't find HPI_FileInterface");
-
-       result = (*hpi_get_interface)((void **) (intptr_t) &hpi_library, "Library", 1);
-
-       if (result != 0)
-               vm_abort("hpi_init: Can't find HPI_LibraryInterface");
-
-       result = (*hpi_get_interface)((void **) (intptr_t) &hpi_system, "System", 1);
-
-       if (result != 0)
-               vm_abort("hpi_init: Can't find HPI_SystemInterface");
-}
-
-
-/* hpi_initialize_socket_library ***********************************************
-
-   Initialize the library Host Porting Interface (HPI).
-
-*******************************************************************************/
-
-int hpi_initialize_socket_library(void)
-{
-       int result;
-
-       /* Resolve the socket library interface. */
-
-       result = (*hpi_get_interface)((void **) (intptr_t) &hpi_socket, "Socket", 1);
-
-       if (result != 0) {
-               if (opt_TraceHPI)
-                       log_println("hpi_initialize_socket_library: Can't find HPI_SocketInterface");
-
-               return JNI_ERR;
-       }
-
-       return JNI_OK;
-}
-
-
-/*
- * These are local overrides for various environment variables in Emacs.
- * Please do not remove this and leave it at the end of the file, where
- * Emacs will automagically detect them.
- * ---------------------------------------------------------------------
- * Local variables:
- * mode: c
- * indent-tabs-mode: t
- * c-basic-offset: 4
- * tab-width: 4
- * End:
- * vim:noexpandtab:sw=4:ts=4:
- */
diff --git a/src/native/vm/openjdk/hpi.cpp b/src/native/vm/openjdk/hpi.cpp
new file mode 100644 (file)
index 0000000..0c283c9
--- /dev/null
@@ -0,0 +1,177 @@
+/* src/native/vm/openjdk/hpi.cpp - HotSpot HPI interface functions
+
+   Copyright (C) 2008
+   CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
+
+   This file is part of CACAO.
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+   02110-1301, USA.
+
+*/
+
+
+#include "config.h"
+
+// Include this one early.
+#include "native/vm/openjdk/hpi.hpp"
+
+#include "mm/memory.h"
+
+#include "native/native.hpp"
+
+#include "vm/options.h"
+#include "vm/os.hpp"
+#include "vm/properties.hpp"
+#include "vm/utf8.h"
+#include "vm/vm.hpp"
+
+
+/* VM callback functions ******************************************************/
+
+static vm_calls_t callbacks = {
+       /* TODO What should we use here? */
+/*   jio_fprintf, */
+/*   unimplemented_panic, */
+/*   unimplemented_monitorRegister, */
+       NULL,
+       NULL,
+       NULL,
+       
+       NULL, /* unused */
+       NULL, /* unused */
+       NULL  /* unused */
+};
+
+
+/**
+ * Initialize the Host Porting Interface (HPI).
+ */
+HPI::HPI()
+{
+}
+
+void HPI::initialize() // REMOVEME
+{
+       TRACESUBSYSTEMINITIALIZATION("hpi_init");
+
+       // Load libhpi.so
+       Properties& properties = VM::get_current()->get_properties();
+       const char* boot_library_path = properties.get("sun.boot.library.path");
+
+       size_t len =
+               os::strlen(boot_library_path) +
+               os::strlen("/native_threads/libhpi.so") +
+               os::strlen("0");
+
+       char* p = MNEW(char, len);
+
+       os::strcpy(p, boot_library_path);
+       os::strcat(p, "/native_threads/libhpi.so");
+
+       utf* u = utf_new_char(p);
+
+    if (opt_TraceHPI)
+               log_println("HPI::initialize: Loading HPI %s ", p);
+
+       MFREE(p, char, len);
+
+       void* handle = native_library_open(u);
+
+       if (handle == NULL)
+               if (opt_TraceHPI)
+                       os::abort("HPI::initialize: HPI open failed");
+
+       // Resolve the DLL_Initialize function from the library.
+       void* dll_initialize = os::dlsym(handle, "DLL_Initialize");
+
+    jint (JNICALL *DLL_Initialize)(GetInterfaceFunc*, void*);
+    DLL_Initialize = (jint (JNICALL *)(GetInterfaceFunc*, void*)) (uintptr_t) dll_initialize;
+
+    if (opt_TraceHPI && DLL_Initialize == NULL)
+               log_println("hpi_init: HPI dlsym of DLL_Initialize failed: %s", os::dlerror());
+
+    if (DLL_Initialize == NULL || (*DLL_Initialize)(&_get_interface, &callbacks) < 0) {
+        if (opt_TraceHPI)
+                       vm_abort("hpi_init: HPI DLL_Initialize failed");
+    }
+
+       native_library_add(u, NULL, handle);
+
+    if (opt_TraceHPI)
+               log_println("HPI::initialize: HPI loaded successfully");
+
+       // Resolve the interfaces.
+       /* NOTE: The intptr_t-case is only to prevent the a compiler
+          warning with -O2: warning: dereferencing type-punned pointer
+          will break strict-aliasing rules */
+
+       int result;
+
+       result = (*_get_interface)((void**) (uintptr_t) &_file, "File", 1);
+
+       if (result != 0)
+               os::abort("hpi_init: Can't find HPI_FileInterface");
+
+       result = (*_get_interface)((void**) (uintptr_t) &_library, "Library", 1);
+
+       if (result != 0)
+               os::abort("hpi_init: Can't find HPI_LibraryInterface");
+
+       result = (*_get_interface)((void**) (uintptr_t) &_system, "System", 1);
+
+       if (result != 0)
+               os::abort("hpi_init: Can't find HPI_SystemInterface");
+}
+
+
+/**
+ * Initialize the Host Porting Interface (HPI) socket library.
+ */
+int HPI::initialize_socket_library()
+{
+       // Resolve the socket library interface.
+       int result = (*_get_interface)((void**) (uintptr_t) &_socket, "Socket", 1);
+
+       if (result != 0) {
+               if (opt_TraceHPI)
+                       log_println("HPI::initialize_socket_library: Can't find HPI_SocketInterface");
+
+               return JNI_ERR;
+       }
+
+       return JNI_OK;
+}
+
+
+// Legacy C interface.
+extern "C" {
+       void HPI_initialize() { VM::get_current()->get_hpi().initialize(); }
+}
+
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c++
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ * vim:noexpandtab:sw=4:ts=4:
+ */
diff --git a/src/native/vm/openjdk/hpi.h b/src/native/vm/openjdk/hpi.h
deleted file mode 100644 (file)
index 356b835..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-/* src/native/vm/openjdk/hpi.h - HotSpot HPI interface functions
-
-   Copyright (C) 2008
-   CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
-
-   This file is part of CACAO.
-
-   This program is free software; you can redistribute it and/or
-   modify it under the terms of the GNU General Public License as
-   published by the Free Software Foundation; either version 2, or (at
-   your option) any later version.
-
-   This program is distributed in the hope that it will be useful, but
-   WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-   02110-1301, USA.
-
-*/
-
-
-#ifndef _HPI_H
-#define _HPI_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "config.h"
-
-/* HPI headers *****************************************************************
-
-   We include hpi_md.h before hpi.h as the latter includes the former.
-
-   These includes define:
-
-   #define _JAVASOFT_HPI_MD_H_
-   #define _JAVASOFT_HPI_H_
-
-*******************************************************************************/
-
-#include INCLUDE_HPI_MD_H
-#include INCLUDE_HPI_H
-
-
-/* HPI interfaces *************************************************************/
-
-extern HPI_FileInterface    *hpi_file;
-extern HPI_SocketInterface  *hpi_socket;
-extern HPI_LibraryInterface *hpi_library;
-extern HPI_SystemInterface  *hpi_system;
-
-
-/* functions ******************************************************************/
-
-void hpi_initialize(void);
-int  hpi_initialize_socket_library(void);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _HPI_H */
-
-
-/*
- * These are local overrides for various environment variables in Emacs.
- * Please do not remove this and leave it at the end of the file, where
- * Emacs will automagically detect them.
- * ---------------------------------------------------------------------
- * Local variables:
- * mode: c
- * indent-tabs-mode: t
- * c-basic-offset: 4
- * tab-width: 4
- * End:
- * vim:noexpandtab:sw=4:ts=4:
- */
diff --git a/src/native/vm/openjdk/hpi.hpp b/src/native/vm/openjdk/hpi.hpp
new file mode 100644 (file)
index 0000000..3b09bf2
--- /dev/null
@@ -0,0 +1,97 @@
+/* src/native/vm/openjdk/hpi.hpp - HotSpot HPI interface functions
+
+   Copyright (C) 2008
+   CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
+
+   This file is part of CACAO.
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2, or (at
+   your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+   02110-1301, USA.
+
+*/
+
+
+#ifndef _HPI_HPP
+#define _HPI_HPP
+
+#include "config.h"
+
+/* HPI headers *****************************************************************
+
+   We include hpi_md.h before hpi.h as the latter includes the former.
+
+   These includes define:
+
+   #define _JAVASOFT_HPI_MD_H_
+   #define _JAVASOFT_HPI_H_
+
+*******************************************************************************/
+
+// Include our JNI header before the HPI headers, because the HPI
+// headers include jni.h and we want to override the typedefs in
+// jni.h.
+#include "native/jni.hpp"
+
+#include INCLUDE_HPI_MD_H
+#include INCLUDE_HPI_H
+
+
+#ifdef __cplusplus
+
+/**
+ * Host Porting Interface (HPI).
+ */
+class HPI {
+private:
+       GetInterfaceFunc      _get_interface;
+       HPI_FileInterface*    _file;
+       HPI_SocketInterface*  _socket;
+       HPI_LibraryInterface* _library;
+       HPI_SystemInterface*  _system;
+
+public:        
+       HPI();
+
+       inline HPI_FileInterface&    get_file   () const { return *_file; }
+       inline HPI_SocketInterface&  get_socket () const { return *_socket; }
+       inline HPI_LibraryInterface& get_library() const { return *_library; }
+       inline HPI_SystemInterface&  get_system () const { return *_system; }
+       
+       void initialize(); // REMOVEME
+       int initialize_socket_library();
+};
+
+#else
+
+void HPI_initialize();
+
+#endif
+
+#endif // _HPI_HPP
+
+
+/*
+ * These are local overrides for various environment variables in Emacs.
+ * Please do not remove this and leave it at the end of the file, where
+ * Emacs will automagically detect them.
+ * ---------------------------------------------------------------------
+ * Local variables:
+ * mode: c++
+ * indent-tabs-mode: t
+ * c-basic-offset: 4
+ * tab-width: 4
+ * End:
+ * vim:noexpandtab:sw=4:ts=4:
+ */
index 1b9780fafffc3cd6a3cb4437f3bc324408ad16e6..e258f36b526d3955ea10ca84351f2ea2c768ee60 100644 (file)
@@ -57,7 +57,7 @@
 
 #include "native/vm/reflection.hpp"
 
-#include "native/vm/openjdk/hpi.h"
+#include "native/vm/openjdk/hpi.hpp"
 #include "native/vm/openjdk/management.hpp"
 
 #include "threads/lock.hpp"
@@ -645,21 +645,23 @@ void JVM_DisableCompiler(JNIEnv *env, jclass compCls)
 
 /* JVM_GetLastErrorString */
 
-jint JVM_GetLastErrorString(char *buf, int len)
+jint JVM_GetLastErrorString(charbuf, int len)
 {
        TRACEJVMCALLS(("JVM_GetLastErrorString(buf=%p, len=%d", buf, len));
 
-       return hpi_system->GetLastErrorString(buf, len);
+       HPI& hpi = VM::get_current()->get_hpi();
+       return hpi.get_system().GetLastErrorString(buf, len);
 }
 
 
 /* JVM_NativePath */
 
-char *JVM_NativePath(char *path)
+char *JVM_NativePath(charpath)
 {
        TRACEJVMCALLS(("JVM_NativePath(path=%s)", path));
 
-       return hpi_file->NativePath(path);
+       HPI& hpi = VM::get_current()->get_hpi();
+       return hpi.get_file().NativePath(path);
 }
 
 
@@ -2050,13 +2052,14 @@ jboolean JVM_IsSameClassPackage(JNIEnv *env, jclass class1, jclass class2)
  */
 #define JVM_EEXIST       -100
 
-jint JVM_Open(const char *fname, jint flags, jint mode)
+jint JVM_Open(const charfname, jint flags, jint mode)
 {
        int result;
 
        TRACEJVMCALLS(("JVM_Open(fname=%s, flags=%d, mode=%d)", fname, flags, mode));
 
-       result = hpi_file->Open(fname, flags, mode);
+       HPI& hpi = VM::get_current()->get_hpi();
+       result = hpi.get_file().Open(fname, flags, mode);
 
        if (result >= 0) {
                return result;
@@ -2078,37 +2081,41 @@ jint JVM_Close(jint fd)
 {
        TRACEJVMCALLS(("JVM_Close(fd=%d)", fd));
 
-       return hpi_file->Close(fd);
+       HPI& hpi = VM::get_current()->get_hpi();
+       return hpi.get_file().Close(fd);
 }
 
 
 /* JVM_Read */
 
-jint JVM_Read(jint fd, char *buf, jint nbytes)
+jint JVM_Read(jint fd, charbuf, jint nbytes)
 {
        TRACEJVMCALLS(("JVM_Read(fd=%d, buf=%p, nbytes=%d)", fd, buf, nbytes));
 
-       return (jint) hpi_file->Read(fd, buf, nbytes);
+       HPI& hpi = VM::get_current()->get_hpi();
+       return (jint) hpi.get_file().Read(fd, buf, nbytes);
 }
 
 
 /* JVM_Write */
 
-jint JVM_Write(jint fd, char *buf, jint nbytes)
+jint JVM_Write(jint fd, charbuf, jint nbytes)
 {
        TRACEJVMCALLS(("JVM_Write(fd=%d, buf=%s, nbytes=%d)", fd, buf, nbytes));
 
-       return (jint) hpi_file->Write(fd, buf, nbytes);
+       HPI& hpi = VM::get_current()->get_hpi();
+       return (jint) hpi.get_file().Write(fd, buf, nbytes);
 }
 
 
 /* JVM_Available */
 
-jint JVM_Available(jint fd, jlong *pbytes)
+jint JVM_Available(jint fd, jlongpbytes)
 {
        TRACEJVMCALLS(("JVM_Available(fd=%d, pbytes=%p)", fd, pbytes));
 
-       return hpi_file->Available(fd, pbytes);
+       HPI& hpi = VM::get_current()->get_hpi();
+       return hpi.get_file().Available(fd, pbytes);
 }
 
 
@@ -2118,7 +2125,8 @@ jlong JVM_Lseek(jint fd, jlong offset, jint whence)
 {
        TRACEJVMCALLS(("JVM_Lseek(fd=%d, offset=%ld, whence=%d)", fd, offset, whence));
 
-       return hpi_file->Seek(fd, (off_t) offset, whence);
+       HPI& hpi = VM::get_current()->get_hpi();
+       return hpi.get_file().Seek(fd, (off_t) offset, whence);
 }
 
 
@@ -2128,7 +2136,8 @@ jint JVM_SetLength(jint fd, jlong length)
 {
        TRACEJVMCALLS(("JVM_SetLength(fd=%d, length=%ld)", length));
 
-       return hpi_file->SetLength(fd, length);
+       HPI& hpi = VM::get_current()->get_hpi();
+       return hpi.get_file().SetLength(fd, length);
 }
 
 
@@ -2138,7 +2147,8 @@ jint JVM_Sync(jint fd)
 {
        TRACEJVMCALLS(("JVM_Sync(fd=%d)", fd));
 
-       return hpi_file->Sync(fd);
+       HPI& hpi = VM::get_current()->get_hpi();
+       return hpi.get_file().Sync(fd);
 }
 
 
@@ -2658,7 +2668,8 @@ jint JVM_InitializeSocketLibrary()
 {
        TRACEJVMCALLS(("JVM_InitializeSocketLibrary()"));
 
-       return hpi_initialize_socket_library();
+       HPI& hpi = VM::get_current()->get_hpi();
+       return hpi.initialize_socket_library();
 }
 
 
@@ -2915,13 +2926,14 @@ void JVM_UnloadLibrary(void* handle)
 
 /* JVM_FindLibraryEntry */
 
-void *JVM_FindLibraryEntry(void *handle, const char *name)
+void *JVM_FindLibraryEntry(void* handle, const char* name)
 {
        void* symbol;
 
        TRACEJVMCALLSENTER(("JVM_FindLibraryEntry(handle=%p, name=%s)", handle, name));
 
-       symbol = hpi_library->FindLibraryEntry(handle, name);
+       HPI& hpi = VM::get_current()->get_hpi();
+       symbol = hpi.get_library().FindLibraryEntry(handle, name);
 
        TRACEJVMCALLSEXIT(("->%p", symbol));
 
index 8446f3e3c33cfbcb87bafdedbf0453dccce1929d..e09f3a518fed381a4d44028bf2f8d5dafbd8c05c 100644 (file)
@@ -35,6 +35,7 @@
 #include "native/jni.hpp"
 
 #if defined(WITH_JAVA_RUNTIME_LIBRARY_OPENJDK)
+# include "native/vm/openjdk/hpi.hpp"
 # include "native/vm/openjdk/management.hpp"
 #endif
 
@@ -69,6 +70,7 @@ private:
        Recompiler _recompiler; ///< JIT recompilation framework.
 #endif
 #if defined(WITH_JAVA_RUNTIME_LIBRARY_OPENJDK)
+       HPI        _hpi;
        Management _management;
 #endif
 
@@ -95,6 +97,7 @@ public:
        Properties& get_properties() { return _properties; }
        Recompiler& get_recompiler() { return _recompiler; } // REMOVEME
 #if defined(WITH_JAVA_RUNTIME_LIBRARY_OPENJDK)
+       HPI&        get_hpi       () { return _hpi; }
        Management& get_management() { return _management; }
 #endif
 };