coroutine support
Rémi Forax
forax at univ-mlv.fr
Sat Nov 14 10:03:35 PST 2009
Le 14/11/2009 10:22, Lukas Stadler a écrit :
> Ah, yes... I forgot to mention: it's currently only implemented in C1,
> and it doesn't even compile on C2 because I had to extend the compiler
> interface. But I'll probably get rid of that, and then it will be a lot
> easier to get C2 working as well.
>
> You're of course right about the graceful shutdown - I will do that as
> well. And if at runtime you're getting crashes in weird places: chances
> are that -Xcomp will fix it.
>
> - Lukas
>
Hi Lukas,
Your example doesn't work on my laptop:
0
#
# A fatal error has been detected by the Java Runtime Environment:
#
# Internal Error (nmethod.cpp:1997), pid=32273, tid=14347120
# Error: guarantee(cont_offset != 0,"unhandled implicit exception in
compiled code")
#
# JRE version: 7.0-b75
# Java VM: OpenJDK Client VM (17.0-b03-internal compiled mode linux-x86 )
# An error report file with more information is saved as:
# /home/forax/java/workspace/coroutine-test/hs_err_pid32273.log
#
# If you would like to submit a bug report, please visit:
# http://java.sun.com/webapps/bugreport/crash.jsp
#
I've attached the hotspot error log.
I've the same error using Fiber or Continuation.
Rémi
------------------------------------------------------------------------
public class FiberTest {
static class MyFiber extends Fiber {
@Override
protected Object generate(Object arg) {
System.out.println("generate called with "+arg);
return null;
}
}
@Continuable
public static void main(String[] args) {
MyFiber fiber=new MyFiber();
Object result = fiber.resume("toto");
System.out.println("resume output "+result);
}
}
------------------------------------------------------------------------
public class CoroutineTest extends Coroutine {
public CoroutineTest(CoroutineContext context) {
super(context);
}
public static void main(String[] args) {
CoroutineContext context = new CoroutineContext();
new CoroutineTest(context);
new CoroutineTest(context);
context.start(null);
}
@Continuable
protected Object run(Object value) {
for (int i = 0; i< 10; i++) {
System.out.println(i);
yield(null);
}
return null;
}
}
> Rémi Forax wrote:
>
>> Hi Lukas, hi all,
>>
>> C1 seems to work but not C2 (see further).
>>
>> Furthermore by default, hotspot requires that package javax.stack exists
>> instead of gracefully disable coroutine if javax.stack is not here
>> (which is the case of the first build, i.e when you use jdk6 to compile
>> jdk7).
>>
>> I will test it tomorrow,
>> Rémi
>>
>>
> _______________________________________________
> mlvm-dev mailing list
> mlvm-dev at openjdk.java.net
> http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev
>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: hs_err_pid32273.log
Url: http://mail.openjdk.java.net/pipermail/mlvm-dev/attachments/20091114/3046f4a0/attachment.ksh
More information about the mlvm-dev
mailing list