Skip to content

Instantly share code, notes, and snippets.

@gerdr
gerdr / gist:1171152
Created August 25, 2011 16:59
profiling.t failure
$ prove --verbose t/profiling/profiling.t
t/profiling/profiling....1..13
Cannot take substr outside string
current instr.: 'parrot;ProfTest;PIRProfile;_block1052' pc 875 (runtime/parrot/library/ProfTest/PIRProfile.pir:364)
called from Sub 'parrot;ProfTest;PIRProfile;_block1048' pc 821 (runtime/parrot/library/ProfTest/PIRProfile.pir:27)
called from Sub 'parrot;ProfTest;PIRProfile;make_line_hash' pc 669 (runtime/parrot/library/ProfTest/PIRProfile.pir:278)
called from Sub 'parrot;ProfTest;PIRProfile;_block1027' pc 545 (runtime/parrot/library/ProfTest/PIRProfile.pir:232)
called from Sub 'parrot;ProfTest;PIRProfile;build_profile_array' pc 488 (runtime/parrot/library/ProfTest/PIRProfile.pir:212)
called from Sub 'parrot;ProfTest;PIRProfile;new' pc 226 (runtime/parrot/library/ProfTest/PIRProfile.pir:100)
called from Sub '_block1000' pc 180 ((file unknown):61916563) (t/profiling/profiling.t:17)
@gerdr
gerdr / shadow-stack.md
Created September 6, 2011 14:19
precise gc of stack vars

###IDEA keep PMC pointers in explicit shadow-stack, a linked list of frames

###IMPLEMENTATION

struct frame
{
    struct frame *prev;
    size_t size;

PMC **pmcs;

@gerdr
gerdr / core.s
Created September 26, 2011 22:21
m0± core on x86
.def _m0_core;
.scl 2;
.type 32;
.endef
.text
.globl _m0_core
.align 16, 0x90
_m0_core: # @m0_core
# BB#0: # %INIT
pushl %ebp
@gerdr
gerdr / gist:1348574
Last active September 27, 2015 23:27
single-precision infinity in C
#include <math.h>
/* ANSI fallback, *might* fail on exotic platforms */
#ifndef INFINITY
#define INFINITY ((float)HUGE_VAL)
#endif
#ifndef NAN
#define NAN (INFINITY - INFINITY)
#endif
@gerdr
gerdr / gist:1514185
Created December 23, 2011 13:17
clang warnings
src/string/api.c:415:39: warning: cast from 'char *' to 'INTVAL *' (aka 'long long *') increases required alignment from 1 to 8 [-Wcast-align]
INTVAL * const buffer_flags = Buffer_bufflagsptr(d);
^~~~~~~~~~~~~~~~~~~~~
./include\parrot/pobj.h:73:32: note: expanded from:
#define Buffer_bufflagsptr(b) ((INTVAL *)Buffer_bufprolog(b))
^
src/string/api.c:2812:1: warning: control may reach end of non-void function [-Wreturn-type]
}
^
src/string/api.c:2842:1: warning: control may reach end of non-void function [-Wreturn-type]
@gerdr
gerdr / cygwin-fix.bat
Created January 19, 2012 17:29
Batch file to rebase Parrot DLLs
@echo off
setlocal
if "%CYGWIN_ROOT%" == "" set CYGWIN_ROOT=C:\cygwin
if not exist "%CYGWIN_ROOT%"\ (
echo directory %CYGWIN_ROOT% does not exist
echo please set the variable CYGWIN_ROOT
exit /B 1
)
@gerdr
gerdr / sizes_pm.diff
Created January 23, 2012 17:43
change opcode size when changing intval size
diff --git a/config/auto/sizes.pm b/config/auto/sizes.pm
index f42aa8e..30a369d 100644
--- a/config/auto/sizes.pm
+++ b/config/auto/sizes.pm
@@ -265,6 +265,8 @@ END
else {
$typesref->{intval} = $intptr;
$conf->data->set( iv => $intptr );
+ $typesref->{opcode} = $intptr;
+ $conf->data->set( opcode_t => $intptr );
@gerdr
gerdr / parrot.h
Created February 6, 2012 10:01
Parrot object model refactor proposal
#ifndef PARROT_H_
#define PARROT_H_
#include <stddef.h>
// short names so we don't have to type Parrot_ everywhere
#define PInt Parrot_Int
#define PNum Parrot_Num
// ...
@gerdr
gerdr / foo.c
Created February 10, 2012 13:06
namespace scheme
#define NAMESPACE_SOURCE
#include "foo.h"
diff --git a/tools/build/Makefile.in b/tools/build/Makefile.in
index 230720d..3cd3e77 100644
--- a/tools/build/Makefile.in
+++ b/tools/build/Makefile.in
@@ -952,6 +952,7 @@ $(OPS_DIR)/$(BIGINT_OPS)$(LOAD_EXT): $(OPS_DIR)/$(BIGINT_OPS_SOURCE) $(LIBTOMMAT
cd src/6model/reprs && $(CC) -c @cc_o_out@P6bigint$(O) -I../../../$(PMC_DIR) -I../../../3rdparty/libtommath $(CINCLUDES) $(CFLAGS) P6bigint.c
cd $(OPS_DIR) && $(LD) @ld_out@$(BIGINT_OPS)$(LOAD_EXT) $(BIGINT_OPS)$(O) ../../3rdparty/libtommath/*$(O) ../6model/reprs/P6bigint$(O) $(LINKARGS)
+$(DYNCALL_BIN): CFLAGS := $(CFLAGS) -w
$(DYNCALL_BIN):