Merge upstream changes with comprehensive conflict resolution#36
Merged
mengzhuo merged 1 commit intoplctlab:mainfrom Sep 19, 2025
DzmingLi:main
Merged
Merge upstream changes with comprehensive conflict resolution#36mengzhuo merged 1 commit intoplctlab:mainfrom DzmingLi:main
mengzhuo merged 1 commit intoplctlab:mainfrom
DzmingLi:main
Conversation
Resolved 50+ merge conflicts systematically, preserving all PLCTLab functionality while adopting upstream enhancements. ## Key Conflict Resolutions: **Type System** - Extended support for T_int16, T_uint16, T_raw_func, T_local types - Integrated trait alias support with PLCTLab's object safety analysis **Compilation Architecture** - Hybrid RISC-V (PLCTLab) + modern WASM (upstream) pipeline support - Combined clam_callback and dwarfsm_callback systems - Target support: wasm-gc, wasm, js, riscv, native, llvm **Performance Optimizations** - Adopted upstream's optimized list operations (special cases for small lists) - Upgraded topological sorting to comprehensive set-based dependency analysis - Enhanced pattern matching with async and guard expression support **Code Quality** - Preserved PLCTLab's clean manual implementations over auto-generated code - Maintained robust error handling patterns - Ensured backward compatibility for CLI interfaces ## Critical Integrations: - Foreign trait compile-time processing (placeholder_env.ml + toplevel_typer.ml) - Pattern matching architectural rewrite (check_match.ml) - Function desugaring with async support (parsing_ast_lint.ml)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request merges the latest features, performance optimizations, and architectural improvements from the upstream branch while carefully preserving and integrating PLCTLab's unique enhancements, such as RISC-V backend support, robust error handling, and advanced trait analysis.
Major Architectural Upgrades & Feature Enhancements
1. Pattern Matching Engine Overhaul (
check_match.ml)try_combine_array_pat_to_string).Texpr_guard_letandTexpr_isexpressions.analyze_casesfor analysis andcheck_matchfor reporting.2. Hybrid Compilation Architecture (
driver_util.ml,moon0_main.ml)riscv_gen) and upstream's unified WASM backend (wasm_genwithdwarfsm_callback).wat_genfunction for text format (.wat) output while integratingdwarfsm_callbackfor modern binary (.wasm) output.Shrink_wasmiroptimizer without losing critical RISC-V target support.3. Trait Analysis System Integration (
placeholder_env.ml,toplevel_typer.ml)Ptd_externandPtype_object.4. Dependency Analysis Algorithm Upgrade (
topo_sort.ml)trait_alias.5. Async Function Support (
parsing_ast_lint.ml)asyncsupport to the function desugaring process.guardconditions, enhancing the language's expressive power.Performance Optimizations
basic_lst.ml): Adopted upstream's highly optimized implementations for core list functions (e.g.,map,fold_right,map2,iteri). These implementations leverage techniques like special casing for small lists (1-10 elements), tail-recursion optimization, and chunked processing to significantly improve performance while maintaining API compatibility. PLCTLab's unique functions likegroupandstable_groupwere preserved.Robustness, Correctness & Error Handling
core_format.ml,parsing_parse.ml): Kept PLCTLab's comprehensivetry...with Sys_errorpattern, which is more robust than upstream's file existence checks as it handles permissions, disk errors, and other scenarios while providing more detailed error messages.dwarfsm_encode_wasm.ml): Preserved PLCTLab's tracking oflow_pcandhigh_pc, ensuring the integrity of DWARF debugging information, which is essential for debugging.pkg.ml): Adopted upstream's safer import mechanism, which detects and prevents name collisions between imported and local definitions, improving code reliability.label.ml): Maintained PLCTLab's safer approach to label comparison/hashing, which considers bothnameandstampfields, making it more robust than upstream'sstamp-only method.mtype.ml,name_mangle.ml): Ensured that all types (including new additions likeT_int16,T_uint16,T_raw_func) are handled correctly during serialization and name mangling, preventing potential runtime errors from incomplete pattern matches.Code Quality & Consistency
basic_core_ident.ml,object_util.ml,trait_impl.ml), preferred PLCTLab's clean, manually written implementations over verbose, auto-generated code from upstream for better readability.typer.ml): Eliminated over 270 lines of duplicated code (for record updates, field access, etc.) in PLCTLab's assignment operator logic, as the functionality already existed elsewhere in the file.basic_lst.ml): Corrected the parameter order of thetakefunction fromtake n xstotake xs nto align with all other call sites in the project and OCaml community conventions. All relevant call sites were updated.mcore_util.ml,monofy_worklist.ml): Standardized the use of the internalLstmodule and adopted modern function signature styles (e.g., labeled arguments~f:), improving code consistency and readability across the project.