From: Brendan Hansen Date: Sun, 5 Feb 2023 20:14:00 +0000 (-0600) Subject: finalized bugfix with recursive structures X-Git-Url: https://git.brendanfh.com/?a=commitdiff_plain;h=12cb7fa62a423d8b6d7de5e196a17d28dd30b3ef;p=onyx.git finalized bugfix with recursive structures --- diff --git a/compiler/include/types.h b/compiler/include/types.h index 6b164d2e..d4321cd6 100644 --- a/compiler/include/types.h +++ b/compiler/include/types.h @@ -217,6 +217,7 @@ const char* type_get_name(Type* type); u32 type_get_alignment_log2(Type* type); Type* type_get_contained_type(Type* type); +b32 type_is_ready_for_lookup(Type* type); b32 type_lookup_member(Type* type, char* member, StructMember* smem); b32 type_lookup_member_by_idx(Type* type, i32 idx, StructMember* smem); diff --git a/compiler/src/checker.c b/compiler/src/checker.c index 2d35aa34..87f1bd14 100644 --- a/compiler/src/checker.c +++ b/compiler/src/checker.c @@ -1834,16 +1834,14 @@ CheckStatus check_field_access(AstFieldAccess** pfield) { token_toggle_end(field->token); } - if (field->expr->type->kind == Type_Kind_Struct) { - if (field->expr->type->Struct.status != SPS_Uses_Done) { - YIELD(field->token->pos, "Waiting for struct type to be completed before looking up members."); - } - } - if (!type_is_structlike(field->expr->type)) { goto try_resolve_from_type; } + if (!type_is_ready_for_lookup(field->expr->type)) { + YIELD(field->token->pos, "Waiting for struct type to be completed before looking up members."); + } + StructMember smem; if (!type_lookup_member(field->expr->type, field->field, &smem)) { if (field->expr->type->kind == Type_Kind_Array) { diff --git a/compiler/src/types.c b/compiler/src/types.c index 2e816dc7..e0db986b 100644 --- a/compiler/src/types.c +++ b/compiler/src/types.c @@ -256,9 +256,7 @@ u32 type_alignment_of(Type* type) { } } -// If this function returns NULL, then the caller MUST yield because the type may still be constructed in the future. -// If there was an error constructing the type, then this function will report that directly. -Type* type_build_from_ast_inner(bh_allocator alloc, AstType* type_node, b32 accept_partial_types) { +static Type* type_build_from_ast_inner(bh_allocator alloc, AstType* type_node, b32 accept_partial_types) { if (type_node == NULL) return NULL; switch (type_node->kind) { @@ -392,8 +390,7 @@ Type* type_build_from_ast_inner(bh_allocator alloc, AstType* type_node, b32 acce return accept_partial_types ? s_node->pending_type : NULL; } - if ((*member)->type->kind == Type_Kind_Struct - && (*member)->type->Struct.status == SPS_Start) { + if ((*member)->type->kind == Type_Kind_Struct && (*member)->type->Struct.status == SPS_Start) { s_node->pending_type_is_valid = 0; return accept_partial_types ? s_node->pending_type : NULL; } @@ -636,6 +633,8 @@ Type* type_build_from_ast_inner(bh_allocator alloc, AstType* type_node, b32 acce return NULL; } +// If this function returns NULL, then the caller MUST yield because the type may still be constructed in the future. +// If there was an error constructing the type, then this function will report that directly. Type *type_build_from_ast(bh_allocator alloc, AstType* type_node) { return type_build_from_ast_inner(alloc, type_node, 0); } @@ -1146,6 +1145,16 @@ Type* type_get_contained_type(Type* type) { } } +b32 type_is_ready_for_lookup(Type* type) { + if (type->kind == Type_Kind_Pointer) type = type->Pointer.elem; + + if (type->kind == Type_Kind_Struct) { + return type->Struct.status == SPS_Uses_Done; + } + + return 1; +} + static const StructMember slice_members[] = { { 0, 0, NULL, "data", NULL, NULL, -1, 0, 0 }, { POINTER_SIZE, 1, &basic_types[Basic_Kind_U32], "count", NULL, NULL, -1, 0, 0 }, diff --git a/docs/ideas/high_level_goals.md b/docs/ideas/high_level_goals.md index 66c6bc45..b4c3ffb9 100644 --- a/docs/ideas/high_level_goals.md +++ b/docs/ideas/high_level_goals.md @@ -1,4 +1,5 @@ High-Level Goals +================ There are many ideas that are wizzing around my head when I think about the future of Onyx, and I'm having @@ -8,5 +9,39 @@ timeline will be beneficial to me and the future of the language. +Optimizing OVM instructions +--------------------------- +As OVM becomes used more and more because of its improved +debugging experience when compared to runtimes like Wasmer, +it would be nice if the runtime was a little faster. As +I look through the generated instructions, I see a lot of +potential for some relatively easy improvements that can +be made. This would still be a larger-endeavour, as +optimizing is not a simple task. Debug information, basic +blocks and other tricky things have to be dealt with. I +think this task would take around 2-3 weeks of focused time +to get something good. +[Onyx Website](./website.md) +-------------- +The domains for the website (https://onyxlang.io) is already +registered, I just need a good-enough website. It does not +need to be anything super-fancy, yet. Just links and basic- +documentation. + + +[Generated Documentation](./doc_format.md) +----------------------- + + +[Core Library Cleanup](./core_libraries.md) +-------------------- + + +[Project Templates](./templated_projects.md) +------------------ + + +[Bundling Onyx for Distribution](./shipping.md) +------------------------------- diff --git a/shared/lib/linux_x86_64/lib/libovmwasm.so b/shared/lib/linux_x86_64/lib/libovmwasm.so deleted file mode 100755 index 28469a47..00000000 Binary files a/shared/lib/linux_x86_64/lib/libovmwasm.so and /dev/null differ