SlideShare a Scribd company logo
1 of 14
ASM Core API - Class
Taegeon Lee
t76lee@uwaterloo.ca
Advisor: Prof. Doo-Hwan Bae
bae@se.kaist.ac.kr
Teaching Assistant: Jiyoung Song
jysong@se.kaist.ac.kr
ASM Introduction
• Motivations
• Overview
Scope
Model
Architecture
Organization
2/14
Motivations
Introduction Background Overall Approach Methodology Experiments Results Conclusion Discussion
 ASMlibrarydesignedto work on compiledjavaclasses.
 There are some techniquessuch as programanalysis,generationand
transformation.
 It is supposedto be fast andsmall.
 Advantagesof working on compiledcode
 Thesourcecodeisnotneeded.So,programtransformationscan beusedonany
applications.
 Itbecomespossibletoanalyze,generateortransformclassesat runtimelodedin
JVM.
3/14ASM Core API – Class
Overview
Introduction Background Overall Approach Methodology Experiments Results Conclusion Discussion
 Scope
 ASMisstrictlylimitedtoreading,writing,transformingand analyzingclasses.
Theclassloading processisoutofscope.
 Model
 ThecoreAPI–an eventbasedrepresentationofclasses
 ThetreeAPI-an objectbasedrepresentation
ASMprovides bothAPI.
 Architecture
 Usingtheevent basedAPIisatwostepprocess:
Assembling event producer,filter andconsumer components intopossiblycomplex
architectures
Thenstartingtheevent producerstorunthegeneration ortransformationprocess
 Organization
 Severalpackagesthat are distributedinseveraljar files
4/14ASM Core API – Class
Classes
• Structure
Overview/ Internal names/ Type descriptors/ Method descriptors
• Interfacesandcomponents
Parsing classes / Generating classes/ Transforming classes/ Removing
class members/ Adding class members
• Tools
Type/ TraceClassVisitor/ CheckClassAdapter/ ASMifier
5/14
Structure
Introduction Background Overall Approach Methodology Experiments Results Conclusion Discussion
 Overview
 Compiledclasscontainsmodifiers,name,superclass,interfacesand annotations.
 Differencesbetweensource andcompliedclasses
6/14ASM Core API – Class
Source file Compiled class
• Contains several classes • Describes only one class
• Doesn’t contain comments,
but can contain class, field,
method and code attribute
s
• Doesn’t contain a package
and import section
• Contains a constant pool se
ction [e.g) array]
Another important difference is that Java types are represented different in compiled
And same source classes.
Structure
Introduction Background Overall Approach Methodology Experiments Results Conclusion Discussion
[1]Overallstructure ofacompiledclass
7/14ASM Core API – Class
Structure
Introduction Background Overall Approach Methodology Experiments Results Conclusion Discussion
 Internalnames
 Theinternalnameofaclassisjustthefullyqualifiednameofthisclass,where dotsare
replaced withslashes.i.e)java/lang/string
Only fortypesthatareconstrained tobeclass orinterface
 Typedescriptors
 Thedescriptorofaclasstypeistheinternalnameofthisclass,precededbyLand
followedbyasemicolon.i.e)thetypedescriptorofstringisLjava/lang/string
 Method descriptors
 Alistoftypedescriptorsthat describetheparametertypesand thereturntypeofa
methodinasinglestring.
Amethoddescriptordoesn’tcontain themethod’s name orargumentnames.
i.e) (I)Idescribes amethodthattakesoneargumentoftypeintand returnanint.
8/14ASM Core API – Class
Interfaces andComponents
Introduction Background Overall Approach Methodology Experiments Results Conclusion Discussion
 ASMcomponents: classReader,classWriter,classVisitor
 Parsingclasses
 classReader–onlyrequiredcomponenttoparsean exisitingclass
 Generatingclasses
 classWriter–onlyrequiredcomponenttogenerateaclass
Generating class canbeloaded dynamically withaclassLoader
 Transformingclass
 It’spossibletouseseveraladaptersinordertocomposeseveralindependentclass
transformationstocomplextransformation
9/14ASM Core API – Class
Reader
Adapter
(classVisitor)
Writer
Interfaces andComponents
Introduction Background Overall Approach Methodology Experiments Results Conclusion Discussion
 Usingtransformedclasses
 Ifyouwant totransformallclasses,youwillhave toputyourtransformationinsidea
classFileTransformerasdefinedinthejava.lang.instrumentpackage.
 Removingclassmembers
 Removingmeansnotforwardingthecallat all.
 Inordertoremoveafieldormethod,youmustnotforwardthemethodcall,and
returnnulltothecaller.
 Addingclassmember
 It’sbasicallyforwarding.
 IfyouputthenewcallinvisitEndmethod,thefieldwillalwaysbeadded sincethis
methodisalwayscalled.
 IfyouputitinvisitFieldorvisitMethod,severalfieldswillbeadded:oneperfieldor
methodintheoriginalclass
10/14ASM Core API – Class
Tools
Introduction Background Overall Approach Methodology Experiments Results Conclusion Discussion
 In additionto the classVisitorclass,ASM providesorg.objectweb.asm.util
package.(not neededat runtime)
 Type
 AtypeobjectrepresentsaJava type,andcan beconstructedeitherfromatype
descriptororclassobject.
 Itcan alsorepresentamethodtype.
 TraceClassVisitor
 Itprovidesatextualrepresentationofthevisitedclass.
 classWriterisnotreadable byhumans.So,inordertogetareadable traceofwhat is
actuallygenerated,TraceClassVisitorcanbeused.
 CheckClassAdapter
 classWriterdoesn’tcheckthatitsmethodsarecalledintheappropriateorderand
withvalidarguments.
 Inordertodetectsomeerrors,CheckClassAdapterisused
 ASMifier
 Itprovidesan alternativebackendfortheTraceClassVisitortool.
11/14ASM Core API – Class
Reference
12/14
Reference
Introduction Background Overall Approach Methodology Experiments Results Conclusion Discussion
[1]E. Bruneton, “ASM 4.0 A Java bytecode engineering library,
” ASM, Sep-2011. [Online].Available: http://asm.ow2.io/asm
4-guide.pdf.
13/14ASM Core API – Class
Thank You.
1st June, 2018
t76lee@uwaterloo.ca

More Related Content

What's hot

Abstract class and Interface
Abstract class and InterfaceAbstract class and Interface
Abstract class and InterfaceHaris Bin Zahid
 
Chapter 9 Interface
Chapter 9 InterfaceChapter 9 Interface
Chapter 9 InterfaceOUM SAOKOSAL
 
oops concept in java | object oriented programming in java
oops concept in java | object oriented programming in javaoops concept in java | object oriented programming in java
oops concept in java | object oriented programming in javaCPD INDIA
 
Basic Java Programming
Basic Java ProgrammingBasic Java Programming
Basic Java ProgrammingMath-Circle
 
Java interview questions 1
Java interview questions 1Java interview questions 1
Java interview questions 1Sherihan Anver
 
Interfaces In Java
Interfaces In JavaInterfaces In Java
Interfaces In Javaparag
 
Polymorphism presentation in java
Polymorphism presentation in javaPolymorphism presentation in java
Polymorphism presentation in javaAhsan Raja
 
Object oriented programming-with_java
Object oriented programming-with_javaObject oriented programming-with_java
Object oriented programming-with_javaHoang Nguyen
 
Interface in java By Dheeraj Kumar Singh
Interface in java By Dheeraj Kumar SinghInterface in java By Dheeraj Kumar Singh
Interface in java By Dheeraj Kumar Singhdheeraj_cse
 
Lambdas and Streams in Java SE 8: Making Bulk Operations simple - Simon Ritter
Lambdas and Streams in Java SE 8: Making Bulk Operations simple - Simon RitterLambdas and Streams in Java SE 8: Making Bulk Operations simple - Simon Ritter
Lambdas and Streams in Java SE 8: Making Bulk Operations simple - Simon RitterJAXLondon2014
 
Distributed Programming (RMI)
Distributed Programming (RMI)Distributed Programming (RMI)
Distributed Programming (RMI)Ravi Kant Sahu
 

What's hot (18)

Abstract class and Interface
Abstract class and InterfaceAbstract class and Interface
Abstract class and Interface
 
Chapter 9 Interface
Chapter 9 InterfaceChapter 9 Interface
Chapter 9 Interface
 
final pl paper
final pl paperfinal pl paper
final pl paper
 
oops concept in java | object oriented programming in java
oops concept in java | object oriented programming in javaoops concept in java | object oriented programming in java
oops concept in java | object oriented programming in java
 
Ppt chapter10
Ppt chapter10Ppt chapter10
Ppt chapter10
 
Basic Java Programming
Basic Java ProgrammingBasic Java Programming
Basic Java Programming
 
polymorphism
polymorphism polymorphism
polymorphism
 
Java interview questions 1
Java interview questions 1Java interview questions 1
Java interview questions 1
 
Interfaces In Java
Interfaces In JavaInterfaces In Java
Interfaces In Java
 
Polymorphism presentation in java
Polymorphism presentation in javaPolymorphism presentation in java
Polymorphism presentation in java
 
Reflection in Java
Reflection in JavaReflection in Java
Reflection in Java
 
Unit 3 Java
Unit 3 JavaUnit 3 Java
Unit 3 Java
 
Packages
PackagesPackages
Packages
 
Object oriented programming-with_java
Object oriented programming-with_javaObject oriented programming-with_java
Object oriented programming-with_java
 
Interface in java By Dheeraj Kumar Singh
Interface in java By Dheeraj Kumar SinghInterface in java By Dheeraj Kumar Singh
Interface in java By Dheeraj Kumar Singh
 
Lambdas and Streams in Java SE 8: Making Bulk Operations simple - Simon Ritter
Lambdas and Streams in Java SE 8: Making Bulk Operations simple - Simon RitterLambdas and Streams in Java SE 8: Making Bulk Operations simple - Simon Ritter
Lambdas and Streams in Java SE 8: Making Bulk Operations simple - Simon Ritter
 
Distributed Programming (RMI)
Distributed Programming (RMI)Distributed Programming (RMI)
Distributed Programming (RMI)
 
Towards Improving Interface Modularity in Legacy Java Software Through Automa...
Towards Improving Interface Modularity in Legacy Java Software Through Automa...Towards Improving Interface Modularity in Legacy Java Software Through Automa...
Towards Improving Interface Modularity in Legacy Java Software Through Automa...
 

Similar to ASM Core API - Class

Mi0041 java and web design
Mi0041  java and web designMi0041  java and web design
Mi0041 java and web designsmumbahelp
 
Mi0041 java and web design
Mi0041  java and web designMi0041  java and web design
Mi0041 java and web designsmumbahelp
 
Mi0041 java and web design
Mi0041  java and web designMi0041  java and web design
Mi0041 java and web designStudy Stuff
 
Mi0041 java and web design
Mi0041  java and web designMi0041  java and web design
Mi0041 java and web designsmumbahelp
 
Understanding And Using Reflection
Understanding And Using ReflectionUnderstanding And Using Reflection
Understanding And Using ReflectionGanesh Samarthyam
 
Object Oriented Principles
Object Oriented PrinciplesObject Oriented Principles
Object Oriented PrinciplesSujit Majety
 
JAVA VIVA QUESTIONS_CODERS LODGE.pdf
JAVA VIVA QUESTIONS_CODERS LODGE.pdfJAVA VIVA QUESTIONS_CODERS LODGE.pdf
JAVA VIVA QUESTIONS_CODERS LODGE.pdfnofakeNews
 
Abap Inicio
Abap InicioAbap Inicio
Abap Iniciounifor
 
Oo abap-sap-1206973306636228-5
Oo abap-sap-1206973306636228-5Oo abap-sap-1206973306636228-5
Oo abap-sap-1206973306636228-5prakash185645
 
Java syntax-and-grammars-oct8
Java syntax-and-grammars-oct8Java syntax-and-grammars-oct8
Java syntax-and-grammars-oct8MISSIASABTAL1
 
java traning report_Summer.docx
java traning report_Summer.docxjava traning report_Summer.docx
java traning report_Summer.docxGauravSharma164138
 
Java Faqs useful for freshers and experienced
Java Faqs useful for freshers and experiencedJava Faqs useful for freshers and experienced
Java Faqs useful for freshers and experiencedyearninginjava
 
Top 371 java fa qs useful for freshers and experienced
Top 371 java fa qs useful for freshers and experiencedTop 371 java fa qs useful for freshers and experienced
Top 371 java fa qs useful for freshers and experiencedGaurav Maheshwari
 

Similar to ASM Core API - Class (20)

Mi0041 java and web design
Mi0041  java and web designMi0041  java and web design
Mi0041 java and web design
 
Mi0041 java and web design
Mi0041  java and web designMi0041  java and web design
Mi0041 java and web design
 
Mi0041 java and web design
Mi0041  java and web designMi0041  java and web design
Mi0041 java and web design
 
Mi0041 java and web design
Mi0041  java and web designMi0041  java and web design
Mi0041 java and web design
 
Understanding And Using Reflection
Understanding And Using ReflectionUnderstanding And Using Reflection
Understanding And Using Reflection
 
Suga java training_with_footer
Suga java training_with_footerSuga java training_with_footer
Suga java training_with_footer
 
Basic syntax
Basic syntaxBasic syntax
Basic syntax
 
Object Oriented Principles
Object Oriented PrinciplesObject Oriented Principles
Object Oriented Principles
 
Java Training in Chennai - Payilagam Syllabus
Java Training in Chennai - Payilagam SyllabusJava Training in Chennai - Payilagam Syllabus
Java Training in Chennai - Payilagam Syllabus
 
JAVA VIVA QUESTIONS_CODERS LODGE.pdf
JAVA VIVA QUESTIONS_CODERS LODGE.pdfJAVA VIVA QUESTIONS_CODERS LODGE.pdf
JAVA VIVA QUESTIONS_CODERS LODGE.pdf
 
Java notes
Java notesJava notes
Java notes
 
Ase02 dmp.ppt
Ase02 dmp.pptAse02 dmp.ppt
Ase02 dmp.ppt
 
Abap Inicio
Abap InicioAbap Inicio
Abap Inicio
 
Oo abap-sap-1206973306636228-5
Oo abap-sap-1206973306636228-5Oo abap-sap-1206973306636228-5
Oo abap-sap-1206973306636228-5
 
Java syntax-and-grammars-oct8
Java syntax-and-grammars-oct8Java syntax-and-grammars-oct8
Java syntax-and-grammars-oct8
 
java traning report_Summer.docx
java traning report_Summer.docxjava traning report_Summer.docx
java traning report_Summer.docx
 
Java Faqs useful for freshers and experienced
Java Faqs useful for freshers and experiencedJava Faqs useful for freshers and experienced
Java Faqs useful for freshers and experienced
 
Slides
SlidesSlides
Slides
 
java basic .pdf
java basic .pdfjava basic .pdf
java basic .pdf
 
Top 371 java fa qs useful for freshers and experienced
Top 371 java fa qs useful for freshers and experiencedTop 371 java fa qs useful for freshers and experienced
Top 371 java fa qs useful for freshers and experienced
 

Recently uploaded

College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...Soham Mondal
 
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝soniya singh
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Dr.Costas Sachpazis
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxJoão Esperancinha
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxpranjaldaimarysona
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxAsutosh Ranjan
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINESIVASHANKAR N
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Analog to Digital and Digital to Analog Converter
Analog to Digital and Digital to Analog ConverterAnalog to Digital and Digital to Analog Converter
Analog to Digital and Digital to Analog ConverterAbhinavSharma374939
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130Suhani Kapoor
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSKurinjimalarL3
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )Tsuyoshi Horigome
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Serviceranjana rawat
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
High Profile Call Girls Nashik Megha 7001305949 Independent Escort Service Na...
High Profile Call Girls Nashik Megha 7001305949 Independent Escort Service Na...High Profile Call Girls Nashik Megha 7001305949 Independent Escort Service Na...
High Profile Call Girls Nashik Megha 7001305949 Independent Escort Service Na...Call Girls in Nagpur High Profile
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingrakeshbaidya232001
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVRajaP95
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSCAESB
 

Recently uploaded (20)

College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
 
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
 
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptx
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptx
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Analog to Digital and Digital to Analog Converter
Analog to Digital and Digital to Analog ConverterAnalog to Digital and Digital to Analog Converter
Analog to Digital and Digital to Analog Converter
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
 
High Profile Call Girls Nashik Megha 7001305949 Independent Escort Service Na...
High Profile Call Girls Nashik Megha 7001305949 Independent Escort Service Na...High Profile Call Girls Nashik Megha 7001305949 Independent Escort Service Na...
High Profile Call Girls Nashik Megha 7001305949 Independent Escort Service Na...
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writing
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentation
 

ASM Core API - Class

  • 1. ASM Core API - Class Taegeon Lee t76lee@uwaterloo.ca Advisor: Prof. Doo-Hwan Bae bae@se.kaist.ac.kr Teaching Assistant: Jiyoung Song jysong@se.kaist.ac.kr
  • 2. ASM Introduction • Motivations • Overview Scope Model Architecture Organization 2/14
  • 3. Motivations Introduction Background Overall Approach Methodology Experiments Results Conclusion Discussion  ASMlibrarydesignedto work on compiledjavaclasses.  There are some techniquessuch as programanalysis,generationand transformation.  It is supposedto be fast andsmall.  Advantagesof working on compiledcode  Thesourcecodeisnotneeded.So,programtransformationscan beusedonany applications.  Itbecomespossibletoanalyze,generateortransformclassesat runtimelodedin JVM. 3/14ASM Core API – Class
  • 4. Overview Introduction Background Overall Approach Methodology Experiments Results Conclusion Discussion  Scope  ASMisstrictlylimitedtoreading,writing,transformingand analyzingclasses. Theclassloading processisoutofscope.  Model  ThecoreAPI–an eventbasedrepresentationofclasses  ThetreeAPI-an objectbasedrepresentation ASMprovides bothAPI.  Architecture  Usingtheevent basedAPIisatwostepprocess: Assembling event producer,filter andconsumer components intopossiblycomplex architectures Thenstartingtheevent producerstorunthegeneration ortransformationprocess  Organization  Severalpackagesthat are distributedinseveraljar files 4/14ASM Core API – Class
  • 5. Classes • Structure Overview/ Internal names/ Type descriptors/ Method descriptors • Interfacesandcomponents Parsing classes / Generating classes/ Transforming classes/ Removing class members/ Adding class members • Tools Type/ TraceClassVisitor/ CheckClassAdapter/ ASMifier 5/14
  • 6. Structure Introduction Background Overall Approach Methodology Experiments Results Conclusion Discussion  Overview  Compiledclasscontainsmodifiers,name,superclass,interfacesand annotations.  Differencesbetweensource andcompliedclasses 6/14ASM Core API – Class Source file Compiled class • Contains several classes • Describes only one class • Doesn’t contain comments, but can contain class, field, method and code attribute s • Doesn’t contain a package and import section • Contains a constant pool se ction [e.g) array] Another important difference is that Java types are represented different in compiled And same source classes.
  • 7. Structure Introduction Background Overall Approach Methodology Experiments Results Conclusion Discussion [1]Overallstructure ofacompiledclass 7/14ASM Core API – Class
  • 8. Structure Introduction Background Overall Approach Methodology Experiments Results Conclusion Discussion  Internalnames  Theinternalnameofaclassisjustthefullyqualifiednameofthisclass,where dotsare replaced withslashes.i.e)java/lang/string Only fortypesthatareconstrained tobeclass orinterface  Typedescriptors  Thedescriptorofaclasstypeistheinternalnameofthisclass,precededbyLand followedbyasemicolon.i.e)thetypedescriptorofstringisLjava/lang/string  Method descriptors  Alistoftypedescriptorsthat describetheparametertypesand thereturntypeofa methodinasinglestring. Amethoddescriptordoesn’tcontain themethod’s name orargumentnames. i.e) (I)Idescribes amethodthattakesoneargumentoftypeintand returnanint. 8/14ASM Core API – Class
  • 9. Interfaces andComponents Introduction Background Overall Approach Methodology Experiments Results Conclusion Discussion  ASMcomponents: classReader,classWriter,classVisitor  Parsingclasses  classReader–onlyrequiredcomponenttoparsean exisitingclass  Generatingclasses  classWriter–onlyrequiredcomponenttogenerateaclass Generating class canbeloaded dynamically withaclassLoader  Transformingclass  It’spossibletouseseveraladaptersinordertocomposeseveralindependentclass transformationstocomplextransformation 9/14ASM Core API – Class Reader Adapter (classVisitor) Writer
  • 10. Interfaces andComponents Introduction Background Overall Approach Methodology Experiments Results Conclusion Discussion  Usingtransformedclasses  Ifyouwant totransformallclasses,youwillhave toputyourtransformationinsidea classFileTransformerasdefinedinthejava.lang.instrumentpackage.  Removingclassmembers  Removingmeansnotforwardingthecallat all.  Inordertoremoveafieldormethod,youmustnotforwardthemethodcall,and returnnulltothecaller.  Addingclassmember  It’sbasicallyforwarding.  IfyouputthenewcallinvisitEndmethod,thefieldwillalwaysbeadded sincethis methodisalwayscalled.  IfyouputitinvisitFieldorvisitMethod,severalfieldswillbeadded:oneperfieldor methodintheoriginalclass 10/14ASM Core API – Class
  • 11. Tools Introduction Background Overall Approach Methodology Experiments Results Conclusion Discussion  In additionto the classVisitorclass,ASM providesorg.objectweb.asm.util package.(not neededat runtime)  Type  AtypeobjectrepresentsaJava type,andcan beconstructedeitherfromatype descriptororclassobject.  Itcan alsorepresentamethodtype.  TraceClassVisitor  Itprovidesatextualrepresentationofthevisitedclass.  classWriterisnotreadable byhumans.So,inordertogetareadable traceofwhat is actuallygenerated,TraceClassVisitorcanbeused.  CheckClassAdapter  classWriterdoesn’tcheckthatitsmethodsarecalledintheappropriateorderand withvalidarguments.  Inordertodetectsomeerrors,CheckClassAdapterisused  ASMifier  Itprovidesan alternativebackendfortheTraceClassVisitortool. 11/14ASM Core API – Class
  • 13. Reference Introduction Background Overall Approach Methodology Experiments Results Conclusion Discussion [1]E. Bruneton, “ASM 4.0 A Java bytecode engineering library, ” ASM, Sep-2011. [Online].Available: http://asm.ow2.io/asm 4-guide.pdf. 13/14ASM Core API – Class
  • 14. Thank You. 1st June, 2018 t76lee@uwaterloo.ca

Editor's Notes

  1. Dynamic Slicing
  2. A tree of objects representing the class Event based API – faster, less memory Advantage : since no need to create and store in memory Disadvantage : implementing class transformation can be more difficult since only one element of the class is available at any given time The object based API : indeed class generator or transformer components that operate on object trees can be composed the links between them representing the order of transformations
  3. Z- boolean C- char B- bytes S- short I- int F- float J- long D- double
  4. More detailed explanation of reader, writer, visitor class is on pg.14
  5. Both approaches are valid ( depends on what you need) for adding class member. visitEnd approach is preferred and correct tho.