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
http://en.wikipedia.org/wiki/X86_calling_conventions#AMD64_ABI_convention | |
rax function(rdi, rsi, rdx, rcx, r8, r9, ...); | |
Preserved across | |
Register Usage function calls | |
%rax temporary register; with variable arguments No | |
passes information about the number of SSE | |
registers used; 1st return register | |
%rbx callee-saved register; optionally used as base Yes |
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
import java.util.ArrayList; | |
import java.util.List; | |
import java.util.Map; | |
import java.nio.file.Paths; | |
/** Caplet to include runtime classpath. */ | |
public class RuntimeClasspathCaplet extends Capsule { | |
private static final String PROP_RUNTIME_CP = "caplet.runtime.classpath"; | |
/** Composition constructor. */ |
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
// Benchmarking pthread_getspecific vs __thread on OS X | |
// | |
// Compile with clang++ -g -O3 -std=c++11 | |
#include <stdio.h> | |
#include <pthread.h> | |
#include <chrono> | |
#include <cinttypes> |
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
apt-get remove $(dpkg --list 'linux-image*' |grep ^ii | awk '{print $2}'\ | grep -v `uname -r`) |
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 <stdio.h> | |
int main(int argc, char **argv) { | |
char *c = new char[0]; | |
printf("new[0] -> %p\n", c); | |
// This is undefined: return (int) *c; | |
return 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
#include <stdio.h> | |
#include <stdlib.h> | |
#include <atomic> | |
#include <chrono> | |
std::chrono::milliseconds direct(int iters) { | |
auto start = std::chrono::system_clock::now(); | |
auto val = new std::atomic<int>[1]; |
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
# Data: | |
# 1ms foo | |
# 3.7s bar | |
# ... | |
# Convert to seconds | |
gawk 'BEGIN {FS=" +"} { val = $1 ~ /ms$/ ? $1 / 1000 : $1 * 1; print val,$2 }' |
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 "exp.h" | |
void no_args() { | |
printf("no args\n"); | |
} | |
void just_pathparams(PathParam<std::string> p1) { | |
printf("just path params: %s\n", p1.value().c_str()); | |
} |
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
template<class _Rp, class ..._ArgTypes> | |
template <class _Alloc> | |
function<_Rp(_ArgTypes...)>::function(allocator_arg_t, const _Alloc&, | |
function&& __f) | |
{ | |
if (__f.__f_ == 0) | |
__f_ = 0; | |
else if (__f.__f_ == (__base*)&__f.__buf_) | |
{ | |
__f_ = (__base*)&__buf_; |
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 <stdio.h> | |
#include <functional> | |
#include <utility> | |
struct Big { | |
char data[1024]; | |
}; | |
int main(int argc, char **argv) { |
NewerOlder