{"id":21197322,"url":"https://github.com/dvx/jssembly","last_synced_at":"2025-08-19T14:02:05.471Z","repository":{"id":62771926,"uuid":"23011413","full_name":"dvx/jssembly","owner":"dvx","description":"Jssembly is a library that allows you to execute native assembly from Java.","archived":false,"fork":false,"pushed_at":"2017-04-18T03:49:53.000Z","size":40,"stargazers_count":125,"open_issues_count":2,"forks_count":12,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-07-10T10:09:13.797Z","etag":null,"topics":[],"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/dvx.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-08-16T05:27:58.000Z","updated_at":"2024-11-30T14:33:33.000Z","dependencies_parsed_at":"2022-11-06T06:30:30.757Z","dependency_job_id":null,"html_url":"https://github.com/dvx/jssembly","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/dvx/jssembly","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dvx%2Fjssembly","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dvx%2Fjssembly/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dvx%2Fjssembly/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dvx%2Fjssembly/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dvx","download_url":"https://codeload.github.com/dvx/jssembly/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dvx%2Fjssembly/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268928920,"owners_count":24330593,"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","status":"online","status_checked_at":"2025-08-05T02:00:12.334Z","response_time":2576,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2024-11-20T19:43:31.114Z","updated_at":"2025-08-05T16:14:02.860Z","avatar_url":"https://github.com/dvx.png","language":"Java","funding_links":[],"categories":["Native"],"sub_categories":[],"readme":"jssembly\n========\n\nJssembly is a library that allows you to execute native assembly from Java via a JNI bridge. The goal is to provide wrappers and parsers for Windows/*NIX/OSX/Android. Most of the work currently consists of writing ANTLR parsers for\n\n  - x86 assembly\n  - amd64 assembly\n  - ARMv7/v8 assembly\n\nHowever, with great power comes great responsibility.\n \n\u003e **WARNING:** Jssembly can (and will) crash your VM if you don't know what you're doing. The current pre-alpha state is in no way meant to be used in production code. You have been warned.\n\nUsage\n----\n\n**Jssembly** emulates ```__asm``` syntax found in Visual Studio or GCC in Java. Currently, a few proofs of concept work on Android and Windows x64 systems. x84 and *NIX support is currently in development.\n\n``` java\nJssembly jsm = new Jssembly();\n```\n### Blocks\nJssembly uses  executable code \"blocks\" as its primary invokable piece of native code. There are two types of blocks: **raw** and **assembly**. Raw blocks contain opcodes whereas assembly blocks contain (you guessed it) platform-specific assembly. For example, here is a raw block called ```test1```:\n\n``` java\njsm.define(\"test1\", new Block(raw) {{\n\t__asm(\n\t\t0x31, 0xC0, 0x48, 0xFF, 0xC0 ... 0xC3\n\t);\n}});\n```\n\nAnd here is an ```x64``` assembly block called ```test2```:\n``` java\njsm.define(\"test2\", new Block(x64) {{\n\t__asm(\"nop\");\n\t__asm(\"mov rax, rdi\")\n\t__asm(\"ret\");\n}});\n```\n\nWe invoke ```test1``` by calling ```jsm.get(\"test1\").invoke(argument1, argument2 ... argN)``` or we can invoke a block in-place like so:\n``` java\njsm.define(\"test3\", new Block(x64) {{\n\t__asm(\n\t\t\"nop\",  // no-op\n\t\t\"ret\"   // return\n\t);\n}}).invoke();\n```\nHere we see yet another flavor of the ```___asm``` syntax. Note that the parser is called when the ```Block``` constructor is called. In case of a syntax error, we should see an exception when a new definition occurs.\n\n### Arguments\nWe can also pass a variable number of arguments to the ```invoke()``` method. These arguments can be accessed through platform-specific assembly.\n\n### Return types\nIn the works, although ```invoke()``` currently returns void.\n\n### Invocation woes\nGreat care must be taken with raw blocks as no viable run-time checks can be done on them. Make *sure* that the right raw code is executed on the right platform -- otherwise, the VM will crash. Naive checks are in the works for assembly blocks.\n\nLicense\n----\n\nMIT.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdvx%2Fjssembly","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdvx%2Fjssembly","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdvx%2Fjssembly/lists"}