Skip to content

Document vtable (Virtual Method Table) - Value 5 #84

@LSantha

Description

@LSantha

vtable (Virtual Method Table)

Document the vtable JNode concept in the wiki.

Value: 5

Concept Summary

Method dispatch table for virtual method calls in class hierarchy. vtable enables efficient virtual method dispatch by providing an index-based lookup table for method implementations in the class hierarchy.

Key Files

  • core/src/core/org/jnode/vm/classmgr/vtable.java
  • core/src/core/org/jnode/vm/classmgr/VirtualMethods.java

Occurrences

~180 references in virtual methods package

Wiki Status

NOT documented

Bridges

Virtual methods, JIT compiler, Method dispatch

Instructions

Skill to Use

Use the [[update-wiki|update-wiki skill]] (load with skill({ name: "update-wiki" })) for understanding JNode internals.

Context Research

Review vtable.java and VirtualMethods.java to understand the virtual method table. Study how vtable is constructed for each class, how method indices are assigned, and how virtual calls are resolved. Research how vtable interacts with JIT compilation.

Update index.md

  • Pages table: Add entry for vtable.md
  • Concepts → Pages table: Add "vtable" mapping to [[vtable]]
  • Source Path → Pages table: Add mappings for core/src/core/org/jnode/vm/classmgr/vtable.java
  • Task Routing table: Add relevant task route(s)

Task Routing Suggestions

  1. Virtual method debugging: vtable is central to virtual dispatch
  2. JIT optimization: Understanding vtable is key for JIT decisions
  3. Inheritance issues: vtable structure affects inheritance behavior

Wiki Page Structure

# vtable (Virtual Method Table)

> Method dispatch table for virtual method calls in class hierarchy.

## Overview
2-3 paragraph explanation of vtable, its role in virtual method dispatch, and how it enables efficient method calls.

## Key Components
| Class / File | Role |
|---|---|
| `core/src/core/org/jnode/vm/classmgr/vtable.java` | vtable implementation |
| `core/src/core/org/jnode/vm/classmgr/VirtualMethods.java` | Virtual methods support |

## How It Works
Explanation of how vtable works, how it's constructed for each class, how method indices are assigned, and how virtual calls use vtable.

## Gotchas & Non-Obvious Behavior
- vtable must be carefully maintained during inheritance
- Method overrides affect vtable layout
- JIT can optimize vtable access

## Related Pages
- [[Virtual-Methods]]
- [[IMT]]
- [[CompiledIMT]]

Related Concepts: Virtual methods, Method dispatch, vtable, Inheritance, JIT

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions