定期ミートアップ 第76回
前回:定期ミートアップ 第74回
Shiika
Convert old HIR to new MIR by yhara · Pull Request #586 · shiika-lang/shiika
前回言ってたやつ
new_runtime: impl. ivars by yhara · Pull Request #588 · shiika-lang/shiika
インスタンス変数
new_runtime: impl. Class object by yhara · Pull Request #589 · shiika-lang/shiika
クラスオブジェクト
puts 1.class.name
Module calls by yhara · Pull Request #590 · shiika-lang/shiika
モジュール
モジュールのメソッドはasyncでなくてはらなない
モジュールのメソッドをオーバーライドするメソッドはasyncでなくてはならない
この処理をいつやるか?
メソッドのindex時?
→index後に発生するメソッドがある(アクセサ)
現在のShiikaの仕様では、インスタンス変数に対して自動でアクセサが生える
インスタンス変数は.initializeの中身を読まないと確定しない
HIR生成が終わって、MIRへの変換を始める直前にやることにした
Llvm 18 by yhara · Pull Request #591 · shiika-lang/shiika
LLVM 18に上げた
Apply TCO where possible by yhara · Pull Request #593 · shiika-lang/shiika
before: %result3 = call ptr @"Meta:Main#run'w"(ptr %"$env")
after: %result3 = tail call ptr @"Meta:Main#run'w"(ptr %"$env")
これがないと長いループがスタックオーバーフローになる
code:sk
class Main
def self.run() -> Int
let a = 123
var i = 0
while i < 300000
i += 1
end
print i
return 0
end
end
Main.run
ループはいけたが終了時にエラーが…(?)
code:txt
(lldb) target create "./a.out"
Current executable set to '/Users/yhara/Dropbox/proj/shiika/a.out' (arm64).
(lldb) run
300000
Process 69612 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
frame #0: 0x0000000000000000
error: memory read failed for 0x0
Target 0: (a.out) stopped.
Process 69612 launched: '/Users/yhara/Dropbox/proj/shiika/a.out' (arm64)
(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
* frame #0: 0x0000000000000000
frame #1: 0x00000001001aa880 a.out`std::sys::thread_local::guard::apple::enable::run_dtors::h572aa1fcd9919e17 inlined std::sys::thread_local::destructors::list
::run::h5af2422ad7e83a29 at list.rs:34:21 opt
frame #2: 0x00000001001aa848 a.out`std::sys::thread_local::guard::apple::enable::run_dtors::h572aa1fcd9919e17 at apple.rs:28:13 opt
frame #3: 0x000000019129e7d8 dyld`invocation function for block in dyld4::RuntimeState::_finalizeListTLV(void*) + 56
frame #4: 0x000000019129e740 dyld`dyld4::RuntimeState::_finalizeListTLV(void*) + 116
frame #5: 0x00000001914d7068 libsystem_c.dylib`exit + 36
frame #6: 0x0000000191632850 libdyld.dylib`dyld4::LibSystemHelpers::exit(int) const + 20
frame #7: 0x000000019128f1a0 dyld`start + 2552
(lldb) exit
#定期ミートアップ