1,027 research outputs found

    Region-based memory management for Mercury programs

    Full text link
    Region-based memory management (RBMM) is a form of compile time memory management, well-known from the functional programming world. In this paper we describe our work on implementing RBMM for the logic programming language Mercury. One interesting point about Mercury is that it is designed with strong type, mode, and determinism systems. These systems not only provide Mercury programmers with several direct software engineering benefits, such as self-documenting code and clear program logic, but also give language implementors a large amount of information that is useful for program analyses. In this work, we make use of this information to develop program analyses that determine the distribution of data into regions and transform Mercury programs by inserting into them the necessary region operations. We prove the correctness of our program analyses and transformation. To execute the annotated programs, we have implemented runtime support that tackles the two main challenges posed by backtracking. First, backtracking can require regions removed during forward execution to be "resurrected"; and second, any memory allocated during a computation that has been backtracked over must be recovered promptly and without waiting for the regions involved to come to the end of their life. We describe in detail our solution of both these problems. We study in detail how our RBMM system performs on a selection of benchmark programs, including some well-known difficult cases for RBMM. Even with these difficult cases, our RBMM-enabled Mercury system obtains clearly faster runtimes for 15 out of 18 benchmarks compared to the base Mercury system with its Boehm runtime garbage collector, with an average runtime speedup of 24%, and an average reduction in memory requirements of 95%. In fact, our system achieves optimal memory consumption in some programs.Comment: 74 pages, 23 figures, 11 tables. A shorter version of this paper, without proofs, is to appear in the journal Theory and Practice of Logic Programming (TPLP

    Front e back office web para o dsd.av.it.pt

    Get PDF
    Mestrado em Engenharia de Computadores e TelemáticaDevido ao elevado n´umero de docentes existente no departamento e ao elevado n´umero de turmas que s˜ao necess´arias para o cada vez maior universo de alunos ligados ao Departamento de Electr´onica, Telecomunicac¸˜oes e Inform´atica (DETI) a elaborac¸˜ao da distribuic¸˜ao do servic¸o docente ´e cada vez mais complexa. Urge a criac¸˜ao de um componente na plataforma de Distribuic¸˜ao de Servic¸o Docente (DSD), que permita de uma forma r´apida e simples gerar uma distribuic¸˜ao dos docentes com base numa lista das preferˆencias de cada docente. Com base nessa necessidade surgiu a ideia de implementar um motor de intelig ˆencia artificial (AIE, de Artificial Intelligence Engine) respons´avel por essas func¸˜oes. Este documento comec¸a por avaliar as diferentes possibilidades de implementac¸˜ao de um AIE e a escolha da linguagem de programac¸˜ao que melhor possa implementar a soluc¸˜ao. Seguidamente ser´a feita uma breve descric¸˜ao da linguagem de programac¸˜ao escolhida. A descric¸˜ao e explicac¸˜ao de como o trabalho foi elaborado. Para finalizar seram apresentados os resultados obtidos e tamb´em problemas e dificuldades que inevitavelmente apareceram.The increasing number of students in the last years in the Department of Electronics, Telecommunications and Informatics (DETI) has inevitably caused an increase in number of teachers required to meet the increasing number of class and office appointments. The task of distributing the teaching service within multiple spaces and scheduling requirements increased in complexity. It would be particularly helpful for the person in charge of this task to automate the generation of the teaching service distribution. Adding to this complexity, individual preferences and constraints must also be taken into account in the process. Such complexity called for the development of a module in the Teacher Distribution Service (DSD, acronym of Distribuic¸˜ao do Servic¸o Docente) platform to provide a fast and simple tool to complete the task. In this work we begin with an assessment of the different possibilities for developing an Artificial Intelligence Engine (AIE) and with the choice of the programming language that can best support the development of this application. Then a brief description of the language chosen to develop the application is given. Follows a complete description of the work I have developed. Next some ideas for future developments are put forward. To finalize a discussion of the achieved results and also the problems and difficulties that inevitably came up are going to be presented

    Transforming floundering into success

    Full text link
    We show how logic programs with "delays" can be transformed to programs without delays in a way which preserves information concerning floundering (also known as deadlock). This allows a declarative (model-theoretic), bottom-up or goal independent approach to be used for analysis and debugging of properties related to floundering. We rely on some previously introduced restrictions on delay primitives and a key observation which allows properties such as groundness to be analysed by approximating the (ground) success set. This paper is to appear in Theory and Practice of Logic Programming (TPLP). Keywords: Floundering, delays, coroutining, program analysis, abstract interpretation, program transformation, declarative debuggingComment: Number of pages: 24 Number of figures: 9 Number of tables: non

    Refinement of higher-order logic programs

    Get PDF
    A refinement calculus provides a method for transforming specifications to executable code, maintaining the correctness of the code with respect to its specification. In this paper we extend the refinement calculus for logic programs to include higher-order programming capabilities in specifications and programs, such as procedures as terms and lambda abstraction. We use a higher-order type and term system to describe programs, and provide a semantics for the higher-order language and refinement. The calculus is illustrated by refinement examples

    Compiler architecture using a portable intermediate language

    Get PDF
    The back end of a compiler performs machine-dependent tasks and low-level optimisations that are laborious to implement and difficult to debug. In addition, in languages that require run-time services such as garbage collection, the back end must interface with the run-time system to provide those services. The net result is that building a compiler back end entails a high implementation cost. In this dissertation I describe reusable code generation infrastructure that enables the construction of a complete programming language implementation (compiler and run-time system) with reduced effort. The infrastructure consists of a portable intermediate language, a compiler for this language and a low-level run-time system. I provide an implementation of this system and I show that it can support a variety of source programming languages, it reduces the overall eort required to implement a programming language, it can capture and retain information necessary to support run-time services and optimisations, and it produces efficient code
    corecore