並び順

ブックマーク数

期間指定

  • から
  • まで

1 - 25 件 / 25件

新着順 人気順

typedef struct function pointer in cの検索結果1 - 25 件 / 25件

  • Writing a C compiler in 500 lines of Python

    A few months ago, I set myself the challenge of writing a C compiler in 500 lines of Python1, after writing my SDF donut post. How hard could it be? The answer was, pretty hard, even when dropping quite a few features. But it was also pretty interesting, and the result is surprisingly functional and not too hard to understand! There's too much code for me to comprehensively cover in a single blog

    • OPcache オペコードキャッシュの仕組み - Shin x Blog

      本エントリでは、PHP の内部実装(php-src)から OPcache のオペコードキャッシュの仕組みを見ていきます。 OPcache にはいくつかの機能がありますが、ここでは共有メモリへのオペコードキャッシュと preload が対象です。ファイルベースのキャッシュと JIT については触れません。 サマリ オペコードキャッシュ preload オペコードキャッシュと preload の比較 オペコードキャッシュ キャッシュデータレイアウト グローバル変数、マクロ キャッシュデータ構造体 オペコードキャッシュ: ZCSG(hash) キャッシュエントリ: zend_accel_hash_entry キャッシュデータ初期化 OPcache 処理の有効化 PHP ファイルコンパイル処理でのキャッシュ制御 persistent_compile_file() の主な処理 zend_accel_

        OPcache オペコードキャッシュの仕組み - Shin x Blog
      • Making a 3D Modeler, in C, in a Week

        Last fall I participated in a week long programming event called the Wheel Reinvention Jam. The point of the Jam was to revisit existing software systems with fresh eyes. I ended up making a 3D modeler called “ShapeUp”. This post will make more sense if you watch the video demo of ShapeUp before reading more. You can try ShapeUp in your browser. This is what it looks like: Mike Wazowski modeled in

          Making a 3D Modeler, in C, in a Week
        • gist:3ef8747868ac126c30f94888425eb56d

          gistfile1.md yjit についてメモ書き MRI に組み込まれた JIT 実装 Shopify で Maxime Chevalier-Boisvert さんが中心となり開発された 日本語だと https://techracho.bpsinc.jp/hachi8833/2021_11_02/112909 が詳しい めちゃ速い $ for opt in '' '--jit' '--yjit'; do echo "opt": $opt; time ./miniruby $opt -e 'def fib(n); return n if n < 2; fib(n - 1) + fib(n-2); end; fib(35)'; done opt: real 0m1.050s user 0m0.971s sys 0m0.036s opt: --jit real 0m0.755s user 0

            gist:3ef8747868ac126c30f94888425eb56d
          • Learn x86-64 assembly by writing a GUI from scratch

            We then pass the address on the stack of the beginning of the string to the write syscall, as well as its length: %define SYSCALL_WRITE 1 %define STDOUT 1 print_hello: push rbp ; Save rbp on the stack to be able to restore it at the end of the function. mov rbp, rsp ; Set rbp to rsp sub rsp, 5 ; Reserve 5 bytes of space on the stack. mov BYTE [rsp + 0], 'h' ; Set each byte on the stack to a string

            • The OpenSSL punycode vulnerability (CVE-2022-3602): Overview, detection, exploitation, and remediation | Datadog Security Labs

              emerging threats and vulnerabilities The OpenSSL punycode vulnerability (CVE-2022-3602): Overview, detection, exploitation, and remediation November 1, 2022 emerging vulnerability On November 1, 2022, the OpenSSL Project released a security advisory detailing a high-severity vulnerability in the OpenSSL library. Deployments of OpenSSL from 3.0.0 to 3.0.6 (included) are vulnerable and are fixed in

                The OpenSSL punycode vulnerability (CVE-2022-3602): Overview, detection, exploitation, and remediation | Datadog Security Labs
              • 0.8.0 Release Notes ⚡ The Zig Programming Language

                Tier 4 Support § Support for these targets is entirely experimental. If this target is provided by LLVM, LLVM may have the target as an experimental target, which means that you need to use Zig-provided binaries for the target to be available, or build LLVM from source with special configure flags. zig targets will display the target if it is available. This target may be considered deprecated by

                • Simply Parse in C

                  by Chloe Kudryavtsev People are terrified of parsers and parsing. To the point of using magical libraries with custom syntaxes to learn just to get started. In the hopes of completely shattering this preconception, I will write a parser for the “ini” file format in about 150 lines of pure and readable ISO C99. Furthermore, this parser will be something that's nice to use and has error correcting f

                    Simply Parse in C
                  • C#からC/C++のネイティブプラグインを使用するときに注意すること - Activ8 Tech Blog

                    こんにちは、エンジニアリングマネージャーの渡辺(@mochi_neko_7)です。 本記事では、Unity/C#からC/C++で作られたネイティブプラグインを呼び出す、いわゆるC# Bridgeなどを作成する際に知っておくべきこと、注意すべきことを紹介します。 ネイティブプラグインを自分で触っているとUnityをクラッシュさせてしまうことも多いと思いますが、通常のように分かりやすいログが出るわけではないため何が原因なのか分かりにくいことも多いのではないでしょうか? 最近はUnityはC#のIL2CPPビルドでパフォーマンスも改善されていますし、そこまでC/C++を触るケースが多くないのかネットにあまり情報も多くはない印象ですが、知らないとデバッグ自体しづらいことも多いです。 自分が雰囲気でコードを書いていたらすぐにUnityをクラッシュさせてしまったので、そのデバッグ過程で得られた理解を整

                      C#からC/C++のネイティブプラグインを使用するときに注意すること - Activ8 Tech Blog
                    • Understanding the Heap - a beautiful mess

                      In this blog, I am going to explain the important concepts of Heap and use the ptmalloc in the Glibc 2.31 library as an example. The heap is a beautiful mess :) I really like the saying shown above. The word Heap we always use refers to the dynamically allocated segment in the virtual memory space of a process, but it actually stands for the implementation of the memory pool(the dynamic memory all

                      • 0.10.0 Release Notes ⚡ The Zig Programming Language

                        Tier 4 Support § Support for these targets is entirely experimental. If this target is provided by LLVM, LLVM may have the target as an experimental target, which means that you need to use Zig-provided binaries for the target to be available, or build LLVM from source with special configure flags. zig targets will display the target if it is available. This target may be considered deprecated by

                        • Rust for Secure IoT Applications: Why C Is Getting Rusty

                          www.embedded-world.eu Rust for Secure IoT Applications Why C Is Getting Rusty Mario Noseda, Fabian Frei, Andreas Rüst, Simon Künzli Zurich University of Applied Sciences (ZHAW) Institute of Embedded Systems (InES) Winterthur, Switzerland mario.noseda@zhaw.ch, fabian.frei@zhaw.ch, andreas.ruest@zhaw.ch, simon.kuenzli@zhaw.ch Abstract— Memory corruption is still the most used type of exploit in toda

                          • V8 Torque user manual · V8

                            V8 Torque is a language that allows developers contributing to the V8 project to express changes in the VM by focusing on the intent of their changes to the VM, rather than preoccupying themselves with unrelated implementation details. The language was designed to be simple enough to make it easy to directly translate the ECMAScript specification into an implementation in V8, but powerful enough t

                            • Lesser known tricks, quirks and features of C

                              Mini-post: Digraphs and Trigraphs | ENOSUCHBLOG C alternative tokens - Wikipedia Why are there digraphs in C and C++? - Stack Overflow Purpose of Trigraph sequences in C++? A brief description of Normative Addendum 1 Designated initializer # These allow you to specify which elements of an object (array, structure, union) are to be initialized by the values following. The order does not matter! str

                              • Making LLVM GEP safer in Haskell

                                In today's article, I will showcase how Haskell's typesystem can be used to simplify code generation and reduce the chance of bugs involving the LLVM getelementptr instruction. Intro to the GEP instruction LLVM as a compiler framework offers many different low-level instructions, one of which being the getelementptr instruction (commonly abbreviated as just "gep"). With gep, you can compute derive

                                  Making LLVM GEP safer in Haskell
                                • Optimizing Ruby’s JSON, Part 4

                                  In the previous post, we established that as long as ruby/json wasn’t competitive on micro-benchmarks, public perception wouldn’t change. Since what made ruby/json appear so bad on micro-benchmarks was its setup cost, we had to find ways to reduce it further. Spot the Seven Differences So I decided to file this performance discrepancy as a bug, and investigate it as such and started profiling Step

                                  • cuneicode, and the Future of Text in C

                                    Following up from the last post, there is a lot more we need to cover. This was intended to be the post where we talk exclusively about benchmarks and numbers. But, I have unfortunately been perfectly taunted and status-locked, like a monster whose “aggro” was pulled by a tank. The reason, of course, is due to a few folks taking issue with my outright dismissal of the C and C++ APIs (and not showi

                                      cuneicode, and the Future of Text in C
                                    • Optimizing Ruby’s JSON, Part 5

                                      In the previous post, we showed how we eliminated two malloc/free pairs of calls when generating small JSON documents, and how that put us ahead of Oj when reusing the JSON::State object. But that API isn’t the one people use, so if we wanted to come out ahead in the micro-benchmarks users might perform themselves, we had to find a way to get rid of that JSON::State allocation too, or to somehow m

                                      • Python behind the scenes #6: how Python object system works

                                        As we know from the previous parts of this series, the execution of a Python program consists of two major steps: The CPython compiler translates Python code to bytecode. The CPython VM executes the bytecode. We've been focusing on the second step for quite a while. In part 4 we've looked at the evaluation loop, a place where Python bytecode gets executed. And in part 5 we've studied how the VM ex

                                        • Decoding UTF8 with Parallel Extract

                                          Decoding UTF8 with Parallel Extract 23 Mar 2024 As a side-quest I recently decided to write a branchless utf8 decoder utilizing the pext or "parallel extract" instruction. It's compliant with rfc-3629, meaning that it doesn't just naively decode the code-point but also checks for overlong encoding, surrogate pairs and such. Compiled with gcc -O3 -march=x86-64-v3 the entire decoder results in just

                                          • 地面を見下ろす少年の足蹴にされる私

                                            Contracts提案(P2900R14)がC++26に向けて採択され、C++26では契約プログラミング機能を言語サポートの下で実践できるようになります。この記事は、その契約プログラミング機能の一部として導入されている違反ハンドラというものについてのお話です。 契約プログラミング機能における違反ハンドラの概要 ユーザー定義違反ハンドラ std::contracts::contract_violation より一般的な利用 外部ツールの共通コールバック機構として 実行時エラーハンドリングのコールバック機能として(P3290R2) プロファイル機能の実行時検査におけるコールバックとして(P3081R0) 未定義動作の実行時ハンドリング機能として(P3100R0, P3229R1, P3205R0) 参考文献 契約プログラミング機能における違反ハンドラの概要 C++26の契約プログラミング機能は

                                              地面を見下ろす少年の足蹴にされる私
                                            • Rust and dynamically-sized thin pointers

                                              One of Rust's notable differences from C is its requirement that all values have a defined size, which enables runtime bounds-checking and advanced static analysis tooling such as MIRI. For dynamically-sized types (DSTs) this requirement is implemented using thick pointers, such that each pointer to a dynamically-sized value is an (address, size) tuple. Thick pointers are more convenient and easie

                                              • C++ exceptions under the hood

                                                Index A tiny ABI An ABI to appease the linker Catching what you throw Magic around __cxa_begin_catch and __cxa_end_catch Gcc_except_table and the personality function A nice personality Two-phase handling Catching our first exception _Unwind_ and call frame info Reading a CFI table And suddenly, reflexion in C++ Setting the context for a landing pad Multiple landing pads & the teachings of the gur

                                                  C++ exceptions under the hood
                                                • POSIX 2024 Changes

                                                  Green additions means the interface is implemented in Sortix. Red additions means the interface will not be implemented in Sortix. Orange additions means the interface is optional and will not be implemented in Sortix. Black additions means the interface still needs to be implemented in Sortix. Green removals means the interfaced was never implemented in Sortix. Orange removals means the interface

                                                  • Python behind the scenes #4: how Python bytecode is executed

                                                    We started this series with an overview of the CPython VM. We learned that to run a Python program, CPython first compiles it to bytecode, and we studied how the compiler works in part two. Last time we stepped through the CPython source code starting with the main() function until we reached the evaluation loop, a place where Python bytecode gets executed. The main reason why we spent time studyi

                                                    1