Skip to content

Instantly share code, notes, and snippets.

💭
Hacking on Compiler Explorer (when I can)

Matt Godbolt mattgodbolt

💭
Hacking on Compiler Explorer (when I can)
Block or report user

Report or block mattgodbolt

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View brk.bas
DIM b% 32
P% = b%
[OPT2
BRK
EQUB 42
EQUS "StackExchange"
EQUB 0
]
CALL b%
View strace.log
[pid 2066] openat(AT_FDCWD, "/opt", O_RDONLY|O_CLOEXEC|O_PATH|O_DIRECTORY) = 4
[pid 2066] name_to_handle_at(4, "wine-stable", {handle_bytes=128 => 8, handle_type=1, f_handle=0xab090400d0e41824}, [550], 0) = 0
[pid 2066] name_to_handle_at(4, "", {handle_bytes=128 => 144}, 0x7ffd319e2e54, AT_EMPTY_PATH) = -1 EOVERFLOW (Value too large for defined data type)
[pid 2066] name_to_handle_at(4, "", {handle_bytes=144}, 0x7ffd319e2e54, AT_EMPTY_PATH) = -1 EINVAL (Invalid argument)
View gist:d83c771cf1775258b46c81ed78ac057f
utils = require('utils');
hw = utils.hexword;
hb = utils.hexbyte;
every = 0;
function spew(pc) {
console.log(`${processor.currentCycles} $${hw(pc)} A=${hb(processor.a)} X=${hb(processor.x)} Y=${hb(processor.y)}`);
// breakpoint every 100 instructions lest things go awry.
return ((++every % 100) === 0);
}
@mattgodbolt
mattgodbolt / render.asm
Created Aug 22, 2019
A bit of Red Dog: Superior Firepower's rendering system. SH4 Assembly, circa 1998
View render.asm
; All new, all-singing, all-dancing textured scape renderer!
.CPU SH4
.OUTPUT DBG=DWARF
.INCLUDE "..\RedDog.pre"
; Prototype: StripHeader *texturedStripRasteriserClipped
; (StripPos *v, StripEntry *strip, Uint32 nStrip, ModelContext *context);
; Register allocation:
temp: .REG R0 ; temporary register, R0 is most accessible
View thing.h
int libraryFunc() { return 1; }
View tree-output.txt
ubuntu@ip-172-30-2-164:/opt/gcc-explorer/windows$ cd /opt/gcc-explorer/windows
ubuntu@ip-172-30-2-164:/opt/gcc-explorer/windows$ tree
.
├── 10.0.10240.0
│   └── ucrt
│   ├── assert.h
│   ├── complex.h
│   ├── conio.h
│   ├── corecrt.h
│   ├── corecrt_io.h
View typesafe.h
// Copyright (C) 2016 Jonathan Müller <jonathanmueller.dev@gmail.com>
// This file is subject to the license terms in the LICENSE file
// found in the top-level directory of this distribution.
#define TYPE_SAFE_ENABLE_ASSERTIONS 0 // disable assertions
//=== assertions boilerplate ===//
//======================================================================//
// Copyright (C) 2016 Jonathan Müller <jonathanmueller.dev@gmail.com>
//
@mattgodbolt
mattgodbolt / hits.csv
Created Aug 27, 2016
GCC Explorer hits by compiler July 2015 to August 2016
View hits.csv
Event Action Total Events Unique Events Event Value Avg. Value
g530 992,513 72,237 531,774 0.54
g520 633,096 47,732 358,557 0.57
g6 412,648 32,689 207,802 0.50
clang380 381,999 27,562 240,131 0.63
armg453 203,148 30,436 104,969 0.52
clang37x 200,480 14,864 152,897 0.76
g482 195,493 9,276 101,412 0.52
g492 149,502 12,417 80,732 0.54
clang371 131,152 9,696 96,763 0.74
You can’t perform that action at this time.