This file contains 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
#|| | |
Let's see if an example works better to explain how lexical scoping works | |
A naive way to implement lexical scoping threads an environment across | |
all the operations. It could, for example, be implemented as an association | |
list: a list of (variable . value) conses. In CL, a second environment | |
is needed for functions (and GO tags, and ...), but it's just more of the | |
same thing. An interpreter for a very restricted language with similar | |
scoping rules, could look like: | |
||# |
This file contains 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
(defpackage "COMPLEX-PUNS" | |
(:use "CL") | |
(:export "%CDREF" "CDREF" "%CDSET" "CDSET")) | |
(in-package "COMPLEX-PUNS") | |
(deftype index () | |
`(mod ,array-dimension-limit)) | |
(sb-c:defknown (%cdref cdref) ((simple-array double-float 1) index) (complex double-float) | |
(sb-c:flushable sb-c:movable sb-c:foldable)) |
This file contains 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
(defun foo (&rest arguments) | |
;; this should all be gensymmed | |
(let (a-value a-p b-value b-p allow-other-keys allow-other-keys-p other-key-p) | |
(loop while arguments do | |
(let ((key (pop arguments)) | |
(value (if (null arguments) | |
(error "Odd number of keyword arguments") | |
(pop arguments)))) | |
(case key | |
(:a |
This file contains 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
(define-vop (bignum-mult-and-add-3-arg) | |
(:translate sb!bignum:%multiply-and-add) | |
(:policy :fast-safe) | |
(:args (x :scs (unsigned-reg) :to :result) | |
(y :scs (unsigned-reg) :to :result) | |
(carry-in :scs (unsigned-reg) :target lo)) | |
(:arg-types unsigned-num unsigned-num unsigned-num) | |
(:results (hi :scs (unsigned-reg) :from :eval) | |
(lo :scs (unsigned-reg) :from (:argument 2))) | |
(:result-types unsigned-num unsigned-num) |
This file contains 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
// b-tree | |
// Before | |
template<unsigned B, typename T, typename I> | |
I btree_array<B, T,I>::search(const T &x) { | |
I j = n; | |
I i = 0; | |
while (i < n) { | |
I lo = i; | |
I hi = std::min(i+B, n); | |
while (lo < hi) { |
This file contains 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
Entity component system for multi-threaded systems with a large memory footprint? | |
I spend most of my development time at work on systems that could be described as very read-optimised index engines. We do things | |
like work with sorted arrays because the density for reads is more important than linear time inserts. | |
The systems are also single writer, multi reader, and we optimise for read latency and throughput at the expense of writes. | |
In a way, I'm trying to bring the design of an ad hoc in-memory object graph closer to normal data bases, and one of the ways I'm | |
considering is to use something like ECS for data representation. We're moving to 1GB pages, and that really simplifies the design | |
tradeoffs: we only really want to make sure we use cache lines fully, but the rest (make sure that related data are mostly in the |
This file contains 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
/* frama-c test.c -wp -then -report */ | |
struct foo { | |
unsigned int x; | |
double y; | |
}; | |
/*@ ghost int state_table[1UL << 30]; */ | |
/*@ ghost unsigned long count; */ |
This file contains 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
% perf stat ./tsx_per_core | |
Aborts: 73381 | |
No reason: 57535 | |
reason 0: 0 | |
reason 1: 15833 | |
reason 2: 15833 | |
reason 3: 13 | |
reason 4: 0 | |
reason 5: 0 | |
81597398 68933303 85476712 72654716 76819140 72119787 77728188 74167801 75244800 72119632 75951739 72606078 74035109 70998737 89185152 58165171 86098994 83338241 88201758 81982602 77964219 77861602 75642915 79207346 73514808 79929374 74429694 71508632 0 0 0 0 |
This file contains 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
#define _GNU_SOURCE | |
#define RLOCK_SIGNAL_HANDLER | |
#include "rlock.h" | |
#include "rlock_process_status.h" | |
#include <assert.h> | |
#include <errno.h> | |
#include <pthread.h> | |
#include <signal.h> |
This file contains 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
#include <assert.h> | |
#include <err.h> | |
#include <inttypes.h> | |
#include <stdint.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <emmintrin.h> | |
#include <tmmintrin.h> |
OlderNewer