[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-jel] java.lang.VerifyError
From: |
Mark Taylor |
Subject: |
Re: [Bug-jel] java.lang.VerifyError |
Date: |
Tue, 17 Nov 2020 10:44:50 +0000 (GMT) |
User-agent: |
Alpine 2.21 (DEB 202 2017-01-01) |
Konstanin,
many thanks for this quick fix - yes it's now working perfectly.
Mark
On Tue, 17 Nov 2020, Konstantin L. Metlov wrote:
> Dear Mark,
>
> Thank you very much for finding and reporting this bug !
>
> It happened because evaluation of logical expressions does not actually
> put the (intermediate) boolean values on Java stack but instead compiles
> into an intertwined (if there are logical operators and brackets) braid of
> conditional jumps. To have the boolean value on stack the compiler has to
> land all the dangling labels to "true" and "false" branches of the logical
> expression and actually load the constants 0 or 1 to stack. This last step
> was missing when wrapping (boxing) the boolean values into the
> java.lang.Boolean type.
>
> It compiled (verified, but not worked properly) for doubles, because in
> Java the double comparisons are actually done via intermediate integers
> (created via dcmpg/dcmpl instructions). These intermediate values
> (incorrectly) served as final boolean values on stack.
>
> This bug is now fixed. The actual fix consists of 4 modified characters:
>
> - cf.code(0x00FEL+((29+resID-20)<<8));
> + cf.code(0x00FEFAL+((29+resID-20)<<16));
>
> in src/java/gnu/jel/OPunary.java . I have also added the corresponding
> tests to JEL testsuite. You can find the updated jel.jar (and jel_g.jar)
> in the pre-release version 2.1.2-pre1 version of JEL I've posted on my
> homepage:
>
> http://www.donfti.ru/~metlov/jel-2_1_2-pre1.zip
>
> $ md5sum jel-2_1_2-pre1.zip
> 44aa87b8f8bd0bdc8c9040b2e55cb6b8 jel-2_1_2-pre1.zip
> $ sha256sum jel-2_1_2-pre1.zip
> 8d606890fb3241adc989fdec3271b17e6621872bc29631c6623d21df88a88e18
> jel-2_1_2-pre1.zip
>
> Please try this version and tell me if it fixes the bug for you.
>
> I've also uploaded the source changes to savannah:
>
> http://svn.savannah.gnu.org/viewvc/jel/trunk/
>
> With the best regards,
> Konstantin.
>
> > Dear Konstantin,
> >
> > I think I have encountered a (weird) JEL bug.
> >
> > If I compile and run the following program against (e.g.) JEL 2.1.1:
> >
> > import gnu.jel.Evaluator;
> > import gnu.jel.Library;
> >
> > public class Jelly3 {
> >
> > public static void main(String[] args) throws Throwable {
> > Library lib = new Library(new Class[] {Jelly3.ALib.class},
> > null, null, null, null);
> >
> > // These calls work OK:
> > Evaluator.compile("dx==1", lib, null);
> > Evaluator.compile("dx==1", lib, Boolean.class);
> > Evaluator.compile("ix==1", lib, null);
> >
> > // But this one causes a java.lang.VerifyError:
> > Evaluator.compile("ix==1", lib, Boolean.class);
> > }
> >
> > public static class ALib {
> > public static double dx() {
> > return 1.0;
> > }
> > public static int ix() {
> > return 1;
> > }
> > }
> > }
> >
> > I see this error:
> >
> > Exception in thread "main" java.lang.VerifyError: (class: dump,
> > method: evaluate signature: ([Ljava/lang/Object;)Ljava/lang/Object;)
> > Expecting to find unitialized object on stack
> > at java.lang.Class.getDeclaredConstructors0(Native Method)
> > at
> > java.lang.Class.privateGetDeclaredConstructors(Class.java:2671)
> > at java.lang.Class.getConstructor0(Class.java:3075)
> > at java.lang.Class.newInstance(Class.java:412)
> > at gnu.jel.Evaluator.compile(Evaluator.java:158)
> > at Jelly3.main(Jelly3.java:16)
> >
> > Any ideas?
> >
> > Many thanks,
> >
> > Mark
> >
> > --
> > Mark Taylor Astronomical Programmer Physics, Bristol University, UK
> > m.b.taylor@bris.ac.uk +44-117-9288776 http://www.star.bris.ac.uk/~mbt/
> >
> > _______________________________________________
> > Bug-jel mailing list
> > Bug-jel@gnu.org
> > https://lists.gnu.org/mailman/listinfo/bug-jel
> >
>
>
>
>
>
> _______________________________________________
> Bug-jel mailing list
> Bug-jel@gnu.org
> https://lists.gnu.org/mailman/listinfo/bug-jel
>
--
Mark Taylor Astronomical Programmer Physics, Bristol University, UK
m.b.taylor@bris.ac.uk +44-117-9288776 http://www.star.bris.ac.uk/~mbt/