Understanding bytecode and what bytecode is likely to be generated by a Java compiler helps the Java programmer in the same way that knowledge of assembler helps the C or C++ programmer. Java bytecode is the form of instructions that Java virtual machine executes. This knowledge is crucial when debugging and doing performance and memory usage tuning. The presenter will share his knowledge on what bytecode means for your platform and how to create compiler while using some awesome tools.
While most bugs reveal their cause within their stack trace, Java’s OutOfMemoryError is less talkative and therefore regarded as being difficult to debug by a majority of developers. With the right techniques and tools, memory leaks in Java programs can however be tackled like any other programming error. This talks discusses how a JVM stores data, categorizes different types of memory leaks that can occur in a Java program and presents techniques for fixing such errors. Furthermore, we will have a closer look at lambda expressions and their considerable potential of introducing memory leaks when they are used incautiously.
Fast as C: How to Write Really Terrible JavaCharles Nutter
For years we’ve been told that the JVM’s amazing optimizers can take your running code and make it “fast” or “as fast as C++” or “as fast as C”…or sometimes “faster than C”. And yet we don’t often see this happen in practice, due in large part to (good and bad) development patterns that have taken hold in the Java world.
In this talk, we’ll explore the main reasons why Java code rarely runs as fast as C or C++ and how you can write really bad Java code that the JVM will do a better job of optimizing. We’ll take some popular microbenchmarks and burn them to the ground, monitoring JIT logs and assembly dumps along the way.
While most bugs reveal their cause within their stack trace, Java’s OutOfMemoryError is less talkative and therefore regarded as being difficult to debug by a majority of developers. With the right techniques and tools, memory leaks in Java programs can however be tackled like any other programming error. This talks discusses how a JVM stores data, categorizes different types of memory leaks that can occur in a Java program and presents techniques for fixing such errors. Furthermore, we will have a closer look at lambda expressions and their considerable potential of introducing memory leaks when they are used incautiously.
Fast as C: How to Write Really Terrible JavaCharles Nutter
For years we’ve been told that the JVM’s amazing optimizers can take your running code and make it “fast” or “as fast as C++” or “as fast as C”…or sometimes “faster than C”. And yet we don’t often see this happen in practice, due in large part to (good and bad) development patterns that have taken hold in the Java world.
In this talk, we’ll explore the main reasons why Java code rarely runs as fast as C or C++ and how you can write really bad Java code that the JVM will do a better job of optimizing. We’ll take some popular microbenchmarks and burn them to the ground, monitoring JIT logs and assembly dumps along the way.
micro(-service) components. While this approach to building software - if done correctly - can improve a system's maintainability and scalability, distributed applications also introduce challanges for operations. Where monolithic applications typically offered direct access to extensive monitoring dashbords, such easy overview is no longer available when multitude services are loosly connected over a network. But how to keep track of a system of such dynamic state?
Distributed tracing is a method of connecting interaction of different services on a network. Collecting and processing such tracing information again allows for the observation of a distributed system in its entirety. This talk shares the presenter's insights gained by working on the JVM-support of distributed tracing for the APM tool Instana. Doing so, it introduces the landscape of distributed tracing on the JVM, discussing popular approaches such as Dapper, Zipkin or Brave/OpenTracing. In the process, it is discussed how byte code instrumentation can be used to capture systems without requiring a user to set up the software under observation. The presentation finishes with a discussion of typical problems of distributed tracing solutions and carefully examines the performance penalties APM tools entail.
https://www.youtube.com/watch?v=VNmtmz3mJN4&
Deep dive into InjectionTDD - how to perform iOS unit tests realtime, without rebuilding entire Xcode project.
With its ninth version, the Java platform has shifted gear and introduced biyearly releases. This was followed by a license change where Oracle, the steward of Java, now publishes a commercial and a non-commercial release of the Java virtual machine while other vendors took more space to promote their alternative builds of the OpenJDK. And in another flood of news, the Java EE specification was terminated and resolved into the Jakarta EE namespace.
A lot has been happening in the traditionally conservative Java ecosystem, to say the least, and many users are wondering if they still can rely on the platform. This talk gives an overview of the Java ecosystem, summarizes the changes that have been, that to expect and why the evolution of the platform is good news to the community.
Down to Stack Traces, up from Heap DumpsAndrei Pangin
Глубже стек-трейсов, шире хип-дампов
Stack trace и heap dump - не просто инструменты отладки; это потайные дверцы к самым недрам виртуальной Java машины. Доклад будет посвящён малоизвестным особенностям JDK, так или иначе связанным с обоходом хипа и стеками потоков.
Мы разберём:
- как снимать дампы в продакшне без побочных эффектов;
- как работают утилиты jmap и jstack изнутри, и в чём хитрость forced режима;
- почему все профилировщики врут, и как с этим бороться;
- познакомимся с новым Stack-Walking API в Java 9;
- научимся сканировать Heap средствами JVMTI;
- узнаем о недокументированных функциях Хотспота и других интересных штуках.
Writing software for a virtual machine enables developers to forget about machine code assembly, interrupts, and processor caches. This makes Java a convenient language, but all too many developers see the JVM as a black box and are often unsure of how to optimize their code for performance. This unfortunately adds credence to the myth that Java is always outperformed by native languages. This session takes a peek at the inner workings of Oracle’s HotSpot virtual machine, its just-in-time compiler, and the interplay with a computer’s hardware. From this, you will understand the more common optimizations a virtual machine applies, to be better equipped to improve and reason about a Java program’s performance and how to correctly measure runtime!
GeeCON 2017 - TestContainers. Integration testing without the hassleAnton Arhipov
TestContainers is a Java library that supports JUnit tests, providing lightweight, throwaway instances of common databases, Selenium web browsers, or anything else that can run in a Docker container.
How do we go from your Java code to the CPU assembly that actually runs it? Using high level constructs has made us forget what happens behind the scenes, which is however key to write efficient code.
Starting from a few lines of Java, we explore the different layers that constribute to running your code: JRE, byte code, structure of the OpenJDK virtual machine, HotSpot, intrinsic methds, benchmarking.
An introductory presentation to these low-level concerns, based on the practical use case of optimizing 6 lines of code, so that hopefully you to want to explore further!
Presentation given at the Toulouse (FR) Java User Group.
Video (in french) at https://www.youtube.com/watch?v=rB0ElXf05nU
Slideshow with animations at https://docs.google.com/presentation/d/1eIcROfLpdTU2_Z_IKiMG-AwqZGZgbN1Bs2E0nGShpbk/pub?start=true&loop=false&delayms=60000
At first glance, Java byte code can appear to be some low level magic that is both hard to understand and effectively irrelevant to application developers. However, neither is true. With only little practice, Java byte code becomes easy to read and can give true insights into the functioning of a Java program. In this talk, we will cast light on compiled Java code and its interplay with the Java virtual machine. In the process, we will look into the evolution of byte code over the recent major releases with features such as dynamic method invocation which is the basis to Java 8 lambda expressions. Finally, we will learn about tools for the run time generation of Java classes and how these tools are used to build modern frameworks and libraries. Among those tools, I present Byte Buddy, an open source tool of my own efforts and an attempt to considerably simplify run time code generation in Java.
Let us explore Java 8 features and start using it in your day to day work. You will be surprised how Java has evolved to become so different yet easy & powerful. In this presentation, we discuss Java 8 Stream API.
micro(-service) components. While this approach to building software - if done correctly - can improve a system's maintainability and scalability, distributed applications also introduce challanges for operations. Where monolithic applications typically offered direct access to extensive monitoring dashbords, such easy overview is no longer available when multitude services are loosly connected over a network. But how to keep track of a system of such dynamic state?
Distributed tracing is a method of connecting interaction of different services on a network. Collecting and processing such tracing information again allows for the observation of a distributed system in its entirety. This talk shares the presenter's insights gained by working on the JVM-support of distributed tracing for the APM tool Instana. Doing so, it introduces the landscape of distributed tracing on the JVM, discussing popular approaches such as Dapper, Zipkin or Brave/OpenTracing. In the process, it is discussed how byte code instrumentation can be used to capture systems without requiring a user to set up the software under observation. The presentation finishes with a discussion of typical problems of distributed tracing solutions and carefully examines the performance penalties APM tools entail.
https://www.youtube.com/watch?v=VNmtmz3mJN4&
Deep dive into InjectionTDD - how to perform iOS unit tests realtime, without rebuilding entire Xcode project.
With its ninth version, the Java platform has shifted gear and introduced biyearly releases. This was followed by a license change where Oracle, the steward of Java, now publishes a commercial and a non-commercial release of the Java virtual machine while other vendors took more space to promote their alternative builds of the OpenJDK. And in another flood of news, the Java EE specification was terminated and resolved into the Jakarta EE namespace.
A lot has been happening in the traditionally conservative Java ecosystem, to say the least, and many users are wondering if they still can rely on the platform. This talk gives an overview of the Java ecosystem, summarizes the changes that have been, that to expect and why the evolution of the platform is good news to the community.
Down to Stack Traces, up from Heap DumpsAndrei Pangin
Глубже стек-трейсов, шире хип-дампов
Stack trace и heap dump - не просто инструменты отладки; это потайные дверцы к самым недрам виртуальной Java машины. Доклад будет посвящён малоизвестным особенностям JDK, так или иначе связанным с обоходом хипа и стеками потоков.
Мы разберём:
- как снимать дампы в продакшне без побочных эффектов;
- как работают утилиты jmap и jstack изнутри, и в чём хитрость forced режима;
- почему все профилировщики врут, и как с этим бороться;
- познакомимся с новым Stack-Walking API в Java 9;
- научимся сканировать Heap средствами JVMTI;
- узнаем о недокументированных функциях Хотспота и других интересных штуках.
Writing software for a virtual machine enables developers to forget about machine code assembly, interrupts, and processor caches. This makes Java a convenient language, but all too many developers see the JVM as a black box and are often unsure of how to optimize their code for performance. This unfortunately adds credence to the myth that Java is always outperformed by native languages. This session takes a peek at the inner workings of Oracle’s HotSpot virtual machine, its just-in-time compiler, and the interplay with a computer’s hardware. From this, you will understand the more common optimizations a virtual machine applies, to be better equipped to improve and reason about a Java program’s performance and how to correctly measure runtime!
GeeCON 2017 - TestContainers. Integration testing without the hassleAnton Arhipov
TestContainers is a Java library that supports JUnit tests, providing lightweight, throwaway instances of common databases, Selenium web browsers, or anything else that can run in a Docker container.
How do we go from your Java code to the CPU assembly that actually runs it? Using high level constructs has made us forget what happens behind the scenes, which is however key to write efficient code.
Starting from a few lines of Java, we explore the different layers that constribute to running your code: JRE, byte code, structure of the OpenJDK virtual machine, HotSpot, intrinsic methds, benchmarking.
An introductory presentation to these low-level concerns, based on the practical use case of optimizing 6 lines of code, so that hopefully you to want to explore further!
Presentation given at the Toulouse (FR) Java User Group.
Video (in french) at https://www.youtube.com/watch?v=rB0ElXf05nU
Slideshow with animations at https://docs.google.com/presentation/d/1eIcROfLpdTU2_Z_IKiMG-AwqZGZgbN1Bs2E0nGShpbk/pub?start=true&loop=false&delayms=60000
At first glance, Java byte code can appear to be some low level magic that is both hard to understand and effectively irrelevant to application developers. However, neither is true. With only little practice, Java byte code becomes easy to read and can give true insights into the functioning of a Java program. In this talk, we will cast light on compiled Java code and its interplay with the Java virtual machine. In the process, we will look into the evolution of byte code over the recent major releases with features such as dynamic method invocation which is the basis to Java 8 lambda expressions. Finally, we will learn about tools for the run time generation of Java classes and how these tools are used to build modern frameworks and libraries. Among those tools, I present Byte Buddy, an open source tool of my own efforts and an attempt to considerably simplify run time code generation in Java.
Let us explore Java 8 features and start using it in your day to day work. You will be surprised how Java has evolved to become so different yet easy & powerful. In this presentation, we discuss Java 8 Stream API.
No dark magic - Byte code engineering in the real worldtcurdt
ften byte code engineering is perceived as "black magic" and considered too low level. This session will not bore you with all the details of the JVM specification but provide you with a practical overview of how this byte code "swizzling" can be used in the real world instead. Several projects have sucessfully leveraged this technique to achieve some amazing things (e.g. AOP). This session will go through some of these examples and try to outline the differences between the two major libraries (BCEL and ASM). Maybe your next project can then benefit from some of this "magic".
Inside the JVM - Follow the white rabbit! / Breizh JUGSylvain Wallez
Presentation given at the Rennes (FR) Java User Group in Feb 2019.
How do we go from your Java code to the CPU assembly that actually runs it? Using high level constructs has made us forget what happens behind the scenes, which is however key to write efficient code.
Starting from a few lines of Java, we explore the different layers that constribute to running your code: JRE, byte code, structure of the OpenJDK virtual machine, HotSpot, intrinsic methds, benchmarking.
An introductory presentation to these low-level concerns, based on the practical use case of optimizing 6 lines of code, so that hopefully you to want to explore further!
Java agents and their instrumentation API offer developers the most powerful toolset to interact with a Java application. Using this API, it becomes possible to alter the code of running applications, for example to add monitoring or to inject security checks as it is done by many enterprise products for the Java ecosystem.
In this session, developers will learn how to program Java agents of their own that make use of the instrumentation API. Doing so, developers learn how the majority of tooling for the JVM is implemented and will learn about Byte Buddy, a high level code generation library that does not require any knowledge of Java byte code that is normally required for writing agents. In the process, developers will see how Java classes can be used as templates for implementing highly performant code changes that avoid the boilerplate of alternative solutions such as AspectJ or Javassist while still performing better than agents implemented in low-level libraries such as ASM.
Presentation given at the Toulouse JUG in Dec 2019
GraalVM and its native-image component allow building native standalone executables from Java or any other language compiling to Java bytecode like Scala or Kotlin.
This talks goes through the practical steps leading to producing a native executable for a command-line tool, explaining the benefits and also the limits of GraalVM native-image.
Soft-Shake 2016 : Jigsaw est prêt à tuer le classpathAlexis Hassler
En 2009, la mort du classpath a été annoncée. Les classloaders à plat ou hiérarchiques devaient être remplacés par des systèmes modulaires et tous nos problèmes de dépendance devaient se résoudre d'eux-mêmes. C'est le projet Jigsaw qui devait accomplir cette tâche. Il sera finalement intégré au JDK 9 dont la sortie est prévue pour 2017.
Dans la première partie de cette présentation, je vous revenir sur le fonctionnement des classloaders du JDK et voir au travers quelques exemples les problèmes étranges qu'ils posent.
Dans la deuxième partie, je présenterai ce que Jigsaw va apporter et j'expliquerai quels problèmes il va résourdre. Je le comparerai aux solutions qui existent déjà, comme OSGi et JBoss Modules.
Finally Java SE 7 is GA and you can start using it. This talk will cover the most important new features of the language and the virtual machine. It will also cover some features that did not make it in to the SE 7 release. Finally we will discuss current state of Java as an ecosystem and my analysis and hopes for the future.
Supercharging reflective libraries with InvokeDynamicIan Robertson
Reflection is a powerful tool but has traditionally carried with it a performance penalty. This session shows how a combination of InvokeDynamic and bytecode generation can be used to transform a traditional reflection-based library into one in which there is almost no performance penalty. To do so, the presentation starts with a brief need-to-know overview of JVM bytecode and the InvokeDynamic protocol. It then walks through creating a simple JSON marshaling library by using ASM bytecode generation and InvokeDynamic and shows how hand-rolled marshaling code can be rivaled in performance. Techniques for testing this code, including security policies, are also covered.
CogLab Information.htmlCogLab InformationCogLabs for this WilheminaRossi174
CogLab Information.html
CogLab Information
CogLabs for this course can be found below. To access CogLab, you will need to have JavaScript enabled. Please reference the platform that you are using to pull up your specific CogLab information each week.
CogLab 2.0 Information download pdf document
media/week1/Coglab_CD.zip
Coglab_Mac/CogLab.jar
META-INF/MANIFEST.MF
Manifest-Version: 1.0
Created-By: 1.5.0_06 (Apple Computer, Inc.)
Main-Class: CogLab
AbsoluteIdentification.classpublicsynchronizedclass AbsoluteIdentification extends java.awt.Canvas implements java.awt.event.KeyListener, Runnable, CLExperiment {
boolean release;
CLFrame frame;
String LabName;
java.util.Vector TrialsToGo;
java.util.Vector TrialsDone;
CLTrial currentTrial;
int NUMREPS;
java.util.Random randGen;
Thread animate;
String host;
String userID;
String userPassword;
String groupID;
String userName;
String version;
java.awt.Dimension canvasSize;
String[] responseKeys;
int response;
int correct;
int thisTrial;
int[][] oo;
int VersionIndex;
String[] versionNames;
boolean practiceDone;
boolean trialDone;
boolean responsePeriod;
java.awt.Image icon;
java.applet.AudioClip[] theClip;
CLUserTransfer CLUT;
java.applet.Applet demoApp;
String FirstName;
String LastName;
CLResults results;
public void AbsoluteIdentification(String, CLUserTransfer, java.awt.Image, java.applet.Applet);
public void AbsoluteIdentification(String, String, java.awt.Image, boolean);
public void setup(String, CLUserTransfer, java.awt.Image);
public void DefineTrials();
publicstatic void main(String[]);
public void paint(java.awt.Graphics);
public void RunATrial();
public void start();
public void stop();
public void run();
public void keyPressed(java.awt.event.KeyEvent);
public void keyReleased(java.awt.event.KeyEvent);
public void keyTyped(java.awt.event.KeyEvent);
public void OutputData(java.util.Vector);
public LabProperties getLabInfo();
}
ApparentMotion.classpublicsynchronizedclass ApparentMotion extends java.awt.Canvas implements Runnable, java.awt.event.KeyListener, CLExperiment {
boolean release;
CLFrame frame;
String LabName;
java.util.Vector TrialsToGo;
java.util.Vector TrialsDone;
CLTrial currentTrial;
java.util.Random randGen;
Thread animate;
java.awt.Dimension canvasSize;
int stimulusSize;
int ISI;
int currentTrialIndex;
String host;
int numTrials;
String[] responseKeys;
java.awt.Image icon;
CLUserTransfer CLUT;
java.applet.Applet demoApp;
int VersionIndex;
String[] versionNames;
boolean notDone;
boolean threadStopped;
boolean startedLoop;
String FirstName;
String LastName;
CLResults results;
public void ApparentMotion(String, CLUserTransfer, java.awt.Image, java.applet.Applet);
public ...
Java basic part 2 : Datatypes Keywords Features Components Security Exceptions Soumen Santra
Features
JVM
Architecture
Security
Data Types
Class and Object
Program
First Java Application
Declaring and creating objects
Arrays
Constructors
this keyword
static keyword
Inheritance
Overriding
Access Modifiers
super keyword
final keyword
abstract classes
interfaces
Exceptions (error handling)
User Defining exceptions
Nginx is a free, open-source, high-performance HTTP server and reverse proxy, as well as an IMAP/POP3 proxy server. Igor Sysoev started working on developing Nginx in 2002 and released it to the public in 2004. Since then Nginx is hosting nearly 12.18% (22.2M) of active sites across all domains and is known for its high performance, stability, rich feature set, simple configuration, and low resource consumption. This report will give you a full overview of the Nginx and explain why this server is so popular.
Instructions for Submissions thorugh G- Classroom.pptxJheel Barad
This presentation provides a briefing on how to upload submissions and documents in Google Classroom. It was prepared as part of an orientation for new Sainik School in-service teacher trainees. As a training officer, my goal is to ensure that you are comfortable and proficient with this essential tool for managing assignments and fostering student engagement.
Synthetic Fiber Construction in lab .pptxPavel ( NSTU)
Synthetic fiber production is a fascinating and complex field that blends chemistry, engineering, and environmental science. By understanding these aspects, students can gain a comprehensive view of synthetic fiber production, its impact on society and the environment, and the potential for future innovations. Synthetic fibers play a crucial role in modern society, impacting various aspects of daily life, industry, and the environment. ynthetic fibers are integral to modern life, offering a range of benefits from cost-effectiveness and versatility to innovative applications and performance characteristics. While they pose environmental challenges, ongoing research and development aim to create more sustainable and eco-friendly alternatives. Understanding the importance of synthetic fibers helps in appreciating their role in the economy, industry, and daily life, while also emphasizing the need for sustainable practices and innovation.
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...Levi Shapiro
Letter from the Congress of the United States regarding Anti-Semitism sent June 3rd to MIT President Sally Kornbluth, MIT Corp Chair, Mark Gorenberg
Dear Dr. Kornbluth and Mr. Gorenberg,
The US House of Representatives is deeply concerned by ongoing and pervasive acts of antisemitic
harassment and intimidation at the Massachusetts Institute of Technology (MIT). Failing to act decisively to ensure a safe learning environment for all students would be a grave dereliction of your responsibilities as President of MIT and Chair of the MIT Corporation.
This Congress will not stand idly by and allow an environment hostile to Jewish students to persist. The House believes that your institution is in violation of Title VI of the Civil Rights Act, and the inability or
unwillingness to rectify this violation through action requires accountability.
Postsecondary education is a unique opportunity for students to learn and have their ideas and beliefs challenged. However, universities receiving hundreds of millions of federal funds annually have denied
students that opportunity and have been hijacked to become venues for the promotion of terrorism, antisemitic harassment and intimidation, unlawful encampments, and in some cases, assaults and riots.
The House of Representatives will not countenance the use of federal funds to indoctrinate students into hateful, antisemitic, anti-American supporters of terrorism. Investigations into campus antisemitism by the Committee on Education and the Workforce and the Committee on Ways and Means have been expanded into a Congress-wide probe across all relevant jurisdictions to address this national crisis. The undersigned Committees will conduct oversight into the use of federal funds at MIT and its learning environment under authorities granted to each Committee.
• The Committee on Education and the Workforce has been investigating your institution since December 7, 2023. The Committee has broad jurisdiction over postsecondary education, including its compliance with Title VI of the Civil Rights Act, campus safety concerns over disruptions to the learning environment, and the awarding of federal student aid under the Higher Education Act.
• The Committee on Oversight and Accountability is investigating the sources of funding and other support flowing to groups espousing pro-Hamas propaganda and engaged in antisemitic harassment and intimidation of students. The Committee on Oversight and Accountability is the principal oversight committee of the US House of Representatives and has broad authority to investigate “any matter” at “any time” under House Rule X.
• The Committee on Ways and Means has been investigating several universities since November 15, 2023, when the Committee held a hearing entitled From Ivory Towers to Dark Corners: Investigating the Nexus Between Antisemitism, Tax-Exempt Universities, and Terror Financing. The Committee followed the hearing with letters to those institutions on January 10, 202
Palestine last event orientationfvgnh .pptxRaedMohamed3
An EFL lesson about the current events in Palestine. It is intended to be for intermediate students who wish to increase their listening skills through a short lesson in power point.
Embracing GenAI - A Strategic ImperativePeter Windle
Artificial Intelligence (AI) technologies such as Generative AI, Image Generators and Large Language Models have had a dramatic impact on teaching, learning and assessment over the past 18 months. The most immediate threat AI posed was to Academic Integrity with Higher Education Institutes (HEIs) focusing their efforts on combating the use of GenAI in assessment. Guidelines were developed for staff and students, policies put in place too. Innovative educators have forged paths in the use of Generative AI for teaching, learning and assessments leading to pockets of transformation springing up across HEIs, often with little or no top-down guidance, support or direction.
This Gasta posits a strategic approach to integrating AI into HEIs to prepare staff, students and the curriculum for an evolving world and workplace. We will highlight the advantages of working with these technologies beyond the realm of teaching, learning and assessment by considering prompt engineering skills, industry impact, curriculum changes, and the need for staff upskilling. In contrast, not engaging strategically with Generative AI poses risks, including falling behind peers, missed opportunities and failing to ensure our graduates remain employable. The rapid evolution of AI technologies necessitates a proactive and strategic approach if we are to remain relevant.
2024.06.01 Introducing a competency framework for languag learning materials ...Sandy Millin
http://sandymillin.wordpress.com/iateflwebinar2024
Published classroom materials form the basis of syllabuses, drive teacher professional development, and have a potentially huge influence on learners, teachers and education systems. All teachers also create their own materials, whether a few sentences on a blackboard, a highly-structured fully-realised online course, or anything in between. Despite this, the knowledge and skills needed to create effective language learning materials are rarely part of teacher training, and are mostly learnt by trial and error.
Knowledge and skills frameworks, generally called competency frameworks, for ELT teachers, trainers and managers have existed for a few years now. However, until I created one for my MA dissertation, there wasn’t one drawing together what we need to know and do to be able to effectively produce language learning materials.
This webinar will introduce you to my framework, highlighting the key competencies I identified from my research. It will also show how anybody involved in language teaching (any language, not just English!), teacher training, managing schools or developing language learning materials can benefit from using the framework.
Acetabularia Information For Class 9 .docxvaibhavrinwa19
Acetabularia acetabulum is a single-celled green alga that in its vegetative state is morphologically differentiated into a basal rhizoid and an axially elongated stalk, which bears whorls of branching hairs. The single diploid nucleus resides in the rhizoid.
Unit 8 - Information and Communication Technology (Paper I).pdfThiyagu K
This slides describes the basic concepts of ICT, basics of Email, Emerging Technology and Digital Initiatives in Education. This presentations aligns with the UGC Paper I syllabus.
9. Java Stack Machine
• JVM is a stack-based machine
• Each thread has a stack
• Stack stores frames
• Frame is created on method invocation
• Frame:
o
Operand stack
o
Array of local variables
o
Reference to the runtime constant pool
11. javap
• Java class file disassembler
• Used with no options shows class
structure only
• Methods, superclass, interfaces, etc
• -c – shows the bytecode
• -private – shows all classes and
members
• -s – prints internal types signatures
• -verbose – prints stack size, number of
locals and args for methods
29. Common sample
public class SimpleProgram
{
public static void main(String[] args)
{
System.out.println("Hello Java Fusion!");
}
}
30. ASM sample
public class ASMSample extends ClassLoader implements Opcodes {
{
public static void main(String[] args)
{
ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS);
cw.visit(V1_1, ACC_PUBLIC, "SimpleProgram", null, "java/lang/Object", null);
}
}
31. ASM sample
public class ASMSample extends ClassLoader implements Opcodes {
{
public static void main(String[] args)
{
ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS);
cw.visit(V1_1, ACC_PUBLIC, "SimpleProgram", null, "java/lang/Object", null); // creates a GeneratorAdapter
for the (implicit) constructor
Method m = Method.getMethod("void <init> ()");
GeneratorAdapter mg = new GeneratorAdapter(ACC_PUBLIC, m, null, null, cw);
mg.loadThis();
mg.invokeConstructor(Type.getType(Object.class), m);
mg.returnValue();
mg.endMethod();
}
}
32. ASM sample
public class ASMSample extends ClassLoader implements Opcodes {
{
public static void main(String[] args)
{
ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS);
cw.visit(V1_1, ACC_PUBLIC, "SimpleProgram", null, "java/lang/Object", null);
// creates a GeneratorAdapter for the (implicit) constructor
Method m = Method.getMethod("void <init> ()");
GeneratorAdapter mg = new GeneratorAdapter(ACC_PUBLIC, m, null, null, cw);
mg.loadThis();
mg.invokeConstructor(Type.getType(Object.class), m);
mg.returnValue();
mg.endMethod(); // creates a GeneratorAdapter for the 'main' method
m = Method.getMethod("void main (String[])");
mg = new GeneratorAdapter(ACC_PUBLIC + ACC_STATIC, m, null, null, cw);
mg.getStatic(Type.getType(System.class), "out",Type.getType(PrintStream.class));
mg.push("Hello Java Fusion!");
mg.invokeVirtual(Type.getType(PrintStream.class),
Method.getMethod("void println (String)"));
mg.returnValue();
mg.endMethod();
cw.visitEnd();
}
}
33. ASM sample
public class ASMSample extends ClassLoader implements Opcodes {
{
public static void main(String[] args)
{
ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS);
cw.visit(V1_1, ACC_PUBLIC, "SimpleProgram", null, "java/lang/Object", null);
// creates a GeneratorAdapter for the (implicit) constructor
Method m = Method.getMethod("void <init> ()");
GeneratorAdapter mg = new GeneratorAdapter(ACC_PUBLIC, m, null, null, cw);
mg.loadThis();
mg.invokeConstructor(Type.getType(Object.class), m);
mg.returnValue();
mg.endMethod();
// creates a GeneratorAdapter for the 'main' method
m = Method.getMethod("void main (String[])");
mg = new GeneratorAdapter(ACC_PUBLIC + ACC_STATIC, m, null, null, cw);
mg.getStatic(Type.getType(System.class), "out",Type.getType(PrintStream.class));
mg.push("Hello Java Fusion!");
mg.invokeVirtual(Type.getType(PrintStream.class),
Method.getMethod("void println (String)"));
mg.returnValue();
mg.endMethod();
cw.visitEnd(); byte[] code = cw.toByteArray();
ASMSample loader = new ASMSample ();
Class<?> exampleClass = loader.defineClass("SimpleProgram", code, 0, code.length);
// uses the dynamically generated class to print 'Hello Java Fusion'
exampleClass.getMethods()[0].invoke(null, new Object[] { null } );
}
}
34. ASM vs. Javassist
• Javassist source level API is much easier to use than the
actual bytecode manipulation in ASM
• Javassist provides a higher level abstraction layer over complex
bytecode level operations. Javassist source level API requires very less or
no knowledge of actual bytecodes, so much easier & faster to
implement.
• Javassist uses reflection mechanism which makes it slower
compared to ASM which uses Classworking techniques at runtime.
• Overall ASM is much faster & gives better performance than
Javassist. Javassist uses a simplified version of Java source code, which
it then compiles into bytecode. That makes Javassist very easy to use, but
it also limits the use of bytecode to what can be expressed within the limits
of the Javassist source code.
• In conclusion, if someone needs easier way of dynamically
manipulating or creating Java classes Javassist API should be used &
where the performance is the key issue ASM library should be used.
35. JRebel
Redeploying sucks, so JRebel
eliminates it. How?
JRebel maps your project workspace directly to the
application under development. When you change any
class or resource in your IDE, the change is immediately
reflected in the application, skipping the build and
redeploy phases.
36. How JRebel works
1) Classes
• JRebel integrates with the JVM and rewrites each class to be
updateable
• JRebel versions each class individually, instead of an application or
module at a time
• It does not use classloaders!
• Changes to classes are always visible in the Reflection API
37. How JRebel works
2) Workspace mapping
petclinic.war
• JRebel integrates with application
servers, frameworks and your IDE
• When a class or resource is being
looked up, JRebel redirects straight
to the workspace
• When an HTTP resource needs to
be served, JRebel serves it from the
workspace
39. Size and speed issues
top1 and top2 are functionally identical
40. Size and speed issues
Method int top1()
0 aload_0 //Push the object reference(this) at index
//0 of the local variable table.
1 getfield #6 <Field int intArr[]>
//Pop the object reference(this) and push
//the object reference for intArr accessed
//from the constant pool.
4 iconst_0 //Push 0.
5 iaload //Pop the top two values and push the
//value at index 0 of intArr.
6 ireturn //Pop top value and push it on the operand
//stack of the invoking method. Exit.
41. Size and speed issues
Method int top2()
0 aload_0
1 astore_2
2 aload_2
3 monitorenter
4 aload_0
5 getfield #6 <Field int intArr[]>
8 iconst_0 //Push 0.
9 iaload
10 istore_1
11 jsr 19
14 iload_1 .
15 ireturn
16 aload_2
17 monitorexit . Exception table: //If any exception occurs between
18 athrow . from to target type //location 4 (inclusive) and location
19 astore_3 4 16 16 any //16 (exclusive) jump to location 16
20 aload_2
21 monitorexit
22 ret 3
.
42. Size and speed issues
top1 and top2 are functionally identical
top1 is 13% faster than top2 as well as much smaller.
43. Puzzle Cutting Class
public class Strange2 {
public class Strange1 {
public static void main(String[] args) {
public static void main(String[] args) {
Missing m; try {
try {
m = new Missing(); } catch
Missing m = new Missing(); } catch
(java.lang.NoClassDefFoundError ex) {
(java.lang.NoClassDefFoundError ex) {
System.out.println("Got it!");
System.out.println("Got it!");
}
}
}
}
}
}
class Missing {
Missing() { }
}
44. Puzzle Cutting Class
public class Strange2 {
public class Strange1 {
public static void main(String[] args) {
public static void main(String[] args) {
Missing m; try {
try {
m = new Missing(); } catch
Missing m = new Missing(); } catch
(java.lang.NoClassDefFoundError ex) {
(java.lang.NoClassDefFoundError ex) {
System.out.println("Got it!");
System.out.println("Got it!");
}
}
}
}
}
}
class Missing {
Missing() { }
}
45. Puzzle Cutting Class
public class Strange2 {
public class Strange1 {
public static void main(String[] args) {
public static void main(String[] args) {
Missing m; try {
try {
m = new Missing(); } catch
Missing m = new Missing(); } catch
(java.lang.NoClassDefFoundError ex) {
(java.lang.NoClassDefFoundError ex) {
System.out.println("Got it!");
System.out.println("Got it!");
}
}
}
}
}
}
class Missing {
Missing() { }
}
???
System.out.println("Got it!"); throws an uncaught
NoClassDefFoundError
46. Puzzle Cutting Class
public class Strange2 {
public class Strange1 {
public static void main(String[] args) {
public static void main(String[] args) {
Missing m; try {
try {
m = new Missing(); } catch
Missing m = new Missing(); } catch
(java.lang.NoClassDefFoundError ex) {
(java.lang.NoClassDefFoundError ex) {
System.out.println("Got it!");
System.out.println("Got it!");
}
}
}
}
class Missing {
Missing() { }
}
System.out.println("Got it!"); Expected throws an uncaught
NoClassDefFoundError
throws an uncaught Result System.out.println("Got it!");
NoClassDefFoundError
47. Puzzle Cutting Class
0: new #2; // class Missing
3: dup
4: invokespecial #3; // Method Missing."<init>":()V
7: astore_1
8: goto 20
11: astore_1
12: getstatic #5; // Field System.out:Ljava/io/PrintStream;
15: ldc #6; // String "Got it!"
17: invokevirtual #7; // Method PrintStream.println:(String;)V
20: return
Exception table:
from to target type
0 8 11 Class java/lang/NoClassDefFoundError
The corresponding code for Strange2.main differs in only one instruction:
11: astore_2 //Store ex catch parameter
javap -c Strange1
48. Using reflection
public class Strange {
public static void main(String[] args) throws Exception {
try {
Object m = Class.forName("Missing").newInstance();
} catch (ClassNotFoundException ex) {
System.err.println("Got it!");
}
}
}
49. Benefits
• Improve speed and size of your applications
• Critical when debugging and doing performance and
memory usage tuning
• Realtime injection
• Build ORM project
• Clustering with AOP
• Know your platform!
• Create your own compile/decompiler?
Editor's Notes
Добавить много Realtime примеров в Far и Inteliji Idea или Eclipse!!!!
#1, #2 и т.д. храняться в пуле констант. Подробней в -verbose
#1, #2 и т.д. храняться в пуле констант. Подробней в -verbose
#1, #2 и т.д. храняться в пуле констант. Подробней в -verbose
#1, #2 и т.д. храняться в пуле констант. Подробней в -verbose The array of local variables, also called the local variable table, contains the parameters of the method and is also used to hold the values of the local variables.
Байт-кода стеко-ориентированный язык, похожий по своей структуре на ассемблер. Что бы произвести операции с данными их сначала нужно положит на стек. Мы хотим взять поле у объект. Что бы это сделять нужно его положить в стек. В байт-коде нет имен переменных, у них есть номера. Нулевой номер у ссылки на текущий объект или у переменой this. Потом идут параметры исполняемого метода. Затем остальные переменные.
Each thread has a JVM stack which stores frames . A frame is created each time a method is invoked, and consists of an operand stack, an array of local variables, and a reference to the runtime constant pool of the class of the current method.
Intel opcode выполняються в среде ОС, Sun opcode в среде JVM Платформы java имеется две особенности. Для обеспечения кроссплатформенности программа сначала компилируется в промежуточный язык низкого уровня - байт-код. Вторая особенность загрузка исполняемых классов происходит с помощью расширяемых classloader. Это механизм обеспечивает большую гибкость и позволяет модифицировать исполняемый код при загрузки, создавать и подгружать новые классы во время выполнения программы. Такая техника широко применяется для реализации AOP, создания тестовых фреймворков, ORM.
Каждому классу в java соответствует один откомпилированный файл. Это справедливо даже для подклассов или анонимным классов. Такой файл содержит информацию об имени класса, его родители, список интерфейсов которые он реализует, перечисление его полей и методов. Важно отметить, что после компиляции информации которая содержит директива import теряется и все классы именуются теперь через полный путь. Например в место String будет записано java/lang/String.
#1, #2 и т.д. храняться в пуле констант
Добавить диограму с Constant pool
prefix определяет тип, для которого предназначен opcode
Each method has a corresponding bytecode array. These values correspond to the index into the array where each opcode and its arguments are stored. You might wonder why the values are not sequential. Since bytecode got its name because each instruction occupies one byte, why are the indexes not 0, 1, and 2? The reason is some of the opcodes have parameters that take up space in the bytecode array. For example, the aload_0 instruction has no parameters and naturally occupies one byte in the bytecode array. Therefore, the next opcode, getfield, is in location 1. However, areturn is in location 4. This is because the getfield opcode and its parameters occupy location 1, 2, and 3
Class Loader при загрузке байткода проверяет его на безопастность и исправность. Больше информации про Class loader
Добавить утелиты для реалных примеров (Jrebel), изменение байт кода без деплоя и тд?
Создадим класс SimpleProgram с помощью библиотеки ASM
Добавить диаграму разницы
Добавить Realtime примеры в Far и Inteliji Idea или Eclipse!!!!
Добавить Realtime примеры в Far и Inteliji Idea или Eclipse!!!!
Добавить Realtime примеры в Far и Inteliji Idea или Eclipse!!!!
В чем разница межжу top1 and top2 ?
Они одинаковые. Методы работают с одной скоростю, если нет, то какой быстрее?
Они одинаковые. Методы работают с одной скоростю, если нет, то какой быстрее?
Они одинаковые. Методы работают с одной скоростю, если нет, то какой быстрее?
показать байт коды классов?
Strange2 хранит в astore_1 ex, а в astore_2 Missing. Strange1 хранить в a_store_1 Missing. Как же правильно сделать прверку? Обяснить подробней
Правильный способ проверки наличия класса. Обяснить его подробней?