Class BytecodeContext.Builder

    • Constructor Detail

      • Builder

        public Builder()
    • Method Detail

      • heapManager

        public BytecodeContext.Builder heapManager​(HeapManager heapManager)
        Sets the heap manager that owns objects and arrays during execution.
        Parameters:
        heapManager - the heap manager
        Returns:
        this builder
      • classResolver

        public BytecodeContext.Builder classResolver​(ClassResolver classResolver)
        Sets the resolver used to look up classes and methods.
        Parameters:
        classResolver - the class resolver
        Returns:
        this builder
      • nativeRegistry

        public BytecodeContext.Builder nativeRegistry​(NativeRegistry nativeRegistry)
        Sets the registry of native method handlers; a default-populated registry is created if omitted.
        Parameters:
        nativeRegistry - the native registry
        Returns:
        this builder
      • invocationHandler

        public BytecodeContext.Builder invocationHandler​(InvocationHandler invocationHandler)
        Overrides the default per-mode invocation handler.
        Parameters:
        invocationHandler - the handler to use, or null for the mode default
        Returns:
        this builder
      • maxCallDepth

        public BytecodeContext.Builder maxCallDepth​(int depth)
        Sets the maximum call stack depth.
        Parameters:
        depth - maximum number of nested frames
        Returns:
        this builder
        Throws:
        IllegalArgumentException - if depth is not positive
      • maxInstructions

        public BytecodeContext.Builder maxInstructions​(int limit)
        Sets the instruction budget after which execution aborts.
        Parameters:
        limit - maximum number of instructions to execute
        Returns:
        this builder
        Throws:
        IllegalArgumentException - if limit is not positive
      • trackStatistics

        public BytecodeContext.Builder trackStatistics​(boolean track)
        Controls whether execution statistics are tracked.
        Parameters:
        track - true to track statistics
        Returns:
        this builder
      • build

        public BytecodeContext build()
        Validates required components and creates the context, defaulting the native registry and propagating the resolver's compact-strings setting to the heap.
        Returns:
        the built context
        Throws:
        IllegalStateException - if the heap manager or class resolver is missing