---
 block_to_imp.c   | 4 +++-
 dtable.c         | 1 -
 loader.c         | 4 ++++
 loader.h         | 5 +++++
 pool.h           | 4 +++-
 selector_table.c | 1 -
 6 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/block_to_imp.c b/block_to_imp.c
index 5b0262c..6a7eaa8 100644
--- a/block_to_imp.c
+++ b/block_to_imp.c
@@ -10,6 +10,7 @@
 #include "objc/blocks_runtime.h"
 #include "blocks_runtime.h"
 #include "lock.h"
+#include "loader.h"
 #include "visibility.h"
 
 
@@ -18,7 +19,8 @@
 #include <nbutil.h>
 #endif
 
-#define PAGE_SIZE 4096
+#undef PAGE_SIZE
+#define PAGE_SIZE page_size
 
 static void *executeBuffer;
 static void *writeBuffer;
diff --git a/dtable.c b/dtable.c
index f534b17..f24826d 100644
--- a/dtable.c
+++ b/dtable.c
@@ -7,7 +7,6 @@
 #include "selector.h"
 #include "class.h"
 #include "lock.h"
-#include "method_list.h"
 #include "slot_pool.h"
 #include "dtable.h"
 #include "visibility.h"
diff --git a/loader.c b/loader.c
index 6f4d88e..d02f43e 100644
--- a/loader.c
+++ b/loader.c
@@ -8,12 +8,14 @@
 #include <gc/gc.h>
 #endif
 #include <stdio.h>
+#include <unistd.h>
 
 /**
  * Runtime lock.  This is exposed in 
  */
 PRIVATE mutex_t runtime_mutex;
 LEGACY void *__objc_runtime_mutex = &runtime_mutex;
+PRIVATE size_t page_size;
 
 void init_alias_table(void);
 void init_arc(void);
@@ -60,6 +62,8 @@ void __objc_exec_class(struct objc_module_abi_8 *module)
 		// call dlopen() or equivalent, and the platform's implementation of
 		// this does not perform any synchronization.
 		INIT_LOCK(runtime_mutex);
+		// Cache system page size
+		page_size = sysconf(_SC_PAGESIZE);
 		// Create the various tables that the runtime needs.
 		init_selector_tables();
 		init_protocol_table();
diff --git a/loader.h b/loader.h
index a97063b..1b6cdfb 100644
--- a/loader.h
+++ b/loader.h
@@ -7,6 +7,11 @@
 #include "protocol.h"
 
 /**
+ * Cache system page size.
+ */
+extern size_t page_size;
+
+/**
  * Checks whether it is safe to load a module with the specified version and
  * module size.  This depends on whether another module with an incompatible
  * ABI has already been loaded.
diff --git a/pool.h b/pool.h
index f0bd545..f9b7da0 100644
--- a/pool.h
+++ b/pool.h
@@ -1,5 +1,6 @@
 #include <stdlib.h>
 #include "lock.h"
+#include "loader.h"
 
 #ifndef POOL_TYPE
 #error POOL_TYPE must be defined
@@ -13,7 +14,8 @@
 #define PREFIX_SUFFIX(x, y) REALLY_PREFIX_SUFFIX(x, y)
 #define NAME(x) PREFIX_SUFFIX(POOL_NAME, x)
 
-#define PAGE_SIZE 4096
+#undef PAGE_SIZE
+#define PAGE_SIZE page_size
 
 // Malloc one page at a time.
 #define POOL_SIZE ((PAGE_SIZE) / sizeof(POOL_TYPE))
diff --git a/selector_table.c b/selector_table.c
index 13b6ca5..760e4fd 100644
--- a/selector_table.c
+++ b/selector_table.c
@@ -11,7 +11,6 @@
 #include "lock.h"
 #include "sarray2.h"
 #include "objc/runtime.h"
-#include "method_list.h"
 #include "class.h"
 #include "selector.h"
 #include "visibility.h"
_______________________________________________
Gnustep-dev mailing list
Gnustep-dev@gnu.org
https://lists.gnu.org/mailman/listinfo/gnustep-dev

Reply via email to