{"id":13610396,"url":"https://github.com/roscopeco/jasm","last_synced_at":"2025-05-16T03:06:07.849Z","repository":{"id":37790105,"uuid":"487298845","full_name":"roscopeco/jasm","owner":"roscopeco","description":"A JVM assembler for the modern age","archived":false,"fork":false,"pushed_at":"2025-01-26T13:18:23.000Z","size":583,"stargazers_count":452,"open_issues_count":5,"forks_count":14,"subscribers_count":9,"default_branch":"develop","last_synced_at":"2025-05-12T04:52:23.558Z","etag":null,"topics":["assembler","assembly-language","bytecode","jvm"],"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/roscopeco.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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-04-30T14:30:01.000Z","updated_at":"2025-04-24T17:09:53.000Z","dependencies_parsed_at":"2025-02-10T06:00:24.605Z","dependency_job_id":"b9e471f5-4015-4dd5-848c-94e4a340f9a9","html_url":"https://github.com/roscopeco/jasm","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roscopeco%2Fjasm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roscopeco%2Fjasm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roscopeco%2Fjasm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roscopeco%2Fjasm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/roscopeco","download_url":"https://codeload.github.com/roscopeco/jasm/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254459088,"owners_count":22074605,"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":["assembler","assembly-language","bytecode","jvm"],"created_at":"2024-08-01T19:01:44.324Z","updated_at":"2025-05-16T03:06:02.839Z","avatar_url":"https://github.com/roscopeco.png","language":"Java","readme":"## JASM - A JVM Assembler for the modern age\n\n### What?\n\nJASM is an assembler/disassembler for JVM bytecode. It provides a nice syntax\nfor writing JVM classes in a bytecode-focused assembly language, and can also\ndisassemble any Java `.class` file to JASM source code.\n\nJASM has a [Gradle plugin](https://github.com/roscopeco/jasm-gradle-plugin) and \na (WIP) [Plugin for IntelliJ](https://github.com/roscopeco/jasm-intellij-plugin).\n\n\u003e [!NOTE]\n\u003e The IntelliJ plugin is not currently being maintained, I just can't keep\n\u003e up with the pace of change or dedicate the time to maintaining it.\n\u003e\n\u003e Unless someone wants to step up and take it over, the recommended way\n\u003e to write JASM code is in Vim - by adding the following line to your\n\u003e `.vimrc` you can get _reasonable_ auto-indent and _some_ syntax highlighting\n\u003e (because Jasm syntax is pretty close to Java 😅).\n\u003e\n\u003e ```\n\u003e au BufRead,BufNewFile *.jasm set filetype=java\n\u003e ```\n\nSee the [Example Gradle project](https://github.com/roscopeco/jasm-example) for\nan example of how JASM might fit in to your project.\n\nLet's just get this out of the way, shall we?\n\n```java\npublic class com/example/HelloWorld {\n    public static main([java/lang/String)V {\n        getstatic java/lang/System.out java/io/PrintStream\n        ldc \"Hello, World\"\n        invokevirtual java/io/PrintStream.println(java/lang/String)V\n        return\n    }\n}\n```\n\nSee the [Examples](docs/examples.md) for more examples of JASM code.\n\n### How?\n\n#### Requirements\n\n* Java 11 or higher is required to run the tool and/or gradle plugin\n  * (However, JASM can assemble classes targeted at any JVM version!)\n\n#### Using the Gradle plugin\n\nIf you just want to use some JASM code in your own Gradle project, the easiest way to get started is\nvia the [Gradle plugin](https://plugins.gradle.org/plugin/com.roscopeco.jasm).\n\nFor more information and some documentation about the plugin, see the \n[Github repo](https://github.com/roscopeco/jasm-gradle-plugin)\n\n#### Using the command-line tool\n\nIf you [downloaded a binary distribution](https://github.com/roscopeco/jasm/releases) then\nyou should be all set. Inside the archive you'll find a `bin/jasm' script that will take\ncare of running the command-line tool for you.\n\nTo see usage details:\n\n`bin/jasm --help`\n\nTo simply assemble a file `src/com/example/MyClass.jasm` to the `classes` directory:\n\n`bin/jasm -i src -o classes com/example/MyClass.jasm`\n\nOr to disassemble a `.class` file `classes/com/example/MyClass.class` to the `src` directory:\n\n`bin/jasm -d -i classes -o src com/example/MyClass.class`\n\nNotice that you set the source and destination directories, and just pass the relative\npath to the files within them - this is how the assembler creates the output files in the\nappropriate place (in a `com/example` directory under the destination directory in\nthe example above).\n\nWhen disassembling, you can optionally specify the `-l` flag, which will cause JASM to \noutput comments in the disassembly with the original line number (if this information is\npresent in the `.class` file).\n\n#### Building the tool with Gradle\n\nIf you grabbed the source from [Github](https://github.com/roscopeco/jasm) you can \neasily build a binary distribution with `./gradlew clean assemble` (pun not intended).\n\n#### Using JASM as a library \n\nIf you want to use this as a library (with Maven or Gradle), you'll want to \npull in the dependency from Maven central.\n\nE.g. (for Gradle):\n\n```kotlin\ndependencies {\n  implementation(\"com.roscopeco.jasm:jasm:0.7.0\")\n}\n```\n\n### Why??\n\nWell, **why not**?\n\nI wrote this for fun, which I had both in writing it and playing with it. \n\nIf you really need some use-cases to justify the electrons squandered in\npursuit of this project, how about these (some lifted from Jasmin's README):\n\n* Curious People - Want to understand more about the way JVM bytecode works\n  or the things that are possible at the bytecode level? Always wondered what \n  `invokedynamic` is for? Curious as to how `@SneakyThrows` can possibly work?\n  This might help!\n\n* System Implementors - If you're writing a JVM or runtime this could be useful\n  for generating test classes...\n\n* Advanced Programmers - You could hand-generate critical classes or methods\n  if you think Javac isn't doing the right thing (but spoiler alert: by this\n  point, it almost certainly is).\n\n* Language Implementors - You could use this as an IL if you liked, rather\n  than getting involved in the nuts and bolts of the binary `.class` format.\n\n* Security Researchers - Create hostile classes and see if you can sneak them\n  past the class verifier.\n\n* Teachers - Perhaps you're teaching a compiler course, maybe you could use this\n  to introduce students to JVM bytecode, or even as an IL for the compilers.\n\n#### Why not just use Jasmin?\n\nThe venerable [Jasmin](https://github.com/davidar/jasmin) project has been around for years,\nand has the advantage of being mature, stable, and well supported everywhere (for example,\nGithub does syntax highlighting for it). So why not just use that?\n\nOf course it's totally personal choice which you use, but there are a few reasons to choose\nJASM over Jasmin:\n\n* JASM supports all the modern features of the latest JVMs, such as\n  * `invokedynamic` and dynamic constants\n  * `record` classes etc\n* JASM has some nice \"quality of life\" features, such as automatically computing stack map frames / maxlocals for you\n* JASM is built on modern tooling, whereas Jasmin's code is showing its age a bit\n  * This makes it easy, for example, to build [Gradle](https://github.com/roscopeco/jasm-gradle-plugin) and [IntelliJ](https://github.com/roscopeco/jasm-intellij-plugin) integration for JASM\n* JASM comes with a full-featured built-in disassembler\n* JASM has (IMHO) a cleaner syntax than Jasmin\n\n\n### Who?\n\nJASM is copyright 2022 Ross Bamford (roscopeco AT gmail DOT com). \n\nSee LICENSE.md for the gory legal stuff (spoiler: MIT).\n","funding_links":[],"categories":["Uncategorized"],"sub_categories":["Uncategorized"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froscopeco%2Fjasm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Froscopeco%2Fjasm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froscopeco%2Fjasm/lists"}