csg-tokyo / csg-tokyo/bluescript
Pre-compilation of library code
@maejima-fumika is already working on this.
Since Mar 16, 2025.
- Dominant language
- TypeScript
- Stars
- 49
- Forks
- 8
- Avg merge
- 1h 24m
- Merged PRs (30d)
- 3
Description
Issues that must be concerned for pre-compiling library code
Library code should be pre-compiled into binary to ensure quick loading when imported as a module. Since the BlueScript VM dynamically assigns unique identifiers to various type-related components on demand for distinction, the following issues must be considered.
-
module ID. When a program is imported as a module, a module identifier is attached to global symbols in the C program after translation. A module identifier is a sequence of digits. Because the BlueScript VM does not generate a module identifier starting with the digit 0, library code must be precompiled with a unique module identifier starting wth the digit 0. The BlueScript developers must ensure that a unique module identifier is given to every library code (source file).
-
array of class types. When library code declares a class type and it is pre-compiled, an array type of that class type must not be used in the library code. This restriction is because the BlueScript VM dynamically gives every array type an unique identifier for distinction. It also generates a unique global data structure for every array type in the C language. The BlueScript VM currently cannot reserve an array-type identifier for library code.
-
property/method names. When library code including class declarations is pre-compiled, the property and method names in the class declarations must be collected and they must be registered when the BlueScript VM restarts with the pre-compiled library code. This is because all property and method names are encoded into unique integers and the unique integers are dynamically assigned to the names.
- See
propertyNames()andaddPropertyName()in theClassTableclass.
- See
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.