🏗️ Refactor: Major LLVM codegen modularization + Phase 15 docs cleanup + Phase 21 DDD concept
## LLVM Codegen Refactoring (by ChatGPT5)
- Split massive boxcall.rs into focused submodules:
- strings.rs: String method optimizations (concat, length)
- arrays.rs: Array operations (get, set, push, length)
- maps.rs: Map operations (get, set, has, size)
- fields.rs: getField/setField handling
- invoke.rs: Tagged invoke implementation
- marshal.rs: Helper functions for marshaling
- Improved code organization and maintainability
- No functional changes, pure refactoring
## Phase 15 Documentation Cleanup
- Restructured phase-15 folder:
- implementation/: Technical implementation docs
- planning/: Planning and sequence docs
- archive/: Redundant/old content
- Removed duplicate content (80k→20k line reduction mentioned 5 times)
- Converted all .txt files to .md for consistency
- Fixed broken links in README.md
- Removed redundant INDEX.md
## Phase 21: Database-Driven Development (New)
- Revolutionary concept: Source code in SQLite instead of files
- Instant refactoring with SQL transactions
- Structured management of boxes, methods, dependencies
- Technical design with security considerations
- Vision: World's first DB-driven programming language
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-12 00:35:11 +09:00
|
|
|
use std::collections::HashMap;
|
|
|
|
|
|
|
|
|
|
use inkwell::{values::BasicValueEnum as BVE, AddressSpace};
|
|
|
|
|
|
|
|
|
|
use crate::backend::llvm::context::CodegenContext;
|
2025-09-12 19:23:16 +09:00
|
|
|
use crate::mir::{function::MirFunction, BasicBlockId, ValueId};
|
|
|
|
|
use super::builder_cursor::BuilderCursor;
|
🏗️ Refactor: Major LLVM codegen modularization + Phase 15 docs cleanup + Phase 21 DDD concept
## LLVM Codegen Refactoring (by ChatGPT5)
- Split massive boxcall.rs into focused submodules:
- strings.rs: String method optimizations (concat, length)
- arrays.rs: Array operations (get, set, push, length)
- maps.rs: Map operations (get, set, has, size)
- fields.rs: getField/setField handling
- invoke.rs: Tagged invoke implementation
- marshal.rs: Helper functions for marshaling
- Improved code organization and maintainability
- No functional changes, pure refactoring
## Phase 15 Documentation Cleanup
- Restructured phase-15 folder:
- implementation/: Technical implementation docs
- planning/: Planning and sequence docs
- archive/: Redundant/old content
- Removed duplicate content (80k→20k line reduction mentioned 5 times)
- Converted all .txt files to .md for consistency
- Fixed broken links in README.md
- Removed redundant INDEX.md
## Phase 21: Database-Driven Development (New)
- Revolutionary concept: Source code in SQLite instead of files
- Instant refactoring with SQL transactions
- Structured management of boxes, methods, dependencies
- Technical design with security considerations
- Vision: World's first DB-driven programming language
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-12 00:35:11 +09:00
|
|
|
|
|
|
|
|
/// Handle MapBox fast-paths (core-first). Returns true if handled.
|
2025-09-12 19:23:16 +09:00
|
|
|
pub(super) fn try_handle_map_method<'ctx, 'b>(
|
🏗️ Refactor: Major LLVM codegen modularization + Phase 15 docs cleanup + Phase 21 DDD concept
## LLVM Codegen Refactoring (by ChatGPT5)
- Split massive boxcall.rs into focused submodules:
- strings.rs: String method optimizations (concat, length)
- arrays.rs: Array operations (get, set, push, length)
- maps.rs: Map operations (get, set, has, size)
- fields.rs: getField/setField handling
- invoke.rs: Tagged invoke implementation
- marshal.rs: Helper functions for marshaling
- Improved code organization and maintainability
- No functional changes, pure refactoring
## Phase 15 Documentation Cleanup
- Restructured phase-15 folder:
- implementation/: Technical implementation docs
- planning/: Planning and sequence docs
- archive/: Redundant/old content
- Removed duplicate content (80k→20k line reduction mentioned 5 times)
- Converted all .txt files to .md for consistency
- Fixed broken links in README.md
- Removed redundant INDEX.md
## Phase 21: Database-Driven Development (New)
- Revolutionary concept: Source code in SQLite instead of files
- Instant refactoring with SQL transactions
- Structured management of boxes, methods, dependencies
- Technical design with security considerations
- Vision: World's first DB-driven programming language
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-12 00:35:11 +09:00
|
|
|
codegen: &CodegenContext<'ctx>,
|
2025-09-12 19:23:16 +09:00
|
|
|
cursor: &mut BuilderCursor<'ctx, 'b>,
|
2025-09-12 20:27:32 +09:00
|
|
|
resolver: &mut super::Resolver<'ctx>,
|
2025-09-12 19:23:16 +09:00
|
|
|
cur_bid: BasicBlockId,
|
🏗️ Refactor: Major LLVM codegen modularization + Phase 15 docs cleanup + Phase 21 DDD concept
## LLVM Codegen Refactoring (by ChatGPT5)
- Split massive boxcall.rs into focused submodules:
- strings.rs: String method optimizations (concat, length)
- arrays.rs: Array operations (get, set, push, length)
- maps.rs: Map operations (get, set, has, size)
- fields.rs: getField/setField handling
- invoke.rs: Tagged invoke implementation
- marshal.rs: Helper functions for marshaling
- Improved code organization and maintainability
- No functional changes, pure refactoring
## Phase 15 Documentation Cleanup
- Restructured phase-15 folder:
- implementation/: Technical implementation docs
- planning/: Planning and sequence docs
- archive/: Redundant/old content
- Removed duplicate content (80k→20k line reduction mentioned 5 times)
- Converted all .txt files to .md for consistency
- Fixed broken links in README.md
- Removed redundant INDEX.md
## Phase 21: Database-Driven Development (New)
- Revolutionary concept: Source code in SQLite instead of files
- Instant refactoring with SQL transactions
- Structured management of boxes, methods, dependencies
- Technical design with security considerations
- Vision: World's first DB-driven programming language
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-12 00:35:11 +09:00
|
|
|
func: &MirFunction,
|
|
|
|
|
vmap: &mut HashMap<ValueId, inkwell::values::BasicValueEnum<'ctx>>,
|
|
|
|
|
dst: &Option<ValueId>,
|
|
|
|
|
box_val: &ValueId,
|
|
|
|
|
method: &str,
|
|
|
|
|
args: &[ValueId],
|
|
|
|
|
recv_h: inkwell::values::IntValue<'ctx>,
|
|
|
|
|
) -> Result<bool, String> {
|
2025-09-12 12:07:07 +09:00
|
|
|
// Only when receiver is annotated as MapBox
|
|
|
|
|
let is_map_annot = matches!(func.metadata.value_types.get(box_val), Some(crate::mir::MirType::Box(b)) if b == "MapBox");
|
|
|
|
|
if !is_map_annot {
|
🏗️ Refactor: Major LLVM codegen modularization + Phase 15 docs cleanup + Phase 21 DDD concept
## LLVM Codegen Refactoring (by ChatGPT5)
- Split massive boxcall.rs into focused submodules:
- strings.rs: String method optimizations (concat, length)
- arrays.rs: Array operations (get, set, push, length)
- maps.rs: Map operations (get, set, has, size)
- fields.rs: getField/setField handling
- invoke.rs: Tagged invoke implementation
- marshal.rs: Helper functions for marshaling
- Improved code organization and maintainability
- No functional changes, pure refactoring
## Phase 15 Documentation Cleanup
- Restructured phase-15 folder:
- implementation/: Technical implementation docs
- planning/: Planning and sequence docs
- archive/: Redundant/old content
- Removed duplicate content (80k→20k line reduction mentioned 5 times)
- Converted all .txt files to .md for consistency
- Fixed broken links in README.md
- Removed redundant INDEX.md
## Phase 21: Database-Driven Development (New)
- Revolutionary concept: Source code in SQLite instead of files
- Instant refactoring with SQL transactions
- Structured management of boxes, methods, dependencies
- Technical design with security considerations
- Vision: World's first DB-driven programming language
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-12 00:35:11 +09:00
|
|
|
return Ok(false);
|
|
|
|
|
}
|
|
|
|
|
let i64t = codegen.context.i64_type();
|
|
|
|
|
match method {
|
|
|
|
|
"size" => {
|
2025-09-12 12:07:07 +09:00
|
|
|
if std::env::var("NYASH_CLI_VERBOSE").ok().as_deref() == Some("1") {
|
|
|
|
|
eprintln!("[LLVM] lower Map.size (core)");
|
|
|
|
|
}
|
🏗️ Refactor: Major LLVM codegen modularization + Phase 15 docs cleanup + Phase 21 DDD concept
## LLVM Codegen Refactoring (by ChatGPT5)
- Split massive boxcall.rs into focused submodules:
- strings.rs: String method optimizations (concat, length)
- arrays.rs: Array operations (get, set, push, length)
- maps.rs: Map operations (get, set, has, size)
- fields.rs: getField/setField handling
- invoke.rs: Tagged invoke implementation
- marshal.rs: Helper functions for marshaling
- Improved code organization and maintainability
- No functional changes, pure refactoring
## Phase 15 Documentation Cleanup
- Restructured phase-15 folder:
- implementation/: Technical implementation docs
- planning/: Planning and sequence docs
- archive/: Redundant/old content
- Removed duplicate content (80k→20k line reduction mentioned 5 times)
- Converted all .txt files to .md for consistency
- Fixed broken links in README.md
- Removed redundant INDEX.md
## Phase 21: Database-Driven Development (New)
- Revolutionary concept: Source code in SQLite instead of files
- Instant refactoring with SQL transactions
- Structured management of boxes, methods, dependencies
- Technical design with security considerations
- Vision: World's first DB-driven programming language
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-12 00:35:11 +09:00
|
|
|
if !args.is_empty() {
|
|
|
|
|
return Err("MapBox.size expects 0 arg".to_string());
|
|
|
|
|
}
|
|
|
|
|
let fnty = i64t.fn_type(&[i64t.into()], false);
|
|
|
|
|
let callee = codegen
|
|
|
|
|
.module
|
|
|
|
|
.get_function("nyash.map.size_h")
|
|
|
|
|
.unwrap_or_else(|| codegen.module.add_function("nyash.map.size_h", fnty, None));
|
2025-09-12 19:23:16 +09:00
|
|
|
let call = cursor
|
|
|
|
|
.emit_instr(cur_bid, |b| b.build_call(callee, &[recv_h.into()], "msize"))
|
🏗️ Refactor: Major LLVM codegen modularization + Phase 15 docs cleanup + Phase 21 DDD concept
## LLVM Codegen Refactoring (by ChatGPT5)
- Split massive boxcall.rs into focused submodules:
- strings.rs: String method optimizations (concat, length)
- arrays.rs: Array operations (get, set, push, length)
- maps.rs: Map operations (get, set, has, size)
- fields.rs: getField/setField handling
- invoke.rs: Tagged invoke implementation
- marshal.rs: Helper functions for marshaling
- Improved code organization and maintainability
- No functional changes, pure refactoring
## Phase 15 Documentation Cleanup
- Restructured phase-15 folder:
- implementation/: Technical implementation docs
- planning/: Planning and sequence docs
- archive/: Redundant/old content
- Removed duplicate content (80k→20k line reduction mentioned 5 times)
- Converted all .txt files to .md for consistency
- Fixed broken links in README.md
- Removed redundant INDEX.md
## Phase 21: Database-Driven Development (New)
- Revolutionary concept: Source code in SQLite instead of files
- Instant refactoring with SQL transactions
- Structured management of boxes, methods, dependencies
- Technical design with security considerations
- Vision: World's first DB-driven programming language
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-12 00:35:11 +09:00
|
|
|
.map_err(|e| e.to_string())?;
|
|
|
|
|
if let Some(d) = dst {
|
|
|
|
|
let rv = call
|
|
|
|
|
.try_as_basic_value()
|
|
|
|
|
.left()
|
|
|
|
|
.ok_or("map.size_h returned void".to_string())?;
|
|
|
|
|
vmap.insert(*d, rv);
|
|
|
|
|
}
|
|
|
|
|
Ok(true)
|
|
|
|
|
}
|
|
|
|
|
"has" => {
|
2025-09-12 12:07:07 +09:00
|
|
|
if std::env::var("NYASH_CLI_VERBOSE").ok().as_deref() == Some("1") {
|
|
|
|
|
eprintln!("[LLVM] lower Map.has (core)");
|
|
|
|
|
}
|
🏗️ Refactor: Major LLVM codegen modularization + Phase 15 docs cleanup + Phase 21 DDD concept
## LLVM Codegen Refactoring (by ChatGPT5)
- Split massive boxcall.rs into focused submodules:
- strings.rs: String method optimizations (concat, length)
- arrays.rs: Array operations (get, set, push, length)
- maps.rs: Map operations (get, set, has, size)
- fields.rs: getField/setField handling
- invoke.rs: Tagged invoke implementation
- marshal.rs: Helper functions for marshaling
- Improved code organization and maintainability
- No functional changes, pure refactoring
## Phase 15 Documentation Cleanup
- Restructured phase-15 folder:
- implementation/: Technical implementation docs
- planning/: Planning and sequence docs
- archive/: Redundant/old content
- Removed duplicate content (80k→20k line reduction mentioned 5 times)
- Converted all .txt files to .md for consistency
- Fixed broken links in README.md
- Removed redundant INDEX.md
## Phase 21: Database-Driven Development (New)
- Revolutionary concept: Source code in SQLite instead of files
- Instant refactoring with SQL transactions
- Structured management of boxes, methods, dependencies
- Technical design with security considerations
- Vision: World's first DB-driven programming language
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-12 00:35:11 +09:00
|
|
|
if args.len() != 1 {
|
|
|
|
|
return Err("MapBox.has expects 1 arg".to_string());
|
|
|
|
|
}
|
2025-09-12 22:36:20 +09:00
|
|
|
let key_i = match func.metadata.value_types.get(&args[0]) {
|
|
|
|
|
Some(crate::mir::MirType::String) => {
|
|
|
|
|
// string key: i8* -> handle
|
|
|
|
|
let pv = resolver.resolve_ptr(codegen, cursor, cur_bid, args[0], &std::collections::HashMap::new(), &std::collections::HashMap::new(), &std::collections::HashMap::new(), vmap)?;
|
|
|
|
|
let fnty_conv = i64t.fn_type(&[codegen.context.ptr_type(AddressSpace::from(0)).into()], false);
|
|
|
|
|
let conv = codegen
|
|
|
|
|
.module
|
|
|
|
|
.get_function("nyash.box.from_i8_string")
|
|
|
|
|
.unwrap_or_else(|| codegen.module.add_function("nyash.box.from_i8_string", fnty_conv, None));
|
|
|
|
|
let kcall = cursor
|
|
|
|
|
.emit_instr(cur_bid, |b| b.build_call(conv, &[pv.into()], "key_i8_to_handle"))
|
|
|
|
|
.map_err(|e| e.to_string())?;
|
|
|
|
|
kcall.try_as_basic_value().left().ok_or("from_i8_string returned void".to_string())?.into_int_value()
|
|
|
|
|
}
|
|
|
|
|
_ => resolver.resolve_i64(codegen, cursor, cur_bid, args[0], &std::collections::HashMap::new(), &std::collections::HashMap::new(), &std::collections::HashMap::new(), vmap)?
|
🏗️ Refactor: Major LLVM codegen modularization + Phase 15 docs cleanup + Phase 21 DDD concept
## LLVM Codegen Refactoring (by ChatGPT5)
- Split massive boxcall.rs into focused submodules:
- strings.rs: String method optimizations (concat, length)
- arrays.rs: Array operations (get, set, push, length)
- maps.rs: Map operations (get, set, has, size)
- fields.rs: getField/setField handling
- invoke.rs: Tagged invoke implementation
- marshal.rs: Helper functions for marshaling
- Improved code organization and maintainability
- No functional changes, pure refactoring
## Phase 15 Documentation Cleanup
- Restructured phase-15 folder:
- implementation/: Technical implementation docs
- planning/: Planning and sequence docs
- archive/: Redundant/old content
- Removed duplicate content (80k→20k line reduction mentioned 5 times)
- Converted all .txt files to .md for consistency
- Fixed broken links in README.md
- Removed redundant INDEX.md
## Phase 21: Database-Driven Development (New)
- Revolutionary concept: Source code in SQLite instead of files
- Instant refactoring with SQL transactions
- Structured management of boxes, methods, dependencies
- Technical design with security considerations
- Vision: World's first DB-driven programming language
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-12 00:35:11 +09:00
|
|
|
};
|
|
|
|
|
let fnty = i64t.fn_type(&[i64t.into(), i64t.into()], false);
|
|
|
|
|
let callee = codegen
|
|
|
|
|
.module
|
|
|
|
|
.get_function("nyash.map.has_h")
|
|
|
|
|
.unwrap_or_else(|| codegen.module.add_function("nyash.map.has_h", fnty, None));
|
2025-09-12 19:23:16 +09:00
|
|
|
let call = cursor
|
|
|
|
|
.emit_instr(cur_bid, |b| b.build_call(callee, &[recv_h.into(), key_i.into()], "mhas"))
|
🏗️ Refactor: Major LLVM codegen modularization + Phase 15 docs cleanup + Phase 21 DDD concept
## LLVM Codegen Refactoring (by ChatGPT5)
- Split massive boxcall.rs into focused submodules:
- strings.rs: String method optimizations (concat, length)
- arrays.rs: Array operations (get, set, push, length)
- maps.rs: Map operations (get, set, has, size)
- fields.rs: getField/setField handling
- invoke.rs: Tagged invoke implementation
- marshal.rs: Helper functions for marshaling
- Improved code organization and maintainability
- No functional changes, pure refactoring
## Phase 15 Documentation Cleanup
- Restructured phase-15 folder:
- implementation/: Technical implementation docs
- planning/: Planning and sequence docs
- archive/: Redundant/old content
- Removed duplicate content (80k→20k line reduction mentioned 5 times)
- Converted all .txt files to .md for consistency
- Fixed broken links in README.md
- Removed redundant INDEX.md
## Phase 21: Database-Driven Development (New)
- Revolutionary concept: Source code in SQLite instead of files
- Instant refactoring with SQL transactions
- Structured management of boxes, methods, dependencies
- Technical design with security considerations
- Vision: World's first DB-driven programming language
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-12 00:35:11 +09:00
|
|
|
.map_err(|e| e.to_string())?;
|
|
|
|
|
if let Some(d) = dst {
|
|
|
|
|
let rv = call
|
|
|
|
|
.try_as_basic_value()
|
|
|
|
|
.left()
|
|
|
|
|
.ok_or("map.has_h returned void".to_string())?;
|
|
|
|
|
vmap.insert(*d, rv);
|
|
|
|
|
}
|
|
|
|
|
Ok(true)
|
|
|
|
|
}
|
|
|
|
|
"get" => {
|
2025-09-12 12:07:07 +09:00
|
|
|
if std::env::var("NYASH_CLI_VERBOSE").ok().as_deref() == Some("1") {
|
|
|
|
|
eprintln!("[LLVM] lower Map.get (core)");
|
|
|
|
|
}
|
🏗️ Refactor: Major LLVM codegen modularization + Phase 15 docs cleanup + Phase 21 DDD concept
## LLVM Codegen Refactoring (by ChatGPT5)
- Split massive boxcall.rs into focused submodules:
- strings.rs: String method optimizations (concat, length)
- arrays.rs: Array operations (get, set, push, length)
- maps.rs: Map operations (get, set, has, size)
- fields.rs: getField/setField handling
- invoke.rs: Tagged invoke implementation
- marshal.rs: Helper functions for marshaling
- Improved code organization and maintainability
- No functional changes, pure refactoring
## Phase 15 Documentation Cleanup
- Restructured phase-15 folder:
- implementation/: Technical implementation docs
- planning/: Planning and sequence docs
- archive/: Redundant/old content
- Removed duplicate content (80k→20k line reduction mentioned 5 times)
- Converted all .txt files to .md for consistency
- Fixed broken links in README.md
- Removed redundant INDEX.md
## Phase 21: Database-Driven Development (New)
- Revolutionary concept: Source code in SQLite instead of files
- Instant refactoring with SQL transactions
- Structured management of boxes, methods, dependencies
- Technical design with security considerations
- Vision: World's first DB-driven programming language
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-12 00:35:11 +09:00
|
|
|
if args.len() != 1 {
|
|
|
|
|
return Err("MapBox.get expects 1 arg".to_string());
|
|
|
|
|
}
|
2025-09-12 22:36:20 +09:00
|
|
|
let call = match func.metadata.value_types.get(&args[0]) {
|
|
|
|
|
Some(crate::mir::MirType::String) => {
|
🏗️ Refactor: Major LLVM codegen modularization + Phase 15 docs cleanup + Phase 21 DDD concept
## LLVM Codegen Refactoring (by ChatGPT5)
- Split massive boxcall.rs into focused submodules:
- strings.rs: String method optimizations (concat, length)
- arrays.rs: Array operations (get, set, push, length)
- maps.rs: Map operations (get, set, has, size)
- fields.rs: getField/setField handling
- invoke.rs: Tagged invoke implementation
- marshal.rs: Helper functions for marshaling
- Improved code organization and maintainability
- No functional changes, pure refactoring
## Phase 15 Documentation Cleanup
- Restructured phase-15 folder:
- implementation/: Technical implementation docs
- planning/: Planning and sequence docs
- archive/: Redundant/old content
- Removed duplicate content (80k→20k line reduction mentioned 5 times)
- Converted all .txt files to .md for consistency
- Fixed broken links in README.md
- Removed redundant INDEX.md
## Phase 21: Database-Driven Development (New)
- Revolutionary concept: Source code in SQLite instead of files
- Instant refactoring with SQL transactions
- Structured management of boxes, methods, dependencies
- Technical design with security considerations
- Vision: World's first DB-driven programming language
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-12 00:35:11 +09:00
|
|
|
// key: i8* -> i64 handle via from_i8_string (string key)
|
2025-09-12 22:36:20 +09:00
|
|
|
let pv = resolver.resolve_ptr(codegen, cursor, cur_bid, args[0], &std::collections::HashMap::new(), &std::collections::HashMap::new(), &std::collections::HashMap::new(), vmap)?;
|
🏗️ Refactor: Major LLVM codegen modularization + Phase 15 docs cleanup + Phase 21 DDD concept
## LLVM Codegen Refactoring (by ChatGPT5)
- Split massive boxcall.rs into focused submodules:
- strings.rs: String method optimizations (concat, length)
- arrays.rs: Array operations (get, set, push, length)
- maps.rs: Map operations (get, set, has, size)
- fields.rs: getField/setField handling
- invoke.rs: Tagged invoke implementation
- marshal.rs: Helper functions for marshaling
- Improved code organization and maintainability
- No functional changes, pure refactoring
## Phase 15 Documentation Cleanup
- Restructured phase-15 folder:
- implementation/: Technical implementation docs
- planning/: Planning and sequence docs
- archive/: Redundant/old content
- Removed duplicate content (80k→20k line reduction mentioned 5 times)
- Converted all .txt files to .md for consistency
- Fixed broken links in README.md
- Removed redundant INDEX.md
## Phase 21: Database-Driven Development (New)
- Revolutionary concept: Source code in SQLite instead of files
- Instant refactoring with SQL transactions
- Structured management of boxes, methods, dependencies
- Technical design with security considerations
- Vision: World's first DB-driven programming language
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-12 00:35:11 +09:00
|
|
|
let fnty_conv = i64t
|
|
|
|
|
.fn_type(&[codegen.context.ptr_type(AddressSpace::from(0)).into()], false);
|
|
|
|
|
let conv = codegen
|
|
|
|
|
.module
|
|
|
|
|
.get_function("nyash.box.from_i8_string")
|
|
|
|
|
.unwrap_or_else(|| codegen.module.add_function("nyash.box.from_i8_string", fnty_conv, None));
|
2025-09-12 19:23:16 +09:00
|
|
|
let kcall = cursor
|
|
|
|
|
.emit_instr(cur_bid, |b| b.build_call(conv, &[pv.into()], "key_i8_to_handle"))
|
🏗️ Refactor: Major LLVM codegen modularization + Phase 15 docs cleanup + Phase 21 DDD concept
## LLVM Codegen Refactoring (by ChatGPT5)
- Split massive boxcall.rs into focused submodules:
- strings.rs: String method optimizations (concat, length)
- arrays.rs: Array operations (get, set, push, length)
- maps.rs: Map operations (get, set, has, size)
- fields.rs: getField/setField handling
- invoke.rs: Tagged invoke implementation
- marshal.rs: Helper functions for marshaling
- Improved code organization and maintainability
- No functional changes, pure refactoring
## Phase 15 Documentation Cleanup
- Restructured phase-15 folder:
- implementation/: Technical implementation docs
- planning/: Planning and sequence docs
- archive/: Redundant/old content
- Removed duplicate content (80k→20k line reduction mentioned 5 times)
- Converted all .txt files to .md for consistency
- Fixed broken links in README.md
- Removed redundant INDEX.md
## Phase 21: Database-Driven Development (New)
- Revolutionary concept: Source code in SQLite instead of files
- Instant refactoring with SQL transactions
- Structured management of boxes, methods, dependencies
- Technical design with security considerations
- Vision: World's first DB-driven programming language
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-12 00:35:11 +09:00
|
|
|
.map_err(|e| e.to_string())?;
|
|
|
|
|
let kh = kcall
|
|
|
|
|
.try_as_basic_value()
|
|
|
|
|
.left()
|
|
|
|
|
.ok_or("from_i8_string returned void".to_string())?
|
|
|
|
|
.into_int_value();
|
|
|
|
|
let fnty = i64t.fn_type(&[i64t.into(), i64t.into()], false);
|
|
|
|
|
let callee = codegen
|
|
|
|
|
.module
|
|
|
|
|
.get_function("nyash.map.get_hh")
|
|
|
|
|
.unwrap_or_else(|| codegen.module.add_function("nyash.map.get_hh", fnty, None));
|
2025-09-12 19:23:16 +09:00
|
|
|
cursor
|
|
|
|
|
.emit_instr(cur_bid, |b| b.build_call(callee, &[recv_h.into(), kh.into()], "mget_hh"))
|
🏗️ Refactor: Major LLVM codegen modularization + Phase 15 docs cleanup + Phase 21 DDD concept
## LLVM Codegen Refactoring (by ChatGPT5)
- Split massive boxcall.rs into focused submodules:
- strings.rs: String method optimizations (concat, length)
- arrays.rs: Array operations (get, set, push, length)
- maps.rs: Map operations (get, set, has, size)
- fields.rs: getField/setField handling
- invoke.rs: Tagged invoke implementation
- marshal.rs: Helper functions for marshaling
- Improved code organization and maintainability
- No functional changes, pure refactoring
## Phase 15 Documentation Cleanup
- Restructured phase-15 folder:
- implementation/: Technical implementation docs
- planning/: Planning and sequence docs
- archive/: Redundant/old content
- Removed duplicate content (80k→20k line reduction mentioned 5 times)
- Converted all .txt files to .md for consistency
- Fixed broken links in README.md
- Removed redundant INDEX.md
## Phase 21: Database-Driven Development (New)
- Revolutionary concept: Source code in SQLite instead of files
- Instant refactoring with SQL transactions
- Structured management of boxes, methods, dependencies
- Technical design with security considerations
- Vision: World's first DB-driven programming language
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-12 00:35:11 +09:00
|
|
|
.map_err(|e| e.to_string())?
|
|
|
|
|
}
|
2025-09-12 22:36:20 +09:00
|
|
|
_ => {
|
|
|
|
|
let iv = resolver.resolve_i64(codegen, cursor, cur_bid, args[0], &std::collections::HashMap::new(), &std::collections::HashMap::new(), &std::collections::HashMap::new(), vmap)?;
|
|
|
|
|
let fnty = i64t.fn_type(&[i64t.into(), i64t.into()], false);
|
|
|
|
|
let callee = codegen
|
|
|
|
|
.module
|
|
|
|
|
.get_function("nyash.map.get_h")
|
|
|
|
|
.unwrap_or_else(|| codegen.module.add_function("nyash.map.get_h", fnty, None));
|
|
|
|
|
cursor
|
|
|
|
|
.emit_instr(cur_bid, |b| b.build_call(callee, &[recv_h.into(), iv.into()], "mget"))
|
|
|
|
|
.map_err(|e| e.to_string())?
|
|
|
|
|
}
|
🏗️ Refactor: Major LLVM codegen modularization + Phase 15 docs cleanup + Phase 21 DDD concept
## LLVM Codegen Refactoring (by ChatGPT5)
- Split massive boxcall.rs into focused submodules:
- strings.rs: String method optimizations (concat, length)
- arrays.rs: Array operations (get, set, push, length)
- maps.rs: Map operations (get, set, has, size)
- fields.rs: getField/setField handling
- invoke.rs: Tagged invoke implementation
- marshal.rs: Helper functions for marshaling
- Improved code organization and maintainability
- No functional changes, pure refactoring
## Phase 15 Documentation Cleanup
- Restructured phase-15 folder:
- implementation/: Technical implementation docs
- planning/: Planning and sequence docs
- archive/: Redundant/old content
- Removed duplicate content (80k→20k line reduction mentioned 5 times)
- Converted all .txt files to .md for consistency
- Fixed broken links in README.md
- Removed redundant INDEX.md
## Phase 21: Database-Driven Development (New)
- Revolutionary concept: Source code in SQLite instead of files
- Instant refactoring with SQL transactions
- Structured management of boxes, methods, dependencies
- Technical design with security considerations
- Vision: World's first DB-driven programming language
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-12 00:35:11 +09:00
|
|
|
};
|
|
|
|
|
if let Some(d) = dst {
|
|
|
|
|
let rv = call
|
|
|
|
|
.try_as_basic_value()
|
|
|
|
|
.left()
|
|
|
|
|
.ok_or("map.get returned void".to_string())?;
|
|
|
|
|
vmap.insert(*d, rv);
|
|
|
|
|
}
|
|
|
|
|
Ok(true)
|
|
|
|
|
}
|
|
|
|
|
"set" => {
|
2025-09-12 12:07:07 +09:00
|
|
|
if std::env::var("NYASH_CLI_VERBOSE").ok().as_deref() == Some("1") {
|
|
|
|
|
eprintln!("[LLVM] lower Map.set (core)");
|
|
|
|
|
}
|
🏗️ Refactor: Major LLVM codegen modularization + Phase 15 docs cleanup + Phase 21 DDD concept
## LLVM Codegen Refactoring (by ChatGPT5)
- Split massive boxcall.rs into focused submodules:
- strings.rs: String method optimizations (concat, length)
- arrays.rs: Array operations (get, set, push, length)
- maps.rs: Map operations (get, set, has, size)
- fields.rs: getField/setField handling
- invoke.rs: Tagged invoke implementation
- marshal.rs: Helper functions for marshaling
- Improved code organization and maintainability
- No functional changes, pure refactoring
## Phase 15 Documentation Cleanup
- Restructured phase-15 folder:
- implementation/: Technical implementation docs
- planning/: Planning and sequence docs
- archive/: Redundant/old content
- Removed duplicate content (80k→20k line reduction mentioned 5 times)
- Converted all .txt files to .md for consistency
- Fixed broken links in README.md
- Removed redundant INDEX.md
## Phase 21: Database-Driven Development (New)
- Revolutionary concept: Source code in SQLite instead of files
- Instant refactoring with SQL transactions
- Structured management of boxes, methods, dependencies
- Technical design with security considerations
- Vision: World's first DB-driven programming language
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-12 00:35:11 +09:00
|
|
|
if args.len() != 2 {
|
|
|
|
|
return Err("MapBox.set expects 2 args (key, value)".to_string());
|
|
|
|
|
}
|
2025-09-12 22:36:20 +09:00
|
|
|
let key_i = match func.metadata.value_types.get(&args[0]) {
|
|
|
|
|
Some(crate::mir::MirType::String) => {
|
|
|
|
|
let pv = resolver.resolve_ptr(codegen, cursor, cur_bid, args[0], &std::collections::HashMap::new(), &std::collections::HashMap::new(), &std::collections::HashMap::new(), vmap)?;
|
|
|
|
|
let fnty_conv = i64t.fn_type(&[codegen.context.ptr_type(AddressSpace::from(0)).into()], false);
|
|
|
|
|
let conv = codegen
|
|
|
|
|
.module
|
|
|
|
|
.get_function("nyash.box.from_i8_string")
|
|
|
|
|
.unwrap_or_else(|| codegen.module.add_function("nyash.box.from_i8_string", fnty_conv, None));
|
|
|
|
|
let kcall = cursor
|
|
|
|
|
.emit_instr(cur_bid, |b| b.build_call(conv, &[pv.into()], "key_i8_to_handle"))
|
|
|
|
|
.map_err(|e| e.to_string())?;
|
|
|
|
|
kcall.try_as_basic_value().left().ok_or("from_i8_string returned void".to_string())?.into_int_value()
|
|
|
|
|
}
|
|
|
|
|
_ => resolver.resolve_i64(codegen, cursor, cur_bid, args[0], &std::collections::HashMap::new(), &std::collections::HashMap::new(), &std::collections::HashMap::new(), vmap)?
|
🏗️ Refactor: Major LLVM codegen modularization + Phase 15 docs cleanup + Phase 21 DDD concept
## LLVM Codegen Refactoring (by ChatGPT5)
- Split massive boxcall.rs into focused submodules:
- strings.rs: String method optimizations (concat, length)
- arrays.rs: Array operations (get, set, push, length)
- maps.rs: Map operations (get, set, has, size)
- fields.rs: getField/setField handling
- invoke.rs: Tagged invoke implementation
- marshal.rs: Helper functions for marshaling
- Improved code organization and maintainability
- No functional changes, pure refactoring
## Phase 15 Documentation Cleanup
- Restructured phase-15 folder:
- implementation/: Technical implementation docs
- planning/: Planning and sequence docs
- archive/: Redundant/old content
- Removed duplicate content (80k→20k line reduction mentioned 5 times)
- Converted all .txt files to .md for consistency
- Fixed broken links in README.md
- Removed redundant INDEX.md
## Phase 21: Database-Driven Development (New)
- Revolutionary concept: Source code in SQLite instead of files
- Instant refactoring with SQL transactions
- Structured management of boxes, methods, dependencies
- Technical design with security considerations
- Vision: World's first DB-driven programming language
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-12 00:35:11 +09:00
|
|
|
};
|
2025-09-12 22:36:20 +09:00
|
|
|
let val_i = resolver.resolve_i64(codegen, cursor, cur_bid, args[1], &std::collections::HashMap::new(), &std::collections::HashMap::new(), &std::collections::HashMap::new(), vmap)?;
|
🏗️ Refactor: Major LLVM codegen modularization + Phase 15 docs cleanup + Phase 21 DDD concept
## LLVM Codegen Refactoring (by ChatGPT5)
- Split massive boxcall.rs into focused submodules:
- strings.rs: String method optimizations (concat, length)
- arrays.rs: Array operations (get, set, push, length)
- maps.rs: Map operations (get, set, has, size)
- fields.rs: getField/setField handling
- invoke.rs: Tagged invoke implementation
- marshal.rs: Helper functions for marshaling
- Improved code organization and maintainability
- No functional changes, pure refactoring
## Phase 15 Documentation Cleanup
- Restructured phase-15 folder:
- implementation/: Technical implementation docs
- planning/: Planning and sequence docs
- archive/: Redundant/old content
- Removed duplicate content (80k→20k line reduction mentioned 5 times)
- Converted all .txt files to .md for consistency
- Fixed broken links in README.md
- Removed redundant INDEX.md
## Phase 21: Database-Driven Development (New)
- Revolutionary concept: Source code in SQLite instead of files
- Instant refactoring with SQL transactions
- Structured management of boxes, methods, dependencies
- Technical design with security considerations
- Vision: World's first DB-driven programming language
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-12 00:35:11 +09:00
|
|
|
let fnty = i64t.fn_type(&[i64t.into(), i64t.into(), i64t.into()], false);
|
|
|
|
|
let callee = codegen
|
|
|
|
|
.module
|
|
|
|
|
.get_function("nyash.map.set_h")
|
|
|
|
|
.unwrap_or_else(|| codegen.module.add_function("nyash.map.set_h", fnty, None));
|
2025-09-12 19:23:16 +09:00
|
|
|
let _ = cursor
|
|
|
|
|
.emit_instr(cur_bid, |b| b.build_call(callee, &[recv_h.into(), key_i.into(), val_i.into()], "mset"))
|
🏗️ Refactor: Major LLVM codegen modularization + Phase 15 docs cleanup + Phase 21 DDD concept
## LLVM Codegen Refactoring (by ChatGPT5)
- Split massive boxcall.rs into focused submodules:
- strings.rs: String method optimizations (concat, length)
- arrays.rs: Array operations (get, set, push, length)
- maps.rs: Map operations (get, set, has, size)
- fields.rs: getField/setField handling
- invoke.rs: Tagged invoke implementation
- marshal.rs: Helper functions for marshaling
- Improved code organization and maintainability
- No functional changes, pure refactoring
## Phase 15 Documentation Cleanup
- Restructured phase-15 folder:
- implementation/: Technical implementation docs
- planning/: Planning and sequence docs
- archive/: Redundant/old content
- Removed duplicate content (80k→20k line reduction mentioned 5 times)
- Converted all .txt files to .md for consistency
- Fixed broken links in README.md
- Removed redundant INDEX.md
## Phase 21: Database-Driven Development (New)
- Revolutionary concept: Source code in SQLite instead of files
- Instant refactoring with SQL transactions
- Structured management of boxes, methods, dependencies
- Technical design with security considerations
- Vision: World's first DB-driven programming language
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-12 00:35:11 +09:00
|
|
|
.map_err(|e| e.to_string())?;
|
|
|
|
|
Ok(true)
|
|
|
|
|
}
|
|
|
|
|
_ => Ok(false),
|
|
|
|
|
}
|
|
|
|
|
}
|