On 05/23/2011 10:39 AM, Paolo Bonzini wrote:
Here is another patch for method hook
Interesting! Does it work, alternatively, if you use _gst_msg_sendf to
send #at:put: to the MethodDictionary of the class (conditional on
_gst_kernel_initialized)? Then you can do the hook from there. It's much
less "magic". :)
Paolo
diff --git a/kernel/Builtins.st b/kernel/Builtins.st
index 666db54..646e886 100644
--- a/kernel/Builtins.st
+++ b/kernel/Builtins.st
@@ -43,6 +43,7 @@ Behavior extend [
]
Object extend [
+
class [
"Answer the class to which the receiver belongs"
<primitive: VMpr_Object_class>
@@ -53,7 +54,7 @@ Object extend [
Behavior extend [
-
+
new [
"Create a new instance of a class with no indexed instance variables"
<primitive: VMpr_Behavior_basicNew>
@@ -77,7 +78,7 @@ Behavior extend [
<primitive: VMpr_Behavior_basicNewColon>
<category: 'builtin'>
self isFixed ifTrue: [
- SystemExceptions.WrongMessageSent signalOn: #new: useInstead: #new
+ SystemExceptions.WrongMessageSent signalOn: #new: useInstead: #new
].
numInstanceVariables isSmallInteger ifTrue: [ ^self primitiveFailed ].
@@ -91,7 +92,7 @@ Behavior extend [
<primitive: VMpr_Behavior_basicNewColon>
<category: 'builtin'>
self isFixed ifTrue: [
- SystemExceptions.WrongMessageSent signalOn: #basicNew: useInstead: #basicNew
+ SystemExceptions.WrongMessageSent signalOn: #basicNew: useInstead: #basicNew
].
numInstanceVariables isSmallInteger ifTrue: [ ^self primitiveFailed ].
diff --git a/libgst/comp.c b/libgst/comp.c
index 0819e96..9cc5986 100644
--- a/libgst/comp.c
+++ b/libgst/comp.c
@@ -2481,8 +2481,11 @@ install_method (OOP methodOOP, OOP classOOP, mst_Boolean untrusted)
}
MAKE_OOP_READONLY (methodOOP, true);
- oldMethod = _gst_identity_dictionary_at_put (methodDictionaryOOP,
- selector, methodOOP);
+ if (_gst_kernel_initialized)
+ _gst_msg_sendf (&oldMethod, "%o %o at: %o put: %o", methodDictionaryOOP, selector, methodOOP);
+ else
+ oldMethod = _gst_identity_dictionary_at_put (methodDictionaryOOP,
+ selector, methodOOP);
#ifdef ENABLE_JIT_TRANSLATION
if (oldMethod != _gst_nil_oop)
diff --git a/snprintfv/snprintfv/filament.h b/snprintfv/snprintfv/filament.h
index 4a91eb6..8a7ce6c 100644
--- a/snprintfv/snprintfv/filament.h
+++ b/snprintfv/snprintfv/filament.h
@@ -1,4 +1,4 @@
-#line 1 "../../../snprintfv/snprintfv/filament.in"
+#line 1 "./filament.in"
/* -*- Mode: C -*- */
/* filament.h --- a bit like a string but different =)O|
@@ -118,7 +118,7 @@ extern char * fildelete (Filament *fil);
extern void _fil_extend (Filament *fil, size_t len, boolean copy);
-#line 61 "../../../snprintfv/snprintfv/filament.in"
+#line 61 "./filament.in"
/* Save the overhead of a function call in the great majority of cases. */
#define fil_maybe_extend(fil, len, copy) \
diff --git a/snprintfv/snprintfv/printf.h b/snprintfv/snprintfv/printf.h
index 49a2e9f..1437dd5 100644
--- a/snprintfv/snprintfv/printf.h
+++ b/snprintfv/snprintfv/printf.h
@@ -1,4 +1,4 @@
-#line 1 "../../../snprintfv/snprintfv/printf.in"
+#line 1 "./printf.in"
/* -*- Mode: C -*- */
/* printf.in --- printf clone for argv arrays
@@ -266,7 +266,7 @@ enum
} \
} SNV_STMT_END
-#line 269 "../../../snprintfv/snprintfv/printf.in"
+#line 269 "./printf.in"
/**
* printf_generic_info:
* @pinfo: the current state information for the format
@@ -302,7 +302,7 @@ extern int printf_generic_info (struct printf_info *const pinfo, size_t n, int *
extern int printf_generic (STREAM *stream, struct printf_info *const pinfo, union printf_arg const *args);
-#line 270 "../../../snprintfv/snprintfv/printf.in"
+#line 270 "./printf.in"
/**
* register_printf_function:
* @spec: the character which will trigger @func, cast to an unsigned int.
@@ -789,7 +789,7 @@ extern int snv_vasprintf (char **result, const char *format, va_list ap);
extern int snv_asprintfv (char **result, const char *format, snv_constpointer const args[]);
-#line 271 "../../../snprintfv/snprintfv/printf.in"
+#line 271 "./printf.in"
/* If you don't want to use snprintfv functions for *all* of your string
formatting API, then define COMPILING_SNPRINTFV_C and use the snv_
diff --git a/snprintfv/snprintfv/stream.h b/snprintfv/snprintfv/stream.h
index 496bd33..0bebce1 100644
--- a/snprintfv/snprintfv/stream.h
+++ b/snprintfv/snprintfv/stream.h
@@ -1,4 +1,4 @@
-#line 1 "../../../snprintfv/snprintfv/stream.in"
+#line 1 "./stream.in"
/* -*- Mode: C -*- */
/* stream.h --- customizable stream routines
@@ -180,7 +180,7 @@ extern int stream_puts (char *s, STREAM *stream);
extern int stream_get (STREAM *stream);
-#line 88 "../../../snprintfv/snprintfv/stream.in"
+#line 88 "./stream.in"
#ifdef __cplusplus
#if 0
/* This brace is so that emacs can still indent properly: */
_______________________________________________
help-smalltalk mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/help-smalltalk