{"id":21085584,"url":"https://github.com/fractalfir/jtcpp","last_synced_at":"2025-10-28T14:06:34.904Z","repository":{"id":182604859,"uuid":"660602484","full_name":"FractalFir/jtcpp","owner":"FractalFir","description":"jtcpp was an experimental JVM bytecode to C++ transpiler(abandoned). ","archived":false,"fork":false,"pushed_at":"2023-07-20T15:42:24.000Z","size":346,"stargazers_count":31,"open_issues_count":0,"forks_count":4,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-07-19T10:25:21.467Z","etag":null,"topics":["converter","cpp","java","jvm","rust","transpiler"],"latest_commit_sha":null,"homepage":"","language":"Rust","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/FractalFir.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-06-30T11:35:20.000Z","updated_at":"2025-07-03T09:33:45.000Z","dependencies_parsed_at":null,"dependency_job_id":"b91830d2-ea02-49f1-8a7b-6e0c3067314f","html_url":"https://github.com/FractalFir/jtcpp","commit_stats":null,"previous_names":["fractalfir/jtcpp"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/FractalFir/jtcpp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FractalFir%2Fjtcpp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FractalFir%2Fjtcpp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FractalFir%2Fjtcpp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FractalFir%2Fjtcpp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/FractalFir","download_url":"https://codeload.github.com/FractalFir/jtcpp/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FractalFir%2Fjtcpp/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266278326,"owners_count":23904039,"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":["converter","cpp","java","jvm","rust","transpiler"],"created_at":"2024-11-19T20:35:26.449Z","updated_at":"2025-10-28T14:06:34.806Z","avatar_url":"https://github.com/FractalFir.png","language":"Rust","readme":"# What is `jtcpp`\nDisclaimer:\n*`jtcpp` was created as a learning exercise, and a way to better understand both JVM bytcode and Java class format. It is a proof of concept, and not meant to be used for anything besides exploring the idea of compiling languages using JVM to native code.*\n\n`jtcpp` is a versatile, highly experimental JVM bytecode to C++ transpiler. It generates C++ code which an exact, JVM op into C++ statement, translation of the input bytecode. This approach has some limitations, which may reduce performance of generated C++ code. This makes general comparisons between speed original Java code and translated C++ very hard, because it varies so much(From 3x speedup to 50x slowdown).\n# Compatibility.\nBuilding `jtcpp` is supported only on Linux. `make`,`cmake`,`git` and either `g++` or `clang` is required.\nTranslated `C++` code should work with almost any compiler. It was tested with both `g++` and `clang`, and minimal supported C++ version is C++ 11. \n# Highly versatile GC\n`jtcpp` supports 4 different GC modes: No GC, Bohem GC, Reference counting, Mixed-mode GC(experimental, combines reference counting and Bohem GC)\n# How to use `jtcpp`\n1. Download `jtcpp` and build it.\n2. Pick a target directory.\n3. Run this command for each file you want to be translated(besides `.class` files, `jtcpp` also supports translating whole `.jar` files in one go)\n`jtcpp MY_TARGET_DIR -s JAVA_FILE_1.jar -s JAVA_FILE_2.class`\nNOTE:All translated dependencies should have the same target directory\n4. Go to your target directory\n    b) If you so desire, change `config.hpp` to configure some more advanced features *currently only the way GC works*.\n5. run `make -j` and wait as translated `C++` is being built\n6. Go to `build` directory within your target directory, `translated.out` is the result of building translated C++ code.\n7. On default, `jtcpp` uses Bohem GC. So, `libgc.so` and `libgccpp.so` need to be shipped alongside `translated.out`.\n# Java Standard Library\n`jtcpp` ships with a minimal, bare-bones implementation of java standard library. The shipped version of the standard library is meant only for testing, and contains only support for classes such as `String`, `Object`, `System` and `PrintStream`, required for outputting to console. Those classes contain only implementations of strictly necessary methods.\n# Java features\n`jtcpp` supports object creation, 1D arrays, inheritance, static and virtual methods. Support for generics is partial and they may not always work.\n`jtcpp` does not support multi dimensional arrays, interfaces, exception handling.\n# JVM bytcode Ops \n`jtcpp` currently supports almost all JVM opcodes, besides: `dup2_x2`, `multanewarray`, and `invokedynamic`.\n# Building some examples\nIn order to test out some examples(they are in `test` directory), compile them using `javac`.  Then, invoke jtcpp with resulting `.class` files as source files for transpilation. Go to the resulting target directory, and run `make`.\nAfter that, you should have a naively compiled version of input program. \n\nBeware! Some of examples do not work on purpose, to show what is currently missing. Examples which do not work have a comment at their top, explaing exactly why they do not work yet.\n## Example of building an example:\n`cd test/nbody`\n\n`javac NBody`\n\n`cd ../..`\n\n`jtcpp --out target/nbody -s test/nbody/Planet.class -s test/nbody/Vector3.class -s test/nbody/NBody.class -s test/nbody/Rand.class`\n\n`cd target/nbody`\n\n`make`\n\n`cd build`\n\n`./translated.out`\n\nAnd after ruinng `./translated.out` you should see positions and velocities of simulated bodies being printed.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffractalfir%2Fjtcpp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffractalfir%2Fjtcpp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffractalfir%2Fjtcpp/lists"}