Selective Specialization for OO language by Jeffrey Dean, Craig Chambers, and David Grove - PowerPoint PPT Presentation

1 / 13
About This Presentation
Title:

Selective Specialization for OO language by Jeffrey Dean, Craig Chambers, and David Grove

Description:

Selective Specialization for OO language. by Jeffrey Dean, Craig Chambers, and David Grove ... This simple specialization scheme is also known as 'customization' ... – PowerPoint PPT presentation

Number of Views:59
Avg rating:3.0/5.0
Slides: 14
Provided by: austi45
Category:

less

Transcript and Presenter's Notes

Title: Selective Specialization for OO language by Jeffrey Dean, Craig Chambers, and David Grove


1
Selective Specialization for OO languageby
Jeffrey Dean, Craig Chambers, and David Grove
2
Overview
  • Disadvantages of dynamic dispatch
  • Incur runtime method lookup, extra level of
    indirection
  • Version of method not known until runtime, many
    compile time optimizations are prevented, ie
    function inlining
  • That is why method specialization is proposed

3
What is method specialization?
  • Compiling specialized versions of a method to
    allow the method to be statically bound. The
    specialized versions of a method provide precise
    static information about which class the method
    is to be dispatched on.

4
Example of dynamic dispatch
  • In this example, self.modify() is dynamically
    dispatched, because at compile time the exact
    type of self is not known
  • Class Foo
  • method f() self.modify()
  • Class A extends Foo
  • method modify()
  • Class B extends A
  • method modify()
  • Now apply method specialization on f()

5
Example of method specialization
  • Now each class has its own version of f(), so at
    compile time we know which version of modify() is
    to be dispatched on self. Thus self.modify() can
    now be statically bound.
  • Class Foo
  • method f() self.modify()
  • Class A extends Foo
  • method f() self.modify()
  • method modify()
  • Class B extends A
  • method f() self.modify()
  • method modify()

6
Method customization
  • This simple specialization scheme is also known
    as customization. A customized version of each
    method is compiled for each class inheriting the
    method. Inside the customized method, the exact
    class of the self receiver is known, enabling
    statically bound method.

7
Problems with customization
  • Overspecialziation
  • - code explosion, many specialized methods that
    are rarely or never invoked.
  • Underspecialization
  • - only methods dispatch on receiver argument is
    specialized and not other argument

8
Example of underspecialization
  • When m() is customized only the dispatch on
    self is specialized but not on arg
  • Method Foom(argA)
  • self.meth1() // message sent to receiver arg
  • arg.meth3() // message sent to formal arg

9
Selective specialization
  • Selective specialization is proposed to solve the
    issues of overspecializing and underspeciaizing.
  • Utilize dynamic profiling data to specialize only
    the heavily-used methods
  • Specialize method dispatch on all its argument,
    both receiver and formal

10
Dynamic profiling
  • Insert instrumentation code in program to detect
    method calls.
  • Result is the call graph of a program. With arc
    connecting caller and callee and a weight that
    associates the execution count.
  • Only considers those arc whose weight is greater
    than some threshold (500 invocations) for
    specialization

11
(No Transcript)
12
  • If arc alpha is signficant for specialization,
    then
  • Callsite is arg2.m2()
  • Caller is Am4()
  • Callee is Bm2()
  • Weight is 550
  • The applicable classes for the arc are
  • A,B,C J for the receiver argument
  • B,E,H,I for the formal argument
  • A,B,C Jm4 (arg2B,E,H,I) is the directive
    computed from the call graph, the compiler can
    use it to generate specialized version of m4
    applicable only to these subset of classes

13
Performance Evalution
  • Benchmark performed on a pure OO language, Cecil
  • Simple customization eliminated 35-61 of dynamic
    dispatches, increased code space by 180-250
  • Selective specialization eliminated 54-66 of
    dynamic dispatches, increased code space by 4-10
Write a Comment
User Comments (0)
About PowerShow.com