I would prefer for various reasons (including my lack of much direct experience with this sort of thing generally and with Avian's code specifically, and my having my work cut out for me already with what I hope to build on top of this) for the authors of the original continuation support to make this change if they agree with my reasoning, (and it seems a priori like a small change to implement, especially for someone coming from implementing the rest) but I may work doing it myself into my plans otherwise. I would be open to some kind of collaboration that makes sense as well.
we may need to recruit for our lobby.
we may need to recruit for our lobby.Not sure what you mean by this...
I've been told by knowledgeable people that it is impossible to implement composable continuations (AKA delimited continuations AKA shift/reset) in terms of call-with-current-continuation. Since I don't yet understand why that is, I figured it would help my understanding to attempt it and see how it fails.
... maybe these links have some more information:
http://okmij.org/ftp/continuations/against-callcc.html
http://okmij.org/ftp/continuations/undelimited.html#delim-vs-undelim
http://okmij.org/ftp/continuations/
Thanks, Simon. I still haven't finished reading all the stuff Anthony
linked to, so I'll focus on that for now.
Hi Anthony,
I haven't talked to Josh yet, but speaking for myself I'd say that it's not a matter of money or even time at this point.
If your Typesafe contact wants to see delimited continuations in Avian, but isn't picky about what that means, then it's done already: https://github.com/dicej/avian/compare/composable-continuations
If, on the other hand, he or she has specific requirements (e.g. speed, memory usage, corner cases) which need to be fulfilled, then even better: please have him or her provide feedback on that implementation. What I'd like best is runnable test cases that cause that implementation to fail, but I'd settle for a precisely worded description of what's missing or wrong with it.
If, once we get into the details, we find that the client needs something that will take significant time and effort beyond what we're willing to do without pay, we can talk about that. I would be very surprised if that were the case, though.
TL;DR: we need feedback, not money (we like money, too, but that's not what Avian is about right now)
On Thu, 6 Mar 2014, Anthony Di Franco wrote:
Hey y'all,
Sorry to have let this drop away. My employer has been running out of
money which created various cascading complications for me. However,
meanwhile, I may have a Typesafe person be willing to pay out of his
personal pocket to get this done. Would you be willing to give a ballpark
estimate on it? I can advise throughout.
On Fri, Dec 27, 2013 at 3:53 PM, Joel Dice <joel...@gmail.com> wrote:
No worries. I'll be busy all day tomorrow, but I'm generally logged in to
Google Talk from 8 to 5 on weekdays, so feel free to ping me there.
Thanks for the link; I'll read it when I get a chance.
On Fri, 27 Dec 2013, Anthony Di Franco wrote:
Sorry, I failed to notice your reply until now. Tomorrow at the same time
would work if still possible.
Also, I just found this very comprehensible passage with a reference to
the
mincaml implementation and a simple explanation (though I'd still suggest
named prompts)
http://stackoverflow.com/questions/5989961/why-are-
delimited-continuation-p
rimitives-named-shift-and-reset
On Dec 20, 2013 8:58 AM, "Joel Dice" <joel...@gmail.com> wrote:
How about noon MST (1PM PST)? I'll plan to be logged in as
joel...@gmail.com on Google Talk at that time. Let me know if
you want to use something different or meet at a different time.
The code of interest is in types.def (the continuationContext
and continuation types), compile.cpp (makeCurrentContinuation,
callContinuation, callWithCurrentContinuation, and dynamicWind),
and of course the wall of assembly in e.g. continuations-x86.S,
which is responsible for copying the next continuation frame to
the real stack and jumping to it.
Here's a breakdown of the types defined in types.def (which are
translated into C++ code at build time):
(type continuationContext
(object next) ;; used to walk the list of dynamic-wind
frames so the
;; appropriate "before" and "after" callbacks
can be
;; called.
(object before) ;; the dynamic-wind "before" callback
(object after) ;; the dynamic-wind "after" callback
(object continuation) ;; the continuation to call when
unwinding through
;; a dynamic-wind frame
(object method)) ;; used to check whether the context of the
called
;; continuation is compatible with the
context of the
;; calling continuation (e.g. the return
types are
;; compatible)
;; this should probably be called continuationFrame:
(type continuation avian/Continuations$Continuation
(object next) ;; the next frame in the continuation
(object context) ;; the continuationContext this continuation
belongs to
(object method) ;; the method for which this frame was
allocated
(void* address) ;; the instruction pointer within the method
at the
;; time the continuation was captured
(uintptr_t returnAddressOffset) ;; the offset within the body
of the
;; frame where the return
address can be
;; found, so we can change it
when the
;; frame is copied to the
stack
(uintptr_t framePointerOffset) ;; as above, except this is
for the
;; frame pointer
(array uintptr_t body)) ;; the body of the frame, as copied
straight
;; from the native stack
The layout of the body of the frame depends on the architecture,
but it looks roughly like this:
|-------------------------|
| Java stack |
|-------------------------|
| alignment padding |
|-------------------------|
| Java locals |
|-------------------------|
| frame header |
|-------------------------|
| frame footer for caller |
|-------------------------|
| arguments from caller |
|-------------------------|
The frame header and frame footer are the arch-dependent parts
and contain the return address, frame pointer, etc.
Hopefully that helps a bit.
On Thu, 19 Dec 2013, Anthony Di Franco wrote:
Saturday should be fine, early afternoon best. I'm
in San Francisco (-8)
Regarding the stack, going a bit lower level, what
would the binary format
of frames look like in an RFC type of explication?
And where in the source
tree do I find the key parts defining and
manipulating them? I am pretty
clear on the concepts but I had a brief peek around
and was repelled by a
wall of assembler so I could use a little primer.
On Dec 18, 2013 7:59 AM, "Joel Dice"
<joel...@gmail.com> wrote:
Yeah, I should have time for a live meeting
this Saturday. What
time zone are you in? Josh and I are in MST
(UTC -7).
The current implementation is pretty simple to
describe:
At any given point in execution, the stack may
be composed of
some combination of the following:
* "real" Java frames, i.e. frames on the
actual process stack
* continuation Java frames: heap-allocated,
immutable objects
containing snapshots of frames captured as
part of a
continuation and collected in a singly-linked
list. These
frames must be copied to the real stack before
they can be used.
Since it's a singly-linked list, several
unique continuations
can share frames which they have in common,
forming a tree.
* "real" native frames, i.e. frames allocated
by native code on
the actual process stack
To capture a continuation, we visit all the
"real" Java frames,
starting with the most recent, and make a
continuation frame
from each one. When we run out of real Java
frames, we link our
continuation-list-in-progress to the next
continuation Java
frame, if any. Otherwise, we've reached a
native frame, so we
stop.
To call a continuation, we unwind the stack to
the most recent
frame shared by the current continuation and
the one we want to
call, then "push" any additional frames in the
called
continuation. The "push" itself does not
require copying all
those frames to the real stack; we only need
to copy the top one
and set Thread::continuation to point to the
next one, which
will be copied to the real stack if and when
it is needed, etc.
Okay, maybe it's not as simple to describe as
I thought.
Hopefully it will make more sense when we
chat later.
On Tue, 17 Dec 2013, Anthony Di Franco wrote:
Now that you're getting started, I'd
like to help
out if possible. I could
benefit from some pointers or recipes
for exposing
vm internals via the
avian package and on the stack frame
format and
existing operations that
manipulate it, installing exception
handlers
especially. Do you have time
for a live text or video interaction to
go over
these things? I think it
would save me a lot of time and maybe I
can
reciprocate by advising on the
implementation strategy.
Anthony
On Nov 16, 2013 11:20 AM, "Joel Dice"
<joel...@gmail.com> wrote:
On Thu, 3 Oct 2013, Anthony Di
Franco wrote:
Hi all, an indecent
proposal:
--
You received this message because
you are
subscribed to a topic
in the Google Groups "Avian"
group.
To unsubscribe from this topic,
visit
https://groups.google.com/d/topic/avian/yrdlmjLy1Ng/
unsubscribe.
To unsubscribe from this group and
all its
topics, send an email
to
avian+unsubscribe@googlegroups.com.
To post to this group, send email
to
av...@googlegroups.com.
Visit this group at
http://groups.google.com/group/avian.
For more options, visit
https://groups.google.com/groups/opt_out.
... issuing the following error message:
def shift[A,B,C](fun: (A => B) => C): A
def reset[A,C](ctx: =>A): C
No, and I wasn't able to reproduce it. And in your Gist, it looks like
the error went away the second time you ran make, which is weird.
Could someone say in English a summary of the strategy of how this is implemented?
--
You received this message because you are subscribed to a topic in the Google Groups "Avian" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/avian/yrdlmjLy1Ng/unsubscribe.
To unsubscribe from this group and all its topics, send an email to avian+unsubscribe@googlegroups.com.
To post to this group, send email to av...@googlegroups.com.
Visit this group at http://groups.google.com/group/avian.
For more options, visit https://groups.google.com/d/optout.
Ah, I didn't read carefully -- that's the part I was missing. It's fixed
now: