惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
月光博客
月光博客
爱范儿
爱范儿
The Cloudflare Blog
Y
Y Combinator Blog
B
Blog RSS Feed
Stack Overflow Blog
Stack Overflow Blog
博客园 - 叶小钗
G
Google Developers Blog
J
Java Code Geeks
P
Proofpoint News Feed
美团技术团队
Engineering at Meta
Engineering at Meta
腾讯CDC
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
博客园_首页
WordPress大学
WordPress大学
博客园 - 聂微东
雷峰网
雷峰网
有赞技术团队
有赞技术团队
L
LangChain Blog
N
Netflix TechBlog - Medium
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
博客园 - 【当耐特】

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
Cx Dev Log — 2026-05-01
COMMENTERTHE · 2026-05-03 · via DEV Community

COMMENTERTHE9

Two sub-packets landed on submain today, moving the IR backend closer to supporting structs properly. The first package upgrades the instruction set to handle memory operations, and the second implements a struct registry integrated into the lowering pass. Together, these changes allow the lowering pass to recognize and manipulate the structs' memory representations, setting the stage for future struct-aware code generation. Meanwhile, main remains unchanged, while submain is breaking ground with 22 new commits developed over 34 days.

IR Memory Operations

Commit 6252994 brought in a crucial update: introducing a Ptr type to the IR type system, complete with a size of 8 bytes and an alignment of 8 bytes. Alongside, three fundamental IR instructions were added:

  • Alloca: It allocates stack space defined by size and alignment.
  • Load: It performs a read operation from a pointer with a specific type.
  • Store: It enables writing a value through a pointer.

The IR validator has adapted to these changes, embedding 43 lines of new checks. Interestingly, it requires Alloca to have a size greater than zero and a power-of-two alignment. Both Load and Store demand a pointer operand typed explicitly as IrType::Ptr.

This memory operation extension is crucial. Without it, the backend couldn’t handle memory structures that exceed single-register values. The improvement reflects typical infrastructure you’d find in a lowering pass designed for IR architectures like Cranelift or LLVM, where memory management is cornerstone.

Struct Registry and Struct-to-Ptr Lowering

Diving further into struct support, commit c95eea6 revealed a robust struct registry. This involves build_struct_table() walking through every SemanticStmt::StructDef. As it encounters each, it lowers field types and computes their layout via compute_struct_layout(), established back in Phase 8.

The produced StructLayoutInfo details field offsets, sizes, and alignments for each struct, threading this struct metadata through key components like LoweringCtx and the lowering functions. The main change here is how lower_type operates, shifting from returning UnsupportedSemanticType for structs to correctly mapping SemanticType::Struct(_) to Ok(IrType::Ptr).

LLVM has a similar stance on treating structs as pointers, which supports computational efficiency. Importantly, the struct layout calculation is performed just once, and then utilized across functions, preventing redundant computations.

The Submain Divergence

Submain’s trajectory reflects a 34-day, 22-commit lead over main, carrying a slew of updates from Phases 10-11 including error management, overflow controls, and optional semicolons. This branch also holds 117 tests against main’s 78.

Concerns rise as days pass without merging these advancements back into main. The longer this continues, the more challenging integration will become, posing significant risks to the overall project. There’s an urgent need to close this divergence to streamline development and mitigate integration complexities.

What Landed vs. What Was Predicted

Interestingly, the predicted advancement in Phase 11's expression lowering occurred, albeit through focus on underlying struct and memory operation enhancement rather than direct expression work. However, several anticipated actions did not see progression — the crucial merge into main remained unaddressed, as did tackling existing IR backend test failures or resolving inactive PRs.

What's Next

Struct support is now foundational. Following this, we should:

  • Lower struct field accesses. Implement DotAccess lowering utilizing StructLayoutInfo for accurate field handling through pointer arithmetic accompanied by Load and Store.
  • Lower struct literals. Translate SemanticExprKind::StructLit into an Alloca followed by Store operations for each field based on layout offsets.
  • Merge submain to main. This remains the top priority with 22 new commits and 39 tests awaiting integration.

The groundwork is laid for more sophisticated struct handling in Cx. The path forward involves both immediate function implementations and resolving the pressing main-submain merge to unify the project’s progress.


Follow the Cx language project:

Originally published at https://cx-lang.com/blog/2026-05-01