{"id":19838959,"url":"https://github.com/objectionary/demu","last_synced_at":"2025-05-01T18:31:39.656Z","repository":{"id":74087791,"uuid":"575859928","full_name":"objectionary/demu","owner":"objectionary","description":"A command line tool for DeMutabilization of EO programs","archived":false,"fork":false,"pushed_at":"2024-11-07T17:23:15.000Z","size":60,"stargazers_count":4,"open_issues_count":10,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-11-07T18:29:09.485Z","etag":null,"topics":["code-optimization","eolang","java","oop"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/objectionary.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-12-08T13:14:40.000Z","updated_at":"2022-12-29T08:21:28.000Z","dependencies_parsed_at":"2024-02-15T16:26:58.909Z","dependency_job_id":"10e80b3f-cab7-4648-a177-fc9368349240","html_url":"https://github.com/objectionary/demu","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/objectionary%2Fdemu","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/objectionary%2Fdemu/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/objectionary%2Fdemu/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/objectionary%2Fdemu/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/objectionary","download_url":"https://codeload.github.com/objectionary/demu/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224270864,"owners_count":17283865,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["code-optimization","eolang","java","oop"],"created_at":"2024-11-12T12:19:43.928Z","updated_at":"2024-11-12T12:19:44.001Z","avatar_url":"https://github.com/objectionary.png","language":"Java","readme":"\u003cimg alt=\"logo\" src=\"https://www.objectionary.com/cactus.svg\" height=\"100px\" /\u003e\n\n[![EO principles respected here](https://www.elegantobjects.org/badge.svg)](https://www.elegantobjects.org)\n[![DevOps By Rultor.com](http://www.rultor.com/b/objectionary/demu)](http://www.rultor.com/p/objectionary/demu)\n[![We recommend IntelliJ IDEA](https://www.elegantobjects.org/intellij-idea.svg)](https://www.jetbrains.com/idea/)\n\n[![mvn](https://github.com/objectionary/demu/actions/workflows/mvn.yml/badge.svg?branch=master)](https://github.com/objectionary/demu/actions/workflows/mvn.yml)\n[![PDD status](http://www.0pdd.com/svg?name=objectionary/demu)](http://www.0pdd.com/p?name=objectionary/demu)\n[![codecov](https://codecov.io/gh/objectionary/demu/branch/master/graph/badge.svg)](https://codecov.io/gh/objectionary/demu)\n[![Maven Central](https://img.shields.io/maven-central/v/org.eolang/demu.svg)](https://maven-badges.herokuapp.com/maven-central/org.eolang/demu)\n[![Hits-of-Code](https://hitsofcode.com/github/objectionary/demu)](https://hitsofcode.com/view/github/objectionary/demu)\n![Lines of code](https://img.shields.io/tokei/lines/github/objectionary/demu)\n[![License](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/objectionary/demu/blob/master/LICENSE.txt)\n\n# DeMu\n\nIt's a well known fact that programs with immutable objects much easy to\nmaintain, test and use, but the main benefit form immutable objects is that they\nallow performing\nmore [aggressive optimizations [1]](https://dl.acm.org/doi/10.1145/583810.583833)\nand apply more valuable analysis. **DeMu** is exactly the tool for removing\nmutable objects like `memory` and `cage`\nfrom [EO](https://github.com/objectionary/eo) programs. Actually, DeMu is\nacronym for **De-Muatabilization**.\n\n## Methodology\n\nThere isn't single formal methodology or algorithm for converting mutable\nobjects into immutable, but we can use some separate methods to achieve this.\n\n### Using SSA form for simple cases\n\nWe actually can\napply [SSA [2]](http://www1.cse.wustl.edu/~cytron/cs531/Resources/Papers/valnum.pdf)\nform for `eo` programs. This approach can immediately remove some usages of\nmutable objects. Let's consider the following example:\n\n```eo\n[] \u003e example\n  cage 0 \u003e index\n  seq \u003e @\n    index.write 1\n    stdout\n      sprintf\n        \"%s\"\n        index\n    TRUE\n```\n\nAfter applying SSA form we get something like the next:\n\n```eo\n[] \u003e example\n  seq \u003e @\n    stdout\n      sprintf\n        \"%s\"\n        1\n    TRUE\n```\n\nAnd as you can see - we removed usage of `cage` from the result program.\nThe relation between SSA form and Dataflow Languages (like `EO` and, \nparticularly, Functional Programming Languages) is quite well described in\nthat [article [3]](https://www.cs.princeton.edu/~appel/papers/ssafun.pdf).\n\n### Using recursion for loops\n\nThe second method is to convert loops into recursive calls.\n\n## Related articles and links\n\n1. [Immutability specification and its applications](https://dl.acm.org/doi/10.1145/583810.583833)\n2. [Global Value Numbers and Redundant Computations](http://www1.cse.wustl.edu/~cytron/cs531/Resources/Papers/valnum.pdf)\n3. [SSA is Functional Programming](https://www.cs.princeton.edu/~appel/papers/ssafun.pdf)\n\n## How to Contribute\n\nFork repository, make changes, send us a pull request. We will review your\nchanges and apply them to the `master` branch shortly, provided they don't\nviolate our quality standards. To avoid frustration, before sending us your pull\nrequest please run full Maven build:\n\n```bash\n$ mvn clean install -Pqulice\n```\n\nYou will need Maven 3.3+ and Java 8+.","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fobjectionary%2Fdemu","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fobjectionary%2Fdemu","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fobjectionary%2Fdemu/lists"}