- Loading...
Patch name: callcc.patch
Continuation are supported via two different ways:
public native Object copyStack(Object context, CopyStackException ex) throws CopyStackException;Object[] using the same serialized form that the Hotspot JVM uses to store debug information internally. This Object[] is then stored in the stack field of the given CopyStackException which is in turn thrown.public native Object copyStackSimple(Object context, Continuation continuation);null, although it would probably be better to return a special static object instance instead of occupying null. In the long run most likely only one implementation will survive.
The public long resumeStack(Object context, Object stack, Object value, Throwable exception); method is used to resume a continuation. (no matter how it was created). The current stack is destroyed up to the context frame and the continuation contained in the stack object is reinstated.
The original copyStack or copyStackSimple call then returns value or throws exception.
Unsafe.doCopyStackContext is used to create a context stack frame for continuations. The first parameter is a Runnable whose run method will be invoked, and the second parameter is a context object (any Object) that will identify this particular doCopyStackContext invocation.
The current proof-of-concept implementation will be used to explore how continuations can be used in a secure environment (applet, etc.).
Starting from a very conservative approach features will be added if they are considered secure.
The targets and actions for continuation permissions could be characterized roughly like this:
Arbitrary continuations can break many low-level assumptions taken by the JVM and the continuation code, some of which could be verified and some not:
Runnable.run()The first security concept will be a very conservative one:
Continuable annotation can be storedContinuation objects do not allow any modificationsContinuableHidden can be stored but the local variables and the expression stack are hiddenWork in progress