info-gnuprologjava
[Top][All Lists]
Advanced

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

Re: [Info-gnuprologjava] {Info-gnuprologjava} 16-bit VM pointers


From: Matt Lilley
Subject: Re: [Info-gnuprologjava] {Info-gnuprologjava} 16-bit VM pointers
Date: Thu, 27 Nov 2014 07:03:00 +1300 (NZDT)

Hi Daniel,

I've attached the patch and a test case, but I confess I don't fully understand the testing scheme. (In fact, when I build the tests here, I get a stack overflow exception which constitutes most of the output for the test-inriasuite. Is that expected? I also get an error in sec74.pl about go7_4/0 not existing. I still get a BUILD SUCCESSFUL result from ant, though)

Because the behaviour is undefined when my new test fails, we can't easily make any guarantees about detecting a failed test. When I try it, the test process just terminates, which isn't really ideal, but I don't know what else can be done. I also don't know which file it should go in; I'm assuming the tests are named for the sections in the ISO document for Prolog, but obviously this doesn't stipulate anything about address sizes. I put it in a file test_32bit.pl

I should also mention that it's not 100% obvious where the project source code is actually stored. I got mine from https://github.com/drt24/gnuprologjava.git which seems to be more up-to-date (0.3.0) then the GNU page (http://ftp.gnu.org/gnu/gnuprologjava/) which has only 0.2.6 (as announced at http://savannah.gnu.org/projects/gnuprologjava/, this is apparently the latest version. Am I working off a community fork? I notice that the last version announced was announced by drt24, which gives me some hope that the project found its way to github and I've managed to find your copy of it!)

If nothing else, hopefully this represents a good starting point for an eventual patch.

Regards,
Matt


Attachment: 0001-Extend-jumps-to-32-bit.patch
Description: Binary data

Attachment: 0002-Add-test-for-complex-clause.patch
Description: Binary data



On 26/11/2014, at 10:21 pm, Daniel Thomas <address@hidden> wrote:

On 25/11/14 19:19, Matt Lilley wrote:
Hi,

I'm not sure if this is the right address; if not, can someone direct me to the right one?

I noticed today while trying to debug some code that GNU Prolog for Java seems to be limited to 16-bit pointers in the VM. For example, the retry-me-else opcode has a maximum argument of 65535. If you create a predicate with a lot of complicated clauses, this can easily be exhausted, and you end up with pointer truncation, and ultimately undefined behaviour.

Is there a good reason we cannot extend this to at least 32 bits? I'm happy to write the patch if someone has the time to review it. At the *very* least we should check in InterpretedByteCode that the retryPosition is less than the maximum jump distance and raise an exception if it is.

Regards,
Matt

Hello Matt,

I would be happy to review such a patch particularly if it came with
some good test cases.

Regards,

Daniel


reply via email to

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