[vmkit-commits] [PATCH] Fix JavaString field layout for OpenJDK

Nicolas Geoffray nicolas.geoffray at gmail.com
Tue Oct 25 14:30:45 PDT 2011


I think this patch is fine. Ideally we should refactor to have the layout in
a separate class. But I can live with your change. Please change the ///
CLASSPATH FIELDS!! comment to just a comment that says that the #else is for
classpath fields. Thanks!

On Tue, Oct 25, 2011 at 11:20 PM, Will Dietz <wdietz2 at illinois.edu> wrote:

> Inlined below.
>
> I understand macros aren't preferred, thoughts on how to best accomplish
> this?
>
> #include JavaStringFieldsOpenJDK.inc, etc?
>
> Field layout can be checked with "javap -private java/lang/String"
> against an OpenJDK installation.
>
> ~Will
>
> >From d707ac49951537aa9ee03dfac62515c8b8367221 Mon Sep 17 00:00:00 2001
> From: Will Dietz <w at wdtz.org>
> Date: Fri, 14 Oct 2011 04:57:57 -0500
> Subject: [PATCH] Fix JavaString field layout for OpenJDK
>
> ---
>  lib/J3/VMCore/JavaString.h |    6 ++++++
>  1 files changed, 6 insertions(+), 0 deletions(-)
>
> diff --git a/lib/J3/VMCore/JavaString.h b/lib/J3/VMCore/JavaString.h
> index e9707ab..7fa31e1 100644
> --- a/lib/J3/VMCore/JavaString.h
> +++ b/lib/J3/VMCore/JavaString.h
> @@ -25,9 +25,15 @@ class JavaString : public JavaObject {
>   // CLASSPATH FIELDS!!
>   const ArrayUInt16* value;
>  public:
> +#ifndef USE_OPENJDK
>   sint32 count;
>   sint32 cachedHashCode;
>   sint32 offset;
> +#else
> +  sint32 offset;
> +  sint32 count;
> +  sint32 cachedHashCode;
> +#endif
>
>   static void setValue(JavaString* self, const ArrayUInt16* array) {
>     llvm_gcroot(self, 0);
> --
> 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/20111025/921cad98/attachment.html>


More information about the vmkit-commits mailing list