Skip to content

Commit

Permalink
remove the header comment as it will probably get out of sync in the …
Browse files Browse the repository at this point in the history
…future
  • Loading branch information
mhmd-azeez committed Feb 6, 2025
1 parent 42e0afb commit bee95a4
Showing 1 changed file with 0 additions and 49 deletions.
49 changes: 0 additions & 49 deletions crates/cli/src/shims.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,55 +2,6 @@ use crate::ts_parser::Interface;
use anyhow::Result;
use std::path::Path;
use wagen::{BlockType, Instr, ValType};
// For Host Functions, the JS PDK takes TypeScript interface declarations like:
// ```typescript
// declare module 'extism:host' {
// interface user {
// floatInputs(p1: F64, p2: F32): I64;
// floatOutput(p1: I32): F64;
// }
// }
//
// Detailed call flow for: floatInputs(1.23, 4.56)
//
// 1. JS PDK Prelude (host.ts):
// - Values are passed through as bit patterns
// - Calls __invokeHostFunc(0, bits1, bits2, 0, 0, 0)
//
// 2. Core (globals.rs):
// - Forwards call to imported __invokeHostFunc from shims
// - Converts return value based on __get_function_return_type
//
// 3. Shims (this module):
// - Routes call to correct host function based on index
// - Converts bit patterns to expected types
// - Returns result as bit pattern
//
// 4. Return path:
// - Core queries __get_function_return_type(0) to convert bits
// - JS PDK gets properly typed value
//
// All values are passed as bit patterns and type checking/conversion
// happens at call boundaries. Host functions always return i64 bits
// which are reinterpreted based on the declared return type.
//
// Generated functions:
// 1. Converters (match import signatures):
// - __conv_floatInputs(i32, i64, i64) -> i64
// - __conv_floatOutput(i32, i64) -> i64
//
// 2. Routers (standard 5-param interface):
// - __invokeHostFunc(i32, i64, i64, i64, i64, i64) -> i64
//
// 3. Type info:
// - __get_function_return_type(i32) -> i32
// Returns: I32(1), I64(2), F32(3), F64(4)
//
// Host imports generated:
// "extism:host/user" {
// "floatInputs": (f64, f32) -> i64
// "floatOutput": (i32) -> f64
// }

pub fn generate_wasm_shims(
path: impl AsRef<Path>,
Expand Down

0 comments on commit bee95a4

Please sign in to comment.