Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2022-06

JVM testing on x86_64

9 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

J. Gareth Moreton

Hi everyone,

So since a large number of my new optimisations do things at the nodal level, I need to do much more extensive testing.  One thing that was brought up was testing JVM and LLVM.  I've managed to build "ppcjvm" on x86_64-win64 after downloading the necessary runtimes, but how do I run the test suite for jvm-java?

erroru.pp(25,3) Fatal: Unknown compilerproc "fpc_get_output". Check if you use the correct run time library.
Fatal: Compilation aborted

There is a jvmbackend branch, but it's 10 years stale and I figured there's a better way of going about it.  Do I need to build the RTL in a certain way or add a specific parameter or directory to the "make full" call to run the test suite?

Gareth aka. Kit

This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus

Reply by email

Jonas Maebe
to J. Gareth Moreton
J. Gareth Moreton wrote 6 lines
on x86_64-win64 after downloading the necessary runtimes, but how do I run the test suite for jvm-java? erroru.pp(25,3) Fatal: Unknown compilerproc "fpc_get_output". Check if you use the correct run time library. Fatal: Compilation aborted

The JVM backend does not support the full RTL nor all language constructs: https://wiki.freepascal.org/FPC_JVM/Language

There is a limited JVM-only testsuite in tests/test/jvm that you check with the testall.sh script in that directory (or testall.bat, but I'm not sure that one is completely up-to-date).

Jonas

Reply by email

J. Gareth Moreton
to Jonas Maebe

The testall.bat file took some modification since it doesn't handle parameters like testall.sh does.  I didn't get too far though:

C:\Users\garet\Documents\programming\fpc-opts\tests\test\jvm>..\..\..\compiler\ppcjvm -Fu..\..\..\rtl\units\jvm-java -O2 -g test
Generated: .\org\freepascal\test\tisclass2.class
test.j:7: JAS Error: Badly formatted number.
.field public static final 'unitfloatconst' F = 0fx40000000                                                             ^ test.j: Found 1 errors
Generated: .\org\freepascal\test\trec.class
TMyClass.j:7: JAS Error: Badly formatted number.
.field public static final 'classfloatconst' F = 0fx40400000                                                              ^ TMyClass.j: Found 1 errors
Generated: .\org\freepascal\test\tisinterface.class Generated: .\org\freepascal\test\tisclassbase.class Generated: .\org\freepascal\test\tisclassbase2.class Generated: .\org\freepascal\test\tisclass1.class
Generated: .\org\freepascal\test\tisclass1$tisclass1nested.class Generated:
.\org\freepascal\test\tisclass1$tisclass1nested$test__fpc_intern_recname_37.class Generated:
.\org\freepascal\test\tisclass1$tisclass1nested$tisclass1nestedl2.class Generated:
.\org\freepascal\test\tisclass1$tisclass1nested$tisclass1nestedl2$test__fpc_intern_recname_43.class Generated: .\org\freepascal\test\tnestrec.class
Generated: .\org\freepascal\test\test__fpc_intern_recname_68.class

C:\Users\garet\Documents\programming\fpc-opts\tests\test\jvm>javac -encoding utf-8 -cp ..\..\..\rtl\units\jvm-java;. JavaClass 'javac' is not recognized as an internal or external command, operable program or batch file.

C:\Users\garet\Documents\programming\fpc-opts\tests\test\jvm>java -Dfile.encoding=UTF-8 -cp ..\..\..\rtl\units\jvm-java;. JavaClass Error: Could not find or load main class JavaClass

C:\Users\garet\Documents\programming\fpc-opts\tests\test\jvm>if 1 NEQ 0 exit /b 1

I'm able to run Shell scripts on my Windows machine thanks to having a bash client installed, but testall.sh closes immediately (and it doesn't give me a chance to view the error messages) but this is probably because I haven't specified any parameters.  I tried the obvious TEST_FPC=../../../compiler/ppcjvm.exe, and PPC instead of TEST_FPC, but it still closed immediately.

Sorry if this is painfully obvious stuff.  I will master non-Windows stuff and all eventually!

Gareth aka. Kit

This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus

Reply by email

J. Gareth Moreton
to J. Gareth Moreton

The lack of "javac" is a little confusing.  I have a lot to learn!

Gareth aka. Kit

J. Gareth Moreton wrote 54 lines
The testall.bat file took some modification since it doesn't handle parameters like testall.sh does.  I didn't get too far though: C:\Users\garet\Documents\programming\fpc-opts\tests\test\jvm>..\..\..\compiler\ppcjvm -Fu..\..\..\rtl\units\jvm-java -O2 -g test Generated: .\org\freepascal\test\tisclass2.class test.j:7: JAS Error: Badly formatted number. .field public static final 'unitfloatconst' F = 0fx40000000                                                             ^ test.j: Found 1 errors Generated: .\org\freepascal\test\trec.class TMyClass.j:7: JAS Error: Badly formatted number. .field public static final 'classfloatconst' F = 0fx40400000                                                              ^ TMyClass.j: Found 1 errors Generated: .\org\freepascal\test\tisinterface.class Generated: .\org\freepascal\test\tisclassbase.class Generated: .\org\freepascal\test\tisclassbase2.class Generated: .\org\freepascal\test\tisclass1.class Generated: .\org\freepascal\test\tisclass1$tisclass1nested.class Generated: .\org\freepascal\test\tisclass1$tisclass1nested$test__fpc_intern_recname_37.class Generated: .\org\freepascal\test\tisclass1$tisclass1nested$tisclass1nestedl2.class Generated: .\org\freepascal\test\tisclass1$tisclass1nested$tisclass1nestedl2$test__fpc_intern_recname_43.class Generated: .\org\freepascal\test\tnestrec.class Generated: .\org\freepascal\test\test__fpc_intern_recname_68.class C:\Users\garet\Documents\programming\fpc-opts\tests\test\jvm>javac -encoding utf-8 -cp ..\..\..\rtl\units\jvm-java;. JavaClass 'javac' is not recognized as an internal or external command, operable program or batch file. C:\Users\garet\Documents\programming\fpc-opts\tests\test\jvm>java -Dfile.encoding=UTF-8 -cp ..\..\..\rtl\units\jvm-java;. JavaClass Error: Could not find or load main class JavaClass C:\Users\garet\Documents\programming\fpc-opts\tests\test\jvm>if 1 NEQ 0 exit /b 1 I'm able to run Shell scripts on my Windows machine thanks to having a bash client installed, but testall.sh closes immediately (and it doesn't give me a chance to view the error messages) but this is probably because I haven't specified any parameters.  I tried the obvious TEST_FPC=../../../compiler/ppcjvm.exe, and PPC instead of TEST_FPC, but it still closed immediately. Sorry if this is painfully obvious stuff.  I will master non-Windows stuff and all eventually! Gareth aka. Kit
This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus

Reply by email

J. Gareth Moreton
to J. Gareth Moreton

Okay. got the JDK installed (and got javac), so we're making progress!  Mostly...

testall.sh still won't run since I'm not specifying the correct options I don't think.  I've gotten testall.bat partially working, but still getting errors (I had to add the '.java' extension to JavaClass to prevent another error).

C:\Users\garet\Documents\programming\fpc-opts\tests\test\jvm>javac -encoding utf-8 -cp ..\..\..\rtl\units\jvm-java;. JavaClass.java JavaClass.java:9: error: cannot find symbol
  TMyClass t = new TMyClass();
  ^
  symbol:   class TMyClass
  location: class JavaClass
JavaClass.java:9: error: cannot find symbol
  TMyClass t = new TMyClass();
                   ^
  symbol:   class TMyClass
  location: class JavaClass
JavaClass.java:29: error: package test does not exist   System.out.println("myrec.a should return 42: "+test.myrec.a);                                                       ^ JavaClass.java:30: error: package test does not exist   System.out.println("myrec.b should return 1234: "+test.myrec.b);                                                         ^ JavaClass.java:31: error: package TMyClass does not exist   System.out.println("TMyClass.rec.c should return 5678: "+TMyClass.rec.c); ^
JavaClass.java:32: error: cannot find symbol
  System.out.println("test.tcl should return 4: "+test.tcl);                                                   ^   symbol:   variable test
  location: class JavaClass
JavaClass.java:33: error: package test does not exist   System.out.println("test.tcrec.a should return 1: "+test.tcrec.a);                                                           ^ JavaClass.java:34: error: package test does not exist   System.out.println("test.tcrec.e should return 5: "+test.tcrec.e);                                                           ^ JavaClass.java:35: error: package test.tcnestrec does not exist   System.out.println("test.tcnestrec.r.d should return 4: "+test.tcnestrec.r.d);
^
JavaClass.java:36: error: package test does not exist   System.out.println("test.tcnestrec.r.arr[1] should return 6: "+test.tcnestrec.arr[1]);
                                                                     ^ JavaClass.java:37: error: cannot find symbol
  TMyClass.settestglobal(654321);
  ^
  symbol:   variable TMyClass
  location: class JavaClass
JavaClass.java:38: error: cannot find symbol
  System.out.println("TMyClass.gettestglobal should return 654321: "+TMyClass.gettestglobal());
                                                                     ^   symbol:   variable TMyClass
  location: class JavaClass
JavaClass.java:39: error: cannot find symbol
  System.out.println("TMyClass.staticmul3(3) should return 9: "+TMyClass.staticmul3(3));

...

And the errors continue ad infinitum.  (This is on 'main', by the way)

Gareth aka. Kit

This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus

Reply by email

J. Gareth Moreton
to Jonas Maebe

Hi Jonas,

Thanks for your help.  I've had to make a lot of changed to testall.bat since it was malformed in places.  I've got it working now though.

Would there be interest in me creating a merge request with the improved TESTALL.BAT file for tests/test/jvm?

Gareth aka. Kit

Jonas Maebe wrote 15 lines
On 2022-06-08 15:15, J. Gareth Moreton via fpc-devel wrote: > The testall.bat file took some modification since it doesn't handle > parameters like testall.sh does.  I didn't get too far though: You have to install our own, patched version of Jasmin: https://wiki.freepascal.org/FPC_JVM#Download Jonas _______________________________________________ fpc-devel maillist  -  https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus

Reply by email

Jonas Maebe
to J. Gareth Moreton
J. Gareth Moreton wrote 6 lines
Thanks for your help.  I've had to make a lot of changed to testall.bat since it was malformed in places.  I've got it working now though. Would there be interest in me creating a merge request with the improved TESTALL.BAT file for tests/test/jvm?

Yes, definitely. Thanks!

Jonas

Reply by email