[vmkit-commits] [PATCH] Move runtime-specific Jnjvm initialization to new JavaUpcalls method

Nicolas Geoffray nicolas.geoffray at gmail.com
Thu Oct 27 09:45:54 PDT 2011


Looks good!

On Thu, Oct 27, 2011 at 3:13 AM, Will Dietz <wdietz2 at illinois.edu> wrote:

> Inlined below.
>
> OpenJDK's method for this will later include the call to
> System.intializeSystemClass(), for what it's worth.
>
> ~Will
>
>
> >From 88f4d3f9facb73f9a55614284f45c09bef812953 Mon Sep 17 00:00:00 2001
> From: Will Dietz <w at wdtz.org>
> Date: Wed, 26 Oct 2011 20:01:24 -0500
> Subject: [PATCH 3/3] Move runtime-specific Jnjvm initialization to new
>  JavaUpcalls method.
>
> ---
>  lib/J3/ClassLib/GNUClasspath/JavaUpcalls.cpp |   10 ++++++++++
>  lib/J3/ClassLib/GNUClasspath/JavaUpcalls.h   |    1 +
>  lib/J3/ClassLib/OpenJDK/JavaUpcalls.cpp      |    5 +++++
>  lib/J3/ClassLib/OpenJDK/JavaUpcalls.h        |    1 +
>  lib/J3/VMCore/Jnjvm.cpp                      |    5 +++--
>  5 files changed, 20 insertions(+), 2 deletions(-)
>
> diff --git a/lib/J3/ClassLib/GNUClasspath/JavaUpcalls.cpp
> b/lib/J3/ClassLib/GNUClasspath/JavaUpcalls.cpp
> index 3ebac59..bc797d1 100644
> --- a/lib/J3/ClassLib/GNUClasspath/JavaUpcalls.cpp
> +++ b/lib/J3/ClassLib/GNUClasspath/JavaUpcalls.cpp
> @@ -1061,6 +1061,16 @@ void
> Classpath::initialiseClasspath(JnjvmClassLoader* loader) {
>   initPhantomReference->setNative();
>  }
>
> +void Classpath::InitializeSystem(Jnjvm * jvm) {
> +#define LOAD_CLASS(cl) \
> +  cl->resolveClass(); \
> +  cl->initialiseClass(jvm);
> +  LOAD_CLASS(newVMThread);
> +  LOAD_CLASS(newVMThrowable);
> +#undef LOAD_CLASS
> +
> +}
> +
>  #include "ClasspathConstructor.inc"
>  #include "Classpath.inc"
>  #include "ClasspathField.inc"
> diff --git a/lib/J3/ClassLib/GNUClasspath/JavaUpcalls.h
> b/lib/J3/ClassLib/GNUClasspath/JavaUpcalls.h
> index f30f3ac..2c355f9 100644
> --- a/lib/J3/ClassLib/GNUClasspath/JavaUpcalls.h
> +++ b/lib/J3/ClassLib/GNUClasspath/JavaUpcalls.h
> @@ -275,6 +275,7 @@ private:
>
>  public:
>   ISOLATE_STATIC void InitializeThreading(Jnjvm* vm);
> +  ISOLATE_STATIC void InitializeSystem(Jnjvm* vm);
>  };
>
>
> diff --git a/lib/J3/ClassLib/OpenJDK/JavaUpcalls.cpp
> b/lib/J3/ClassLib/OpenJDK/JavaUpcalls.cpp
> index 99bcce5..6b68703 100644
> --- a/lib/J3/ClassLib/OpenJDK/JavaUpcalls.cpp
> +++ b/lib/J3/ClassLib/OpenJDK/JavaUpcalls.cpp
> @@ -1069,6 +1069,11 @@ void
> Classpath::initialiseClasspath(JnjvmClassLoader* loader) {
>   initPhantomReference->setNative();
>  }
>
> +void Classpath::InitializeSystem(Jnjvm * jvm) {
> +  // TODO: Implement me!
> +}
> +
> +
>  #include "ClasspathConstructor.inc"
>  #include "Classpath.inc"
>  #include "ClasspathField.inc"
> diff --git a/lib/J3/ClassLib/OpenJDK/JavaUpcalls.h
> b/lib/J3/ClassLib/OpenJDK/JavaUpcalls.h
> index ae5eb63..7bb5c8e 100644
> --- a/lib/J3/ClassLib/OpenJDK/JavaUpcalls.h
> +++ b/lib/J3/ClassLib/OpenJDK/JavaUpcalls.h
> @@ -275,6 +275,7 @@ private:
>
>  public:
>   ISOLATE_STATIC void InitializeThreading(Jnjvm* vm);
> +  ISOLATE_STATIC void InitializeSystem(Jnjvm* vm);
>  };
>
>
> diff --git a/lib/J3/VMCore/Jnjvm.cpp b/lib/J3/VMCore/Jnjvm.cpp
> index 4ed8bc3..4961694 100644
> --- a/lib/J3/VMCore/Jnjvm.cpp
> +++ b/lib/J3/VMCore/Jnjvm.cpp
> @@ -1105,9 +1105,7 @@ void Jnjvm::loadBootstrap() {
>   LOAD_CLASS(upcalls->newConstructor);
>   LOAD_CLASS(upcalls->newField);
>   LOAD_CLASS(upcalls->newMethod);
> -  LOAD_CLASS(upcalls->newVMThread);
>   LOAD_CLASS(upcalls->newStackTraceElement);
> -  LOAD_CLASS(upcalls->newVMThrowable);
>   LOAD_CLASS(upcalls->boolClass);
>   LOAD_CLASS(upcalls->byteClass);
>   LOAD_CLASS(upcalls->charClass);
> @@ -1151,6 +1149,9 @@ void Jnjvm::loadBootstrap() {
>   LOAD_CLASS(upcalls->SystemClass);
>  #undef LOAD_CLASS
>
> +  // Implementation-specific end-of-bootstrap initialization
> +  upcalls->InitializeSystem(this);
> +
>   loadAppClassLoader();
>   obj = JavaThread::get()->currentThread();
>   javaLoader = appClassLoader->getJavaClassLoader();
> --
> 1.7.5.1
> _______________________________________________
> vmkit-commits mailing list
> vmkit-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/vmkit-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/vmkit-commits/attachments/20111027/f3ce4c58/attachment.html>


More information about the vmkit-commits mailing list