//! JVMRS - JVM implementation in Rust
//!
//! JVMRS is a high-performance Java Virtual Machine written in Rust,
//! featuring JIT compilation, inline caching, thread-local allocation,
//! and comprehensive polyglot capabilities.
//!
//! ## Performance Features
//!
//! - **Inline Caching**: 3-5x faster virtual method dispatch
//! - **Thread-Local Allocation (TLAB)**: 2-3x faster object allocation
//! - **Tiered JIT Compilation**: Adaptive compilation strategy
//! - **Generational GC**: Parallel sweep with reduced pause times
//!
//! ## Unique Capabilities
//!
//! - **Rust-Based**: Memory safety by construction
//! - **Polyglot**: Direct Java/Rust interop without JNI overhead
//! - **WebAssembly**: Native WASM support for browser/edge deployment
//! - **Embedded**: no_std support for resource-constrained environments
//! - **Interactive REPL**: Full-featured REPL for JVM exploration
//!
//! ## Getting Started
//!
//! ### Quick Start
//!
//! ```rust
//! use jvmrs::Interpreter;
//!
//! // Create interpreter
//! # let mut interpreter = Interpreter::new();
//! // Run a Java class
//! # // interpreter.run_main("HelloWorld")?;
//! # Ok::<(), jvmrs::JvmError>(())
//! ```
//!
//! ### Interactive REPL
//!
//! ```bash
//! cargo run -- --repl
//! ```
//!
//! ### Performance Optimization
//!
//! ```rust
//! use jvmrs::jit::TieredCompilationConfig;
//!
//! # let config = TieredCompilationConfig {
//! #     baseline_threshold: 50,
//! #     optimized_threshold: 1000,
//! #     ..Default::default()
//! # };
//! ```
//!
//! ## Module Organization
//!
//! ### Core / Runtime
//! - `class_file` - Class file parsing
//! - `class_loader` - Class loading from classpath
//! - `class_cache` - Fast binary cache (.jvmc)
//! - `memory` - Heap, stack frames, values
//! - `allocator` - Arena-based allocation
//! - `gc` - Garbage collection
//! - `inline_cache` - Inline caching for method invocation
//! - `tlab` - Thread-local allocation buffers
//! - `compressed_oops` - 16-bit compressed references for memory-constrained environments
//!
//! ### Execution
//! - `interpreter` - Bytecode execution engine
//! - `native` - Native method dispatch
//! - `reflection` - Runtime introspection
//! - `repl` - Interactive REPL for JVM exploration
//!
//! ### Compilation
//! - `jit` - JIT manager, tiered compilation
//! - `cranelift_jit` - Cranelift bytecode-to-native
//! - `aot_compiler` - AOT to object files
//! - `wasm_backend` - WebAssembly emission (feature: wasm)
//!
//! ### Developer Tools
//! - `debug` - Logging, trace config
//! - `profiler` - Flame graphs, hotspots
//! - `trace` - Time-travel debugging
//! - `deterministic` - Reproducible execution
//!
//! ### Optional Features
//! - `ffi` - C API (feature: ffi)
//! - `interop` - Java/Rust interop (feature: interop)
//! - `async_io` - Async class loading (feature: async)
//! - `simd` - Vectorized arrays (feature: simd)
//! - `truffle` - GraalVM-style language API (feature: truffle)
//! - `security`, `aop`, `cloud`, `hot_reload` - Additional capabilities
//!
//! ## Documentation
//!
//! - [Quick Start Guide](QUICKSTART.md) - Get started in minutes
//! - [Architecture Documentation](ARCHITECTURE.md) - Design and components
//! - [API Reference](docs/api-reference.md) - Complete API reference
//! - [Performance Tuning Guide](docs/performance-tuning.md) - Optimize performance
//! - [Polyglot Programming Guide](docs/polyglot-programming.md) - Java/Rust interop
//! - [Competitive Differentiation](docs/competitive-differentiation.md) - vs HotSpot/GraalVM
//! - [Implementation Summary](IMPLEMENTATION_SUMMARY.md) - Features and enhancements
//! - [Developer Experience](docs/developer-experience.md) - Tools and workflows
//!
//! ## Examples
//!
//! ### Basic Usage
//!
//! ```rust
//! use jvmrs::{Interpreter, Value};
//!
//! # let mut interpreter = Interpreter::new();
//! // Call a static method
//! # // let result = interpreter.invoke_method(
//! # //     "java/lang/Math",
//! # //     "max",
//! # //     &[Value::Int(10), Value::Int(20)]
//! # // )?;
//! # // assert_eq!(result, Value::Int(20));
//! # Ok::<(), jvmrs::JvmError>(())
//! ```
//!
//! ### Polyglot Programming
//!
//! ```rust
//! use jvmrs::{Interpreter, Value};
//!
//! # let mut interpreter = Interpreter::new();
//! // Register Rust function
//! # // interpreter.register_native_method(
//! # //     "com/example/Native",
//! # //     "add",
//! # //     "(II)I",
//! # //     Box::new(|args, _memory| {
//! # //         let a = args[0].as_int();
//! # //         let b = args[1].as_int();
//! # //         Ok(Value::Int(a + b))
//! # //     })
//! # // )?;
//! // Call from Java
//! # // interpreter.run_main("com/example/Caller")?;
//! # Ok::<(), jvmrs::JvmError>(())
//! ```
//!
//! ### Performance Monitoring
//!
//! ```rust
//! use jvmrs::{Interpreter, Profiler};
//!
//! # let mut interpreter = Interpreter::new();
//! // Monitor inline cache
//! # // let stats = interpreter.get_inline_cache_stats();
//! # // for (site, cache_stats) in stats {
//! # //     println!("Hit rate: {:.2}%", cache_stats.hit_rate);
//! # // }
//! // Monitor TLAB
//! # // let stats = interpreter.get_tlab_stats();
//! # // println!("TLAB hit rate: {:.2}%", stats.hit_rate);
//! // Profile performance
//! # let profiler = Profiler::new();
//! # // interpreter.set_profiler(Some(profiler.clone()));
//! // ... run workload ...
//! # // profiler.generate_flame_graph("flamegraph.svg")?;
//! # Ok::<(), jvmrs::JvmError>(())
//! ```
//!
//! ## Benchmarks
//!
//! Run the comprehensive benchmark suite:
//!
//! ```bash
//! cargo bench
//! ```
//!
//! ## Testing
//!
//! ```bash
//! cargo test                        # Unit tests
//! cargo test --test property_tests    # Property-based tests
//! ```
//!
//! ## License
//!
//! Licensed under either of [MIT](LICENSE-MIT) or [Apache-2.0](LICENSE-APACHE) at your option.

// Core modules
pub mod error;

// Core error type
pub use error::JvmError;

// Core: class loading and memory
pub mod allocator;
pub mod class_cache;
pub mod class_file;
pub mod class_loader;
pub mod compressed_oops;
pub mod gc;
pub mod inline_cache;
pub mod memory;
pub mod tlab;

// Re-export commonly used memory types
pub use memory::{Memory, Value, StackFrame};
pub use error::MemoryError;

// Re-export compressed oops types
pub use compressed_oops::{CompressedOops, OopMode};

// Execution
pub mod annotations;
pub mod interpreter;
pub mod jni;
pub mod native;
pub mod reflection;
pub mod serialization;
pub mod visualization;

// Re-export the main interpreter type
pub use interpreter::Interpreter;

// Compilation
pub mod aot_compiler;
pub mod cranelift_jit;
pub mod jit;

// Re-export commonly used JIT types
pub use jit::{JitManager, TieredCompilationConfig, CompilationLevel};

// Developer tools
pub mod debug;
pub mod deterministic;
pub mod profiler;
pub mod trace;

// Re-export profiler
pub use profiler::Profiler;

// Optional / experimental
pub mod aop;
pub mod cloud;
pub mod escape_analysis;
pub mod extensions;
pub mod hot_reload;
pub mod osr;
pub mod pgo;
pub mod repl;
pub mod security;

#[cfg(feature = "no_std")]
pub mod core;

#[cfg(feature = "ffi")]
pub mod ffi;

#[cfg(feature = "interop")]
pub mod interop;

#[cfg(feature = "async")]
pub mod async_io;

#[cfg(feature = "simd")]
pub mod simd;

#[cfg(feature = "wasm")]
pub mod wasm_backend;

#[cfg(feature = "truffle")]
pub mod truffle;
