summaryrefslogtreecommitdiff
path: root/Ports/citron/patches/0007-Disable-GC-on-serenity.patch
diff options
context:
space:
mode:
authorAli Mohammad Pur <ali.mpfard@gmail.com>2022-02-13 17:06:03 +0330
committerAli Mohammad Pur <Ali.mpfard@gmail.com>2022-02-13 19:03:43 +0330
commitb760a1a4bacfbaf57dbb7d424a9c25d8db96f10f (patch)
treed8067405c06a59fca25f41e35595db5da5e15b2f /Ports/citron/patches/0007-Disable-GC-on-serenity.patch
parent4b412e8feeb4804f305aecec9695fb36c9acc0e4 (diff)
downloadserenity-b760a1a4bacfbaf57dbb7d424a9c25d8db96f10f.zip
Ports: Update the citron patches after upstreaming a few
This also switches to checking out a specific commit instead of just the master HEAD, as the port linter requires a hash (which is imo pointless in this case), and we can't provide a stable hash for the master branch HEAD.
Diffstat (limited to 'Ports/citron/patches/0007-Disable-GC-on-serenity.patch')
-rw-r--r--Ports/citron/patches/0007-Disable-GC-on-serenity.patch60
1 files changed, 60 insertions, 0 deletions
diff --git a/Ports/citron/patches/0007-Disable-GC-on-serenity.patch b/Ports/citron/patches/0007-Disable-GC-on-serenity.patch
new file mode 100644
index 0000000000..953a5edbd8
--- /dev/null
+++ b/Ports/citron/patches/0007-Disable-GC-on-serenity.patch
@@ -0,0 +1,60 @@
+From 88242bebd8381deef7598470ed74c23dbffaacb4 Mon Sep 17 00:00:00 2001
+From: Ali Mohammad Pur <ali.mpfard@gmail.com>
+Date: Fri, 11 Feb 2022 18:29:07 +0330
+Subject: [PATCH 7/9] Disable GC on serenity
+
+---
+ src/memory.c | 4 ++++
+ src/system.c | 3 +++
+ 2 files changed, 7 insertions(+)
+
+diff --git a/src/memory.c b/src/memory.c
+index f221e06..974bbe6 100644
+--- a/src/memory.c
++++ b/src/memory.c
+@@ -91,6 +91,7 @@ void* ctr_heap_allocate(size_t size)
+ /* Check whether we can afford to allocate this much */
+ ctr_gc_alloc = GC_get_heap_size() - GC_get_free_bytes() - GC_get_unmapped_bytes();
+
++#ifndef __serenity__
+ if (ctr_gc_memlimit < ctr_gc_alloc) {
+ ctr_gc_sweep(0);
+ if (ctr_gc_memlimit < ctr_gc_alloc) {
+@@ -104,6 +105,7 @@ void* ctr_heap_allocate(size_t size)
+ }
+ }
+ }
++#endif
+
+ /* Perform allocation and check result */
+ slice_of_memory = calloc(size, 1);
+@@ -225,10 +227,12 @@ size_t ctr_heap_get_latest_tracking_id() { return numberOfMemBlocks - 1; }
+ */
+ void ctr_heap_free_rest()
+ {
++#ifndef __serenity__
+ size_t i;
+ for (i = 0; i < numberOfMemBlocks; i++) {
+ ctr_heap_free(memBlocks[i].space);
+ }
++#endif
+ }
+
+ /**
+diff --git a/src/system.c b/src/system.c
+index e42d09a..a6856b8 100644
+--- a/src/system.c
++++ b/src/system.c
+@@ -426,6 +426,9 @@ void ctr_gc_mark(ctr_object* object, int last_vector_index)
+ */
+ void ctr_gc_sweep(int all)
+ {
++#ifdef __serenity
++ return;
++#endif
+ ctr_object* previousObject = NULL;
+ ctr_object* currentObject = ctr_first_object;
+ ctr_object* nextObject = NULL;
+--
+2.34.1
+