Skip to content

Instantly share code, notes, and snippets.

@dinfuehr
dinfuehr / aarch64-logical-immediates.txt
Last active August 8, 2022 19:16
all possible logical immediates
5555555555555555 0101010101010101010101010101010101010101010101010101010101010101 size=02 length=00 rotation=00 N=0 immr=000000 imms=111100
aaaaaaaaaaaaaaaa 1010101010101010101010101010101010101010101010101010101010101010 size=02 length=00 rotation=01 N=0 immr=000001 imms=111100
1111111111111111 0001000100010001000100010001000100010001000100010001000100010001 size=04 length=00 rotation=00 N=0 immr=000000 imms=111000
8888888888888888 1000100010001000100010001000100010001000100010001000100010001000 size=04 length=00 rotation=01 N=0 immr=000001 imms=111000
4444444444444444 0100010001000100010001000100010001000100010001000100010001000100 size=04 length=00 rotation=02 N=0 immr=000010 imms=111000
2222222222222222 0010001000100010001000100010001000100010001000100010001000100010 size=04 length=00 rotation=03 N=0 immr=000011 imms=111000
3333333333333333 0011001100110011001100110011001100110011001100110011001100110011 size=04 length=01 rotation=00 N=0 immr=000000 imms=111001
9999999999999999 100110011001100110011001100
#include <iostream>
#include <chrono>
#include <atomic>
#include <cassert>
#include <mutex>
const int ITERATIONS = 10'000'000;
std::mutex mtx;
int state = 2;
@dinfuehr
dinfuehr / Dockerfile
Created July 10, 2016 09:32
cacao-jvm-dockerfile
FROM ubuntu:16.04
MAINTAINER dominik.infuehr@gmail.com
RUN apt-get update \
&& apt-get install -y \
mercurial \
wget \
unzip \
libtool \
autoconf \
@dinfuehr
dinfuehr / richards-fixed.js
Last active October 9, 2018 17:40
richards sampling
function runRichards() {
var scheduler = new Scheduler();
scheduler.addIdleTask(0, null, 1000);
var queue = new Packet();
scheduler.addWorkerTask(1, queue);
if (scheduler.queueCount != 2322) {}
}
function Scheduler() { }
@dinfuehr
dinfuehr / FwdptrDataModel.java
Created November 8, 2017 06:32
fwdptr heap overhead
package org.openjdk.jol.datamodel;
import org.openjdk.jol.util.MathUtil;
public class FwdptrDataModel implements DataModel {
private final int align;
private final boolean compressedOops;
private final FwdptrModel fwdptrModel;
@dinfuehr
dinfuehr / aarch64-logical-immediates.rb
Last active May 2, 2017 18:55
output all logical immediate values with n, immr and imms
def get_imms(size, length)
length | case size
when 2 then 0b111100
when 4 then 0b111000
when 8 then 0b110000
when 16 then 0b100000
when 32 then 0b000000
when 64 then 0b000000
end
end
use std::cell::RefCell;
use std::ops::Index;
struct GrowableVec<T> {
elements: RefCell<Vec<Box<RefCell<T>>>>,
}
impl<T> GrowableVec<T> {
fn new() -> GrowableVec<T> {
GrowableVec {
@dinfuehr
dinfuehr / diff.md
Last active November 4, 2016 16:25
rust compilation difference

Nightly (f09420685 2016-10-20)

0000000000000000 <__rust_maybe_catch_panic>:
   0:   55                      push   %rbp
   1:   41 57                   push   %r15
   3:   41 56                   push   %r14
   5:   53                      push   %rbx
   6:   50                      push   %rax
type Date = chrono::Date<chrono::Local>;
pub struct DateIterator {
start: Date,
end: Date
}
impl Iterator for DateIterator {
// ... not important
}
@dinfuehr
dinfuehr / error.rs
Created January 26, 2015 09:03
Rust: cannot move out of borrowed content
struct Foo {
value: String
}
impl Foo {
fn test(&mut self) -> String {
let old = self.value;
self.value = "new".to_string();
old
}