wip(phase15): AOT修正作業中 - Nyプラグインと標準ライブラリ実装
Phase 15のAOT/ネイティブビルド修正作業を継続中。 ChatGPTによるstd実装とプラグインシステムの改修を含む。 主な変更点: - apps/std/: string.nyashとarray.nyashの標準ライブラリ追加 - apps/smokes/: stdライブラリのスモークテスト追加 - プラグインローダーv2の実装改修 - BoxCallのハンドル管理改善 - JIT hostcall registryの更新 - ビルドスクリプト(build_aot.sh, build_llvm.sh)の調整 まだ修正作業中のため、一部の機能は不完全な状態。 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
12
apps/smokes/std/array_len_min.nyash
Normal file
12
apps/smokes/std/array_len_min.nyash
Normal file
@ -0,0 +1,12 @@
|
||||
// Minimal reproduction for ArrayBox.length() fast-path
|
||||
static box Main {
|
||||
main() {
|
||||
local a
|
||||
a = new ArrayBox()
|
||||
// Expect: print 0, return 0
|
||||
print(a.length())
|
||||
if a.length() != 0 { return 1 }
|
||||
return 0
|
||||
}
|
||||
}
|
||||
|
||||
49
apps/smokes/std/array_smoke.nyash
Normal file
49
apps/smokes/std/array_smoke.nyash
Normal file
@ -0,0 +1,49 @@
|
||||
// std.array smoke: len/push/pop/slice
|
||||
static box Main {
|
||||
main() {
|
||||
local A
|
||||
A = include "apps/std/array.nyash"
|
||||
local fails
|
||||
fails = 0
|
||||
|
||||
local a
|
||||
a = new ArrayBox()
|
||||
if A.array_len(a) != 0 { fails = fails + 1 }
|
||||
|
||||
// push
|
||||
if A.array_push(a, 10) != 1 { fails = fails + 1 }
|
||||
if A.array_push(a, 20) != 2 { fails = fails + 1 }
|
||||
if A.array_len(a) != 2 { fails = fails + 1 }
|
||||
|
||||
// pop
|
||||
local v
|
||||
v = A.array_pop(a)
|
||||
if v != 20 { fails = fails + 1 }
|
||||
if A.array_len(a) != 1 { fails = fails + 1 }
|
||||
// pop remaining and one extra -> null
|
||||
v = A.array_pop(a)
|
||||
if v != 10 { fails = fails + 1 }
|
||||
v = A.array_pop(a)
|
||||
if v != null { fails = fails + 1 }
|
||||
|
||||
// slice
|
||||
A.array_push(a, 1)
|
||||
A.array_push(a, 2)
|
||||
A.array_push(a, 3)
|
||||
local s
|
||||
s = A.array_slice(a, 0, 2)
|
||||
if s.length() != 2 { fails = fails + 1 }
|
||||
if s.get(0) != 1 { fails = fails + 1 }
|
||||
if s.get(1) != 2 { fails = fails + 1 }
|
||||
// clamp
|
||||
s = A.array_slice(a, -5, 99)
|
||||
if s.length() != 3 { fails = fails + 1 }
|
||||
|
||||
if fails == 0 {
|
||||
print("OK: array")
|
||||
return 0
|
||||
}
|
||||
print("FAIL: array (" + fails.toString() + ")")
|
||||
return 1
|
||||
}
|
||||
}
|
||||
43
apps/smokes/std/array_smoke_dbg.nyash
Normal file
43
apps/smokes/std/array_smoke_dbg.nyash
Normal file
@ -0,0 +1,43 @@
|
||||
static box Main {
|
||||
main() {
|
||||
local A
|
||||
A = include "apps/std/array.nyash"
|
||||
local fails
|
||||
fails = 0
|
||||
|
||||
local a
|
||||
a = new ArrayBox()
|
||||
print("len0=" + A.array_len(a))
|
||||
|
||||
// push
|
||||
print("push1->" + A.array_push(a, 10))
|
||||
print("push2->" + A.array_push(a, 20))
|
||||
print("len2=" + A.array_len(a))
|
||||
|
||||
// pop
|
||||
local v
|
||||
v = A.array_pop(a)
|
||||
print("pop1=" + v)
|
||||
print("len1=" + A.array_len(a))
|
||||
// pop remaining and one extra -> null
|
||||
v = A.array_pop(a)
|
||||
print("pop2=" + v)
|
||||
v = A.array_pop(a)
|
||||
print("pop3=" + v)
|
||||
|
||||
// slice
|
||||
A.array_push(a, 1)
|
||||
A.array_push(a, 2)
|
||||
A.array_push(a, 3)
|
||||
local s
|
||||
s = A.array_slice(a, 0, 2)
|
||||
print("slice_len1=" + s.length())
|
||||
print("s[0]=" + s.get(0))
|
||||
print("s[1]=" + s.get(1))
|
||||
// clamp
|
||||
s = A.array_slice(a, -5, 99)
|
||||
print("slice_len2=" + s.length())
|
||||
return 0
|
||||
}
|
||||
}
|
||||
|
||||
38
apps/smokes/std/string_smoke.nyash
Normal file
38
apps/smokes/std/string_smoke.nyash
Normal file
@ -0,0 +1,38 @@
|
||||
// std.string smoke: length/concat/slice/index_of/equals
|
||||
static box Main {
|
||||
main() {
|
||||
local S
|
||||
S = include "apps/std/string.nyash"
|
||||
local fails
|
||||
fails = 0
|
||||
|
||||
// length
|
||||
if S.string_length("abc") != 3 { fails = fails + 1 }
|
||||
if S.string_length("") != 0 { fails = fails + 1 }
|
||||
|
||||
// concat
|
||||
if S.string_concat("a", "b") != "ab" { fails = fails + 1 }
|
||||
if S.string_concat("", "x") != "x" { fails = fails + 1 }
|
||||
|
||||
// slice (clamp + basic)
|
||||
if S.string_slice("hello", 1, 4) != "ell" { fails = fails + 1 }
|
||||
if S.string_slice("hi", -5, 5) != "hi" { fails = fails + 1 }
|
||||
if S.string_slice("x", 0, 0) != "" { fails = fails + 1 }
|
||||
|
||||
// index_of
|
||||
if S.string_index_of("banana", "na") != 2 { fails = fails + 1 }
|
||||
if S.string_index_of("banana", "zz") != -1 { fails = fails + 1 }
|
||||
if S.string_index_of("abc", "") != 0 { fails = fails + 1 }
|
||||
|
||||
// equals
|
||||
if S.string_equals("a", "a") != 1 { fails = fails + 1 }
|
||||
if S.string_equals("a", "b") != 0 { fails = fails + 1 }
|
||||
|
||||
if fails == 0 {
|
||||
print("OK: string")
|
||||
return 0
|
||||
}
|
||||
print("FAIL: string (" + fails.toString() + ")")
|
||||
return 1
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user