3 #include "shotgun/lib/shotgun.h"
4 #include "shotgun/lib/cpu.h"
5 #include "shotgun/lib/machine.h"
6 #include "shotgun/lib/tuple.h"
7 #include "shotgun/lib/methctx.h"
8 #include "shotgun/lib/object.h"
9 #include "shotgun/lib/bytearray.h"
10 #include "shotgun/lib/string.h"
11 #include "shotgun/lib/class.h"
12 #include "shotgun/lib/hash.h"
13 #include "shotgun/lib/symbol.h"
14 #include "shotgun/lib/selector.h"
16 void cpu_clear_cache(STATE
, cpu c
) {
17 struct method_cache
*ent
, *end
;
19 ent
= state
->method_cache
;
20 end
= ent
+ CPU_CACHE_SIZE
;
27 void cpu_clear_cache_for_method(STATE
, cpu c
, OBJECT meth
, int full
) {
28 struct method_cache
*ent
, *end
;
30 selector_clear_by_name(state
, meth
);
32 ent
= state
->method_cache
;
33 end
= ent
+ CPU_CACHE_SIZE
;
36 if(ent
->name
== meth
) {
37 if(full
&& ent
->method
&& REFERENCE_P(ent
->method
)) {
40 if(ISA(meth
, state
->global
->tuple
)) {
41 meth
= tuple_at(state
, meth
, 1);
43 // Don't this for now. Inline caches are disabled and we're using
44 // the serial number to detect core methods.
45 // fast_inc(meth, CMETHOD_f_SERIAL);
54 void cpu_clear_cache_for_class(STATE
, cpu c
, OBJECT klass
) {
55 struct method_cache
*ent
, *end
;
57 ent
= state
->method_cache
;
58 end
= ent
+ CPU_CACHE_SIZE
;
61 if(ent
->klass
== klass
|| ent
->module
== klass
) {