SlideShare une entreprise Scribd logo
1  sur  18
Profiler Instrumentation Using
        Metaprogramming Techniques

                 Ritu Arora, Yu Sun, Zekai Demirezen, Jeff Gray
                      University of Alabama at Birmingham
                     {ritu, yusun, zekzek, gray}@cis.uab.edu

                              ACM Southeast Conference,
                                  Auburn, Alabama

                                      29th March 2008         Software Composition and Modeling Laboratory




                                                              SoftCom
This project is supported by NSF CAREER award (CCF-0643725)
                                                                                                                1
                                                                           Department of Computer and Information Sciences
                                                                                       University of Alabama at Birmingham
Overview of Presentation



                  Metaprogramming
OpenJava
                       Profiler


                    Overview of        Javassist
                    Techniques

                       Profiler
           AOP
                   Instrumentation


                     Discussion



                                          2
Metaprogramming




• A metaprogram manipulates another program
• Main approaches towards metaprogramming
   – Compile-time metaobjects
   – Load-time class adaptation
   – Aspect-Oriented Programming (AOP)
Compile-Time Metaobjects
Load-Time Class Adaptation
                   ...    ...   ...                     ...   ...     ...

                                        loaded by
                                                                                          Inapplicable to
Application
                                                                                          classes loaded by
   Classes                                               Interception
                     Application
                                                                                          other class loaders
                     class loader                   class loader/Javassist

                                      subclasses of


                                                                                          Portable interception
                                                                                          of all application
                                                                        JMangler:
                                                                                          classes
                                          Class
                 Java                                                  extension of
                                       ClassLoader
                  APIs                                                 ClassLoader


                                                                    Native extension of
                                         Bootstrap
                                                                       bootstrap CL
                                        class loader
                Java
               Virtual
                                                                                          Dependent on
              Machine
                                                                                          custom JVM
                                      Execution engine
                                                                                          implementation
                                                                                          Dependent on
                                        I/O interface
                 Native                                                                   platform specific
                                                                      Native I/O DLL
                                             DLL
              libraries
                                                                                          custom DLL
Aspect-Oriented Programming
• Language-based approach for capturing
  crosscutting concerns
• A concern is crosscutting if it is scattered across
  multiple modules
• Example of an AOP Language: AspectJ
Crosscutting Concern
                                                  XML Parsing in Apache
                                              

                                                  Tomcat Server




                                                  Logging in Apache
                                              

                                                  Tomcat Server




Source: http://www.parc.com/research/projects/aspectj/
Case Study: Profiler Instrumentation
                        • Essential tool for
                          code optimization
                          and performance
                          enhancement
                        • Provides the run-
                          time information
                          about the code
                        • Commercial
                          Profiler: JProbe
OpenJava
• Extensible meta-language based on Java
• Enhances the reflective ability of Java




               Overview of OpenJava
Profiler Implementation Using
                     OpenJava
 public class ProfilerMeta instantiates Metaclass
                       extends OJClass{
// Show Profiler in main method
 public void translateDefinition() throws MOPException {

     if(m.getName().equalsIgnoreCase(quot;mainquot;))
    OJMethod[] methods = getDeclaredMethods();
    OJMethod m; // each method in application
      Statement showGUI =
    int msize;   // number of statements in method
             makeStatement(quot;{Profiler.show();}quot;);
    for (int i = 0; i < methods.length; ++i) {
     public class ProfilerMeta
      m m.getBody().insertElementAt(showGUI, 0);
        = methods[i];

             instantiates Metaclass
      // Show Profiler in main method
       if(m.getName().equalsIgnoreCase(quot;mainquot;))
     // Insert Profiler.start() at method front
                     extends OJClass{
        Statement showGUI =
       Statement start =
            makeStatement(quot;{Profiler.show();}quot;);
        OJMethod[] methods = getDeclaredMethods();
         m.getBody().insertElementAt(showGUI, 0);
             makeStatement(quot;{Profiler.start(quot;quot; +
          OJMethod m; // each method in application
      // Insert Profiler.start() at method front
                            m.getName() + quot;quot;);}quot;);
          int msize;   // number of statements in method
        Statement start =
         m.getBody().insertElementAt(start, 0);
            makeStatement(quot;{Profiler.start(quot;quot; +
                           m.getName() + quot;quot;);}quot;);
        m.getBody().insertElementAt(start, 0);

     //Insert Profiler.end() at method end at method end
          Insert Profiler.end()
     //
        Statement end =
          Statement end =
          makeStatement(quot;{Profiler.end();}quot;);
             makeStatement(quot;{Profiler.end();}quot;);
        m.getBody().insertElementAt(end, msize);

          m.getBody().insertElementAt(end, msize);
      }
     }
 }
Profiler Implementation Using
                      Javassist
public class ProfilerClassLoader
             extends ClassLoader {
public Class loadClass(String arg0)
throws ClassNotFoundException {
                   CtMethod m = methods[i];
    CtClass c = ClassPool.getDefault().get(arg0);
    CtMethod[] methods = c.getDeclaredMethods();

                          if(m.getName().equalsIgnoreCase(quot;mainquot;))
    for (int i = 0; i < methods.length; i++) {
                            m.insertBefore(quot;new Profiler.show();quot;);
      CtMethod m = methods[i];

        if(m.getName().equalsIgnoreCase(quot;mainquot;))
          m.insertBefore(quot;new Profiler.show();quot;);
                       m.insertBefore(quot;Profiler.start(” +
    CtClass c = ClassPool.getDefault().get(arg0);
     m.insertBefore(quot;Profiler.start(” +
                                           m.getName() + quot;quot;);quot;);
                    m.getName() + quot;quot;);quot;);
      CtMethod[] methods = c.getDeclaredMethods();
        m.insertAfter(quot;Profiler.end();quot;; +
                          m.insertAfter(quot;Profiler.end();quot;; +
    }

    return c.toClass();

 }
}
AspectJ
• A crosscutting concern is isolated in a modular
  unit called “aspect”
• Like classes, aspects contain attributes and
  methods and can inherit from other aspects
• Aspects are woven into the application at the
  compile-time via AspectJ compiler
• Key language concepts: joint point, pointcut
  expression, advice
Profiler Implementation Using
                     AspectJ
public aspect ProfileClasses {

pointcut everyMethod() : call(* *.*(..));

 before(): call(void *.main(..)) {
   new Profiler.show();
             after() returning : everyMethod() {
}
            pointcut everyMethod() : call(* *.*(..));
                  Profiler.end();
 before() : everyMethod() {
   Signature s } thisJoinPoint.getSignature();
               =
              before(): call(void *.main(..)) {
   Profiler.start(s.getName());
                   new Profiler.show();
 }

              }
 after() returning : everyMethod() {
     Profiler.end();
 }

                 before() : everyMethod() {
}
                   Signature s = thisJoinPoint.getSignature();
                   Profiler.start(s.getName());
                 }
Benefits and Limitations of Using
            OpenJava
• Clear modularization boundary
  – Separate base program and the metaprogram
  – Changes can be made to any line of Java code
• Problem
  – Definition of each class in the source file must add
    “instantiates <metaclass-name>”
  – It cannot automatically catch every return point for each
    method
  – It cannot find the return statement nested in a statement
    or a block
      • Solution: parse the code within the OpenJava
        metaprogram
Expressiveness of AspectJ
• AspectJ is more expressive than OpenJava and
  Javassist
• Code written in AspectJ is easier to read and
  comprehend
• Integrated tool support for AspectJ
• Limitation
  – Need to recognize and specify join points clearly
  – Certain code constructs like “for loops” cannot be
    specified as join points
Javassist as a ByteCode
          Transformation API
• Source code not required if the bytecode level
  APIs are used
• Does not need any special compiler
• Transformations can be performed at both
  compile-time and load-time
• Limitation
  – Inapplicable to classes loaded by other class
    loaders
Conclusion
• Manual invasive changes to a source code base
  is challenging
• Metaprogramming can help in isolating change
  requests in separate modules without the need
  of invasively changing the source code
Questions ?



              18

Contenu connexe

Tendances

Basis for comparison programming languages
Basis for comparison programming languagesBasis for comparison programming languages
Basis for comparison programming languagesAbdo ELhais
 
Bernard Chalk 21.doc
Bernard Chalk 21.docBernard Chalk 21.doc
Bernard Chalk 21.docbutest
 
Introduction tojavaandxml lc-slides01-fp2005-ver 1.0
Introduction tojavaandxml lc-slides01-fp2005-ver 1.0Introduction tojavaandxml lc-slides01-fp2005-ver 1.0
Introduction tojavaandxml lc-slides01-fp2005-ver 1.0Sanjay Yadav
 
6010 java programming version 6
6010 java programming version 66010 java programming version 6
6010 java programming version 6bestip
 
DejaVOO: A Regression Testing Tool for Java Software
DejaVOO: A Regression Testing Tool for Java SoftwareDejaVOO: A Regression Testing Tool for Java Software
DejaVOO: A Regression Testing Tool for Java SoftwareManas Tungare
 
It pro dev_birbilis_20101127_en
It pro dev_birbilis_20101127_enIt pro dev_birbilis_20101127_en
It pro dev_birbilis_20101127_enGeorge Birbilis
 
Php On Java (London Java Community Unconference)
Php On Java (London Java Community Unconference)Php On Java (London Java Community Unconference)
Php On Java (London Java Community Unconference)Robin Fernandes
 
Introduction to java
Introduction to javaIntroduction to java
Introduction to javaAjay Sharma
 
Towards JVM Dynamic Languages Toolchain
Towards JVM Dynamic Languages ToolchainTowards JVM Dynamic Languages Toolchain
Towards JVM Dynamic Languages ToolchainAttila Szegedi
 
Java session01
Java session01Java session01
Java session01Niit Care
 
Java and Related Technologies
Java and Related TechnologiesJava and Related Technologies
Java and Related TechnologiesQualys
 
Features of java unit 1
Features of java unit 1Features of java unit 1
Features of java unit 1RubaNagarajan
 
J2ee strutswithhibernate-140121221332-phpapp01
J2ee strutswithhibernate-140121221332-phpapp01J2ee strutswithhibernate-140121221332-phpapp01
J2ee strutswithhibernate-140121221332-phpapp01Jay Palit
 

Tendances (19)

Ijetcas14 385
Ijetcas14 385Ijetcas14 385
Ijetcas14 385
 
Basis for comparison programming languages
Basis for comparison programming languagesBasis for comparison programming languages
Basis for comparison programming languages
 
Bernard Chalk 21.doc
Bernard Chalk 21.docBernard Chalk 21.doc
Bernard Chalk 21.doc
 
Java ms harsha
Java ms harshaJava ms harsha
Java ms harsha
 
Introduction tojavaandxml lc-slides01-fp2005-ver 1.0
Introduction tojavaandxml lc-slides01-fp2005-ver 1.0Introduction tojavaandxml lc-slides01-fp2005-ver 1.0
Introduction tojavaandxml lc-slides01-fp2005-ver 1.0
 
6010 java programming version 6
6010 java programming version 66010 java programming version 6
6010 java programming version 6
 
DejaVOO: A Regression Testing Tool for Java Software
DejaVOO: A Regression Testing Tool for Java SoftwareDejaVOO: A Regression Testing Tool for Java Software
DejaVOO: A Regression Testing Tool for Java Software
 
It pro dev_birbilis_20101127_en
It pro dev_birbilis_20101127_enIt pro dev_birbilis_20101127_en
It pro dev_birbilis_20101127_en
 
Php On Java (London Java Community Unconference)
Php On Java (London Java Community Unconference)Php On Java (London Java Community Unconference)
Php On Java (London Java Community Unconference)
 
Introduction to java
Introduction to javaIntroduction to java
Introduction to java
 
perl-java
perl-javaperl-java
perl-java
 
Towards JVM Dynamic Languages Toolchain
Towards JVM Dynamic Languages ToolchainTowards JVM Dynamic Languages Toolchain
Towards JVM Dynamic Languages Toolchain
 
Core Java
Core JavaCore Java
Core Java
 
Java session01
Java session01Java session01
Java session01
 
Programming in Java
Programming in JavaProgramming in Java
Programming in Java
 
Java and Related Technologies
Java and Related TechnologiesJava and Related Technologies
Java and Related Technologies
 
Features of java unit 1
Features of java unit 1Features of java unit 1
Features of java unit 1
 
J introtojava1-pdf
J introtojava1-pdfJ introtojava1-pdf
J introtojava1-pdf
 
J2ee strutswithhibernate-140121221332-phpapp01
J2ee strutswithhibernate-140121221332-phpapp01J2ee strutswithhibernate-140121221332-phpapp01
J2ee strutswithhibernate-140121221332-phpapp01
 

Similaire à Profiler Instrumentation Using Metaprogramming Techniques

Java questions and answers jan bask.net
Java questions and answers jan bask.netJava questions and answers jan bask.net
Java questions and answers jan bask.netJanbask ItTraining
 
Java Virtual Machine - Internal Architecture
Java Virtual Machine - Internal ArchitectureJava Virtual Machine - Internal Architecture
Java Virtual Machine - Internal Architecturesubnesh
 
Top 10 Important Core Java Interview questions and answers.pdf
Top 10 Important Core Java Interview questions and answers.pdfTop 10 Important Core Java Interview questions and answers.pdf
Top 10 Important Core Java Interview questions and answers.pdfUmesh Kumar
 
Java virtual machine
Java virtual machineJava virtual machine
Java virtual machineNikhil Sharma
 
Core java learning path for beginners
Core java learning path for beginnersCore java learning path for beginners
Core java learning path for beginnersJobbackingCodeHelpMe
 
SPEC INDIA Java Case Study
SPEC INDIA Java Case StudySPEC INDIA Java Case Study
SPEC INDIA Java Case StudySPEC INDIA
 
A begineers guide of JAVA - Getting Started
 A begineers guide of JAVA - Getting Started A begineers guide of JAVA - Getting Started
A begineers guide of JAVA - Getting StartedRakesh Madugula
 
Java Virtual Machine
Java Virtual Machine Java Virtual Machine
Java Virtual Machine profbnk
 
imperative programming language, java, android
imperative programming language, java, androidimperative programming language, java, android
imperative programming language, java, androidi i
 
Eclipse vs Netbean vs Railo
Eclipse vs Netbean vs RailoEclipse vs Netbean vs Railo
Eclipse vs Netbean vs RailoMohd Safian
 
Java Attacks & Defenses - End of Year 2010 Presentation
Java Attacks & Defenses - End of Year 2010 PresentationJava Attacks & Defenses - End of Year 2010 Presentation
Java Attacks & Defenses - End of Year 2010 PresentationJames Hamilton
 
A Brief study on JVM A Brief study on JVM
A Brief study on JVM A Brief study on JVMA Brief study on JVM A Brief study on JVM
A Brief study on JVM A Brief study on JVMBRNSSPublicationHubI
 

Similaire à Profiler Instrumentation Using Metaprogramming Techniques (20)

Java questions and answers jan bask.net
Java questions and answers jan bask.netJava questions and answers jan bask.net
Java questions and answers jan bask.net
 
Java basics notes
Java basics notesJava basics notes
Java basics notes
 
Inside JVM
Inside JVMInside JVM
Inside JVM
 
Java
Java Java
Java
 
Java Virtual Machine - Internal Architecture
Java Virtual Machine - Internal ArchitectureJava Virtual Machine - Internal Architecture
Java Virtual Machine - Internal Architecture
 
Top 10 Important Core Java Interview questions and answers.pdf
Top 10 Important Core Java Interview questions and answers.pdfTop 10 Important Core Java Interview questions and answers.pdf
Top 10 Important Core Java Interview questions and answers.pdf
 
Java virtual machine
Java virtual machineJava virtual machine
Java virtual machine
 
String class
String classString class
String class
 
Core java learning path for beginners
Core java learning path for beginnersCore java learning path for beginners
Core java learning path for beginners
 
SPEC INDIA Java Case Study
SPEC INDIA Java Case StudySPEC INDIA Java Case Study
SPEC INDIA Java Case Study
 
A begineers guide of JAVA - Getting Started
 A begineers guide of JAVA - Getting Started A begineers guide of JAVA - Getting Started
A begineers guide of JAVA - Getting Started
 
Project Zero JavaOne 2008
Project Zero JavaOne 2008Project Zero JavaOne 2008
Project Zero JavaOne 2008
 
Unit1 JAVA.pptx
Unit1 JAVA.pptxUnit1 JAVA.pptx
Unit1 JAVA.pptx
 
Java Virtual Machine
Java Virtual Machine Java Virtual Machine
Java Virtual Machine
 
imperative programming language, java, android
imperative programming language, java, androidimperative programming language, java, android
imperative programming language, java, android
 
Eclipse vs Netbean vs Railo
Eclipse vs Netbean vs RailoEclipse vs Netbean vs Railo
Eclipse vs Netbean vs Railo
 
Java chapter 1
Java   chapter 1Java   chapter 1
Java chapter 1
 
Java Attacks & Defenses - End of Year 2010 Presentation
Java Attacks & Defenses - End of Year 2010 PresentationJava Attacks & Defenses - End of Year 2010 Presentation
Java Attacks & Defenses - End of Year 2010 Presentation
 
java basics.pptx
java basics.pptxjava basics.pptx
java basics.pptx
 
A Brief study on JVM A Brief study on JVM
A Brief study on JVM A Brief study on JVMA Brief study on JVM A Brief study on JVM
A Brief study on JVM A Brief study on JVM
 

Profiler Instrumentation Using Metaprogramming Techniques

  • 1. Profiler Instrumentation Using Metaprogramming Techniques Ritu Arora, Yu Sun, Zekai Demirezen, Jeff Gray University of Alabama at Birmingham {ritu, yusun, zekzek, gray}@cis.uab.edu ACM Southeast Conference, Auburn, Alabama 29th March 2008 Software Composition and Modeling Laboratory SoftCom This project is supported by NSF CAREER award (CCF-0643725) 1 Department of Computer and Information Sciences University of Alabama at Birmingham
  • 2. Overview of Presentation Metaprogramming OpenJava Profiler Overview of Javassist Techniques Profiler AOP Instrumentation Discussion 2
  • 3. Metaprogramming • A metaprogram manipulates another program • Main approaches towards metaprogramming – Compile-time metaobjects – Load-time class adaptation – Aspect-Oriented Programming (AOP)
  • 5. Load-Time Class Adaptation ... ... ... ... ... ... loaded by Inapplicable to Application classes loaded by Classes Interception Application other class loaders class loader class loader/Javassist subclasses of Portable interception of all application JMangler: classes Class Java extension of ClassLoader APIs ClassLoader Native extension of Bootstrap bootstrap CL class loader Java Virtual Dependent on Machine custom JVM Execution engine implementation Dependent on I/O interface Native platform specific Native I/O DLL DLL libraries custom DLL
  • 6. Aspect-Oriented Programming • Language-based approach for capturing crosscutting concerns • A concern is crosscutting if it is scattered across multiple modules • Example of an AOP Language: AspectJ
  • 7. Crosscutting Concern XML Parsing in Apache  Tomcat Server Logging in Apache  Tomcat Server Source: http://www.parc.com/research/projects/aspectj/
  • 8. Case Study: Profiler Instrumentation • Essential tool for code optimization and performance enhancement • Provides the run- time information about the code • Commercial Profiler: JProbe
  • 9. OpenJava • Extensible meta-language based on Java • Enhances the reflective ability of Java Overview of OpenJava
  • 10. Profiler Implementation Using OpenJava public class ProfilerMeta instantiates Metaclass extends OJClass{ // Show Profiler in main method public void translateDefinition() throws MOPException { if(m.getName().equalsIgnoreCase(quot;mainquot;)) OJMethod[] methods = getDeclaredMethods(); OJMethod m; // each method in application Statement showGUI = int msize; // number of statements in method makeStatement(quot;{Profiler.show();}quot;); for (int i = 0; i < methods.length; ++i) { public class ProfilerMeta m m.getBody().insertElementAt(showGUI, 0); = methods[i]; instantiates Metaclass // Show Profiler in main method if(m.getName().equalsIgnoreCase(quot;mainquot;)) // Insert Profiler.start() at method front extends OJClass{ Statement showGUI = Statement start = makeStatement(quot;{Profiler.show();}quot;); OJMethod[] methods = getDeclaredMethods(); m.getBody().insertElementAt(showGUI, 0); makeStatement(quot;{Profiler.start(quot;quot; + OJMethod m; // each method in application // Insert Profiler.start() at method front m.getName() + quot;quot;);}quot;); int msize; // number of statements in method Statement start = m.getBody().insertElementAt(start, 0); makeStatement(quot;{Profiler.start(quot;quot; + m.getName() + quot;quot;);}quot;); m.getBody().insertElementAt(start, 0); //Insert Profiler.end() at method end at method end Insert Profiler.end() // Statement end = Statement end = makeStatement(quot;{Profiler.end();}quot;); makeStatement(quot;{Profiler.end();}quot;); m.getBody().insertElementAt(end, msize); m.getBody().insertElementAt(end, msize); } } }
  • 11. Profiler Implementation Using Javassist public class ProfilerClassLoader extends ClassLoader { public Class loadClass(String arg0) throws ClassNotFoundException { CtMethod m = methods[i]; CtClass c = ClassPool.getDefault().get(arg0); CtMethod[] methods = c.getDeclaredMethods(); if(m.getName().equalsIgnoreCase(quot;mainquot;)) for (int i = 0; i < methods.length; i++) { m.insertBefore(quot;new Profiler.show();quot;); CtMethod m = methods[i]; if(m.getName().equalsIgnoreCase(quot;mainquot;)) m.insertBefore(quot;new Profiler.show();quot;); m.insertBefore(quot;Profiler.start(” + CtClass c = ClassPool.getDefault().get(arg0); m.insertBefore(quot;Profiler.start(” + m.getName() + quot;quot;);quot;); m.getName() + quot;quot;);quot;); CtMethod[] methods = c.getDeclaredMethods(); m.insertAfter(quot;Profiler.end();quot;; + m.insertAfter(quot;Profiler.end();quot;; + } return c.toClass(); } }
  • 12. AspectJ • A crosscutting concern is isolated in a modular unit called “aspect” • Like classes, aspects contain attributes and methods and can inherit from other aspects • Aspects are woven into the application at the compile-time via AspectJ compiler • Key language concepts: joint point, pointcut expression, advice
  • 13. Profiler Implementation Using AspectJ public aspect ProfileClasses { pointcut everyMethod() : call(* *.*(..)); before(): call(void *.main(..)) { new Profiler.show(); after() returning : everyMethod() { } pointcut everyMethod() : call(* *.*(..)); Profiler.end(); before() : everyMethod() { Signature s } thisJoinPoint.getSignature(); = before(): call(void *.main(..)) { Profiler.start(s.getName()); new Profiler.show(); } } after() returning : everyMethod() { Profiler.end(); } before() : everyMethod() { } Signature s = thisJoinPoint.getSignature(); Profiler.start(s.getName()); }
  • 14. Benefits and Limitations of Using OpenJava • Clear modularization boundary – Separate base program and the metaprogram – Changes can be made to any line of Java code • Problem – Definition of each class in the source file must add “instantiates <metaclass-name>” – It cannot automatically catch every return point for each method – It cannot find the return statement nested in a statement or a block • Solution: parse the code within the OpenJava metaprogram
  • 15. Expressiveness of AspectJ • AspectJ is more expressive than OpenJava and Javassist • Code written in AspectJ is easier to read and comprehend • Integrated tool support for AspectJ • Limitation – Need to recognize and specify join points clearly – Certain code constructs like “for loops” cannot be specified as join points
  • 16. Javassist as a ByteCode Transformation API • Source code not required if the bytecode level APIs are used • Does not need any special compiler • Transformations can be performed at both compile-time and load-time • Limitation – Inapplicable to classes loaded by other class loaders
  • 17. Conclusion • Manual invasive changes to a source code base is challenging • Metaprogramming can help in isolating change requests in separate modules without the need of invasively changing the source code

Notes de l'éditeur

  1. <number><number>
  2. Source for profiler: http://www.filebuzz.com/software_screenshot/full/4146-LTProf.gif
  3. - Source program (written in OpenC++ or OpenJava) is translated into top-level definitions for classes and member-functions.A metaobject is created for each top-level definition.metaobject then translates the top-level definitions into appropriate C++ or Java codeTranslated code is then collected and assembled into a contiguous source code. <number><number>
  4. Achieved by customizing the Java class loaderi.e., through bytecode manipulation Can be used to modify the structure and behavior of the classExample: Javassist APIsFour ways of intercepting classes at load-time: use of a custom class loader, extension of the class java.lang.ClassLoader, use of a custom JVM implementation, and use of a custom I/O DLL. Only the second option provides portable generic interception.
  5. -red shows lines of code that handle logging in org.apache.tomcat server-not in just one place-not even in a small number of places<number>
  6. <number>
  7. Supports structural reflectionAbility to alter the structure of existing classesNew classes can be definedByte-code can be transformed at either the load-time or compile-time<number>