{"id":24737422,"url":"https://github.com/engineersbox/continuity","last_synced_at":"2026-02-23T16:02:35.747Z","repository":{"id":40335471,"uuid":"452116550","full_name":"EngineersBox/Continuity","owner":"EngineersBox","description":"A Java state persistence/continuation/checkpointing library with runtime JVM state reification","archived":false,"fork":false,"pushed_at":"2024-07-30T13:42:21.000Z","size":2405,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-10-27T15:37:02.958Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/EngineersBox.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2022-01-26T02:37:36.000Z","updated_at":"2024-07-30T13:42:25.000Z","dependencies_parsed_at":"2024-07-30T17:26:33.981Z","dependency_job_id":null,"html_url":"https://github.com/EngineersBox/Continuity","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/EngineersBox/Continuity","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EngineersBox%2FContinuity","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EngineersBox%2FContinuity/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EngineersBox%2FContinuity/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EngineersBox%2FContinuity/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/EngineersBox","download_url":"https://codeload.github.com/EngineersBox/Continuity/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EngineersBox%2FContinuity/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29747981,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-23T07:44:07.782Z","status":"ssl_error","status_checked_at":"2026-02-23T07:44:07.432Z","response_time":90,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":"2025-01-27T22:08:16.082Z","updated_at":"2026-02-23T16:02:35.727Z","avatar_url":"https://github.com/EngineersBox.png","language":"Java","readme":"# Continuity\r\n\r\nA Java state persistence/continuation/checkpointing library with runtime JVM state reification.\r\n\r\n### Attribution\r\n\r\nThis implementation is based around OffByNull's Coroutines library \u003chttps://github.com/offbynull/coroutines\u003e. I'm aiming\r\nto attempt at providing support for lambdas via `INVOKEDYNAMIC` calls which are not supported in the coroutines library.\r\n\r\n## Instrumentation Stages\r\n\r\n* Method location\r\n* Method introspection\r\n* Serialization of .continuity files\r\n* Bytecode injection\r\n* Serialization data creation\r\n\r\n## Stage 1: Method Location\r\n\r\nFind methods to instrument in each ClassNode. Ignore classes that are interfaces since they possess no body or direct callsite.\r\nCheck if the class has already been instrumented, if it has, then ensure the marker is formatted correctly and then skip class \r\nif marker valid.\r\n\r\nFind methods that have a Continuation instance passed as a parameter. Store these in the stage context and return;\r\n\r\n## Stage 2: Method Introspection\r\n\r\nUsing the method instructions, find the call points for continuation and suspend points. Then Get method frames and\r\nfigure out what vars need to be allocated in order to store the LVA and OS stack vars. Also determine if there are\r\nreturn values that need to be cached. Once these have been determined, allocate stack slots for them to be put into\r\nduring the bytecode injection stage. Next, create the variables for the Continuation parameter and the method state.\r\n\r\n## Stage 3: Serialization of .continuity Files\r\n\r\nTODO\r\n\r\n## Stage 4: Bytecode Injection\r\n\r\nSee the `doc` directory for details on how state management bytecode is implemented and injected into the methods.\r\n\r\n## Stage 5: Serialization Data Creation\r\n\r\n## Continuity Lang\r\n\r\nAn intermediate language is used to create the bytecode definitions. The language is compiled into\r\nJava, as a set of instructions loaded through `InsnBuilder`. All native functions in the `continuity`\r\nlanguage are direct static methods on `InsnBuilder`. Any function invocations that are from reference\r\nchains such as `OSRestoreOperations.loadContainerVars(...)` are namespaced to invoke actual Java\r\nclasses.\r\n\r\nThis is not designed to be a full language, only a meta language as an intermediate transform. As such\r\nthe namespacing and available context is bound by a `HashMap` provided as context to the parser. Theoretically,\r\nyou can do anything you want in the language but it would require extensive modification of the parser\r\nand additional context that would handle state in Java as opposed to the language.\r\n\r\nFiles are expected to use the `cib` extension, indicating `Continuity Intermediate Bytecode`, an example\r\nof this is the following:\r\n\r\n```cib\r\n// File: example.cib\r\n// Declare some vars that will be provided to the parser as translation context\r\nctx {\r\n    contArgVar;\r\n    example;\r\n    other;\r\n};\r\n\r\n// Reference an external class in the JVM via ClassLoader\r\next com.engineersbox.continuity.core.annotation.BytecodeInternal $ Accessor;\r\n\r\nlet testString: str = \"string\";\r\n// Declare an array variable with an initialiser\r\nlet arrayVariable: int32[] = {\r\n    434,\r\n    8234532\r\n};\r\n\r\n/**\r\n * Declare a function, essentially acting as a macro\r\n */\r\nfn test() {\r\n    // Declare a scoped variable\r\n    let test: Object = std::loadVar(ctx::contArgVar);\r\n    // Reference a scoped variable\r\n    let.test;\r\n    std::loadVar(ctx::contArgVar);\r\n};\r\n\r\n/*\r\n * Invoke an external context driven function via a reference chain,\r\n * the OSRestoreOperations reference is expected to loaded via ext \u003cpath\u003e;\r\n * or ext { ... \u003cpath\u003e; }.\r\n */\r\nstd::call(ext::Accessor-\u003egetMethod(ctx::example-\u003eget().replace('$', '.')), std::loadVar(ctx::contArgVar));\r\nstd::combineIf(\r\n    // Evaluate boolean expressions\r\n    ctx::example-\u003eget().contains(\"$\") \u0026\u0026 (5.3 \u003e=  let.arrayVariable[0] ^ let.testString == \"string\"),\r\n    // Invoke a declared function\r\n    fn.test()\r\n);\r\n// If statement evaluation\r\nif (!ctx::example-\u003eget().contains(\"$\") \u0026\u0026 (5.3 \u003e= let.arrayVariable[1] ^ \"string\" == \"string\")) {\r\n    std::loadVar(ctx::contArgVar);\r\n} else if (ctx::other == null) {\r\n    std::lineNumber(ctx::other);\r\n} else if (ctx::example-\u003eget().contains(\"$\")) {\r\n    fn.test();\r\n    std::lineNumber(ctx::other);\r\n} else {\r\n    std::call(ext::Accessor-\u003egetMethod(ctx::example-\u003eget().replace('$', '.')), std::loadVar(ctx::contArgVar));\r\n    std::debug(\"Unknown state\");\r\n};\r\n```\r\n\r\nWhich generates the following parse tree:\r\n\r\n\u003cimg src=\"doc/exampleParseTree.png\" alt=\"Example Parse Tree\"\u003e","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fengineersbox%2Fcontinuity","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fengineersbox%2Fcontinuity","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fengineersbox%2Fcontinuity/lists"}