Skip to content

Language: JIT support for non-void function return types #55

@PurHur

Description

@PurHur

Problem

lib/JIT.php throws on non-void returns:
Non-void return types not supported yet

User-defined functions with return values are required for any non-trivial app structure (helpers, routers).

Goal

Compile functions returning strings, ints, bools, arrays (per existing value types).

Tasks

  • Extend TYPE_RETURN / TYPE_FUNCCALL_EXEC_RETURN paths for typed returns
  • ABI: map PHP return types to LLVM types (__value__*, strings, hashtables)
  • PHPT: function returning string concatenation, recursive calls (if stack supported)
  • Update capability matrix in README

Acceptance criteria

function greet(string $name): string { return 'Hello '.$name; }
echo greet('World');

works in JIT and AOT.

Files

  • lib/JIT.php, lib/JIT.pre

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions