Download presentation
Presentation is loading. Please wait.
1
Process Mobility on the JVM for ProcessJ
CPA 2009
2
Intro to ProcessJ ProcessJ is a new process-oriented language
Syntax close to Java and a semantics close to occam-π Scoping rules similar to Java Provides an approachable environment for broader audience of imperative programmers Multiple target platforms
3
Intro to ProcessJ Multiplexer Example (Occam)
PROC mux (CHAN INT in1?, in2?, out!) INT data: WHILE TRUE ALT in1 ? data out ! data in2 ? data
4
Intro to ProcessJ Multiplexer Example
proc void mux(chan<int>.read in1, chan<int>.read in2, chan<int>.write out) { int data; while (true) { alt { data = in1.read() : out.write(data); data = in2.read() : } } }
5
Intro to ProcessJ Sequential subset mimics Java/C
Sequential subset mimics Java/C Semicolon delimited statements Assignment, arithmetic Conditionals For, While loops
6
Intro to ProcessJ Channels look like objects with read, write methods (as in JCSP) Special syntax for: Par blocks Alt bocks Parallel For loops
7
Our Compiler Multiple backends MPI, Java (JCSP), Occam
Java backend targets Java source code Take advantage of javac's optimizer
8
JCSP / JCSP.net Serialization Network Classloading
Mobile Channels, Processes
9
Process Mobility Illustrate process mobility in JCSP
Peter Welch - Bond example (jcsp.net pg 88)
10
Process Mobility Certain behavior implied at suspend point
mobile proc void foo() { int a = 0; while (a == 0) { a = a + 1; suspend; a = a - 1; } }
11
Challenges of the platform
No continuations Limitations on flow control
12
Suspending Support must be added for saving and restoring the local variable part of the JVM activation record - Return control to caller
13
Resuming Restore activation record
Jump to appropriate bytecode instruction Goto would be nice!
14
Code Outline public class Foo { private Object[] actRec;
private int jumpTarget public void foo() { ... switch (jumpTarget) { case 1: goto #1; default: break; } while(1) { suspend(); ; #1 } } }
15
Source Code Rewriting Methods
Must separate code into regions between suspend calls (Fuenfrocken 98) Java compiler sensitive to visibility of declared variables Large overhead in generated LOCs
16
Bytecode Transformation
-Truyen -Bouchenak
17
Overview of transformation
18
Bytecode Transformation
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.