Skip to content

Instantly share code, notes, and snippets.

use "ponybench"
primitive A
primitive B
primitive C
primitive D
actor Main is BenchmarkList
new create(env: Env) =>
PonyBench(env, this)
diff --git i/src/libponyc/codegen/codegen.c w/src/libponyc/codegen/codegen.c
index 0aa8de7fb..484f3948a 100644
--- i/src/libponyc/codegen/codegen.c
+++ w/src/libponyc/codegen/codegen.c
@@ -336,12 +336,13 @@ static void init_runtime(compile_t* c)
# endif
#endif
- // void pony_sendv(i8*, __object*, $message*, $message*)
+ // void pony_sendv(i8*, __object*, $message*, $message*, i1)
diff --git i/src/libponyc/codegen/gencall.c w/src/libponyc/codegen/gencall.c
index 06f62ec92..f2007da29 100644
--- i/src/libponyc/codegen/gencall.c
+++ w/src/libponyc/codegen/gencall.c
@@ -271,8 +271,12 @@ static void set_descriptor(compile_t* c, reach_type_t* t, LLVMValueRef value)
LLVMValueRef desc_ptr = LLVMBuildStructGEP(c->builder, value, 0, "");
LLVMValueRef store = LLVMBuildStore(c->builder,
((compile_type_t*)t->c_type)->desc, desc_ptr);
+#if PONY_LLVM >= 400
+ tbaa_tag(c, c->tbaa_descptr, store);
actor Main
new create(env: Env) =>
let x = String
x.reserve(USize(-1))
while true do
x.recalc()
x.push(1)
end
@Praetonus
Praetonus / gen.pony
Created April 11, 2017 15:44
pony trait benchmark
use "collections"
use "files"
actor Main
new create(env: Env) =>
try
let auth = env.root as AmbientAuth
let dir_path = FilePath(auth, "traits_bench")
if not dir_path.mkdir() then
actor A
let _array: Array[U8] = Array[U8]
be send(b: B) =>
let array_copy = recover trn Array[U8] end
array_copy.reserve(_array.size())
for i in _array.values() do
array_copy.push(i)
end
class Foo
var i: USize = 0
fun ref boom() => i = 3
actor Main
new create(env: Env) =>
let a: Foo val = Foo
env.out.print(a.i.string())
bla[Foo val](a)
env.out.print(a.i.string())
@Praetonus
Praetonus / mpmcq.c
Last active October 13, 2016 21:53
void* ponyint_mpmcq_pop(mpmcq_t* q)
{
size_t my_ticket = atomic_fetch_add_explicit(&q->ticket, 1,
memory_order_relaxed);
while(my_ticket != atomic_load_explicit(&q->waiting_for,
memory_order_relaxed))
ponyint_cpu_relax();
atomic_thread_fence(memory_order_acquire);
#include <benchmark/benchmark.h>
static void BM_clz(benchmark::State& state)
{
unsigned long x = 5;
while (state.KeepRunning())
{
benchmark::DoNotOptimize(&x);
unsigned long t = x - 1;
if (t == 0)
@Praetonus
Praetonus / bench.cpp
Created September 20, 2016 14:24
CAS benchmark
#include <benchmark/benchmark.h>
extern "C"
{
void* ponyint_pool_alloc(size_t index);
void ponyint_pool_free(size_t index, void* p);
}
struct PreAlloc
{