Skip to content

Instantly share code, notes, and snippets.

View anarazel's full-sized avatar

Andres Freund anarazel

View GitHub Profile
.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)
@anarazel
anarazel / x32.ll
Created September 21, 2018 18:01
; 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 }
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 */
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))
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
setup
{
CREATE OR REPLACE FUNCTION blurt_and_lock(text) RETURNS text IMMUTABLE LANGUAGE plpgsql AS $$
BEGIN
RAISE NOTICE 'called for %', $1;
IF pg_try_advisory_xact_lock(current_setting('spec.session')::int, 1) THEN
RAISE NOTICE 'blocking 2';
PERFORM pg_advisory_xact_lock(current_setting('spec.session')::int, 2);
ELSE
Jun 21 10:59:43 alap4 kernel: rcu: INFO: rcu_sched self-detected stall on CPU
Jun 21 10:59:43 alap4 kernel: rcu: 4-....: (59999 ticks this GP) idle=4fa/1/0x4000000000000002 softirq=11208655/11208655 fqs=14983
Jun 21 10:59:43 alap4 kernel: (t=60000 jiffies g=24107409 q=5523)
Jun 21 10:59:43 alap4 kernel: NMI backtrace for cpu 4
Jun 21 10:59:43 alap4 kernel: CPU: 4 PID: 2448 Comm: Web Content Tainted: G U W O 5.2.0-rc5-andres-00177-g29f785ff76b6 #94
Jun 21 10:59:43 alap4 kernel: Hardware name: LENOVO 20FWCTO1WW/20FWCTO1WW, BIOS R07ET88W (2.28 ) 01/18/2019
Jun 21 10:59:43 alap4 kernel: Call Trace:
Jun 21 10:59:43 alap4 kernel: <IRQ>
Jun 21 10:59:43 alap4 kernel: dump_stack+0x67/0x90
Jun 21 10:59:43 alap4 kernel: nmi_cpu_backtrace.cold.0+0x13/0x50
400 /* release the buffer space */
401 pfree(file->files);
0x00000000007d88a8 <+56>: mov 0x8(%r12),%rdi
0x00000000007d88ad <+61>: callq 0x9734f0 <pfree>
402 pfree(file);
0x00000000007d88b2 <+66>: pop %rbx
0x00000000007d88b3 <+67>: mov %r12,%rdi
0x00000000007d88b6 <+70>: pop %r12
0x00000000007d88b8 <+72>: pop %rbp
WIP: Add support for copying node tree into single allocation.
As an example as to why one would want that, here's a
MemoryContextStats for the same query being added to the
plancache. The query is just a randomly selected one among the queries
issued by \d+.
PREPARE foo AS SELECT c.relchecks, c.relkind, c.relhasindex, c.relhasrules, c.relhastriggers, c.relrowsecurity, c.relforcerowsecurity, false AS relhasoids>
EXECUTE foo ;
This file has been truncated, but you can view the full file.
#include "postgres.h"
#include "nodes/primnodes.h"
#include "nodes/pathnodes.h"
#include "nodes/plannodes.h"
#include "nodes/execnodes.h"
#include "nodes/memnodes.h"
#include "nodes/value.h"
#include "nodes/pg_list.h"
#include "nodes/extensible.h"