Skip to content

Instantly share code, notes, and snippets.

Andres Freund anarazel

View GitHub Profile
View gist:13c852c02d8d8dc4f359406c91577f56
2019-03-12 15:12:57.477 PDT [12044][3/14] LOG: requesting checkpoint
2019-03-12 15:12:57.477 PDT [12044][3/14] STATEMENT: CREATE DATABASE test1 TEMPLATE template0;
2019-03-12 15:12:57.477 PDT [12044][3/14] LOG: finished requesting checkpoint
2019-03-12 15:12:57.477 PDT [12044][3/14] STATEMENT: CREATE DATABASE test1 TEMPLATE template0;
2019-03-12 15:12:57.477 PDT [12038][] LOG: checkpoint starting: immediate force wait flush-all
2019-03-12 15:12:57.511 PDT [12038][] LOG: checkpoint complete: wrote 3 buffers (0.0%); 0 WAL file(s) added, 0 removed, 0 recycled; write=0.033 s, sync=0.000 s, total=0.034 s; sync files=0, longest=0.000 s, average=0.000 s; distance=5 kB, estimate=5 kB
2019-03-12 15:12:57.577 PDT [12044][3/14] LOG: finished waiting for checkpoint
2019-03-12 15:12:57.577 PDT [12044][3/14] STATEMENT: CREATE DATABASE test1 TEMPLATE template0;
2019-03-12 15:12:57.590 PDT [12044][3/14] LOG: requesting checkpoint
2019-03-12 15:12:57.590 PDT [12044][3/14] STATEMENT: CREATE DATABASE test1 TEMPLATE te
View ltoa.c
void
pg_ltoa(int32 val, char *a)
{
uint32 value;
/*
* Avoid problems with the most negative integer not being representable
* as a positive integer.
*/
if (unlikely(val == PG_INT32_MIN))
View i-am-a-monster.h
typedef struct NullableDatum
{
Datum datum;
bool isnull;
/* FIXME: space for flags? */
} NullableDatum;
typedef struct FunctionCallInfoDataVar
{
FmgrInfo *flinfo; /* ptr to lookup info used for this call */
View x32.ll
; ModuleID = '<stdin>'
source_filename = "pg"
target datalayout = "e-m:e-p:32:32-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnux32"
%struct.ExprState = type { %struct.Node, i8, i8, i32, %struct.TupleTableSlot*, %struct.ExprEvalStep*, i32 (%struct.ExprState*, %struct.ExprContext*, i8*)*, %struct.Expr*, i8*, i32, i32, %struct.PlanState*, %struct.ParamListInfoData*, i32*, i8*, i32*, i8* }
%struct.Node = type { i32 }
%struct.TupleTableSlot = type { i32, i8, i8, i8, i8, %struct.HeapTupleData*, %struct.tupleDesc*, %struct.MemoryContextData*, i32, i32, i32*, i8*, %struct.MinimalTupleData*, %struct.HeapTupleData, i32, i8 }
%struct.tupleDesc = type { i32, i32, i32, i8, i32, %struct.tupleConstr*, [0 x %struct.FormData_pg_attribute] }
%struct.tupleConstr = type { %struct.attrDefault*, %struct.constrCheck*, %struct.attrMissing*, i16, i16, i8 }
View clang.s
.text
.file "combine.c"
.globl evalexpr_0_0 # -- Begin function evalexpr_0_0
.p2align 4, 0x90
.type evalexpr_0_0,@function
evalexpr_0_0: # @evalexpr_0_0
.cfi_startproc
# %bb.0:
movb $0, (%rdi)
movb $1, (%rsi)
View gist:d3da35d2ae9d7760d5677267da06b77c
$ cat /tmp/combine.ll
; ModuleID = '<stdin>'
source_filename = "pg"
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"
define void @evalexpr_0_0(i8* align 8 noalias, i32* align 8 noalias) {
entry:
%a01 = getelementptr i8, i8* %0, i16 0
View gist:84cd16d3242ca4bd4c4fb6f4a86bb05a
movb $0, (%rbx)
movl (%rax,%rcx), %esi
movq %rsi, (%r10)
movb $0, 1(%rbx)
movl 4(%rax,%rcx), %esi
movq %rsi, 8(%r10)
movb $0, 2(%rbx)
movl 8(%rax,%rcx), %esi
movq %rsi, 16(%r10)
movb $0, 3(%rbx)
View gist:af10ee63fa508a902b2c22c67c488930
andres@alap4:~/src/postgresql$ clang-7 -march=i386 -O2 -m32 ~/tmp/flttst.c -o ~/tmp/flttst && ~/tmp/flttst
r1 = 1, r2 = 0
andres@alap4:~/src/postgresql$ clang-7 -march=nehalem -O2 -m32 ~/tmp/flttst.c -o ~/tmp/flttst && ~/tmp/flttst
r1 = 1, r2 = 1
andres@alap4:~/src/postgresql$ cat ~/tmp/flttst.c
#include <stdio.h>
#include <math.h>
int main(int argc, char **argv)
{
View gist:25803f926254747ff80d32ec25749a7e
#ifdef HAVE__BUILTIN_BSWAP64
#define BSWAP64(x) __builtin_bswap64(x)
#else
#define BSWAP64(x) ((((x) << 56) & UINT64CONST(0xff00000000000000)) | \
(((x) << 40) & UINT64CONST(0x00ff000000000000)) | \
(((x) << 24) & UINT64CONST(0x0000ff0000000000)) | \
(((x) << 8) & UINT64CONST(0x000000ff00000000)) | \
(((x) >> 8) & UINT64CONST(0x00000000ff000000)) | \
(((x) >> 24) & UINT64CONST(0x0000000000ff0000)) | \
(((x) >> 40) & UINT64CONST(0x000000000000ff00)) | \
View gist:4216557
diff --git a/handler.c b/handler.c
index 13c89ec..3f21e79 100644
--- a/handler.c
+++ b/handler.c
@@ -1236,7 +1236,7 @@ static int autoview_handler (BODY *a, STATE *s)
int rc = 0;
snprintf (type, sizeof (type), "%s/%s", TYPE (a), a->subtype);
- rfc1524_mailcap_lookup (a, type, entry, M_AUTOVIEW);
+ rfc1524_mailcap_lookup (a, type, entry, s->flags & M_REPLYING ? M_COMPOSE : M_AUTOVIEW);
You can’t perform that action at this time.