This is the mail archive of the kawa@sourceware.org mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Kawa and Google Summer of Code?


On Mar 11, 2013, at 2:05 PM, Per Bothner <per@bothner.com> wrote:

> We're approaching this year's Google Summer of Code, and
> we have to decide whether to participate again.  The issue
> is whether we have mentors to help the students.  Last year
> Jamison Hope, with some help from Helmut Eller and myself,
> did a great job on mentoring Charles Turner with Common
> Lisp improvements.  This year I will be moving, and have
> some family complications, so I will again not be able
> to be a primary mentor, though I can help out with advice.

Thanks, Per.  It looks like work is going to be keeping me pretty busy
for the next several months, so I think I'll have to forego being a
primary mentor this year as well.  I'll be happy to sign up to be a
co-mentor and help out as much as I can, though.

> Anyone want to mentor?  I think it's a good learning experience
> for the mentor as well as the student!

+1

Everybody should sign up to be a mentor.  It's fun, you get to hack on
Kawa and share your wisdom with an impressionable young mind.  And when
it's all over, Google gives you a t-shirt.

> If we join in, we
> will most likely again do so under the GNU banner - they
> will help out with coordination and practical matters.
> We'll probably only get one student, though if we get
> enough mentors we can apply for more.
> 
> http://www.google-melange.com/gsoc/homepage/google/gsoc2013
> http://www.gnu.org/software/kawa/Ideas-and-tasks.html [needs some updating]
> http://www.gnu.org/software/soc-projects/ideas-2013.html

<thread-hijack>

Here's another idea that I've had running around the back of my head for
a while but haven't had any time to actually try to implement it:

SICP Chapter 5 presents a register machine simulator written as Scheme
code.  What if we cross that idea with Kawa's compiler to have a way
to embed JVM assembly language instructions -- or a close approximation,
anyway -- inside of Scheme code?

So we'd have something like this, maybe:

(define (gcd a::int b::int) ::int
  (asm
    test-b:
    (iload (reg b))
    (ifne (label gcd-loop))
    (iload (reg a))
    (goto (label gcd-done))
    gcd-loop:
    (iload (reg b))
    (iload (reg a))
    (iload (reg b))
    (irem)
    (istore (reg b))
    (istore (reg a))
    (goto (label test-b))
    gcd-done:
    (ireturn)))

And that compiles to:

  0: iload_1
  1: ifne 8
  4: iload_0
  5: goto 17
  8: iload_1
  9: iload_0
 10: iload_1
 11: irem
 12: istore_1
 13: istore_0
 14: goto 0
 17: ireturn

which is the same as what we'd get from a pure Scheme version:

(define (gcd a::int b::int)::int
  (if (= b 0)
      a
      (gcd b (remainder a b))))


Of course, we'd have to figure out a good balance between faithfulness
to the underlying JVM instructions and utility -- in my example I use
the variable names ("a" & "b") instead of their register locations
("0" & "1").  (Do we follow gnu.bytecode.CodeAttr and abstract away the
various ways to insert an int literal? Probably!)

Anyway, it could be an interesting tool to experiment with the JVM
instruction set.

Thoughts?

</thread-hijack>


-Jamie

--
Jamison Hope
The PTR Group
www.theptrgroup.com




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]