Presentation is loading. Please wait.

Presentation is loading. Please wait.

Group 4: Song Li, Ying Lu, Hexin Wang, and Michael Walker May 1, 2000

Similar presentations


Presentation on theme: "Group 4: Song Li, Ying Lu, Hexin Wang, and Michael Walker May 1, 2000"— Presentation transcript:

1 Group 4: Song Li, Ying Lu, Hexin Wang, and Michael Walker May 1, 2000
Java ParTy: Java With Parameterized Types “Tonight I’m gonna ParTy like it’s 1999.” Prince Background just got here last week finished degree at MIT week before Philosophy of advising students don’t come to grad school to implement someone else’s idea can get paid more to do that in industry learn to be a researcher important part of that is deciding what problems and ideas are worth spending time on grad students should have their own project looking for students who can come up with their own ideas for research will take good students interested in things I’m interested in – systems, programming languages & compilers, security rest of talk – give you a flavor of the kinds of things I am interested in meant to give you ideas (hopefully even inspiration!) but not meant to suggest what you should work on CS655: Programming Languages University of Virginia Computer Science Group 4: Song Li, Ying Lu, Hexin Wang, and Michael Walker May 1, 2000

2 University of Virginia CS 655
Outline Motivation Related Work Our Solution: ParTy Evaluation Remaining Work Conclusion 22 July 2019 University of Virginia CS 655

3 University of Virginia CS 655
Motivation Java provides no support for genericity [JLS] Must use Object parameters with type casting Performance hit Type safety is an issue 22 July 2019 University of Virginia CS 655

4 Genericity: Potential Benefits
Ideal scenario: One generic abstraction that adapts Compiled code is JVM-compatible Type safety control is just as powerful as non-generic code Performance boost in execution speed Small code size 22 July 2019 University of Virginia CS 655

5 Genericity: Potential Benefits
ParTy scenario: One generic abstraction that adapts Compiled code is JVM-compatible Type safety control is just as powerful as non-generic code Performance boost in execution speed Small code size We can’t have everything! But we can delay code blowup... 22 July 2019 University of Virginia CS 655

6 University of Virginia CS 655
Related Work Examine support for type parameters in other languages C++, Ada, Sather, Eiffel, Haskell, ML Examine current proposals for Java extensions GJ, PolyJ, Pizza, Agesen et. al. 22 July 2019 University of Virginia CS 655

7 Related Work: GJ and Pizza [Bracha+98]
GJ translates into legal JVM bytecode Homogeneous genericity Substitutes type variables by their “bounding type” usually, Object Constrains code size Sacrifices speed No type constraints 22 July 2019 University of Virginia CS 655

8 Related Work: PolyJ [Liskov+97]
Modifies JVM bytecode to express parameterization better performance small code size Adds where clause type constraints a la CLU [LSA+77] Creates a new language 22 July 2019 University of Virginia CS 655

9 Related Work: Agesen et. al. (Stanford, 1997)
Insert preprocess step into JVM loader no change to JVM delays code blowup until load-time! No type constraints Details of implementation are vague 22 July 2019 University of Virginia CS 655

10 Related Work: Comparison
22 July 2019 University of Virginia CS 655

11 University of Virginia CS 655
Java ParTy Philosophy Provide a powerful, safe, and efficient construct for designing generic classes without changing JVM bytecodes Rule: Do not add complexity to Java unless its usefulness outweighs its complexity 22 July 2019 University of Virginia CS 655

12 Our Solution: Java ParTy
Constructed JLS-extended syntax and semantics Brief list of features: type parameters within class or interface where clause type constraints type parameter can itself be of a parameterized type 22 July 2019 University of Virginia CS 655

13 University of Virginia CS 655
ParTy Code Example class myClass<Type1, Type2> where { boolean lt( Type1 t) } extends myBaseClass implements myInterface { // class body } 22 July 2019 University of Virginia CS 655

14 ParTy Implementation ParTy class A (1) Generic class A written
class A<T>{ // body } (1) Generic class A written (2) class B written to instantiate A with actual types ParTy class B Class B { A<int> a; A<String> b; } 22 July 2019 University of Virginia CS 655

15 ParTy Implementation ParTy class A (3) Classes are sent to compiler
(4) Corresponding .pclass created ParTy compiler class A<T>{ // body } A.pclass file ParTy class B Class B { A<int> a; A<String> b; } B.pclass file 22 July 2019 University of Virginia CS 655

16 ParTy Implementation ParTy class A
(5) Regular .class files generated at load-time ParTy compiler ParTy preprocessor class A<T>{ // body } A_int .class A.pclass file A_String .class ParTy class B Class B { A<int> a; A<String> b; } B.pclass file B.class 22 July 2019 University of Virginia CS 655

17 ParTy Implementation JVM (6) JVM-compatible classes are run
ParTy class A ParTy compiler ParTy preprocessor class A<T>{ // body } A_int .class JVM A.pclass file A_String .class ParTy class B Class B { A<int> a; A<String> b; } B.pclass file B.class 22 July 2019 University of Virginia CS 655

18 Qualitative Evaluation
How useful is ParTy? Constructed Pair, Set, LinkedList, OrderedSet generic classes What restrictions are there? No where clause for individual methods no implicit type information allowed no value parameters within <…> 22 July 2019 University of Virginia CS 655

19 Quantitative Evaluation
Code size blowup delay is good for network transmissions Benchmarking Ran ParTy code against equivalent Java Results... 22 July 2019 University of Virginia CS 655

20 Quantitative Evaluation: Results
ParTy yielded code up to 27.6% faster! 22 July 2019 University of Virginia CS 655

21 University of Virginia CS 655
Remaining Work Finish ParTy compiler add type checks Support for primitive types Integration of ParTy preprocessor into JVM ClassLoader more extensive benchmarking 22 July 2019 University of Virginia CS 655

22 University of Virginia CS 655
Conclusion 22 July 2019 University of Virginia CS 655

23 University of Virginia CS 655
Conclusion ParTy provides a powerful, safe, and efficient construct for designing generic classes without changing JVM bytecodes ParTy code size expansion delayed until load time ParTy adds only the most useful features of type parameterization to Java 22 July 2019 University of Virginia CS 655


Download ppt "Group 4: Song Li, Ying Lu, Hexin Wang, and Michael Walker May 1, 2000"

Similar presentations


Ads by Google