parameterized regular expressions in JavaMOP CS 119 which file? - - PowerPoint PPT Presentation

parameterized regular expressions in javamop
SMART_READER_LITE
LIVE PREVIEW

parameterized regular expressions in JavaMOP CS 119 which file? - - PowerPoint PPT Presentation

parameterized regular expressions in JavaMOP CS 119 which file? http://fsl.cs.uiuc.edu/index.php/Monitoring-Oriented_Programming 2 What is MOP? (their own words) Framework for reliable software development Monitoring is basic


slide-1
SLIDE 1

parameterized regular expressions in JavaMOP

CS 119

“which file?”

slide-2
SLIDE 2

2

http://fsl.cs.uiuc.edu/index.php/Monitoring-Oriented_Programming

slide-3
SLIDE 3

3

What is MOP? (their own words)

  • Framework for reliable software development

– Monitoring is basic design discipline

  • … rather than “add on” grafted onto existing code

– Recovery allowed and encouraged – Provides to programmers and hides under the hood a large body of formal methods knowledge/techniques

  • Monitor synthesis algorithms

– Generic for different languages and application domains

slide-4
SLIDE 4

4

MOP Approach to Monitoring

Keep the following distinct and generic:

  • specification formalisms
  • event definitions
  • validation handlers
slide-5
SLIDE 5

5

MOP Monitoring Oriented Programming

  • Same idea as design by contract: specifications are written as

comments in code. Monitors are generated from specs.

  • Philosophy: no silver-bullet logic for specs
  • MOP logic plugins (a subset):

– ERE (extended regular expressions) – CFG (context free grammars) – PtLTL (Past-time LTL) and FtLTL (Future-time LTL) – JML (fragment of Java modeling language) – ATL (Allen temporal logic) – Jass (The CSP Process algebra)

  • Generic wrt. parameters

– Provide a plugin for a propositional logic, and MOP does the rest

  • wrt. data parameterization.

– Makes designing a new logic extremely easy compared to other frameworks.

slide-6
SLIDE 6

6 ERE LTL ptLTL ptCaRet logic plugins

… …

JavaMOP BusMOP

MOP

CFG languages

Instances of MOP

MOP JavaMOP BusMOP HardwareMOP …

today

slide-7
SLIDE 7

7

JavaMOP Operation

JavaMOP AspectJ

under the hood

slide-8
SLIDE 8

8

properties of Java library APIs properties of Java library APIs

R1: There should be no two calls to next() without a call to hasNext() in between,

  • n the same iterator.
slide-9
SLIDE 9

9

Iterator

next next i) suffix suffix trace semantics ii)looking for validation

slide-10
SLIDE 10

1 0

/*@ partial scope = global logic = ERE HasNext { event hasnext : end(call(* Iterator.hasNext())); event next : begin(call(* Iterator.next())); formula : next next } validation handler{ System.err.println("*** call hasNext() before next()"); } @*/

Property in Property in JavaMOP avaMOP

check trace suffix track all events logic to be used events formula to be checked code to be executed if formula becomes validated

PROPOSITIONAL!

slide-11
SLIDE 11

1 1

class class Test { public public static tatic void

  • id main(String[] args) {

Vector<Integer> v1 = new ew Vector(); Vector<Integer> v2 = new ew Vector(); v1.add(1); v1.add(3); v2.add(5); v2.add(7); Iterator it1 = v1.iterator(); Iterator it2 = v2.iterator(); int int sum = 0; if if(it1.hasNext()) sum += (Integer)it2.next(); if if(it1.hasNext()) sum += (Integer)it2.next(); System.out.println(”sum(v2) = " + sum); } } should have been: if if(it2 it2.hasNext())

The propositional property The propositional property does

  • es

not not flag flag the following error he following error

execution emits: hasNext() next() hasNext() next() spec “next next” does not match and hence no error detected unguarded calls: it2 it2.next()

)

slide-12
SLIDE 12

1 2

Improved Property in Improved Property in JavaMOP avaMOP

centralized tracking

  • f values. We will

get to this

PARAMETERIZED!

/*@ partial centralized scope = global logic = ERE HasNext(Iterator i) { event hasnext<i> : end(call(* i.hasNext())); event next<i> : begin(call(* i.next())); formula : next next } validation handler{ System.err.println("*** call hasNext() before next()"); } @*/ parameterized with iterator events refer to parameter this causes the handler to be invoked

slide-13
SLIDE 13

1 3

DEMO ON SLIDES

slide-14
SLIDE 14

1 4

slide-15
SLIDE 15

1 5

slide-16
SLIDE 16

1 6

slide-17
SLIDE 17

1 7

slide-18
SLIDE 18

1 8

slide-19
SLIDE 19

1 9

slide-20
SLIDE 20

2 0

slide-21
SLIDE 21

2 1

slide-22
SLIDE 22

2 2

slide-23
SLIDE 23

2 3

slide-24
SLIDE 24

2 4

slide-25
SLIDE 25

2 5

slide-26
SLIDE 26

2 6

END OF DEMO ON SLIDES

slide-27
SLIDE 27

2 7

data values

  • handling of data values efficiently in

monitoring frameworks is one of the current research challenges.

  • different frameworks approach it

differently, achieving different expressiveness and efficiency.

slide-28
SLIDE 28

2 8

in this simple case: store monitor in iterator

v1 v2 it1 it2 it1 it2 associate a monitor with each object of interest class class Test { public public static tatic void

  • id main(String[] args) {

Vector<Integer> v1 = new ew Vector(); Vector<Integer> v2 = new ew Vector(); v1.add(1); v1.add(3); v2.add(5); v2.add(7); Iterator it1 = v1.iterator(); Iterator it2 = v2.iterator(); int int sum = 0; if if(it1.hasNext()) sum += (Integer)it2.next(); if if(it1.hasNext()) sum += (Integer)it2.next(); System.out.println(”sum(v2) = " + sum); } }

  • nly objects
  • f interest
  • ur program again
slide-29
SLIDE 29

2 9

algorithm

  • assume a property only mentions one kind of object (an iterator

in this case).

  • note, there could be many objects monitored (it1,it2).
  • ne can piggy-back a monitor on each object that is monitored.
  • alternatively: keep a map from objects to their monitors.
  • when an operation of interest occurs (hasNext() or next()) that

refers to an object, the monitor of that object is “executed”. If null, a monitor is first created.

Piggy-back (transportation), something that is riding

  • n the back of something else

i1 i2 associate a monitor with each object of interest

slide-30
SLIDE 30

3 0

algorithm pseudo-code

if (it.monitor == null) it.monitor = new Monitor(); it.monitor.next(); Consider a call of it.next() for

  • example. This could lead to the

following monitoring code:

however, this does not work when property refers to more than 1 object, where to store the monitor?

not to mention that the java library cannot be instrumented easily.

slide-31
SLIDE 31

3 1

properties of Java library APIs properties of Java library APIs

R2: An enumeration should not be propagated after the underlying vector has been changed.

slide-32
SLIDE 32

3 2

create next* updatesource updatesource* next

R2: An enumeration should not be propagated after the underlying vector has been changed.

suffix validation now the property must refer to more than one object: a vector and an enumerator

Piggy-back no longer works. There is not a 1-1 correspondence between objects and monitors

slide-33
SLIDE 33

3 3

Vector v1 = new ew Vector(); Vector v2 = new ew Vector(); v1.add(1); v1.add(2); v2.add(4); v2.add(5); Enumeration e1 = v1.elements(); Enumeration e2 = v1.elements(); Enumeration e3 = v2.elements(); while while(e1.hasMoreElements())print(e1.nextElement()); v1.add(99); while while(e2.hasMoreElements())print(e2.nextElement()); while while(e3.hasMoreElements())print(e3.nextElement());

many vectors and enumerators

v1 v2 e1 e2 e3 create(v,e) next(e) updatesource(v) events: add next 8 (v,e) 2 { (v1,e1),(v1,e2),(v2,e3) } create(v,e) next(e)* updatesource(v)+ next(e) catch this pattern

slide-34
SLIDE 34

3 4

/*@ partial centralized scope = global logic = ERE SafeEnum (Vector v, Enumeration+ e) { event create<e, v> : end(call(Enumeration v.elements())) with (e); event updatesource<v> : end(call(* v.add*(..))) \/ end(call(* v.clear())) \/ end(call(* v.insertElementAt(..))) && \/ end(call(* v.remove*(..))) \/ end(call(* v.retainAll(..))) \/ end(call(* v.set*(..))); event next<e> : begin(call(Object e.nextElement())); formula : create next* updatesource updatesource* next } validation handler { System.out.println("datasource changed during iteration!"); } @*/

specification

slide-35
SLIDE 35

3 5

  • The problem: how to monitor a universally

quantified specification efficiently!

create<v,e> udatesource<v> next<e> create next* updatesource+ next

(∀ v,e) ϕ

MOP’s distinguished feature: separate handling of values

slide-36
SLIDE 36

3 6

two approaches to data

  • Eagle, PQL, PTQL, Tracematches, … :

– Choose a quantified logic – Device monitor synthesizer for it:

  • MOP:

– only knows how to generate monitors for ϕ – The (∀p) is dealt with separately, and once-and-for-all, for all logics

(∀p) ϕ Mon(∀p) ϕ (∀p) ϕ p ! Monϕ

slide-37
SLIDE 37

3 7

handling of data values

  • value embedding scheme : the values become part of the monitors

(state machines), for example by labeling transitions. This means modifying the state machine concept.

  • value indexing scheme : Keep automata atomic and index them with

data

– If one object per property max:

  • Map objects to monitors
  • Or piggyback monitor on object

– If more than one object per property:

  • Centralized index table from data to monitors
  • Perhaps combination of piggybacking and centralized index table

i=i1

i1 i2

slide-38
SLIDE 38

3 8

MOP’s propositional monitors

<v1,e1>

<v1,e2>

<v2,e3>

  • ne propositional

monitor instance per parameter instance

slide-39
SLIDE 39

3 9

MOP’s propositional monitors

<v1,e1>

<v1,e2>

<v2,e3>

The problem: The problem: how can one retrieve all needed monitor instances efficiently? updatesource<v1>

Naïve implementation Very inefficient

slide-40
SLIDE 40

4 0

Vector v1 = new Vector(); Vector v2 = new Vector(); v1.add(1); v1.add(2); v2.add(4); v2.add(5); Enumeration e1 = v1.elements(); Enumeration e2 = v1.elements(); Enumeration e3 = v2.elements(); while(e1.hasMoreElements())print(e1.nextElement()); v1.add(99); while(e2.hasMoreElements())print(e2.nextElement()); while(e3.hasMoreElements())print(e3.nextElement());

Naïve implementation

slide-41
SLIDE 41

4 1

Vector v1 = new Vector(); Vector v2 = new Vector(); v1.add(1); v1.add(2); v2.add(4); v2.add(5); Enumeration e1 = v1.elements(); Enumeration e2 = v1.elements(); Enumeration e3 = v2.elements(); while(e1.hasMoreElements())print(e1.nextElement()); v1.add(99); while(e2.hasMoreElements())print(e2.nextElement()); while(e3.hasMoreElements())print(e3.nextElement());

create next update next update

<v1,e1>

Naïve implementation

slide-42
SLIDE 42

4 2

Vector v1 = new Vector(); Vector v2 = new Vector(); v1.add(1); v1.add(2); v2.add(4); v2.add(5); Enumeration e1 = v1.elements(); Enumeration e2 = v1.elements(); Enumeration e3 = v2.elements(); while(e1.hasMoreElements())print(e1.nextElement()); v1.add(99); while(e2.hasMoreElements())print(e2.nextElement()); while(e3.hasMoreElements())print(e3.nextElement());

create next update next update

<v1,e1>

Naïve implementation

slide-43
SLIDE 43

4 3

Vector v1 = new Vector(); Vector v2 = new Vector(); v1.add(1); v1.add(2); v2.add(4); v2.add(5); Enumeration e1 = v1.elements(); Enumeration e2 = v1.elements(); Enumeration e3 = v2.elements(); while(e1.hasMoreElements())print(e1.nextElement()); v1.add(99); while(e2.hasMoreElements())print(e2.nextElement()); while(e3.hasMoreElements())print(e3.nextElement());

create next update next update

<v1,e1>

create next update next update

<v1,e2>

Naïve implementation

slide-44
SLIDE 44

4 4

Vector v1 = new Vector(); Vector v2 = new Vector(); v1.add(1); v1.add(2); v2.add(4); v2.add(5); Enumeration e1 = v1.elements(); Enumeration e2 = v1.elements(); Enumeration e3 = v2.elements(); while(e1.hasMoreElements())print(e1.nextElement()); v1.add(99); while(e2.hasMoreElements())print(e2.nextElement()); while(e3.hasMoreElements())print(e3.nextElement());

create next update next update

<v1,e1>

create next update next update

<v1,e2>

create next update next update

<v2,e3>

Naïve implementation

slide-45
SLIDE 45

4 5

Vector v1 = new Vector(); Vector v2 = new Vector(); v1.add(1); v1.add(2); v2.add(4); v2.add(5); Enumeration e1 = v1.elements(); Enumeration e2 = v1.elements(); Enumeration e3 = v2.elements(); while(e1.hasMoreElements())print(e1.nextElement() ()); v1.add(99); while(e2.hasMoreElements())print(e2.nextElement()); while(e3.hasMoreElements())print(e3.nextElement());

create next update next update

<v1,e1>

create next update next update

<v1,e2>

create next update next update

<v2,e3>

Naïve implementation

slide-46
SLIDE 46

4 6

Vector v1 = new Vector(); Vector v2 = new Vector(); v1.add(1); v1.add(2); v2.add(4); v2.add(5); Enumeration e1 = v1.elements(); Enumeration e2 = v1.elements(); Enumeration e3 = v2.elements(); while(e1.hasMoreElements())print(e1.nextElement()); v1.add(99); while(e2.hasMoreElements())print(e2.nextElement()); while(e3.hasMoreElements())print(e3.nextElement());

create next update next update

<v1,e1>

create next update next update

<v1,e2>

create next update next update

<v2,e3>

Naïve implementation

slide-47
SLIDE 47

4 7

Vector v1 = new Vector(); Vector v2 = new Vector(); v1.add(1); v1.add(2); v2.add(4); v2.add(5); Enumeration e1 = v1.elements(); Enumeration e2 = v1.elements(); Enumeration e3 = v2.elements(); while(e1.hasMoreElements())print(e1.nextElement()); v1.add(99); while(e2.hasMoreElements())print(e2.nextElement() ()); while(e3.hasMoreElements())print(e3.nextElement());

create next update next update

<v1,e1>

create next update next update

<v1,e2>

create next update next update

<v2,e3> match inefficient search for monitors update<v1>

Naïve implementation

slide-48
SLIDE 48

4 8 create next update next update create next update next update create next update next update

Vector v1 = new Vector(); Vector v2 = new Vector(); v1.add(1); v1.add(2); v2.add(4); v2.add(5); Enumeration e1 = v1.elements(); Enumeration e2 = v1.elements(); Enumeration e3 = v2.elements(); while(e1.hasMoreElements())print(e1.nextElement()); v1.add(99); while(e2.hasMoreElements())print(e2.nextElement()); while(e3.hasMoreElements())print(e3.nextElement());

<v,e> v1 v2 e1 e2 e3 <v> <e> e1 e2 e3 v1 v2

create next update

events: events: create<v,e> update<v> next<e> monitor creation event One index per parameter set. Weak references.

Indexed implementation

slide-49
SLIDE 49

4 9

Vector v1 = new Vector(); Vector v2 = new Vector(); v1.add(1); v1.add(2); v2.add(4); v2.add(5); Enumeration e1 = v1.elements(); Enumeration e2 = v1.elements(); Enumeration e3 = v2.elements(); while(e1.hasMoreElements())print(e1.nextElement()); v1.add(99); while(e2.hasMoreElements())print(e2.nextElement()); while(e3.hasMoreElements())print(e3.nextElement());

Indexed implementation

slide-50
SLIDE 50

5 0 create next update next update

Vector v1 = new Vector(); Vector v2 = new Vector(); v1.add(1); v1.add(2); v2.add(4); v2.add(5); Enumeration e1 = v1.elements(); Enumeration e2 = v1.elements(); Enumeration e3 = v2.elements(); while(e1.hasMoreElements())print(e1.nextElement()); v1.add(99); while(e2.hasMoreElements())print(e2.nextElement()); while(e3.hasMoreElements())print(e3.nextElement());

<v,e> v1 e1

create

<v>

update

v1 <e> e1

next

Indexed implementation

slide-51
SLIDE 51

5 1 create next update next update

Vector v1 = new Vector(); Vector v2 = new Vector(); v1.add(1); v1.add(2); v2.add(4); v2.add(5); Enumeration e1 = v1.elements(); Enumeration e2 = v1.elements(); Enumeration e3 = v2.elements(); while(e1.hasMoreElements())print(e1.nextElement()); v1.add(99); while(e2.hasMoreElements())print(e2.nextElement()); while(e3.hasMoreElements())print(e3.nextElement());

<v,e> v1 e1

create

<v>

update

v1 <e> e1

next create next update next update

e2 e2

Indexed implementation

slide-52
SLIDE 52

5 2 create next update next update create next update next update create next update next update

Vector v1 = new Vector(); Vector v2 = new Vector(); v1.add(1); v1.add(2); v2.add(4); v2.add(5); Enumeration e1 = v1.elements(); Enumeration e2 = v1.elements(); Enumeration e3 = v2.elements(); while(e1.hasMoreElements())print(e1.nextElement()); v1.add(99); while(e2.hasMoreElements())print(e2.nextElement()); while(e3.hasMoreElements())print(e3.nextElement());

<v,e> v1 v2 e1 e2 e3 <v> <e> e1 e2 e3 v1 v2

create next update

Indexed implementation

slide-53
SLIDE 53

5 3 create next update next update create next update next update create next update next update

Vector v1 = new Vector(); Vector v2 = new Vector(); v1.add(1); v1.add(2); v2.add(4); v2.add(5); Enumeration e1 = v1.elements(); Enumeration e2 = v1.elements(); Enumeration e3 = v2.elements(); while(e1.hasMoreElements())print(e1.nextElement() ()); v1.add(99); while(e2.hasMoreElements())print(e2.nextElement()); while(e3.hasMoreElements())print(e3.nextElement());

<v,e> v1 v2 e1 e2 e3 <v> <e> e1 e2 e3 v1 v2

create next update

Indexed implementation

slide-54
SLIDE 54

5 4 create next update next update create next update next update create next update next update

Vector v1 = new Vector(); Vector v2 = new Vector(); v1.add(1); v1.add(2); v2.add(4); v2.add(5); Enumeration e1 = v1.elements(); Enumeration e2 = v1.elements(); Enumeration e3 = v2.elements(); while(e1.hasMoreElements())print(e1.nextElement()); v1.add(99); while(e2.hasMoreElements())print(e2.nextElement()); while(e3.hasMoreElements())print(e3.nextElement());

<v,e> v1 v2 e1 e2 e3 <v> <e> e1 e2 e3 v1 v2

create next update

Indexed implementation

slide-55
SLIDE 55

5 5 create next update next update create next update next update create next update next update

Vector v1 = new Vector(); Vector v2 = new Vector(); v1.add(1); v1.add(2); v2.add(4); v2.add(5); Enumeration e1 = v1.elements(); Enumeration e2 = v1.elements(); Enumeration e3 = v2.elements(); while(e1.hasMoreElements())print(e1.nextElement()); v1.add(99); while(e2.hasMoreElements())print(e2.nextElement() ()); while(e3.hasMoreElements())print(e3.nextElement());

<v,e> v1 v2 e1 e2 e3 <v> <e> e1 e2 e3 v1 v2

create next update

match! match!

Indexed implementation

slide-56
SLIDE 56

5 6 create next update next update create next update next update create next update next update

Vector v1 = new Vector(); Vector v2 = new Vector(); v1.add(1); v1.add(2); v2.add(4); v2.add(5); Enumeration e1 = v1.elements(); Enumeration e2 = v1.elements(); Enumeration e3 = v2.elements(); while(e1.hasMoreElements())print(e1.nextElement()); v1.add(99); while(e2.hasMoreElements())print(e2.nextElement()); while(e3.hasMoreElements())print(e3.nextElement());

e1 e2 e3 e1 events: events: create<v,e> update<v> next<e> monitor creation event decentralized: decentralized: storing first index in objects v1 e2 e3 v2

slide-57
SLIDE 57

5 7

aspect for centralized solution

slide-58
SLIDE 58

5 8

aspect for decentralized solution

slide-59
SLIDE 59

5 9

properties of Java library APIs properties of Java library APIs

R3: An collection should not be modified while it is a member of a hashset (don’t change the hashcode).

slide-60
SLIDE 60

6 0

add modify

suffix validation

R3: An collection should not be modified while it is a member of a hashset (don’t change the hashcode).

add collection to hashset remove collection from hashset modify collection

note: without having seen a remove

{…}

coll add remove modify hashset

  • f
slide-61
SLIDE 61

6 1

HashSet s = new ew HashSet(); Collection c = new ew ArrayList(); c.add("this is ok"); s.add(c); System.out.println(s.contains(c)); c.add("this is not ok"); System.out.println(s.contains(c)); adding collection to hash set and then updating it

bad update changing hashcode of collection c subsequently s.contains(c) yields false

slide-62
SLIDE 62

6 2

/*@ partial centralized scope = global logic = ERE HashSet (HashSet t, Collection+ c){ event put <t, c> : end(call(* t.add(c))); event remove <t, c>: end(call(* t.remove(c))); event modify <c> : begin(call(* c.add(..))) \/ begin(call(* c.addAll(..))) \/ begin(call(* c.remove(..))) \/ begin(call(* c.removeAll(..))); formula : put modify } validation handler { System.out.println("collection updated while in hashset"); } @*/

specification 1 : hashset of collections

watch out. should be: … add(Object) … remove(Object) will not work

slide-63
SLIDE 63

6 3

/*@ partial centralized scope = global logic = ERE HashSet (HashSet t, Object o){ [int hashcode=0;] event put <t, o> : end(call(* t.add(o))) {hashcode = o.hashCode();}; event remove <t, o>: end(call(* t.remove(o))); event contains <t, o> : begin(call(* t.contains(o))); formula : put contains contains* } validation handler { if (@MONITOR.hashcode != o.hashCode()) System.out.println("HashCode changed"); } @*/

specification 2 : hashset of any objects

local variable tested in handler updated on put events

slide-64
SLIDE 64

6 4 R4: If a Reader is created on top of an Inputstream, none of the two may be read from if one (even the other) is closed.

slide-65
SLIDE 65

6 5

try try{ InputStream i = new ew StringBufferInputStream("AB"); InputStreamReader r = new ew InputStreamReader(i); System.out.println((char har)r.read()); r.close(); System.out.println((char har)i.read() .read()); } catch catch(IOException e) { System.out.println("*** io error"); } closing down reader reading inputstream

something one should not do:

  • create reader from input stream,
  • close down reader,
  • continue reading from inputstream
  • utput:

A ?

slide-66
SLIDE 66

6 6

/*@ partial centralized scope = global logic = ERE ClosedReaderI(Reader+ r, InputStream+ s) { event create<r, s> : end(call(Reader+.new(s, ..))) with(r); event closeS<s> : end(call(* s.close())); event closeR<r> : end(call(* r.close())); event readS<s> : begin(call(* s.read*(..))); event readR<r> : begin(call(* r.read*(..))); formula : create (readS + readR)* (closeS + closeR) (readS + readR) } validation handler{ System.out.println("one input source has been closed"); } @*/

specification

  • utput:

A

  • ne input source has been closed

?

slide-67
SLIDE 67

6 7

/*@ centralized scope = global logic = ERE ClosedReaderI(Reader+ r, InputStream+ s) { [static int createcount=0; int readcount = 0;] event create<r, s> : end(call(Reader+.new(s, ..))) with(r) {createcount++;}; event closeS<s> : end(call(* s.close())); event closeR<r> : end(call(* r.close())); event readS<s> : begin(call(* s.read*(..))); event readR<r> : begin(call(* r.read*(..))) {readcount++;}; formula : (create readR* ((closeS closeR)+(closeR closeS)))* } violation handler{ System.out.println("pattern " + @MONITOR.createcount + " violated after reading " + @MONITOR.readcount); } @*/

specification on total trace + profiling

counters: one static, common for all monitors and one for each monitor no longer partial property over total trace. we require

  • nly read by

Reader. reference to monitor contents

slide-68
SLIDE 68

6 8

<Specification> ::= /*@ <Header> <Body> <Handlers> @*/ <Header> ::= <Attribute>*[scope =<Scope>][logic =<Logic>] <Attribute> ::= static | outline | offline | centralized | partial <Scope> ::= global | class [(<Name>)] | interface | method <Logic> ::= ERE | CFG | PTLTL | FTLTL | JML | RAW | … <Body> ::= [<Name>][(<Parameters>)]{<LogicBody>} <Parameters> ::= ( <Type> <Identifier>)+ <LogicBody> ::= [[<VarDeclaration>]]<Event>* [<Formula>] <Event> ::= <EventHeader>:<EventDecl> [{<Statement>}]; <EventHeader> ::= event<Identifier>[<<Parameters>>] <EventDecl> ::= <EventPoint>[with(<Type> <Name>)][ && <BExp>] <EventPoint> ::= (begin | end)(<EventPattern>) <EventPattern> ::= (call|exec)(<Method>) | update(<Field>) <Formula> ::= formula : <Formula> <Handlers> ::= [<ViolationHandler>] [<ValidationHandler>] <ViolationHandler> ::= validation handler {<Statements>} <ValidationHandler> ::= validation handler {<Statements>} <Formula> ::= empty | epsilon | a | ~ <Formula> | <Formula> * | <Formula> <Formula> | <Formula> + <Formula> | <Formula> & <Formula> ERE syntax generic syntax

slide-69
SLIDE 69

6 9

MOP: Evaluation

  • More than 100 program-property pairs

– Dacapo benchmark, Tracematches benchmark, Eclipse, …

  • Overhead < 8% in most cases; close to hand-optimized

4.5 2.2 1.7 1.5 2.8 0.0 6.5 4.7 5.4 6.7 4.4 3.5 xalan 0.0 0.0 8.0 5.4 13.7 25.4 0.0 0.0 11.3 44.8 0.0 0.0 pmd 0.1 0.0 0.6 1.1 0.0 0.3 0.0 0.0 0.0 0.0 0.0 0.5 lusearch 1.1 1.7 2.2 3.2 0.0 0.3 1.8 1.2 0.5 1.9 0.2 1.6 luindex 0.2 0.4 2.3 0.0 0.6 0.0 0.3 0.2 0.5 0.8 0.0 0.6 jython 0.0 0.0 1.4 1.4 0.0 0.8 2.1 0.0 1.2 0.9 0.0 3.3 hsqldb 0.0 0.0 1.0 0.5 1.5 0.8 0.0 0.0 0.0 1.5 0.6 1.2 fop 2.4 2.2 3.1 3.0 1.5 3.8 0.5 3.7 1.4 0.0 2.8 4.1 eclipse 0.0 0.0 0.0 0.5 0.0 0.0 4.8 3.6 0.0 0.0 0.0 0.0 chart 0.0 5.8 0.0 0.0 0.0 0.4 1.1 0.0 0.0 0.0 1.5 0.0 antlr ClosedReader LeakingSync HasNext HashMap SafeIterator SafeEnum

Overhead in % MOP monitors VS. hand-optimized monitors

slide-70
SLIDE 70

7 0

MOP: Evaluation (cont.)

  • Even significantly faster than logic specific solutions

N/A 63.5 20.2 11.1 51.2K ABC Reweave N/A 124.3 23.9 21.2 438.7K Aprove HashSet N/A 15.2 3.3 3.3 9.9K Weka Hashtable N/A 452 232 210 1.4K CerRevSim NullTrack 7084 1509 136 0.1 9.5K jHotDraw SafeEnum 2193 354 6.6 21.1K ajHotDraw Listener PQL Tracematches MOP Hand Optimized LOC Program Property

Results for Tracematches benchmarks, Overhead in %

slide-71
SLIDE 71

7 1

Limitations of the Current Implementation of JavaMOP

  • No nested or existential parameters
  • Monitor creating events must contain all the

parameters of the specification

  • No support for real-time
slide-72
SLIDE 72

7 2

end