summaryrefslogtreecommitdiffstats
path: root/Object.c
diff options
context:
space:
mode:
authorHisham Muhammad <hisham@gobolinux.org>2006-07-11 06:13:32 +0000
committerHisham Muhammad <hisham@gobolinux.org>2006-07-11 06:13:32 +0000
commit5d48ab8c28925f892e8e7f432f7d2b78c86e95c5 (patch)
tree13a209d132be00e28d24f9ce750a873055cfbd98 /Object.c
parent4c41e78bbfe34c67db16bbce8e0241ba583e8572 (diff)
Performance improvement hackathon: improve process comparison routines,
disable useless code in release builds such as runtime type-checking on dynamic data structures and process fields that are not being computed, faster(?) method for verifying the process owner (still need to ensure correctness), don't destroy and create process objects for hidden kernel threads over and over. Phew. I shouldn't be doing all this today, but I could not resist.
Diffstat (limited to 'Object.c')
-rw-r--r--Object.c36
1 files changed, 17 insertions, 19 deletions
diff --git a/Object.c b/Object.c
index 62a1c3a3..15b9a6ec 100644
--- a/Object.c
+++ b/Object.c
@@ -15,37 +15,37 @@ in the source distribution for its full text.
#include "debug.h"
/*{
+
+#ifndef DEBUG
+#define Object_setClass(obj, class)
+#endif
+
typedef struct Object_ Object;
typedef void(*Object_Display)(Object*, RichString*);
-typedef int(*Object_Compare)(const Object*, const Object*);
+typedef int(*Object_Compare)(const void*, const void*);
typedef void(*Object_Delete)(Object*);
struct Object_ {
+ #ifdef DEBUG
char* class;
+ #endif
Object_Display display;
- Object_Compare compare;
Object_Delete delete;
};
}*/
-static char* OBJECT_CLASS = "Object";
+#ifdef DEBUG
+char* OBJECT_CLASS = "Object";
-void Object_new() {
- Object* this;
- this = malloc(sizeof(Object));
- this->class = OBJECT_CLASS;
- this->display = Object_display;
- this->compare = Object_compare;
- this->delete = Object_delete;
-}
+#else
+#define OBJECT_CLASS NULL
+#endif
-bool Object_instanceOf(Object* this, char* class) {
- return this->class == class;
-}
+#ifdef DEBUG
-void Object_delete(Object* this) {
- free(this);
+void Object_setClass(void* this, char* class) {
+ ((Object*)this)->class = class;
}
void Object_display(Object* this, RichString* out) {
@@ -54,6 +54,4 @@ void Object_display(Object* this, RichString* out) {
RichString_write(out, CRT_colors[DEFAULT_COLOR], objAddress);
}
-int Object_compare(const Object* this, const Object* o) {
- return (this - o);
-}
+#endif

© 2014-2024 Faster IT GmbH | imprint | privacy policy