builder+vm: unify method calls via emit_unified_call; add RouterPolicy trace; finalize LocalSSA/BlockSchedule guards; docs + selfhost quickstart
- Unify standard method calls to emit_unified_call; route via RouterPolicy and apply rewrite::{special,known} at a single entry.\n- Stabilize emit-time invariants: LocalSSA finalize + BlockSchedule PHI→Copy→Call ordering; metadata propagation on copies.\n- Known rewrite default ON (userbox only, strict guards) with opt-out flag NYASH_REWRITE_KNOWN_DEFAULT=0.\n- Expand TypeAnnotation whitelist (is_digit_char/is_hex_digit_char/is_alpha_char/Map.has).\n- Docs: unified-method-resolution design note; Quick Reference normalization note; selfhosting/quickstart.\n- Tools: add tools/selfhost_smoke.sh (dev-only).\n- Keep behavior unchanged for Unknown/core/user-instance via BoxCall fallback; all tests green (quick/integration).
This commit is contained in:
@ -8,10 +8,11 @@ impl super::MirBuilder {
|
||||
expression: ASTNode,
|
||||
) -> Result<ValueId, String> {
|
||||
let res_val = self.build_expression_impl(expression)?;
|
||||
let res_local = self.local_ssa_ensure(res_val, 0);
|
||||
let ok_id = self.value_gen.next();
|
||||
self.emit_instruction(super::MirInstruction::BoxCall {
|
||||
dst: Some(ok_id),
|
||||
box_val: res_val,
|
||||
box_val: res_local,
|
||||
method: "isOk".to_string(),
|
||||
args: vec![],
|
||||
method_id: None,
|
||||
@ -19,20 +20,17 @@ impl super::MirBuilder {
|
||||
})?;
|
||||
let then_block = self.block_gen.next();
|
||||
let else_block = self.block_gen.next();
|
||||
self.emit_instruction(super::MirInstruction::Branch {
|
||||
condition: ok_id,
|
||||
then_bb: then_block,
|
||||
else_bb: else_block,
|
||||
})?;
|
||||
let ok_local = self.local_ssa_ensure(ok_id, 4);
|
||||
crate::mir::builder::emission::branch::emit_conditional(self, ok_local, then_block, else_block)?;
|
||||
self.start_new_block(then_block)?;
|
||||
self.emit_instruction(super::MirInstruction::Return {
|
||||
value: Some(res_val),
|
||||
value: Some(res_local),
|
||||
})?;
|
||||
self.start_new_block(else_block)?;
|
||||
let val_id = self.value_gen.next();
|
||||
self.emit_instruction(super::MirInstruction::BoxCall {
|
||||
dst: Some(val_id),
|
||||
box_val: res_val,
|
||||
box_val: res_local,
|
||||
method: "getValue".to_string(),
|
||||
args: vec![],
|
||||
method_id: None,
|
||||
|
||||
Reference in New Issue
Block a user