163 research outputs found

    Towards Trustworthy Refactoring in Erlang

    Get PDF
    Tool-assisted refactoring transformations must be trustworthy if programmers are to be confident in applying them on arbitrarily extensive and complex code in order to improve style or efficiency. We propose a simple, high-level but rigorous, notation for defining refactoring transformations in Erlang, and show that this notation provides an extensible, verifiable and executable specification language for refactoring. To demonstrate the applicability of our approach, we show how to define and verify a number of example refactorings in the system.Comment: In Proceedings VPT 2016, arXiv:1607.0183

    Adat és kiértékelési függőségi elemzés funkcionális nyelvekre-Erlang programok statikus elemzése

    Get PDF
    A szoftverfejlesztést támogató eszközök jelentősége rohamosan nő az utóbbi évtizedekben. A forráskódok mérete akkorára nő, hogy humán erővel átlátni szinte lehetetlen, de legalábbis nehézkes és időigényes folyamat. Így egyre inkább elterjednek azok az eszközök, melyek a kód megértést, karbantartást, hibakeresést támogatnak vagy éppen lehetőséget nyújtanak a forráskód különböző szempontok szerinti refaktorálására. Ez a támogatás történhet dinamikusan, azaz futási időben, illetve statikusan, azaz fordı́tási időben. Előbbi esetben a már futó szoftver monitorozásával, esetlegesen a kód instrumentálásával nyerhetünk ki információt és segı́thetjük ezzel a fejlesztőket. Utóbbi esetben viszont nincs szükség a szoftver futtatására, csupán a forráskód alapján gyűjtünk információt és használjuk fel különböző célokra. Dolgozatomban ez utóbbi módszerrel, a forráskódok statikus elemzésével foglalkoztam, Erlang nyelvhez. Definiáltam Erlang programok elsőrendű adatfolyam-gráfját, és az ezen a gráfon értelmezett elsőrendű adatfolyam relációt. A RefactorErl keretrendszer alap eszközkészletéhez igazı́tva megadtam az ehhez tartozó algoritmusokat. Erlang programok adatfolyam-gráfját ı́gy inkrementálisan fel tudjuk épı́teni a forráskódok változásának figyelembe vételével. A adatfolyam reláció segı́tségével pedig választ kaphatunk olyan kérdésekre, hogy mi lehet a program egy adott pontján lévő kifejezésének az értéke, illetve hogy egy adott érték milyen programpontokra juthat el. A reláció interprocedurálisan számı́tható és figyelembe veszi a hı́vási kontextust. Az adatfolyam relációt felhasználásával megadtam, hogyan számı́tható ki az aszinkron üzenetküldések és -fogadások közötti közvetlen adatfolyam. Definiáltam Erlang programokon értelmezett adatfüggőség relációt, mely az adatfolyam-gráf kiterjesztésén a viselkedésfüggőség gráfon számı́tható ki. A függőségi reláció megadja, hogy két Erlang programbeli kifejezés között van-e függés, azaz kiértékelésük függ-e egymástól. A RefactorErl keretrendszerhez kidolgozott algoritmusok felhasználásra kerültek olyan problémák megoldásában mint a releváns tesztesek kiválasztása, vagy párhuzamosı́tható komponensek függőségi kapcsolatainak az ellenőrzése. Az adatfolyam, adatfüggőség és egyéb statikus elemzések felhasználásával kidolgoztam különböző jól párhuzamosı́tható számı́tási modellek viselkedésének leı́rását, mint például az elemenkénti feldolgozás. A megadott szabályok alapján a RefactorErl keretrendszerben megadhatók azok a mintafelismerési algoritmusok, melyek segı́tségével azonosı́thatóak azok a szekvenciális kódrészletek, melyek lecserélhetőek egy ekvivalens párhuzamos végrehajtásra

    Static analysis for safe software upgrade

    Get PDF
    Having applications accessible without downtime is no longer an exclusive requirement of mission-critical applications or traditional domains like communications. Running applications also require changes in the source code and upgrading live systems. Different approaches exist depending on the used technology. Systems implemented in Erlang can take the advantage of the underlying BEAM virtual machine and can be upgraded easily. However, source code has to be developed carefully once an upgrade is needed to not introduce run-time errors during the upgrade. We are developing a method to statically check the source code of Erlang applications for constructs that may lead to upgrading issues

    Functional Programming for Embedded Systems

    Get PDF
    Embedded Systems application development has traditionally been carried out in low-level machine-oriented programming languages like C or Assembler that can result in unsafe, error-prone and difficult-to-maintain code. Functional programming with features such as higher-order functions, algebraic data types, polymorphism, strong static typing and automatic memory management appears to be an ideal candidate to address the issues with low-level languages plaguing embedded systems. However, embedded systems usually run on heavily memory-constrained devices with memory in the order of hundreds of kilobytes and applications running on such devices embody the general characteristics of being (i) I/O- bound, (ii) concurrent and (iii) timing-aware. Popular functional language compilers and runtimes either do not fare well with such scarce memory resources or do not provide high-level abstractions that address all the three listed characteristics. This work attempts to address this gap by investigating and proposing high-level abstractions specialised for I/O-bound, concurrent and timing-aware embedded-systems programs. We implement the proposed abstractions on eagerly-evaluated, statically-typed functional languages running natively on microcontrollers. Our contributions are divided into two parts - Part 1 presents a functional reactive programming language - Hailstorm - that tracks side effects like I/O in its type system using a feature called resource types. Hailstorm’s programming model is illustrated on the GRiSP microcontroller board.Part 2 comprises two papers that describe the design and implementation of Synchron, a runtime API that provides a uniform message-passing framework for the handling of software messages as well as hardware interrupts. Additionally, the Synchron API supports a novel timing operator to capture the notion of time, common in embedded applications. The Synchron API is implemented as a virtual machine - SynchronVM - that is run on the NRF52 and STM32 microcontroller boards. We present programming examples that illustrate the concurrency, I/O and timing capabilities of the VM and provide various benchmarks on the response time, memory and power usage of SynchronVM

    RESTful Service Composition

    Get PDF
    The Service-Oriented Architecture (SOA) has become one of the most popular approaches to building large-scale network applications. The web service technologies are de facto the default implementation for SOA. Simple Object Access Protocol (SOAP) is the key and fundamental technology of web services. Service composition is a way to deliver complex services based on existing partner services. Service orchestration with the support of Web Services Business Process Execution Language (WSBPEL) is the dominant approach of web service composition. WSBPEL-based service orchestration inherited the issue of interoperability from SOAP, and it was furthermore challenged for performance, scalability, reliability and modifiability. I present an architectural approach for service composition in this thesis to address these challenges. An architectural solution is so generic that it can be applied to a large spectrum of problems. I name the architectural style RESTful Service Composition (RSC), because many of its elements and constraints are derived from Representational State Transfer (REST). REST is an architectural style developed to describe the architectural style of the Web. The Web has demonstrated outstanding interoperability, performance, scalability, reliability and modifiability. RSC is designed for service composition on the Internet. The RSC style is composed on specific element types, including RESTful service composition client, RESTful partner proxy, composite resource, resource client, functional computation and relaying service. A service composition is partitioned into stages; each stage is represented as a computation that has a uniform identifier and a set of uniform access methods; and the transitions between stages are driven by computational batons. RSC is supplemented by a programming model that emphasizes on-demand function, map-reduce and continuation passing. An RSC-style composition does not depend on either a central conductor service or a common choreography specification, which makes it different from service orchestration or service choreography. Four scenarios are used to evaluate the performance, scalability, reliability and modifiability improvement of the RSC approach compared to orchestration. An RSC-style solution and an orchestration solution are compared side by side in every scenario. The first scenario evaluates the performance improvement of the X-Ray Diffraction (XRD) application in ScienceStudio; the second scenario evaluates the scalability improvement of the Process Variable (PV) snapshot application; the third scenario evaluates the reliability improvement of a notification application by simulation; and the fourth scenario evaluates the modifiability improvement of the XRD application in order to fulfil emerging requirements. The results show that the RSC approach outperforms the orchestration approach in every aspect

    A heuristic-based approach to code-smell detection

    Get PDF
    Encapsulation and data hiding are central tenets of the object oriented paradigm. Deciding what data and behaviour to form into a class and where to draw the line between its public and private details can make the difference between a class that is an understandable, flexible and reusable abstraction and one which is not. This decision is a difficult one and may easily result in poor encapsulation which can then have serious implications for a number of system qualities. It is often hard to identify such encapsulation problems within large software systems until they cause a maintenance problem (which is usually too late) and attempting to perform such analysis manually can also be tedious and error prone. Two of the common encapsulation problems that can arise as a consequence of this decomposition process are data classes and god classes. Typically, these two problems occur together – data classes are lacking in functionality that has typically been sucked into an over-complicated and domineering god class. This paper describes the architecture of a tool which automatically detects data and god classes that has been developed as a plug-in for the Eclipse IDE. The technique has been evaluated in a controlled study on two large open source systems which compare the tool results to similar work by Marinescu, who employs a metrics-based approach to detecting such features. The study provides some valuable insights into the strengths and weaknesses of the two approache

    Refactoring for introducing and tuning parallelism for heterogeneous multicore machines in Erlang

    Get PDF
    This research has been generously supported by the European Union Framework 7 Para-Phrase project (IST-288570), EU Horizon 2020 projects RePhrase (H2020-ICT-2014-1), agreement number 644235; Teamplay (H2020-ICT 2017-1) agreement number 779882, and EPSRC Discovery, EP/P020631/1. EU COST Action IC1202: Timing Analysis On Code-Level (TACLe), and by a travel grant from EU HiPEAC.This paper presents semi‐automatic software refactorings to introduce and tune structured parallelism in sequential Erlang code, as well as to generate code for running computations on GPUs and possibly other accelerators. Our refactorings are based on the lapedo framework for programming heterogeneous multi‐core systems in Erlang. lapedo is based on the PaRTE refactoring tool and also contains (1) a set of hybrid skeletons that target both CPU and GPU processors, (2) novel refactorings for introducing and tuning parallelism, and (3) a tool to generate the GPU offloading and scheduling code in Erlang, which is used as a component of hybrid skeletons. We demonstrate, on four realistic use‐case applications, that we are able to refactor sequential code and produce heterogeneous parallel versions that can achieve significant and scalable speedups of up to 220 over the original sequential Erlang program on a 24‐core machine with a GPU.PostprintPeer reviewe

    Erlang programok statikus elemzése és szeletelése

    Get PDF
    A funkcionális programozási nyelvek terjedésének velejárója, hogy felmerül az igény olyan eszközökre, amelyek a fejlesztési folyamatot támogatják. Ezek lehetnek futási idejű eszközök, vagy olyanok, melyek csupán a forráskód elemzésével kı́nálnak hasznos információkat a fejlesztők számára. Az Erlang ipari környezetben is gyakran használt funkcionális programozási nyelv. A RefactorErl egy statikus elemző és refaktoráló eszköz Erlanghoz, mely számos transzformációt biztosı́t a forráskód jelentésmegőrző átalakı́tására, másrészről kiterjedt statikus elemzőkészlettel segı́ti a fejlesztőket a mindennapos tevékenységükben. Kutatásomban olyan elemzési módszerekkel foglalkoztam, amelyek segı́tségével az Erlang programok forráskódjában rejlő összetett összefüggések nyerhetők ki. Ezek az eredmények pedig további magasabb szintű elemzések alapját képzik. Az ismertetett eredményeim a vezérlés és az Erlang folyamatok közötti kapcsolatok elemzéséhez kapcsolódnak. A dolgozatomban Erlang programok vezérlésfolyam-gráfját adtam meg, amely tartalmazza a programok végrehajtása során előálló lehetséges végrehajtási utakat. A gráfot a nyelv szintaktikus kategóriáihoz rendelt formális szabályok segı́tségével definiáltam, amelyek a nyelv szemantikájának megfelelően adják meg a vezérlésfolyam-gráf éleit. A vezérlésfolyam-gráf felhasználásra került további elemzésekhez is, mint például a párhuzamosı́tható komponensek azonosı́tása. A vezérlésfolyam-gráf, illetve a benne foglalt információk felhasználhatóak a forráskódban történő változások hatáselemzéséhez. A vezérlésfüggőségi gráf egy kompaktabb reprezentáció, amely a vezérlési utakban lévő szekvenciák eliminálásával már csak a kifejezések közötti közvetlen függőségeket tartalmazza. Megadtam Erlang programokra a vezérlésfüggőségi gráfot, amelyet adatfüggőségi információkkal egészı́tettem ki. Az ı́gy definiált Erlang függőségi gráf felhasználható gráf alapú statikus programszeleteléshez. A definiált infrastruktúrára épı́tve megadtam egy hatáselemzés alapú teszteset szelekciós módszert. A módszer azon tesztesetek halmazát adja meg, amelyek érintettek lehetnek a változtatás/transzformáció kapcsán. Azaz a változtatás hatása elterjedhet a tesztelt funkcionalitásba. Az elemzés nem csak a transzformációk hatásának elemzésére, hanem tetszőleges változás elemzésére is használható. Dolgozatomban bemutattam Erlang programok egy statikus kommunikációs modelljét. Megadtam azokat az algoritmusokat, melyek segı́tségével felderı́thetőek az elindı́tott Erlang folyamatok és a köztük aszinkron üzenetküldésekkel lebonyolı́tott kommunikáció. A modellbe felvettem olyan rejtett kommunikációs elemeket is, mint a közös osztott memóriának tekinthető Erlang Term Storage (ets) táblák használata. Megadtam azokat a statikus elemzési algoritmusokat, melyek felhasználásával kiegészı́thető a kommunikációs gráf speciális Erlang folyamatokkal (például generikus szerverek) és az interfészeiken keresztül történő rejtett kommunikációval. A kommunikációs gráf kiválóan használható a kódban rejlő összefüggések megjelenı́tésére, kódmegértés, konkurenciából fakadó hibakeresés támogatásához. Ugyanakkor felhasználható konkurens programok változásához köthető hatáselemzés pontosı́tásához is

    Data abstraction in coordination constraints

    Get PDF
    Communications in Computer and Information Science 393, 2013This paper studies complex coordination mechanisms based on constraint satisfaction. In particular, it focuses on data-sensitive connectors from the Reo coordination language. These connectors restrict how and where data can flow between loosely-coupled components taking into account the data being exchanged. Existing engines for Reo provide a very limited support for data-sensitive connectors, even though data constraints are captured by the original semantic models for Reo. When executing data-sensitive connectors, coordination constraints are not exhaustively solved at compile time but at runtime on a per-need basis, powered by an existing SMT (satisfiability modulo theories) solver.To deal with a wider range of data types and operations, we abstract data and reduce the original constraint satisfaction problem to a SAT problem, based on a variation of predicate abstraction. We show soundness and completeness of the abstraction mechanism for well-defined constraints, and validate our approach by evaluating the performance of a prototype implementation with different test cases, with and without abstraction.(undefined

    Static Analysis for Divide-and-Conquer Pattern Discovery

    Get PDF
    Routines implementing divide-and-conquer algorithms are good candidates for parallelization. Their identifying property is that such a routine divides its input into "smaller" chunks, calls itself recursively on these smaller chunks, and combines the outputs into one. We set up conditions which characterize a wide range of d&c routine definitions. These conditions can be verified by static program analysis. This way d&c routines can be found automatically in existing program texts, and their parallelization based on semi-automatic refactoring can be facilitated. We work out the details in the context of the Erlang programming language
    corecore