MATLAB stands for Matrix Laboratory. MATLAB was written originally
to provide easy access to matrix software developed by the LINPACK (linear system package) and matlab 2012a manual pdf
MATLAB stands for Matrix Laboratory. MATLAB was written originally
to provide easy access to matrix software developed by the LINPACK (linear system package) and matlab 2012a manual pdf
This presentation describes some key features of Scala uses in the creation of machine learning algorithms:
1 Functorial definition of tensors for learning non-linear models (manifolds)
2. Monads to compose of explicit kernel functions in Euclidean space
3. Implicit class to extends Scala standard library
4. Stackable traits and dependency injection to build formal models and dynamic workflows
5. Tail recursion to implementation dynamic programming techniques
6. Streaming to reduce memory consumption for big data
7. Control of back pressure in data flows
http://patricknicolas.blogspot.com
http://bit.ly/12GjRu9
Dr. Sachin Verma is a young, diligent and dynamic physician. He did his graduation from IGMC Shimla and MD in Internal Medicine from GSVM Medical College Kanpur. Then he did his Fellowship in Intensive Care Medicine (FICM) from Apollo Hospital Delhi. He has done fellowship in infectious diseases by Infectious Disease Society of America (IDSA). He has also done FCCS course and is certified Advance Cardiac Life support (ACLS) and Basic Life Support (BLS) provider by American Heart Association. He has also done a course in Cardiology by American College of Cardiology and a course in Diabetology by International Diabetes Centre. He specializes in the management of Infections, Multiorgan Dysfunctions and Critically ill patients and has many publications and presentations in various national conferences under his belt. He is currently working in NABH Approved Ivy super-specialty Hospital Mohali as Consultant Intensivists and Physician.
Dr. Sachin Verma is a young, diligent and dynamic physician. He did his graduation from IGMC Shimla and MD in Internal Medicine from GSVM Medical College Kanpur. Then he did his Fellowship in Intensive Care Medicine (FICM) from Apollo Hospital Delhi. He has done fellowship in infectious diseases by Infectious Disease Society of America (IDSA). He has also done FCCS course and is certified Advance Cardiac Life support (ACLS) and Basic Life Support (BLS) provider by American Heart Association. He has also done a course in Cardiology by American College of Cardiology and a course in Diabetology by International Diabetes Centre. He specializes in the management of Infections, Multiorgan Dysfunctions and Critically ill patients and has many publications and presentations in various national conferences under his belt. He is currently working in NABH Approved Ivy super-specialty Hospital Mohali as Consultant Intensivists and Physician.
Tuberculosis suspect. Productive cough for more than 2 weeks, which may be accompanied by other respiratory symptoms and/or constitutional symptoms
Case of tuberculosis. A definite case of TB or one in which a health worker (clinician or other medical practitioner) has diagnosed TB and has decided to treat the patient with a full course of TB treatment.
Any person given treatment for TB should be recorded as a case. Incomplete “trial” TB treatment should not be given as a method for diagnosis.
This presentation describes some key features of Scala uses in the creation of machine learning algorithms:
1 Functorial definition of tensors for learning non-linear models (manifolds)
2. Monads to compose of explicit kernel functions in Euclidean space
3. Implicit class to extends Scala standard library
4. Stackable traits and dependency injection to build formal models and dynamic workflows
5. Tail recursion to implementation dynamic programming techniques
6. Streaming to reduce memory consumption for big data
7. Control of back pressure in data flows
http://patricknicolas.blogspot.com
http://bit.ly/12GjRu9
Dr. Sachin Verma is a young, diligent and dynamic physician. He did his graduation from IGMC Shimla and MD in Internal Medicine from GSVM Medical College Kanpur. Then he did his Fellowship in Intensive Care Medicine (FICM) from Apollo Hospital Delhi. He has done fellowship in infectious diseases by Infectious Disease Society of America (IDSA). He has also done FCCS course and is certified Advance Cardiac Life support (ACLS) and Basic Life Support (BLS) provider by American Heart Association. He has also done a course in Cardiology by American College of Cardiology and a course in Diabetology by International Diabetes Centre. He specializes in the management of Infections, Multiorgan Dysfunctions and Critically ill patients and has many publications and presentations in various national conferences under his belt. He is currently working in NABH Approved Ivy super-specialty Hospital Mohali as Consultant Intensivists and Physician.
Dr. Sachin Verma is a young, diligent and dynamic physician. He did his graduation from IGMC Shimla and MD in Internal Medicine from GSVM Medical College Kanpur. Then he did his Fellowship in Intensive Care Medicine (FICM) from Apollo Hospital Delhi. He has done fellowship in infectious diseases by Infectious Disease Society of America (IDSA). He has also done FCCS course and is certified Advance Cardiac Life support (ACLS) and Basic Life Support (BLS) provider by American Heart Association. He has also done a course in Cardiology by American College of Cardiology and a course in Diabetology by International Diabetes Centre. He specializes in the management of Infections, Multiorgan Dysfunctions and Critically ill patients and has many publications and presentations in various national conferences under his belt. He is currently working in NABH Approved Ivy super-specialty Hospital Mohali as Consultant Intensivists and Physician.
Tuberculosis suspect. Productive cough for more than 2 weeks, which may be accompanied by other respiratory symptoms and/or constitutional symptoms
Case of tuberculosis. A definite case of TB or one in which a health worker (clinician or other medical practitioner) has diagnosed TB and has decided to treat the patient with a full course of TB treatment.
Any person given treatment for TB should be recorded as a case. Incomplete “trial” TB treatment should not be given as a method for diagnosis.
Dr. Sachin Verma is a young, diligent and dynamic physician. He did his graduation from IGMC Shimla and MD in Internal Medicine from GSVM Medical College Kanpur. Then he did his Fellowship in Intensive Care Medicine (FICM) from Apollo Hospital Delhi. He has done fellowship in infectious diseases by Infectious Disease Society of America (IDSA). He has also done FCCS course and is certified Advance Cardiac Life support (ACLS) and Basic Life Support (BLS) provider by American Heart Association. He has also done a course in Cardiology by American College of Cardiology and a course in Diabetology by International Diabetes Centre. He specializes in the management of Infections, Multiorgan Dysfunctions and Critically ill patients and has many publications and presentations in various national conferences under his belt. He is currently working in NABH Approved Ivy super-specialty Hospital Mohali as Consultant Intensivists and Physician.
This presentation takes you on a functional programming journey, it starts from basic Scala programming language design concepts and leads to a concept of Monads, how some of them designed in Scala and what is the purpose of them
Communications Mining Series - Zero to Hero - Session 1DianaGray10
This session provides introduction to UiPath Communication Mining, importance and platform overview. You will acquire a good understand of the phases in Communication Mining as we go over the platform with you. Topics covered:
• Communication Mining Overview
• Why is it important?
• How can it help today’s business and the benefits
• Phases in Communication Mining
• Demo on Platform overview
• Q/A
In his public lecture, Christian Timmerer provides insights into the fascinating history of video streaming, starting from its humble beginnings before YouTube to the groundbreaking technologies that now dominate platforms like Netflix and ORF ON. Timmerer also presents provocative contributions of his own that have significantly influenced the industry. He concludes by looking at future challenges and invites the audience to join in a discussion.
Sudheer Mechineni, Head of Application Frameworks, Standard Chartered Bank
Discover how Standard Chartered Bank harnessed the power of Neo4j to transform complex data access challenges into a dynamic, scalable graph database solution. This keynote will cover their journey from initial adoption to deploying a fully automated, enterprise-grade causal cluster, highlighting key strategies for modelling organisational changes and ensuring robust disaster recovery. Learn how these innovations have not only enhanced Standard Chartered Bank’s data infrastructure but also positioned them as pioneers in the banking sector’s adoption of graph technology.
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...Neo4j
Leonard Jayamohan, Partner & Generative AI Lead, Deloitte
This keynote will reveal how Deloitte leverages Neo4j’s graph power for groundbreaking digital twin solutions, achieving a staggering 100x performance boost. Discover the essential role knowledge graphs play in successful generative AI implementations. Plus, get an exclusive look at an innovative Neo4j + Generative AI solution Deloitte is developing in-house.
The Art of the Pitch: WordPress Relationships and SalesLaura Byrne
Clients don’t know what they don’t know. What web solutions are right for them? How does WordPress come into the picture? How do you make sure you understand scope and timeline? What do you do if sometime changes?
All these questions and more will be explored as we talk about matching clients’ needs with what your agency offers without pulling teeth or pulling your hair out. Practical tips, and strategies for successful relationship building that leads to closing the deal.
DevOps and Testing slides at DASA ConnectKari Kakkonen
My and Rik Marselis slides at 30.5.2024 DASA Connect conference. We discuss about what is testing, then what is agile testing and finally what is Testing in DevOps. Finally we had lovely workshop with the participants trying to find out different ways to think about quality and testing in different parts of the DevOps infinity loop.
GraphRAG is All You need? LLM & Knowledge GraphGuy Korland
Guy Korland, CEO and Co-founder of FalkorDB, will review two articles on the integration of language models with knowledge graphs.
1. Unifying Large Language Models and Knowledge Graphs: A Roadmap.
https://arxiv.org/abs/2306.08302
2. Microsoft Research's GraphRAG paper and a review paper on various uses of knowledge graphs:
https://www.microsoft.com/en-us/research/blog/graphrag-unlocking-llm-discovery-on-narrative-private-data/
GridMate - End to end testing is a critical piece to ensure quality and avoid...ThomasParaiso2
End to end testing is a critical piece to ensure quality and avoid regressions. In this session, we share our journey building an E2E testing pipeline for GridMate components (LWC and Aura) using Cypress, JSForce, FakerJS…
A tale of scale & speed: How the US Navy is enabling software delivery from l...sonjaschweigert1
Rapid and secure feature delivery is a goal across every application team and every branch of the DoD. The Navy’s DevSecOps platform, Party Barge, has achieved:
- Reduction in onboarding time from 5 weeks to 1 day
- Improved developer experience and productivity through actionable findings and reduction of false positives
- Maintenance of superior security standards and inherent policy enforcement with Authorization to Operate (ATO)
Development teams can ship efficiently and ensure applications are cyber ready for Navy Authorizing Officials (AOs). In this webinar, Sigma Defense and Anchore will give attendees a look behind the scenes and demo secure pipeline automation and security artifacts that speed up application ATO and time to production.
We will cover:
- How to remove silos in DevSecOps
- How to build efficient development pipeline roles and component templates
- How to deliver security artifacts that matter for ATO’s (SBOMs, vulnerability reports, and policy evidence)
- How to streamline operations with automated policy checks on container images
Threats to mobile devices are more prevalent and increasing in scope and complexity. Users of mobile devices desire to take full advantage of the features
available on those devices, but many of the features provide convenience and capability but sacrifice security. This best practices guide outlines steps the users can take to better protect personal devices and information.
Elevating Tactical DDD Patterns Through Object CalisthenicsDorra BARTAGUIZ
After immersing yourself in the blue book and its red counterpart, attending DDD-focused conferences, and applying tactical patterns, you're left with a crucial question: How do I ensure my design is effective? Tactical patterns within Domain-Driven Design (DDD) serve as guiding principles for creating clear and manageable domain models. However, achieving success with these patterns requires additional guidance. Interestingly, we've observed that a set of constraints initially designed for training purposes remarkably aligns with effective pattern implementation, offering a more ‘mechanical’ approach. Let's explore together how Object Calisthenics can elevate the design of your tactical DDD patterns, offering concrete help for those venturing into DDD for the first time!
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...SOFTTECHHUB
The choice of an operating system plays a pivotal role in shaping our computing experience. For decades, Microsoft's Windows has dominated the market, offering a familiar and widely adopted platform for personal and professional use. However, as technological advancements continue to push the boundaries of innovation, alternative operating systems have emerged, challenging the status quo and offering users a fresh perspective on computing.
One such alternative that has garnered significant attention and acclaim is Nitrux Linux 3.5.0, a sleek, powerful, and user-friendly Linux distribution that promises to redefine the way we interact with our devices. With its focus on performance, security, and customization, Nitrux Linux presents a compelling case for those seeking to break free from the constraints of proprietary software and embrace the freedom and flexibility of open-source computing.
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024Neo4j
Neha Bajwa, Vice President of Product Marketing, Neo4j
Join us as we explore breakthrough innovations enabled by interconnected data and AI. Discover firsthand how organizations use relationships in data to uncover contextual insights and solve our most pressing challenges – from optimizing supply chains, detecting fraud, and improving customer experiences to accelerating drug discoveries.
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionAggregage
Join Maher Hanafi, VP of Engineering at Betterworks, in this new session where he'll share a practical framework to transform Gen AI prototypes into impactful products! He'll delve into the complexities of data collection and management, model selection and optimization, and ensuring security, scalability, and responsible use.
Transcript: Selling digital books in 2024: Insights from industry leaders - T...BookNet Canada
The publishing industry has been selling digital audiobooks and ebooks for over a decade and has found its groove. What’s changed? What has stayed the same? Where do we go from here? Join a group of leading sales peers from across the industry for a conversation about the lessons learned since the popularization of digital books, best practices, digital book supply chain management, and more.
Link to video recording: https://bnctechforum.ca/sessions/selling-digital-books-in-2024-insights-from-industry-leaders/
Presented by BookNet Canada on May 28, 2024, with support from the Department of Canadian Heritage.
2. ANNOTATION INFERENCE: AN OVERVIEW
Annotation Inference includes following steps:
Load external/previously inferred annotations from
specified sources (XML files, class files, annotation logs,
etc.)
Load descriptions of classes to analyze
Invoke inference algorithm on loaded classes and
annotations to produce set of inferred annotations
Update inferred annotations with propagation algorithm
to ensure extension to other methods in inheritance
hierarchy
Process conflicts between inferred and external
annotations
Inference process is parameterized with algorithms
which implement inference for specific kinds of
annotations (e.g. nullability):
Infer field annotations given its value
Infer method annotations given its bytecode
3. ANNOTATIONS STRUCTURE
Annotations are represented as a map from
annotation position to actual annotation values (e.g.
NULLABLE/NOT_NULL)
Annotation position consists of
Class member (field/method)
Declaration position – annotated component of class
member:
Field type position – annotates field type
Return type – annotates return type of the method
Parameter position – annotates type of method parameter
(given its index)
4. ANNOTATION LATTICE
Inference assumes that annotations form a lattice,
hence for any pair (a, b) of annotations of the same
kind (e.g. nullability) least upper LUB(a, b) and
greatest lower GLB(a, b) bounds are defined
Nullability: NOT_NULL < NULLABLE
Mutability: READ_ONLY < MUTABLE
Unification: given two annotations (a, b) and
declaration position p unified annotation unify(a, b,
p) is defined as:
LUB(a, b) if p is covariant
GLB(a, b) if p is contravariant
b if p is invariant (assuming a == b)
Unification is naturally extended to annotation sets
Annotation a (“parent”) subsumes annotation b
(“child”) at position p if unify(a, b, p) == a
5. FIELD/METHOD DEPENDENCY
Field dependency is a map which associates field
descriptions with pair (readers, writers) where
readers is a set of all methods (within given class set)
which access field value through GETFIELD or
GETSTATIC instructions
writers is a set of all methods (within given class set)
which mutate field value through PUTFIELD or
PUTSTATIC instructions
Method dependency is a graph with methods as
vertices. The graph contains egde (a, b) if one of
the following conditions holds:
If method a invokes method b through one of
INVOKE*** instructions
If there is a non-primitive field such that method a is its
reader and method b is its writer
6. ANNOTATION INFERENCE (WITHOUT PROPAGATION)
Input:
classSource: set of classes to analyze
externalAnn: external annotations (e. g. loaded from
classfiles/XMLs)
existingAnn: previously inferred annotations
Output:
inferredAnn: inferred annotations
inferredAnn := copy of existingAnn
fieldDep := build field dependency map for all classes in classSource
methDep := build method dependency graph for all classes in
classSource
depComps := list of SCCs of methDep ordered with the respect to
topological sorting
For each field f in fieldDep, use annotation-specific algorithm to infer
annotations from initial value of f and copy them to inferredAnn
For each component comp in components infer annotation for
methods within comp (see below)
7. INFER ANNOTATIONS ON DEPENDENCY GRAPH SCC
Input:
methods: set of methods which form dependency graph SCC
ann: current annotations (to be updated by the inference)
queue := new queue containing all items from methods
while (queue is not empty)
m := remove first method from queue
cfg := build control-flow graph of m
inferredAnn := Invoke annotation-specific inference algorithm (e.g.
nullability) for method m, graph cfg and predefined annotations ann
Copy all changed annotations from inferredAnn to ann
If (at least one annotation was changed/added/removed) then
Add to the queue:
all dependent methods of m which belong to the same SCC
as m itself
method m
8. PROPAGATION: AN OVERVIEW
Propagation algorithm extends given annotation set
to methods within the same inheritance hierarchy
Propagation proceeds in the following steps:
1. Resolve annotation conflicts
Parent and child method have conflicting annotations at
some position if child annotation does not subsumes parent
annotation. Conflicts are fixed by updating parent annotation
to be least upper bound of child annotation and previous
parent annotation
2. Unify parameter annotations
Methods in the same inheritance hierarchy are assigned
identical annotation at corresponding parameter. The
annotation is computed as least upper bound over
annotations already present at that parameter
3. Apply propagation overrides
Propagation override is an exception to unification algorithm
which states that given method and all its descendants must
have some specific annotation at given parameter
9. PROPAGATION: CONFLICT RESOLUTION
Input
leaves: set of “leaf” methods
lat: annotation lattice
ann: annotations (to be updated)
For each method leaf in leaves
propagatedAnn := Annotations(ann)
Perform breadth-first traversal of method hierarchy graph starting
from leaf (moving from child to parents) and
for each traversed method m and each parent method pm of m
and each annotation position ppos in pm
p := declaration position of ppos
pos := position corresponding to ppos in method m
child := propagatedAnn[p], parent := ann[pp]
If (child is defined) then
If (parent is defined) then
ann[pp] := lat.unify(child, parent, p)
else propagatedAnn[pp] := child
If (p == RETURN_TYPE) then ann[pp] := child
10. PROPAGATION: CONFLICT RESOLUTION EXAMPLE (I)
public class XHierarchyAnnotatedMiddle {
public interface Top1 {
@NotNull
Object m(@Nullable Object x);
}
public interface Top2 {
@NotNull
Object m(@Nullable Object x);
}
public interface Middle extends Top1, Top2 {
@Nullable
Object m(Object x);
}
public interface Leaf1 extends Middle {
Object m(@NotNull Object x);
}
public interface Leaf2 extends Middle {
Object m(Object x);
}
}
11. PROPAGATION: CONFLICT RESOLUTION EXAMPLE (II)
public class XHierarchyAnnotatedMiddle {
public interface Top1 {
@Nullable
Object m(@NotNull Object x);
}
public interface Top2 {
@Nullable
Object m(@NotNull Object x);
}
public interface Middle extends Top1, Top2 {
@Nullable
Object m(Object x);
}
public interface Leaf1 extends Middle {
Object m(@NotNull Object x);
}
public interface Leaf2 extends Middle {
Object m(Object x);
}
}
12. PROPAGATION: PARAMETER UNIFICATION
Input
methods: set of methods
lat: annotation lattice
ann: annotations (to be updated)
descriptors := set of method descriptors found in methods
For each method descriptor desc in descriptors
descMethods := subset of methods with descriptor desc
For each parameter declaration position p in desc
paramAnn := set of all annotations from ann defined at such
position pos that its method is from descMethods and its
declaration position is p
If (paramAnn is not empty) then
unifiedAnnotation := lat.unify(paramAnn, p)
For each method m in descMethods
pos := annotation position of m corresponding to
declaration position p
ann[pos] := unifiedAnnotation
13. PROPAGATION: PARAMETER UNIFICATION EXAMPLE (I)
public class XHierarchy {
public interface Top1 {
Object m(Object x, Object y);
}
public interface Top2 {
Object m(@NotNull Object x, Object y);
}
public interface Middle extends Top1, Top2 {
Object m(@Nullable Object x, @Nullable Object y);
}
public interface Leaf1 extends Middle {
Object m(Object x, Object y);
}
public interface Leaf2 extends Middle {
Object m(Object x, @Nullable Object y);
}
}
14. PROPAGATION: PARAMETER UNIFICATION EXAMPLE (II)
public class XHierarchy {
public interface Top1 {
Object m(@NotNull Object x, @Nullable Object y);
}
public interface Top2 {
Object m(@NotNull Object x, @Nullable Object y);
}
public interface Middle extends Top1, Top2 {
Object m(@NotNull Object x, @Nullable Object y);
}
public interface Leaf1 extends Middle {
Object m(@NotNull Object x, @Nullable Object y);
}
public interface Leaf2 extends Middle {
Object m(@NotNull Object x, @Nullable Object y);
}
}
15. PROPAGATION: OVERRIDING RULES
Input
graph: method hierarchy graph
overrides: annotations specifying overriding rules
ann: annotations (to be updated)
For each method annotation ann at position opos in overrides
method := method corresponding to annotation position opos
Perform breadth-first traversal of method hierarchy graph starting
from method (moving from parent to children) and
for each traversed method m
pos := position corresponding to opos in method m
ann[pos] := overrides[opos]
16. PROPAGATION: OVERRIDING RULE EXAMPLE (I)
Rule: Top1.m(Object, Object) at 0 is NULLABLE
public class XHierarchy {
public interface Top1 {
Object m(@NotNull Object x, @Nullable Object y);
}
public interface Top2 {
Object m(@NotNull Object x, @Nullable Object y);
}
public interface Middle extends Top1, Top2 {
Object m(@NotNull Object x, @Nullable Object y);
}
public interface Leaf1 extends Middle {
Object m(@NotNull Object x, @Nullable Object y);
}
public interface Leaf2 extends Middle {
Object m(@NotNull Object x, @Nullable Object y);
}
}
17. PROPAGATION: OVERRIDING RULE EXAMPLE (II)
Rule: Top1.m(Object, Object) at 0 is NULLABLE
public class XHierarchy {
public interface Top1 {
Object m(@Nullable Object x, @Nullable Object y);
}
public interface Top2 {
Object m(@Nullable Object x, @Nullable Object y);
}
public interface Middle extends Top1, Top2 {
Object m(@Nullable Object x, @Nullable Object y);
}
public interface Leaf1 extends Middle {
Object m(@Nullable Object x, @Nullable Object y);
}
public interface Leaf2 extends Middle {
Object m(@Nullable Object x, @Nullable Object y);
}
}
18. CONFLICT PROCESSING
Input:
existingAnn: predefined annotations
inferredAnn: inferred annotations
lat: annotation lattice
excPositions: set of excluded annotation positions
Output:
conflicts: list of triples (position, existing annotation, inferred
annotation)
conflicts := empty list
positions := set of all positions in existingAnn
For each annotation position pos in positions
inferred := inferredAnn[pos], existing := existingAnn[pos]
p := declaration position corresponding to pos
If (existing does not subsume inferred at p) then
If (pos in excPositions) then inferredAnn[pos] := existing
else add (pos, existing, inferred) to conflicts
19. CONFLICT PROCESSING: EXAMPLE
public class XHierarchy {
public interface Top1 {
Object m(Object x, Object y);
}
public interface Top2 {
Object m(@Nullable @NotNull Object x, Object y);
}
public interface Middle extends Top1, Top2 {
@NotNull
@Nullable
Object m(@Nullable Object x, @Nullable Object y);
}
public interface Leaf1 extends Middle {
Object m(Object x, Object y);
}
public interface Leaf2 extends Middle {
Object m(Object x, @Nullable Object y);
}
}
20. CONTROL-FLOW GRAPH
Method control-flow graph describes transitions
between bytecode instructions
Each instruction and transition has corresponding
frame state which describes content of local
variables and stack
Interesting stack values correspond to method
parameters
Also each instruction has one outcome value
which reflects possible terminations of outgoing
control-flow paths:
ONLY_RETURNS
ONLY_THROWS
RETURNS_AND_THROWS
Instruction outcomes are computed on demand
21. COMPUTATION OF INSTRUCTION OUTCOMES
Outcome of given instruction srcInsn is computed
by depth-first traversal of all instructions reachable
from srcInsn and merging outcomes of all visited
termination instructions such that
Outcome of any *RETURN instruction is
ONLY_RETURNS
Outcome of ATHROW instruction is ONLY_THROWS
Traversal can be stopped earlier if
RETURNS_AND_THROWS outcome is produced
Outcomes are merged according to the rules:
a+a=a
a + b = RETURN_AND_THROWS if a != b
23. MUTABILITY INFERENCE
Input:
method: method to be analyzed
cfg: control-flow graph of method
ann: predefined annotations set
Output:
inferredAnn: inferred annotations set
mutabilityMap := empty map from values to mutability annotations
For each invocation instruction insn in cfg
If (insn is invocation of some method m) then
If (insn is mutating invocation of some method m) then
Mark each possible value of m’s receiver as MUTABLE
For each parameter param of m
pos := annotation position corresponding to param of m
If (ann[pos] is MUTABLE) then mark each possible value of
param as MUTABLE
For each value v in mutabilityMap which is parameter of method
pos := annotation position corresponding to v in method
ann[pos] := convert mutabilityMap[v] to annotation value
24. MUTABILITY INFERENCE: VALUE MARKING
Input
value: stack value
mutabilityMap : map from values to mutability annotations (to be
updated)
mutabilityMap[value] := MUTABLE
If (value is created by method invocation instruction insn and insn
propagates mutability)
m := method invoked by insn
Recursively mark each possible values of m’s receiver as
MUTABLE
25. NULLABILITY INFERENCE: NULLABILITY VALUES
Inference process assigns nullability to stack
values:
UNKNOWN: not enough information to infer nullability
NULLABLE
NOT_NULL
NULL
UNREACHABLE: contradicting nullabilities (value is not
realizable)
Nullability merge rules:
a+a=a
a + CONFLICT = CONFLICT + a = a
a + NULL = NULL + a = NULLABLE
a + NULLABLE = NULLABLE + a = NULLABLE
NOT_NULL + UNKNOWN = UNKWNON + NOT_NULL
= UNKNOWN
26. NULLABILITY INFERENCE: NULLABILITY MAPS
Nullability map is used to keep association between
stack values and nullability. In particular, nullability map
is computed for each instruction and transition in
control-flow graph of a method
Additional structures:
Set of method annotation position
Set of existing annotations (external or previously inferred)
Declaration index (used to look up fields and methods by their
descriptors in bytecode)
Optional frame state:
In case of transition-related map it’s a state AFTER originating
instruction
In case of instruction-related map it’s a merged state BEFORE the
instruction
Assuming state is defined if some value is present in map, but
absent in its state, it’s said to be unreachable
Set of spoiled values (i.e. values which are no longer
associated with parameters due to assignment)
27. NULLABILITY INFERENCE: NULLABILITY MAP LOOKUPS
Stored: m.getStored(v)
Return actual nullability previously stored in map, or UNKNOWN if
nullability is not defined
Full: m[v]
If (v is lost) then return CONFLICT
If (some nullability x was previously stored for value v) then retun
x
If (v is created by some instruction insn) then
If (insn is NEW, NEWARRAY, ANEWARRAY,
MULTIANEWARRAY, or LDC) then return NOT_NULL
If (insn is ACONST_NULL) then return NULL
If (insn is AALOAD) then return UNKNOWN
If (insn is GETFIELD or GETSTATIC) then return nullability
corresponding to the field annotation (or UNKNOWN if
undefined)
If (insn is INVOKE***) then return nullability corresponding to
return value of the invoked method (or UNKNOWN if
undefined)
If (v is interesting) then return nullability corresponding to existing
annotation at position encoded by v
If (v is null) then return NULL
If (v is primitive) then return CONFLICT
Otherwise return NOT_NULL
28. NULLABILITY INFERENCE: MERGING NULLABILITY MAPS
Input:
srcMaps: Set of nullability maps
Output:
mergedMap: merged nullability map
mergedValues: set of values which have different nullability in at
least two maps in srcMaps
mergedMap := new empty nullability map
mergedValues := new empty set
affectedValues := set of all stack values in srcMaps key sets
For each map m in srcMaps
Add all values from m.spoiledValues to mergedMap.spoiledValues
For each value v in affectedValues
If (v is already in mergedMap keys) then
If (mergedMap[v] != m[v]) then add v to mergedValues
mergedMap[v] := merge m[v] with mergedMap[v]
else mergedMap[v] := m[v]
If (v is lost in m and m.getStored(v) != NOT_NULL) then
Add v to mergedMap.spoiledValues
29. NULLABILITY INFERENCE: INFER FROM FIELD VALUE
Input:
field: field description
Output:
ann: nullability annotation
If (field is final and field type is not primitive and field initial
value is not null) then
ann := NOT_NULL
else
ann := UNKWNOWN
30. NULLABILITY INFERENCE: INFER FROM METHOD
Input:
method: method to be analyzed
cfg: control-flow graph of method
ann: predefined annotations set
Output:
inferredAnn: inferred annotations set
ovrMap := new empty nullability map
mergedMap := new empty nullability map
returnValueInfo := UNKNOWN
fieldInfo := new empty map from fields to nullability values
For each instruction insn in cfg
insnMap := compute nullability map for insn
If (insn is *RETURN) then
Process return instruction (insn, mergedMap, returnValueInfo)
If (insn is PUTFIELD or PUSTATIC) then
Process field write (insn, fieldInfo)
inferredAnn := create annotations (ovrMap, mergedMap,
returnValueInfo, fieldInfo)
31. NULLABILITY INFERENCE: PROCESS RETURNS
Input:
insn: instruction
mergedMap: nullability map (to be updated)
returnValueInfo: return value nullability (to be updated)
Merge insnMap to mergedMap
If (insn is ARETURN) then
For each possible return value v
retValue := if ovrMap contains v then ovrMap[v] else
insnMap[v]
Merge retValue to returnValueInfo
32. NULLABILITY INFERENCE: PROCESS FIELD WRITE
Input:
insn: instruction
fieldInfo: map from fields to nullability values (to be updated)
field := field mutated by insn
If (field has reference type and is final) then
nullability := Merge all possible nullabilities of new field value in
insn
If (fieldInfo contains key field) then
fieldInfo[field] := fieldInfo[field] merge nullability
else
fieldInfo[field] := nullability
33. NULLABILITY INFERENCE: CREATE ANNOTATIONS
Input:
ovrMap: override nullability map
mergedMap: merged instruction nullability map
returnValueInfo: return value nullability
fieldInfo: map from fields to nullability values
Output
ann: annotations set
ann := new empty annotations set
ann[return type position] := convert returnValueInfo to annotation
For each interesting value v in mergedMap.keySet
pos := annotation position corresponding to v
If (v in ovrMap.keySet) then
nullability := ovrMap.getStored(v)
else If (v in mergedMap.spoiledValues)
nullability := NULLABLE
else nullability := mergedMap.getStored(v)
ann[pos] := convert nullability to annotation
34. COMPUTE INSTRUCTION NULLABILITY MAP
Input:
ann: existing annotations set
insn: instruction
cfg: control-flow graph
ovrMap: overriding nullability map (to be updated)
Output:
insnMap: instruction nullability map
insnMap, mergedValues := merge maps from incoming edges of insn
inheritedValues := insnMap.keySet – mergedValues
Process dereferencing (ann, insn, insnMap, cfg, ovrMap)
If (insn is null check) then
Process null-branching (insn, insnMap, cfg, ovrMap)
Else If (insn is equality check preceded by instanceof) then
Process instanceof-branching (insn, insnMap, cfg, ovrMap)
Else for each outgoing transition e of insn
e.nullabilityMap := Copy of insnMap with state replaced with e’s
own frame state
35. PROCESS DEREFERENCING INSTRUCTION
Input:
ann: existing set of annotations
insn: instruction
insnMap: instruction nullability map (to be updated)
cfg: control-flow graph
ovrMap: overriding nullability map (to be updated)
If (insn is invocation of some method m) then
Mark each possible value of m’s receiver as NOT_NULL
For each parameter param of m
pos := annotation position corresponding to param of m
If (ann[pos] is NOT_NULL) then mark each possible value
of param as NOT_NULL
If (insn is GETFIELD, ARRAYLENGTH, ATHROW,
MONITORENTER, MONITOREXIT, *ALOAD, *ASTORE, or
PUTFIELD) then
Mark each possible value of insn receiver as NOT_NULL
36. PROCESS NULL-BRANCHING INSTRUCTION
Input:
insn: instruction
insnMap: instruction nullability map (to be updated)
cfg: control-flow graph
ovrMap: overriding nullability map (to be updated)
For nullable transition e
e.nullabilityMap := Copy of insnMap with state replaced with e’s
own frame state and nullability of condition subjects replaced
according to the rule:
If CONFLICT or NOT_NULL then CONFLICT, otherwise NULL
For non-nullable transition e
Similar to above, but replacement rule is
If CONFLICT or NULL then CONFLICT, otherwise NOT_NULL
For each remaining transition e
e.nullabilityMap := Copy of insnMap with state replaced with e’s
own frame state
If (outcome of nullable transition target is ONLY_THROWS) then
For each possible value v of condition subject
ovrMap[v] := NOT_NULL
37. PROCESS INSTANCEOF-BRANCHING INSTRUCTION
Input:
insn: instruction (IFEQ/IFNE) preceded by INSTANCEOF
insnMap: instruction nullability map (to be updated)
cfg: control-flow graph
ovrMap: overriding nullability map (to be updated)
For instance-of (non-nullable) transition e
e.nullabilityMap := Copy of insnMap with state replaced with e’s
own frame state and nullability of condition subjects replaced
according to the rule:
If CONFLICT or NULL then CONFLICT, otherwise NOT_NULL
For not-instance-of (nullable) transition e
Similar to above, but replacement rule is
If UNKNOWN then NULLABLE, otherwise do not change
For each remaining transition e
e.nullabilityMap := Copy of insnMap with state replaced with e’s
own frame state
38. NULLABILITY VALUE MARKING
Input
value: stack value
inheritedValues: set of inherited values
insnMap: instruction nullability map (to be updated)
ovrMap: overriding nullability map (to be updated)
If (insnMap.getStored(value) is neither CONFLICT, nor NULL)
insnMap[value] := NOT_NULL
If (value is interesting and
inheritedValues is empty and
value is not in insnMap.spoiledValues) then
ovrMap[value] := NOT_NULL