Most CLOS implementations use a representation for instances which
uses an indirection, in order to implement class redefinition and
change-class
. In this document I propose a technique which
avoids the indirection most of the time, describe how to optimise
around the assumption that a class does not change, and how
this technique fares with multiple threads.
First, make the damn GC work consistently.
Parallel marking seems easier than parallel copying. The GC is already designed after https://dl.acm.org/doi/pdf/10.1145/512529.512546 and has the same mark queue design. We presumably “just” need to make marking atomic,
Looking through the "checklist" on https://news.ycombinator.com/item?id=14691212. I think I made it out alive.
- Everything is 256 bits wide, including the "byte" type. This means that whilst byte[] is valid syntax, it will take up 32x more space than you expect. Storage space is extremely limited in Solidity programs. You should use "bytes" instead which is an actual byte array. The native 256-bit wide primitive type is called "bytes32" but the actual 8-bit wide byte type is called "int8".
Object size is an implementation detail.
- Strings. What can we say about this. There is a string type. It is useless. There is no support for string manipulation at all. String concatenation must be done by hand after casting to a byte array. Basics like indexOf() must also be written by hand or implementations copied into your program. To even learn the length of a string you must cast it to a byte array, but see above. In some versions of the Solidity compiler passing an empty string to a function would cause all
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
static int peek_failures = 0; | |
int SSL_peek(SSL *s, void *buf, int num) | |
{ | |
if (s->handshake_func == 0) { | |
SSLerr(SSL_F_SSL_PEEK, SSL_R_UNINITIALIZED); | |
return -1; | |
} | |
if (s->shutdown & SSL_RECEIVED_SHUTDOWN) { |
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
;; A grown up version of https://lists.gnu.org/archive/html/emacs-devel/2018-03/msg00127.html | |
(defvar-local *vpi-did-full-indent?* nil) | |
(defun vpi-find-start () | |
(loop | |
(back-to-indentation) | |
(when (or (= (point-min) (point)) (zerop (current-column))) | |
(return)) | |
(forward-line -1))) |
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
#include <gc.h> | |
#include <cstddef> | |
#include <new> | |
void* operator new(std::size_t n) { | |
void *p = GC_MALLOC(n); | |
if (!p) throw std::bad_alloc(); | |
return p; | |
} |
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
(define-syntax beaver | |
(syntax-rules [a b c d quote] | |
[(beaver lefts 0 rights 'a) | |
(right lefts 1 rights 'b)] | |
[(beaver lefts 0 rights 'b) | |
(left lefts 1 rights 'a)] | |
[(beaver '(lefts ...) 0 '(rights ...) 'c) | |
'(lefts ... 1 rights ...)] | |
[(beaver lefts 0 rights 'd) | |
(right lefts 1 rights 'd)] |
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
(defun distance-histogram () | |
(let ((hist (make-array 128 | |
:element-type '(unsigned-byte 64) | |
:initial-element 0))) | |
(flet ((measure (object referenced) | |
(when (typep referenced '(or cons array standard-object)) | |
(let* ((object (sb-kernel:get-lisp-obj-address object)) | |
(referenced (sb-kernel:get-lisp-obj-address referenced)) | |
(delta (ash (- object referenced) -3)) | |
(size (* (signum delta) (integer-length (abs delta))))) |
We want a thread-local GC for SICL. If most collections are thread-local, we would improve upon latency and throughput, even with many threads.
The plan for a while was to use something like the Doligez-Leroy-Gonthier (DLG) collector [fn:thread-local-ml]. However,
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
;;; Remove any assignment instructions and locations which appear to | |
;;; be redundant. We define a "redundant" assignment to be one which | |
;;; assigns from a lexical location to another, either with only one | |
;;; defining instruction; i.e. the assignment does not cause any | |
;;; visible effect. | |
(defun remove-redundant-assignments (enter-instruction) | |
(cleavir-ir:map-instructions-arbitrary-order | |
(lambda (instruction) | |
(when (typep instruction 'cleavir-ir:assignment-instruction) |
NewerOlder