[ANN] Beta support for jdk8's lambdas

94 views
Skip to first unread message

Sriram Srinivasan

unread,
Aug 9, 2014, 5:32:42 AM8/9/14
to kilimt...@googlegroups.com
(Sorry: Reposting as a topic-level topic)

Lambda functions are now pausable.

Pick it up from the asm5-jdk8 branch
(https://github.com/kilim/kilim/tree/asm5-jdk8)

Example:

public void execute() throws Pausable {
Foo f = () -> {
...;
Task.sleep(100);
...
}

f.call();
}

interface Foo {
int call() throws Pausable;
}

As always, feedback, criticisms and code reviews welcome.

--sriram.

seth/nqzero

unread,
Aug 12, 2014, 2:28:27 PM8/12/14
to kilimt...@googlegroups.com
this is great sriram. it doesn't handle the case that i was most
interested in, ie the ability to create an actor using a lambda, eg

kilim.start( () -> { Task.sleep(1000); System.out.println("hello world"); } );

i added a demo example (Dummy) which exposes a few limitations: void
returns weren't handled, and the callsites don't get generated (if i
understand the terminology correctly). i have a fix for the first
issue, and a kludge for the second

https://github.com/kilim/kilim/pull/37

believe i can fix the second issue correctly, but won't have time for
a few days. thanks for the java8 support - this is really sexy and i'm
excited

seth
> --
> You received this message because you are subscribed to the Google Groups "kilimthreads" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to kilimthreads...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

seth/nqzero

unread,
Aug 15, 2014, 11:52:12 AM8/15/14
to kilimt...@googlegroups.com
updated that pull request with a fix for the callsite kludge using
your transformIndyBootstrap()

still a WIP, re-weaving woven classes doesn't work and suspect the
transform is being applied to non-pausable methods, though haven't
been able to track it down yet

kilim

unread,
Aug 26, 2014, 10:43:18 AM8/26/14
to kilimt...@googlegroups.com


On Tuesday, August 12, 2014 11:58:27 PM UTC+5:30, seth/nqzero wrote:
this is great sriram. it doesn't handle the case that i was most
interested in, ie the ability to create an actor using a lambda, eg



Fixed. 


Task.spawn( () -> {
     System.out.println("Before sleep");
     Task.sleep(1000); 
     System.out.println("After sleep");
});


Task.spawn takes a "Spawnable", but you don't have to know that.  Whatever pausable body you supply is wrapped into a Task and started.

 

seth/nqzero

unread,
Sep 11, 2014, 9:08:33 PM9/11/14
to kilimt...@googlegroups.com
on the asm5-jdk8 branch, if a class has only a single method, which is pausable, the weaver messes up invocations of that method, converting them to shims and resulting in a

java.lang.IncompatibleClassChangeError: Found class kilim.examples.Userdata$Eats1, but interface was expected

eg, see examples.Userdata in https://github.com/nqzero/kilim/tree/srl.icce

should i continue to add issues such as this one to issue 36 (support java8 and lambdas) or start a new issue ? i haven't yet made any attempt to fix the weaver, but if you'd like i'll take a shot at it

seth







--

Sriram Srinivasan

unread,
Sep 12, 2014, 12:27:54 AM9/12/14
to kilimt...@googlegroups.com

On Sep 12, 2014, at 6:38 AM, seth/nqzero <bl...@nqzero.com> wrote:

> on the asm5-jdk8 branch, if a class has only a single method, which is pausable, the weaver messes up invocations of that method, converting them to shims and resulting in a
>
> java.lang.IncompatibleClassChangeError: Found class kilim.examples.Userdata$Eats1, but interface was expected
>
> eg, see examples.Userdata in https://github.com/nqzero/kilim/tree/srl.icce
>
> should i continue to add issues such as this one to issue 36 (support java8 and lambdas) or start a new issue ? i haven't yet made any attempt to fix the weaver, but if you'd like i'll take a shot at it


Thanks seth. The issue of java8/lambdas is too broad, so make each issue a new one. If it turns out that more than one issue is related to the same underlying issue, we can add that to the issue notes. And yes, if you can take a shot at it, it'd be lovely!

--sriram.

seth/nqzero

unread,
Sep 12, 2014, 9:36:27 PM9/12/14
to kilimt...@googlegroups.com

Jason Pell

unread,
Nov 10, 2014, 7:22:27 PM11/10/14
to kilimt...@googlegroups.com
Hi All,

When will java 8 be supported by kilim.  I see that oracle is ending support updates to java 7 from april next year.


Sriram Srinivasan

unread,
Nov 10, 2014, 9:43:39 PM11/10/14
to kilimt...@googlegroups.com
Have you seen the asm5-jdk8 branch?
https://github.com/kilim/kilim/tree/asm5-jdk8

All the major changes have been made and I'm waiting for feedback. 

--sriram.

Jason Pell

unread,
Nov 10, 2014, 10:23:42 PM11/10/14
to kilimt...@googlegroups.com

Oh sorry did not realize it was ready for testing. I will take a look this week and get back to you

Sriram Srinivasan

unread,
Nov 10, 2014, 10:28:26 PM11/10/14
to kilimt...@googlegroups.com

seth/nqzero

unread,
Nov 10, 2014, 10:33:29 PM11/10/14
to kilimt...@googlegroups.com
the lambdas mostly work great. seems like a few rough edges eg


but it's really a great addition to kilim - much more accessible api

Reply all
Reply to author
Forward
0 new messages