160 likes | 180 Views
Explore Automated Object-Oriented software development methods, trace semantics, and code generation in Concurrent Class Machines for optimized code. Bridging object-oriented and formal methods for system development.
E N D
Automated Software Engineering with Concurrent Class Machines Radu Grosu SUNY at Stony Brook joint work with Y. Liu, S. Smolka, S.Stoller, J. Yan SUNY at Stony Brook
Motivation (ASE) • Automated OO software development method: • OO language forreq.specification/modeling/implem, • transition semantics capturing OO constructs, • trace semantics supporting compositional refinement, • analysis exploiting OO structure, • generation of optimized (and monitored) code. • Close the gap between: • object oriented methods(UML,OMT,…), • formal methods(Model Checking, Static Analysis,…).
Concurrent Class Machines (CCM) • Modeling language for concurrent OO systems • classes, inheritance, objects, object creation • methods, exceptions, multithreading, • abstract collection types, nondeterminism. • 2.Observational trace semantics • class machine refinement, • modular reasoning. • 3. Code generation and analysis • prototype code generation. • exploits the hierarchy information (in progress),
Readers/Writers Problem RdCap Thread Resource Class Diagram res m Monitor 1 * 1 m * Client WrCap
Classes res: Resource; -free: boolean; ar: int; +Monitor(r:Resource) +acqRd(): void +acqWr(): void +relRd(): void +relWr(): void attributes Monitor Call entry point return exit point methods Method signature
res: Resource; -free: boolean; ar: int; +Monitor(r:Resource) +acqRd() free | ar > 0 -> free := false; ar := ar+1 +acqWr() +relRd() +relWr() Transitions Monitor transition (atomic) guard (blocking) assignments (parallel) method can be declared atomic
Call Hierarchy (Boxes) -m: Monitor; -inCS: boolean; +RdCap(m:Monitor) +acq():void throws MonExc +rel():void throws MonExc new MonExc +read():int throws MonExc v: int;e:MonExc v inCs e ! inCS e v m.res.read() RdCap local variables return expression choice point (nondeterminism) return variable method invocation box object creation box exception exit point
Concurrency c.start c c new Client(m) new Client(m) Client extends Thread -m: Monitor +main(): void r: Resource; c: Client new Resource r m c.start new Monitor(r) +run(): void thread start box thread run method
Operational Semantics Ctrl Stack Ctrl Stack Frame Stack Frame Stack Ctrl Stack Ctrl Stack Frame Stack Frame Stack ni f’0k0 fiki ni fiki f0k0 n0 n’0 f0k0-1 fiki-1 biki fiki-1 f0k0-1 biki b0k0 b0k0 … … … … … … t0 … … … … bi1 f00 fi0 fi0 f00 bi1 b01 b01 t0:Thread t0:Thread ti:Thread ti:Thread … … Attr’t0 Attrt0 … … Attrti Attrti Object Pool Object Pool Transition system A* = (S, s0, )
Method Invocation Box Ctrl Stack Frame Stack b.c f … … r.read() RResource Resource +read(): int +read(): int Client -m: Monitor +run(): int r: Resource; i: int i b v v
Method Invocation Box (Call) Ctrl Stack Frame Stack b.c f … … r.read() RResource Resource c fb +read(): int +read(): int b f … … Ctrl Stack Frame Stack Client -m: Monitor +run(): int r: Resource; i: int i b v v
Method Invocation Box (Return) Ctrl Stack Frame Stack b.r f[v/i] … … r.read() RResource Resource r fb +read(): int +read(): int b f … … Ctrl Stack Frame Stack Client -m: Monitor +run(): int r: Resource; i: int i b v v
Environment (Interface) Objects Client Ctrl Stack Frame Stack -m: Monitor b.r f[v/i] +run(): int r: Resource; i: int … … i r.read() b Resource v +read(): int Static vars, streams… Allow compositional modeling & reasoning: • Their body is not known and not part of • Allow any update of public objects. The latter are • determined via an escape analysis.
Denotational Semantics • Execution of CCM m • s0-> s1-> s2->… -> sn • si-> si+1 is a CCM transition in or • si-> si+1 is an environment transition. • Set of Traces Lm of m • Projection of executions on global variables. • Object escape analysisis necessary. • Refinement m < n • Inclusion of the sets of tracesLm Ln • Compositionalw.r.t.beh/arch hierarchies.
Modular Reasoning M M’ = < lfp N N M < N M M’ M’ < N M Fixpoint induction < N’ N N’ N < N N < M M’ M M Sub-CCM refinement Super-CCM refinement
Wrap Up • Modeling language for concurrent OO systems • classes, inheritance, objects, object creation • methods, exceptions, multithreading, • abstract collection types, nondeterminism. • 2.Observational trace semantics • class machine refinement, • modular reasoning. • 3. Code generation and analysis • prototype code generation. • exploits the hierarchy information (in progress),