Skip to content

2024

Prerequisite of Go Sync Mutex Implementation

This blog is split from the blog of sync mutex implementation due to its length. For better reading experience and clearer organization, it's reasonable to make these background knowledge a separated article.

This blog introduces the language level instructions/functions such as atomic and synchronization, the runtime spinning, sleeping and awoken. It also briefs the memory barrier and assembly code in golang.

LLVM IR Emission(1): Overall and Type Emission

This blog briefly introduces the LLVM IR emission practice in Piovt-Language. The pl utilizes the LLVM to generates the backend code and does optimizer with the help of LLVM passes. The emission happens during converting from AST node into the LLVM, coupled with the syntax check as well. In this blog, we focus on the conversion details between LLVM IR and AST, and by the way inspects the ways of type check in a static language.

LLVM: Control Flow and Phi Node

LLVM provides a set of APIs for you to emit the platform dependent IR, and helps to optimize the generated IR and finally produces the low level executable code.

When writing a compiler, we first need to parse the high level source code into the AST. And then, after processing the modules and type checks, it's time to start to interact with LLVM to emit the LLVM IR.

This blog records my misunderstanding during learning llvm control flow and phi node.

Go Program Out of Memory

Last week, during on duty, one user reported his program exited silently without any useful information during deployment, the process is aborted with a killed information:

[1]    90616 killed     ./bin/server

This is an intrigue question as why the program is killed by OOM killer instead of a fatal stack overflow error.