How flintvn/flintjvm works
Purpose and entry points
Flint is a C++ embedded Java-like virtual machine with native bindings for core runtime APIs, graphics, networking, storage, and RTOS/platform services. The VM public surface and likely integration entry point are vm/inc/flint.h and vm/src/flint.cpp; platform adopters supply system implementations modeled by template/src/flint_system_api.cpp.
VM lifecycle and execution
The VM coordinates class loading, object/runtime state, threading, native dispatch, and bytecode execution. vm/src/flint_execution.cpp is the interpreter/execution core; vm/src/flint.cpp owns top-level VM behavior; vm/src/flint_java_thread.cpp represents managed Java threads. Execution crosses into platform and native layers through vm/src/flint_native_interface.cpp.
Class, bytecode, and archive loading
Class metadata is parsed and retained through class-loader, constant-pool, field, and method subsystems. vm/src/flint_class_loader.cpp, vm/src/flint_java_class.cpp, and vm/src/flint_const_pool.cpp form the class-definition path. Input may come from raw files or ZIP/JAR-like archives via vm/src/flint_file_reader.cpp and vm/src/flint_zip_file_reader.cpp, creating a boundary between application artifacts/storage and VM-internal representations.
Managed object model and runtime services
Objects, arrays, strings, throwables, and dictionaries provide the VM’s managed runtime substrate. Key implementations are vm/src/flint_java_object.cpp, vm/src/flint_array_object.cpp, and vm/src/flint_java_string.cpp. These structures are consumed by the interpreter and native-interface boundary, where native code must preserve VM object/reference conventions.
Native Java API implementation
Native methods implement the Java-facing base library in C++. Shared binding infrastructure is in native/common/src/flint_native.cpp and native/common/src/flint_native_common.cpp. Core native APIs—object/class behavior, strings, files, math, reflection, and threading—reside under native/base/src/flint_native_object.cpp, native/base/src/flint_native_string.cpp, and native/base/src/flint_native_thread.cpp.
Graphics and networking extensions
Optional native domains extend the runtime beyond base APIs. Software RGB565 graphics, fixed-point support, and Java graphics bindings are implemented by native/draw/src/flint_native_graphics.cpp, native/draw/src/flint_native_rgb565_graphics.cpp, and native/draw/src/flint_rgb565_sw_gfx.cpp. Socket, datagram, address, and stream bindings are implemented in native/net/src/flint_native_flint_socket_impl.cpp, native/net/src/flint_native_flint_datagram_socket_impl.cpp, and native/net/src/flint_native_flint_socket_input_stream.cpp.
Platform abstraction and deployed runtime
The VM depends on system API abstractions for OS/platform operations, configured through template/inc/flint_conf.h and implemented by adopters. The provided embedded deployment targets FreeRTOS, FatFs, and lwIP: impl/src/freertos_system_thread_api.cpp, impl/src/fatfs_system_io_api.cpp, and impl/src/lwip_system_net_api.cpp. Control flows from VM/native APIs to these adapters, isolating platform-specific scheduling, filesystem I/O, and network stacks from interpreter code.
Main entry points: flint_system_api.cpp System API Contract · flint.cpp VM Lifecycle · flint_execution.cpp Bytecode Interpreter · flint_native.cpp Native Binding Core
Components 17
VM Core
Managed execution and class runtime.
- VM Public API · Integration entry point for VM adopters.
vm/inc/flint.h - VM Lifecycle · Owns top-level VM behavior and runtime coordination.
vm/src/flint.cpp - Bytecode Interpreter · Executes managed Java bytecode.
vm/src/flint_execution.cpp - Managed Threads
vm/src/flint_java_thread.cpp - Native Interface · Crosses between managed execution and C++ native methods.
vm/src/flint_native_interface.cpp - Class Loading · Builds class metadata from application artifacts.
vm/src/flint_class_loader.cpp - Class & Constant Pool
vm/src/flint_java_class.cpp - Artifact Readers · Reads raw class files and ZIP/JAR-like archives.
vm/src/flint_zip_file_reader.cpp - Managed Objects · Object, array, string, and throwable substrate.
vm/src/flint_java_object.cpp
Native APIs
C++ implementations of Java-facing bindings.
- Native Binding Core · Shared native method support and conventions.
native/common/src/flint_native.cpp - Base Native APIs · Object, string, file, math, reflection, and thread natives.
native/base/src/flint_native_object.cpp - Graphics Bindings · Java graphics bindings and RGB565 software rendering.
native/draw/src/flint_native_graphics.cpp - Network Bindings · Socket, datagram, address, and stream bindings.
native/net/src/flint_native_flint_socket_impl.cpp
Platform Integration
Adopter-provided system services and embedded adapters.
- System API Contract · Configuration and adopter-supplied system implementation model.
template/src/flint_system_api.cpp - FreeRTOS Adapter
impl/src/freertos_system_thread_api.cpp - FatFs Adapter
impl/src/fatfs_system_io_api.cpp - lwIP Adapter
impl/src/lwip_system_net_api.cpp
Connections 21
- VM Public API → VM Lifecycle: creates and controls
- VM Lifecycle → Bytecode Interpreter: runs
- VM Lifecycle → Class Loading: loads classes
- VM Lifecycle → Managed Threads: manages
- Bytecode Interpreter → Managed Objects: operates on
- Bytecode Interpreter → Native Interface: invokes native methods
- Class Loading → Artifact Readers: reads artifacts
- Class Loading → Class & Constant Pool: builds
- Bytecode Interpreter → Class & Constant Pool: resolves bytecode symbols
- Native Interface → Native Binding Core: dispatches through
- Native Binding Core → Base Native APIs: supports
- Native Binding Core → Graphics Bindings: supports
- Native Binding Core → Network Bindings: supports
- Native Interface → Managed Objects: preserves references
- VM Lifecycle → System API Contract: uses platform services
- Base Native APIs → System API Contract: uses system APIs
- Graphics Bindings → System API Contract: uses platform services
- Network Bindings → System API Contract: uses network services
- System API Contract → FreeRTOS Adapter: thread implementation
- System API Contract → FatFs Adapter: I/O implementation
- System API Contract → lwIP Adapter: network implementation