[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-jel] java.lang.VerifyError

From: Konstantin L. Metlov
Subject: Re: [Bug-jel] java.lang.VerifyError
Date: Tue, 17 Nov 2020 12:42:00 +0300
User-agent: SquirrelMail/1.4.23 [SVN]

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


$ md5sum jel-2_1_2-pre1.zip
44aa87b8f8bd0bdc8c9040b2e55cb6b8  jel-2_1_2-pre1.zip
$ sha256sum 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:


With the best regards,

> 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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]