public inbox for java-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Allow 1.7 class file format
@ 2012-04-23 13:30 Andrew Haley
  2012-04-23 16:58 ` Andrew Hughes
  2012-04-25 10:17 ` Andrew Haley
  0 siblings, 2 replies; 4+ messages in thread
From: Andrew Haley @ 2012-04-23 13:30 UTC (permalink / raw)
  To: GCJ-patches

There's no real reason to disallow 1.7 class files.  Anyone trying to
use any of the new opcodes or new constants will fail verification,
and most Java programs don't use them.

Andrew.


012-04-23  Andrew Haley  <aph@redhat.com>

	* defineclass.cc (MAJOR_1_7,  MINOR_1_7): New.
	(parse): Allow MAJOR_1_7 classfile version.

Index: defineclass.cc
===================================================================
--- defineclass.cc	(revision 186103)
+++ defineclass.cc	(working copy)
@@ -361,6 +361,8 @@
 #define MINOR_1_5  0
 #define MAJOR_1_6 50
 #define MINOR_1_6  0
+#define MAJOR_1_7 51
+#define MINOR_1_7  0

 void
 _Jv_ClassReader::parse ()
@@ -371,8 +373,8 @@

   int minor_version = read2u ();
   int major_version = read2u ();
-  if (major_version < MAJOR_1_1 || major_version > MAJOR_1_6
-      || (major_version == MAJOR_1_6 && minor_version > MINOR_1_6))
+  if (major_version < MAJOR_1_1 || major_version > MAJOR_1_7
+      || (major_version == MAJOR_1_7 && minor_version > MINOR_1_7))
     throw_class_format_error ("unrecognized class file version");
   is_15 = (major_version >= MAJOR_1_5);


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Allow 1.7 class file format
  2012-04-23 13:30 Allow 1.7 class file format Andrew Haley
@ 2012-04-23 16:58 ` Andrew Hughes
  2012-04-23 17:19   ` Andrew Haley
  2012-04-25 10:17 ` Andrew Haley
  1 sibling, 1 reply; 4+ messages in thread
From: Andrew Hughes @ 2012-04-23 16:58 UTC (permalink / raw)
  To: Andrew Haley; +Cc: GCJ-patches

----- Original Message -----
> There's no real reason to disallow 1.7 class files.  Anyone trying to
> use any of the new opcodes or new constants will fail verification,
> and most Java programs don't use them.
> 

Seems very sensible to me.  I was thinking we'd need something like this for
bootstrapping if nothing else.

FWIW, I think gcj is the only Classpath VM that checks the range of this at all
and it's always seemed fairly incompatible with a FOSS model of working to me
i.e. if there's a real issue with not being able to read a class, it's easier
to dig into the code and debug it when it hits the unknown bytecode
rather than on some arbitrary version check.  As you say, in the majority of cases, 1.7
versioned bytecode will only contain bytecodes from <=1.6 anyway.

> Andrew.
> 
> 
> 012-04-23  Andrew Haley  <aph@redhat.com>
> 
> 	* defineclass.cc (MAJOR_1_7,  MINOR_1_7): New.
> 	(parse): Allow MAJOR_1_7 classfile version.
> 
> Index: defineclass.cc
> ===================================================================
> --- defineclass.cc	(revision 186103)
> +++ defineclass.cc	(working copy)
> @@ -361,6 +361,8 @@
>  #define MINOR_1_5  0
>  #define MAJOR_1_6 50
>  #define MINOR_1_6  0
> +#define MAJOR_1_7 51
> +#define MINOR_1_7  0
> 
>  void
>  _Jv_ClassReader::parse ()
> @@ -371,8 +373,8 @@
> 
>    int minor_version = read2u ();
>    int major_version = read2u ();
> -  if (major_version < MAJOR_1_1 || major_version > MAJOR_1_6
> -      || (major_version == MAJOR_1_6 && minor_version > MINOR_1_6))
> +  if (major_version < MAJOR_1_1 || major_version > MAJOR_1_7
> +      || (major_version == MAJOR_1_7 && minor_version > MINOR_1_7))
>      throw_class_format_error ("unrecognized class file version");
>    is_15 = (major_version >= MAJOR_1_5);
> 
> 
> 

-- 
Andrew :)

Free Java Software Engineer
Red Hat, Inc. (http://www.redhat.com)

PGP Key: 248BDC07 (https://keys.indymedia.org/)
Fingerprint = EC5A 1F5E C0AD 1D15 8F1F  8F91 3B96 A578 248B DC07

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Allow 1.7 class file format
  2012-04-23 16:58 ` Andrew Hughes
@ 2012-04-23 17:19   ` Andrew Haley
  0 siblings, 0 replies; 4+ messages in thread
From: Andrew Haley @ 2012-04-23 17:19 UTC (permalink / raw)
  To: Andrew Hughes; +Cc: GCJ-patches

On 04/23/2012 05:58 PM, Andrew Hughes wrote:
> FWIW, I think gcj is the only Classpath VM that checks the range of this at all
> and it's always seemed fairly incompatible with a FOSS model of working to me
> i.e. if there's a real issue with not being able to read a class, it's easier
> to dig into the code and debug it when it hits the unknown bytecode
> rather than on some arbitrary version check.

I don't know why that check is there.  I suppose it's always been
easier to update it rather than just delete the check.

Andrew.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Allow 1.7 class file format
  2012-04-23 13:30 Allow 1.7 class file format Andrew Haley
  2012-04-23 16:58 ` Andrew Hughes
@ 2012-04-25 10:17 ` Andrew Haley
  1 sibling, 0 replies; 4+ messages in thread
From: Andrew Haley @ 2012-04-25 10:17 UTC (permalink / raw)
  To: java-patches

On 04/23/2012 02:30 PM, Andrew Haley wrote:
> 012-04-23  Andrew Haley  <aph@redhat.com>
> 
> 	* defineclass.cc (MAJOR_1_7,  MINOR_1_7): New.
> 	(parse): Allow MAJOR_1_7 classfile version.

Committed to 4.7 release branch.

Andrew.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-04-25 10:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-23 13:30 Allow 1.7 class file format Andrew Haley
2012-04-23 16:58 ` Andrew Hughes
2012-04-23 17:19   ` Andrew Haley
2012-04-25 10:17 ` Andrew Haley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).