better inlining split

This commit is contained in:
dzaima 2025-06-08 23:40:30 +03:00
parent 8c22564b41
commit 671efcc948

View File

@ -855,7 +855,7 @@ static B readStruct(BQNFFIType* t, u8* ptr) {
return HARR_FV(r); return HARR_FV(r);
} }
static B readSimple(u8 resCType, u8* ptr) { static NOINLINE B readSimple(u8 resCType, u8* ptr) {
switch(resCType) { default: UD; // thrM("FFI: Unimplemented type"); switch(resCType) { default: UD; // thrM("FFI: Unimplemented type");
case sty_void:return m_c32(0); case sty_void:return m_c32(0);
case sty_a: return getB(*(BQNV*)ptr); case sty_a: return getB(*(BQNV*)ptr);
@ -884,23 +884,22 @@ static B readRe(BQNFFIType* t, u8* src) {
return r; return r;
} }
static B readAny(B o, u8* ptr) { // doesn't consume static NOINLINE B readComplex(B o, u8* ptr) { // doesn't consume
if (isC32(o)) {
return readSimple(styG(o), ptr);
} else {
BQNFFIType* t = c(BQNFFIType, o); BQNFFIType* t = c(BQNFFIType, o);
if (t->ty == cty_repr) { // cty_repr, scalar:x if (t->ty == cty_repr) { // cty_repr, scalar:x
return readRe(t, ptr); return readRe(t, ptr);
} else if (t->ty==cty_struct || t->ty==cty_starr) { // {...}, [n]... } else if (t->ty==cty_struct || t->ty==cty_starr) { // {...}, [n]...
return readStruct(c(BQNFFIType, o), ptr); return readStruct(t, ptr);
} else if (t->ty==cty_ptr) { // *... } else if (t->ty==cty_ptr) { // *...
return m_ptrobj_s(*(void**)ptr, inc(t->a[0].o)); return m_ptrobj_s(*(void**)ptr, inc(t->a[0].o));
} }
}
thrM("FFI: Unimplemented in-memory type for reading"); thrM("FFI: Unimplemented in-memory type for reading");
} }
static B readAny(B o, u8* ptr) { // doesn't consume
return isC32(o)? readSimple(styG(o), ptr) : readComplex(o, ptr);
}
B readUpdatedObj(BQNFFIEnt ent, bool anyMut, B** objs) { B readUpdatedObj(BQNFFIEnt ent, bool anyMut, B** objs) {
if (isC32(ent.o)) return m_f64(0); // scalar if (isC32(ent.o)) return m_f64(0); // scalar
BQNFFIType* t = c(BQNFFIType, ent.o); BQNFFIType* t = c(BQNFFIType, ent.o);