Skip to content

Instantly share code, notes, and snippets.

View UplinkCoder's full-sized avatar

Stefan Koch UplinkCoder

View GitHub Profile
BCTemporary genTemporary(BCType bct);
void incSp(BCValue val);
StackAddr currSp();
BCLabel genLabel();
BCAddr beginJmp();
void endJmp(BCAddr atIp, BCLabel target);
BCAddr genJump(BCLabel target);
CndJmpBegin beginCndJmp(BCValue cond = BCValue.init, bool ifTrue = false);
void endCndJmp(CndJmpBegin jmp, BCLabel target);
void emitFlg(BCValue lhs);
BCBuilitin_NextUTF8CharT nextChar = (const Heap* heapPtr, uint* argPtr) pure {
uint stringPos = *argPtr;
uint stringPosOverFour = stringPos / 4;
uint bytePos = stringPos % 4;
uint loWord = heapPtr._heap[stringPosOverFour];
uint c = intrin_Byte3(loWord, bytePos);
if (!((cast(ubyte)c) & 0x80)) {
(*argPtr) = stringPos + 1;
return BCValue(Imm32(c));
@UplinkCoder
UplinkCoder / fixwhitespace.d
Created August 22, 2016 05:38
fixwhitespace - fixes what dmd complains about
/**
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
* Source: $(DMDSRC _checkwhitespace.d)
*/
import std.stdio : writefln;
import std.file;
import std.string;
import std.range;
auto jmp1 = beginJmp();
auto label1 = genLabel();
auto p1 = genParameter(BCType(BCTypeEnum.String));//SP[4]
//currSp();//SP[8]
incSp();
Set(BCValue(StackAddr(8), BCType(BCTypeEnum.i32)), BCValue(Imm32(0)));
//currSp();//SP[12]
incSp();
auto tmp1 = genTemporary(BCType(BCTypeEnum.Slice, 2));//SP[16]
auto tmp2 = genTemporary(BCType(BCTypeEnum.i32));//SP[20]
RootObject
Dsymbol
AliasThis
AttribDeclaration
StorageClassDeclaration
DeprecatedDeclaration
LinkDeclaration
ProtDeclaration
AlignDeclaration
AnonDeclaration
import std.stdio;
import std.algorithm;
import std.range;
import std.string;
import std.file;
import std.math;
string visitor_boilerplate = `
module ddmd.asttypename;
@UplinkCoder
UplinkCoder / align.diff
Created September 29, 2016 01:29
align
diff --git a/src/dstruct.d b/src/dstruct.d
index a1dc22d..12366a3 100644
--- a/src/dstruct.d
+++ b/src/dstruct.d
@@ -299,7 +299,8 @@ extern (C++) class StructDeclaration : AggregateDeclaration
if (semanticRun == PASSinit)
{
protection = sc.protection;
-
+ if (sc && sc.aligndecl && !sc.aligndecl._scope && sc.parent._scope)
uint[] neededArraySize(uint size)
{
return (size - 1) / 4 + 2 + !(size & 3);
}
uint[] stringToUintArray(string s)
{
if (s.length == 0)
{
return [0u, 0u];
}
import std.datetime : StopWatch;
import std.stdio;
import ddmd.ctfe.bc_common;
import ddmd.ctfe.bc;
import core.stdc.string;
__gshared int[4096] bca;
__gshared BCGen gen;
uint makeFirst()
{
This file has been truncated, but you can view the full file.
module vibe.core.drivers.libasync;
import object;
version (VibeLibasyncDriver)
{
import vibe.core.core;
import vibe.core.driver;
import vibe.core.drivers.threadedfile;
import vibe.core.drivers.timerqueue;
import vibe.core.log;
import vibe.utils.array : FixedRingBuffer;