Skip to content

Instantly share code, notes, and snippets.

View arnsholt's full-sized avatar

Arne Skjærholt arnsholt

View GitHub Profile
From 2c199b71040c8469d6ae204cd799f5c15047f8aa Mon Sep 17 00:00:00 2001
From: =?utf-8?q?Arne=20Skj=C3=A6rholt?= <arnsholt@gmail.com>
Date: Tue, 8 Jun 2010 18:33:53 +0200
Subject: [PATCH] Mark test and clean targets as phony.
---
ufo | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/ufo b/ufo
From 688c9cd76289ce72ce37ace500f33a2b001a2c9c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Arne=20Skj=C3=A6rholt?= <arnsholt@gmail.com>
Date: Wed, 30 Jun 2010 17:41:08 +0200
Subject: [PATCH] Only print unique directories, and not their prefixes. v2.
---
ufo | 20 ++++++++++++++++++--
1 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/ufo b/ufo
From e978a1e6a0c7377e68452b5165b8ce0214dbcce3 Mon Sep 17 00:00:00 2001
From: Arne <arnsholt@gmail.com>
Date: Sat, 3 Jul 2010 18:39:48 +0200
Subject: [PATCH] Fix bug(s) in unique-dir feature.
---
ufo | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/ufo b/ufo
/* Helper for finding a slot number. */
static INTVAL try_get_slot(PARROT_INTERP, CStructREPRData *repr_data, PMC *class_key, STRING *name, PMC **attrptr) {
INTVAL slot = -1;
if (repr_data->name_to_index_mapping) {
CStructNameMap *cur_map_entry = repr_data->name_to_index_mapping;
while (cur_map_entry->class_key != NULL) {
if (cur_map_entry->class_key == class_key) {
PMC *slot_pmc = VTABLE_get_pmc_keyed_str(interp, cur_map_entry->name_map, name);
if (!PMC_IS_NULL(slot_pmc)) {
slot = VTABLE_get_integer(interp, slot_pmc);
@arnsholt
arnsholt / CStruct.c
Created April 17, 2012 08:30
P6int.c segfault
/* Binds the given value to the specified attribute. */
static void bind_attribute_boxed(PARROT_INTERP, STable *st, void *data, PMC *class_handle, STRING *name, INTVAL hint, PMC *value) {
CStructREPRData *repr_data = (CStructREPRData *)st->REPR_data;
CStructBody *body = (CStructBody *)data;
STRING *type_str = Parrot_str_new_constant(interp, "type");
STRING *carray_str = Parrot_str_new_constant(interp, "CArray");
INTVAL slot;
/* Try to find the slot. */
slot = hint >= 0 ? hint :
@arnsholt
arnsholt / valgrind.log
Created April 29, 2012 11:55
Valgrind log excerpt
==74142== Invalid read of size 1
==74142== at 0x7FFFFFE007D4: ???
==74142== by 0x10AE2A51F: sqlite3VdbeExec (in /usr/lib/libsqlite3.dylib)
==74142== by 0x10AE2B797: sqlite3_step (in /usr/lib/libsqlite3.dylib)
==74142== by 0x10516CB8C: dcCall_x64_sysv (in /Users/arne/programming/perl/nqp/install/lib/parrot/4.3.0-devel/dynext/nqp_dyncall_ops.bundle)
==74142== by 0x7FFF5FBFEE3F: ???
==74142== by 0x105159010: Parrot_nqp_native_call_p_p_p_p (nqp_dyncall_ops.c:3723)
==74142== by 0x10874A91F: ???
==74142== by 0x1B: ???
==74142== by 0x10771F3EF: ???
@arnsholt
arnsholt / sketch.pl
Created April 29, 2012 14:07
Manually managed strings sketch
multi manually-manage(Str $x) {
$x does ManualyManagedNativeString;
$x.cstr = CStr.new($x);
}
role ManuallyManagedNativeString {
has CStr $.cstr;
}
@arnsholt
arnsholt / callbacks.md
Created July 10, 2012 18:20
Plan and notes for Zavolaj callbacks
  1. nqp_native_call() needs return and parameter type info to set up the callback.
  2. Likewise, callback_handler() needs the same to marshal the arguments and unpack the return value.
  3. Given 1 and 2, arg_types in the NativeCall REPR needs to be a more expressive type than INTVAL*. struct { INTVAL; PMC * }* perhaps?
  4. 3 implies updating nqp_native_call_build() to build the correct structure.
  5. Finally, postcircumfix:<( )> in role Native of NativeCall.pm6 needs to pass signature info for callback arguments to nqp_native_call_build().

Implementation should probably be backwards, starting with passing information about callbacks and working my way down to actually doing the dyncallback stuff.

Perl 6 callback parameter syntax for when I forget it: &lt; jnthn&gt; sub (int $n, &amp;callback(Str, int, int --&gt; int)) is native { * }

@arnsholt
arnsholt / gitdiff.patch
Created July 28, 2012 12:07
Why U segfault?
diff --git a/src/Perl6/Actions.pm b/src/Perl6/Actions.pm
index c790afb..5176b8c 100644
--- a/src/Perl6/Actions.pm
+++ b/src/Perl6/Actions.pm
@@ -229,7 +229,7 @@ class Perl6::Actions is HLL::Actions {
# Finish up code object for the mainline.
if $*DECLARAND {
- $*W.attach_signature($*DECLARAND, $*W.create_signature([]));
+ $*W.attach_signature($*DECLARAND, $*W.create_signature(nqp::hash('parameters', [])));
diff --git a/src/core/traits.pm b/src/core/traits.pm
index 885823d..8049b3b 100644
--- a/src/core/traits.pm
+++ b/src/core/traits.pm
@@ -15,6 +15,7 @@ my class X::Inheritance::Unsupported { ... }
my class X::Export::NameClash { ... }
my class X::Composition::NotComposable { ... }
my class X::Import::MissingSymbols { ... }
+my class X::Redeclaration { ... }