public inbox for kawa@sourceware.org
 help / color / mirror / Atom feed
From: Per Bothner <per@bothner.com>
To: Panicz Maciej Godek <godek.maciek@gmail.com>, kawa@sourceware.org
Subject: Re: java.lang.RuntimeException: invoke: no method named `$000a' in class gnu.expr.PrimProcedure
Date: Mon, 28 Feb 2022 16:19:59 -0800	[thread overview]
Message-ID: <a5ca1172-e4e2-7fb9-3a95-0699bf8bf190@bothner.com> (raw)
In-Reply-To: <CAMFYt2Yryine4JfBcG4X40STP9nB_2H=hsTBRKqfn5+pKyAusA@mail.gmail.com>



On 2/28/22 15:10, Panicz Maciej Godek via Kawa wrote:
> I have a new problem. When I invoke a function, I get the following error:
> 
> java.lang.RuntimeException: invoke: no method named `$000a' in class
> gnu.expr.PrimProcedure

This is an exception thrown by the 'invoke' procedure:

https://www.gnu.org/software/kawa/Method-operations.html#idm45230715888224

This is a way to explicitly call a Java method. 'invoke' can appear in user-code, and
sometimes the compiler generates call to it.  In this case it looks like the
compiler has translated some form to the equivalent of (invoke OBJECT '$000a ARGS ...).
With appropriate type information about OBJECT and the ARGS, in further steps
the compiler can translate this to an inline JVM invokexxx instruction,
but when it doesn't have the needed type information it will invoke at run-time.
The call to invoke should should up in the --debug-print-final-expr output.
Probably for some reason the method $000a isn't being generated or it
is generated in the wrong class.

> I suppose there could be some bug in the treatment of continuations when
> call/cc appears in the body of a method (but it's only a hypothesis).

Could well be.  Kawa will try to optimze call/cc when invoking and handling the
continuation are in the same method, but because Kawa does a lot of
inlining and other optimizations it could well have gotten confused.

> Anyway, I wonder if Kawa provides a way of performing an early return from
> a method (other than call/cc)?

Well you could use exceptions: primitive-throw with try-catch.  call/cc is
basically compiled into that anyway, except when it can be optimized to a goto.
-- 
	--Per Bothner
per@bothner.com   http://per.bothner.com/

      reply	other threads:[~2022-03-01  0:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-28 23:10 Panicz Maciej Godek
2022-03-01  0:19 ` Per Bothner [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a5ca1172-e4e2-7fb9-3a95-0699bf8bf190@bothner.com \
    --to=per@bothner.com \
    --cc=godek.maciek@gmail.com \
    --cc=kawa@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).