Group 4: Song Li, Ying Lu, - PowerPoint PPT Presentation

About This Presentation
Title:

Group 4: Song Li, Ying Lu,

Description:

Group 4: Song Li, Ying Lu, Hexin Wang, and Michael Walker. May 1, 2000 ... Type safety control is just as powerful as non-generic code ... – PowerPoint PPT presentation

Number of Views:16
Avg rating:3.0/5.0
Slides: 24
Provided by: David77
Category:
Tags: group | song | ying

less

Transcript and Presenter's Notes

Title: Group 4: Song Li, Ying Lu,


1
Java ParTy Java With Parameterized Types
Tonight Im gonna ParTy like its 1999. Prince

CS655 Programming Languages University of
Virginia Computer Science
  • Group 4 Song Li, Ying Lu,
  • Hexin Wang, and Michael Walker
  • May 1, 2000

2
Outline
  • Motivation
  • Related Work
  • Our Solution ParTy
  • Evaluation
  • Remaining Work
  • Conclusion

3
Motivation
  • Java provides no support for genericity JLS
  • Must use Object parameters with type casting
  • Performance hit
  • Type safety is an issue

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

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

6
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.

7
Related Work GJ and Pizza Bracha98
  • 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

8
Related Work PolyJ Liskov97
  • Modifies JVM bytecode to express parameterization
  • better performance
  • small code size
  • Adds where clause type constraints a la CLU
    LSA77
  • Creates a new language

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

10
Related Work Comparison
11
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

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

13
ParTy Code Example
class myClassltType1, Type2gt where boolean lt(
Type1 t) extends myBaseClass implements
myInterface // class body
14
ParTy Implementation
ParTy class A
class AltTgt // body
(1) Generic class A written (2) class B written
to instantiate A with actual types
ParTy class B
Class B Altintgt a AltStringgt b
15
ParTy Implementation
ParTy class A
(3) Classes are sent to compiler (4)
Corresponding .pclass created
ParTy compiler
class AltTgt // body
A.pclass file
ParTy class B
Class B Altintgt a AltStringgt b
B.pclass file
16
ParTy Implementation
ParTy class A
(5) Regular .class files generated at load-time
ParTy compiler
ParTy preprocessor
class AltTgt // body
A_int .class
A.pclass file
A_String .class
ParTy class B
Class B Altintgt a AltStringgt b
B.pclass file
B.class
17
ParTy Implementation
(6) JVM-compatible classes are run
ParTy class A
ParTy compiler
ParTy preprocessor
class AltTgt // body
A_int .class
JVM
A.pclass file
A_String .class
ParTy class B
Class B Altintgt a AltStringgt b
B.pclass file
B.class
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 ltgt

19
Quantitative Evaluation
  • Code size
  • blowup delay is good for network transmissions
  • Benchmarking
  • Ran ParTy code against equivalent Java
  • Results...

20
Quantitative Evaluation Results
  • ParTy yielded code up to 27.6 faster!

21
Remaining Work
  • Finish ParTy compiler
  • add type checks
  • Support for primitive types
  • Integration of ParTy preprocessor into JVM
    ClassLoader
  • more extensive benchmarking

22
Conclusion
23
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
Write a Comment
User Comments (0)
About PowerShow.com