Potential Improvements to Dotty Linker

148 views
Skip to first unread message

Suminda Dharmasena

unread,
May 23, 2016, 11:49:29 PM5/23/16
to dotty-internals
Hello,

1st and foremost this is a great project and initiative. Following are some things which can improve it further.
  • Reverse engineering ByteCode to TASTY so Java specific areas also can be optimised
    • Ideally reverse engineering gainst an ASM specification will perhaps make this more generic and maintainable in which case you can also reverse engineer some native code java calls and also link with other languages like LLVM IR, .Net Code, etc. Don't worry about the these possibilities just make sure (1) ByteCode code represented against a ASM for the JVM (2) from the ASM representation move to TASTY; same process can be used for other binary executables IR by defining the respective ASMs models.
  • Eliminate GCable Object Creation
    • Analyse memory usage and referencing to decide safest point an object can be desiccated. Perhaps this information can be use in other backends like SN
    • Use in conjunction with off heap memory usage to eliminate on heap memory allocation. If you can reach 0 this will be a great breakthrough.
      • Java objects can be made off heap objects through Java Instrumentation or ByteCode Weaving where Objects Fields are mapped and accessed from off heap memory. It is best to keep the Java Object layout intact, through mmapped to off heap, for objects accessed in native methods. You will have to represent the and manage the whole object graph on off heap. Many serialisation frameworks can do this statically but in this case you have to managing allocation and deallocations and dynamically manage the object graph efficiently. Also you do not have the luxury to serialise and deserialise - you just have to work with what is on off heap. For Java objects you will have to use ByteCode Weaving or Java Instrumentation to map the fields to of heap. Also regions can be used to make this more optimal.
  • Auto Referencing Parameters and Return Values - through use of off heap
    • Generate meta data on variable which are candidates for pass by reference or returning reference. Perhaps this information can be use in other backends like SN
    • In JVM backend side if variables are marked as pass by reference, Off Heap can be use to achieve this. The variable can be stored in Off Heap and the Linker can insert references to its usage.
  • Side effect tracking / Effect tracking
    • Side effect tracking /effect tracking in the linker can help in:
      • Further optimising code. Get from input to output with minimum cycles and memory usage. Anything that is runtime would be what is dependent on IO. Any code that can be fully or partly evaluated (independent of IO) at compile time should be evaluated at compile time.
      • Eliminate any restriction you might need now for optimisation
  • Optimisation of Data Structures
  • Rewriting and transformations
    • Make this mainline and also improve on this so the specific need for macros will diminish  and is eliminated of transformations and rewrites
    • Use annotation hooks for rewriting and transformation
    • Perhaps translation of TASTY to and ASM representation
    • Reverse translation from ASM to TASTY
  • Bake the backend more generic & pluggable
    • Model the backend platform as perhaps an ASM and generate code against it. By changing the ASM specification you can easily redefine new backends.
    • Have a layer for mapping between AST and ASM representation
    • Also you can have ASM level optimisations through a DSL
    • This on the long run will partly save the engineering overhead for maintainability of other backends
    • Process:
      1. TASTY to ASM
      2. ASM model to Specific Machine / Binary Representation
  • GA
    • As long as this is experimental this is less useful. So have a clear strategy to get this into production ready mode and also integrate with mainline Scala.
Suminda

Naftoli Gugenheim

unread,
May 24, 2016, 12:09:55 AM5/24/16
to Suminda Dharmasena, dotty-internals

Sounds great! How much of it are you volunteering for?


--
You received this message because you are subscribed to the Google Groups "dotty-internals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dotty-interna...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages