NitroVM

A High-Performance Virtual Machine for Delphi

Learn More

What is NitroVM?

A Modern Virtual Machine for Delphi

NitroVM™ is a high-performance, stack-based virtual machine designed specifically for Delphi developers who need flexible, cross-platform code execution capabilities. Built with modern software architecture principles, it provides a robust foundation for plugin systems, scripting engines, and modular applications.

Solving Real-World Problems

Traditional Delphi applications face challenges with modularity, cross-platform deployment, and runtime extensibility. NitroVM addresses these issues by providing:

  • Dynamic code loading and execution without application restart
  • Safe sandboxed execution environment for untrusted code
  • Seamless integration with existing Delphi applications
  • Cross-platform bytecode that runs on Windows, Linux, and macOS

Perfect For

πŸ”§ Plugin Architectures

Build extensible applications where users can add custom functionality through dynamically loaded modules.

πŸ“œ Scripting Engines

Embed powerful scripting capabilities in your applications with full access to Pascal types and external libraries.

🌐 Cross-Platform Tools

Deploy the same business logic across multiple platforms using NitroVM's platform abstraction layer.

πŸ”„ Hot-Reloadable Systems

Update application logic in real-time without stopping execution - perfect for development and production scenarios.

Core Features

⚑

High-Performance Architecture

Stack-based virtual machine with optimized bytecode execution and native calling conventions.

var LVM: TNitroVM; begin LVM := TNitroVM.Create(); try LVM.BeginProgram() .AddInstruction(NVM_OP_PUSH, TNVMValue.From<string>('Hello NitroVM!')) .AddInstruction(NVM_OP_WRITELN) .AddInstruction(NVM_OP_STOP) .ExecuteProgram(); finally LVM.Free(); end; end;
🌐

Cross-Platform Support

Native support for Windows x64, Linux, and macOS with platform abstraction layer.

// Platform information WriteLn('Platform: ', NVMGetPlatformName()); WriteLn('Architecture: ', NVMGetArchitectureName()); WriteLn('64-bit: ', NVMIs64BitPlatform()); // External library extension WriteLn('Library ext: ', NVMGetLibraryExtension());
πŸ”§

Built-in Opcodes

Comprehensive set of built-in operations for arithmetic, strings, control flow, and I/O.

// Arithmetic and comparison LVM.AddInstruction(NVM_OP_PUSH, TNVMValue.From<Int32>(10)) .AddInstruction(NVM_OP_PUSH, TNVMValue.From<Int32>(5)) .AddInstruction(NVM_OP_ADD_INT32) // Result: 15 .AddInstruction(NVM_OP_WRITELN); // Output result
πŸ”„

Hot Reloading

Dynamic module reloading during runtime without stopping execution.

// Hot reload support if LVM.CanHotReload('MyModule') then begin LVM.StartHotReload(); LVM.ReloadModule('MyModule'); LVM.CompleteHotReload(); WriteLn('Module reloaded successfully!'); end;

Dynamic Module System

Create and Build Modules

Build modules programmatically with functions, exports, and dependencies.

// Create a new module var LModule: TNVMModule; begin LModule := LVM.CreateModule('MathLib'); LVM.BeginModuleBuilder(LModule) .BeginFunction('Add', 2) .AddModuleInstruction(LModule, NVM_OP_ADD_INT32) .AddModuleInstruction(LModule, NVM_OP_RETURN) .EndFunction() .EndModuleBuilder(LModule) .RegisterCreatedModule(LModule); end;

Load and Save Modules

Persistent module storage with dependency resolution and version management.

// Load module from file var LModule: TNVMModule; begin LModule := LVM.LoadModule('MyLibrary.nvmm'); // Save module to file LModule.SaveToFile('MyLibrary.nvmm'); // Call module function var LResult := LVM.CallModuleFunction('MyLibrary', 'Calculate', [10, 20]); end;

External DLL Integration

Universal DLL Access

Call any external DLL function with automatic type marshalling and platform abstraction.

// Load Windows API LVM.LoadExternalLibrary('user32.dll'); LVM.RegisterExternalFunction('MessageBoxW', 'user32.dll'); // Call MessageBox var LResult: TNVMValue; begin LResult := LVM.CallExternalFunction('MessageBoxW', [ 0, // hWnd PWideChar('Hello from NitroVM!'), // lpText PWideChar('NitroVM'), // lpCaption 0 // uType ]); end;

Native Memory Management

Direct native memory allocation and pointer manipulation for high-performance scenarios.

// Allocate native memory var LMemPtr: Pointer; LSize: Cardinal; begin LSize := 1024; LMemPtr := LVM.AllocateNativeMemory(LSize); try // Use memory... FillChar(LMemPtr^, LSize, 0); finally LVM.FreeNativeMemory(LMemPtr); end; end;

Advanced Type System

Complete Pascal Types

Full support for all Pascal types including integers, floats, strings, arrays, records, and variants.

// Type support examples LVM.Push(TNVMValue.From<Int32>(42)); LVM.Push(TNVMValue.From<Double>(3.14159)); LVM.Push(TNVMValue.From<string>('Hello World')); LVM.Push(TNVMValue.From<Boolean>(True)); // Complex types var LArray: TArray<Integer>; begin SetLength(LArray, 3); LArray[0] := 1; LArray[1] := 2; LArray[2] := 3; LVM.Push(TNVMValue.From<TArray<Integer>>(LArray)); end;

RTTI-Based Serialization

Automatic type detection and serialization using Delphi's RTTI system.

// Automatic type handling var LValue: TNVMValue; LTypeInfo: PTypeInfo; begin LValue := LVM.Pop(); LTypeInfo := LValue.TypeInfo; case LTypeInfo.Kind of tkInteger: WriteLn('Integer: ', LValue.AsType<Integer>); tkFloat: WriteLn('Float: ', LValue.AsType<Double>); tkString: WriteLn('String: ', LValue.AsType<string>); end; end;

Why Choose NitroVM?

  • High Performance: Optimized bytecode execution with native calling conventions
  • Cross-Platform: Single codebase runs on Windows, Linux, and macOS
  • Modular Design: Dynamic loading and hot reloading of code modules
  • External Integration: Direct access to any DLL/shared library
  • Type Safety: Complete Pascal type system with RTTI support
  • Memory Efficient: Optimized memory management and garbage collection
  • Developer Friendly: Rich API with fluent interface design
  • Production Ready: Comprehensive error handling and debugging tools
// Complete example: Plugin system var LVM: TNitroVM; LPlugin: TNVMModule; LResult: TNVMValue; begin LVM := TNitroVM.Create(); try // Load external dependencies LVM.LoadExternalLibrary('mylib.dll'); // Load plugin module LPlugin := LVM.LoadModule('plugin.nvmm'); // Execute plugin function LResult := LVM.CallModuleFunction('plugin', 'Process', ['data']); WriteLn('Result: ', LResult.AsType<string>); finally LVM.Free(); end; end;