Skip to content

Instantly share code, notes, and snippets.

module LispParser where
import Control.Monad
import Text.ParserCombinators.Parsec hiding (spaces)
data LispVal = Atom String
| List [LispVal]
| Vector (Int, [LispVal])
| DottedList [LispVal] LispVal
| Number Integer
@pwq1989
pwq1989 / speed_test.cpp
Last active December 22, 2015 06:48
A test program for this Question which faster in follows: 1. sort 10000 int 2. read 1M bytes from memory
#include <iostream>
#include<stdlib.h>
#include <stdio.h>
#include "stdlib.h"
#include "string.h"
using namespace std;
//void set_affinity();
#pragma once
#include <functional>
#ifndef _MSC_VER
#define __thiscall
#endif
namespace vczh {
template<typename TResult, typename ...TArgs>
@pwq1989
pwq1989 / interpreter.cpp
Last active June 3, 2019 08:27
simple interpreter used TCO, inspired by @Belleve's version
/*
* simple interpreter
* @author youxi
* @email pwq1989@gmail.com
*/
#include <iostream>
#include <time.h>
#include <stdlib.h>
#include "interpreter.h"
-XX:+UnlockDiagnosticVMOptions -XX:+PrintAssembly
-XX:+PrintCompilation
-XX:+DebugNonSafepoints
-XX:InlineSmallCode=2000
java -server -XX:+UnlockDiagnosticVMOptions -XX:+TraceClassLoading -XX:+PrintAssembly -XX:+LogCompilation -XX:LogFile=live.log
java -XXaltjvm=gcih -XX:+UnlockDiagnosticVMOptions -XX:+PrintAssembly test.Main > a.log
-XX:-UseInterpreter
-XX:+PrintStubCode
-XX:+TieredCompilation
@pwq1989
pwq1989 / hotspot6-unwind.diff
Created March 2, 2015 11:23
remove rbp from normal reg set, and save rsp to rbp
diff --git a/src/cpu/x86/vm/c1_MacroAssembler_x86.cpp b/src/cpu/x86/vm/c1_MacroAssembler_x86.cpp
index 576d338..ae335b4 100644
--- a/src/cpu/x86/vm/c1_MacroAssembler_x86.cpp
+++ b/src/cpu/x86/vm/c1_MacroAssembler_x86.cpp
@@ -358,6 +358,7 @@ void C1_MacroAssembler::build_frame(int frame_size_in_bytes) {
generate_stack_overflow_check(frame_size_in_bytes);
push(rbp);
+ mov(rbp, rsp);
#ifdef TIERED
@pwq1989
pwq1989 / walltime.c
Last active August 29, 2015 14:21
a kernel module sample process's wall-time
#include <linux/module.h>
#include <linux/sched.h>
#include <linux/kernel.h>
#include <linux/wait.h>
#include <linux/delay.h>
#include <linux/fs.h>
#include <asm/uaccess.h>
#include <linux/mm.h>
#include <linux/pid.h>
#include <linux/list.h>
@pwq1989
pwq1989 / vimrc
Last active January 18, 2017 08:57
vimrc
set encoding=utf-8
set fileencoding=utf-8
set fileencodings=ucs-bom,utf-8,chinese,cp936
set guifont=Consolas\ 16
" language messages zh_CN.utf-8
" set guifont=Monospace\ 12
set langmenu=zh_CN.UTF-8
set lines=45 columns=100
set number
@pwq1989
pwq1989 / Molokai.vim
Created January 18, 2017 08:56
modified Molokai.vim
" Vim color file
"
" Author: Tomas Restrepo <tomas@winterdom.com>
" https://github.com/tomasr/molokai
"
" Note: Based on the Monokai theme for TextMate
" by Wimer Hazenberg and its darker variant
" by Hamish Stuart Macpherson
"
@pwq1989
pwq1989 / cloudSettings
Last active September 30, 2020 03:54
vscode_config
{"lastUpload":"2020-09-30T03:54:16.120Z","extensionVersion":"v3.4.3"}