Need a VM that accepts, if not understands, JVM_CONSTANT_ModuleId
Jonathan Gibbons
Jonathan.Gibbons at Sun.COM
Mon Mar 30 15:30:01 PDT 2009
Mark, Karen,
Was there a resolution to this?
-- Jon
Mark Reinhold wrote:
> I spent some time this weekend trying to get the basic end-to-end
> module-loading mechanism working. I pretty quickly ran up against the
> fact that HotSpot -- not even in Karen's prototype version -- doesn't
> grok constant-pool items with tag 13 for CONSTANT_ModuleId_info and
> instead throws a ClassFormatError, as well it should in this case.
>
> I tried hacking on jvm.h and classFileParser.cpp to make this work but
> failed, most likely because I'm missing something obvious.
>
> Karen, does the following patch make any sense? If not, could you please
> send me one -- or push one -- that does?
>
> Note that right now I don't need the VM to do anything with these items,
> I just need it not to give up when it does see them.
>
> (For the moment I worked around this problem by using a hacked-up copy of
> the ASM library to strip the offending items and related attributes.)
>
> Thanks,
> - Mark
>
>
> ------------------------------------------------------------------------
>
> diff -r dae503d9f04c src/share/vm/classfile/classFileParser.cpp
> --- a/src/share/vm/classfile/classFileParser.cpp Thu Feb 26 10:57:13 2009 -0800
> +++ b/src/share/vm/classfile/classFileParser.cpp Sun Mar 08 20:02:11 2009 -0700
> @@ -159,6 +159,14 @@
> cp->name_and_type_at_put(index, name_index, signature_index);
> }
> break;
> + case JVM_CONSTANT_ModuleId :
> + {
> + cfs->guarantee_more(5, CHECK); // name_index, version_index, tag/access_flags
> + u2 name_index = cfs->get_u2_fast();
> + u2 version_index = cfs->get_u2_fast();
> + // ## cp->name_and_type_at_put(index, name_index, signature_index);
> + }
> + break;
> case JVM_CONSTANT_Utf8 :
> {
> cfs->guarantee_more(2, CHECK); // utf8_length
> @@ -301,6 +309,8 @@
> signature_ref_index, CHECK_(nullHandle));
> break;
> }
> + case JVM_CONSTANT_ModuleId : // ##
> + break;
> case JVM_CONSTANT_Utf8 :
> break;
> case JVM_CONSTANT_UnresolvedClass : // fall-through
> diff -r dae503d9f04c src/share/vm/prims/jvm.h
> --- a/src/share/vm/prims/jvm.h Thu Feb 26 10:57:13 2009 -0800
> +++ b/src/share/vm/prims/jvm.h Sun Mar 08 20:02:11 2009 -0700
> @@ -1038,8 +1038,11 @@
> JVM_CONSTANT_Fieldref,
> JVM_CONSTANT_Methodref,
> JVM_CONSTANT_InterfaceMethodref,
> - JVM_CONSTANT_NameAndType
> + JVM_CONSTANT_NameAndType,
> + JVM_CONSTANT_ModuleId
> };
> +
> +#define JVM_CONSTANT_MAX JVM_CONSTANT_ModuleId
>
> /* Used in the newarray instruction. */
>
> diff -r dae503d9f04c src/share/vm/utilities/constantTag.cpp
> --- a/src/share/vm/utilities/constantTag.cpp Thu Feb 26 10:57:13 2009 -0800
> +++ b/src/share/vm/utilities/constantTag.cpp Sun Mar 08 20:02:11 2009 -0700
> @@ -59,6 +59,9 @@
> case JVM_CONSTANT_NameAndType :
> st->print("NameAndType");
> break;
> + case JVM_CONSTANT_ModuleId :
> + st-print("ModuleId");
> + break;
> case JVM_CONSTANT_Utf8 :
> st->print("Utf8");
> break;
> diff -r dae503d9f04c src/share/vm/utilities/constantTag.hpp
> --- a/src/share/vm/utilities/constantTag.hpp Thu Feb 26 10:57:13 2009 -0800
> +++ b/src/share/vm/utilities/constantTag.hpp Sun Mar 08 20:02:11 2009 -0700
> @@ -76,7 +76,7 @@
> bool is_symbol() const { return is_utf8(); }
>
> constantTag(jbyte tag) {
> - assert((tag >= 0 && tag <= JVM_CONSTANT_NameAndType) ||
> + assert((tag >= 0 && tag <= JVM_CONSTANT_MAX) ||
> (tag >= JVM_CONSTANT_InternalMin && tag <= JVM_CONSTANT_InternalMax), "Invalid constant tag");
> _tag = tag;
> }
>
More information about the jigsaw-dev
mailing list