diff --git a/engine/scripts/src/gameplay.cpp b/engine/scripts/src/gameplay.cpp index b9aa35c..3ccf044 100644 --- a/engine/scripts/src/gameplay.cpp +++ b/engine/scripts/src/gameplay.cpp @@ -50,6 +50,12 @@ PUBLIC(void public_donothing()) /* nothing */ } +static void bench_alloc_free() +{ + auto x = std::make_unique(1024); + __asm__("" :: "m"(x[0]) : "memory"); +} + PUBLIC(void benchmarks()) { try @@ -76,6 +82,8 @@ PUBLIC(void benchmarks()) measure("Dynamic call handler x4 (inline)", inline_dyncall_handler); measure("Dynamic call handler x4 (call)", opaque_dyncall_handler); + measure("Allocate 1024-bytes, and free it", bench_alloc_free); + //benchmark_multiprocessing(); } diff --git a/ext/libriscv b/ext/libriscv index d85b7c0..3d9bdc1 160000 --- a/ext/libriscv +++ b/ext/libriscv @@ -1 +1 @@ -Subproject commit d85b7c0f9247c3cc6b7fd8303a20e44a335754f1 +Subproject commit 3d9bdc1e4eff41e6416e14ff062a7d29f0e59ba5 diff --git a/programs/micro/libc/engine.hpp b/programs/micro/libc/engine.hpp index 03e985d..18a13f6 100644 --- a/programs/micro/libc/engine.hpp +++ b/programs/micro/libc/engine.hpp @@ -1,4 +1,5 @@ #pragma once +#include "override/new" #include #include #include diff --git a/programs/micro/libc/override/new b/programs/micro/libc/override/new index 9a705b2..908aa3b 100644 --- a/programs/micro/libc/override/new +++ b/programs/micro/libc/override/new @@ -1,25 +1,26 @@ #pragma once #include_next #include +#include #include inline void* operator new(size_t size) { - return sys_malloc(size); + return malloc(size); } inline void* operator new[](size_t size) { - return sys_malloc(size); + return malloc(size); } inline void operator delete(void* ptr) { - sys_free(ptr); + free(ptr); } inline void operator delete[](void* ptr) { - sys_free(ptr); + free(ptr); } // C++14 sized deallocation inline void operator delete(void* ptr, std::size_t) { - sys_free(ptr); + free(ptr); } inline void operator delete [](void* ptr, std::size_t) { - sys_free(ptr); + free(ptr); }