}
+bool method_on_call_stack(struct object_heap* oh, struct CompiledMethod* method) {
+
+ struct Interpreter* i = oh->cached.interpreter;
+ word_t fp = i->framePointer;
+ struct Closure* closure = (struct Closure*)i->method;
+ do {
+ if (closure->method == method) return true;
+ fp = object_to_smallint(i->stack->elements[fp - FRAME_OFFSET_PREVIOUS_FRAME_POINTER]);
+ if (fp < FUNCTION_FRAME_SIZE) break;
+ closure = (struct Closure*)i->stack->elements[fp - FRAME_OFFSET_METHOD];
+ } while (fp >= FUNCTION_FRAME_SIZE);
+
+ if (closure->method == method) return true;
+ return false;
+}
void method_unoptimize(struct object_heap* oh, struct CompiledMethod* method) {
#ifdef PRINT_DEBUG_UNOPTIMIZER
printf("Unoptimizing '"); print_symbol(method->selector); printf("'\n");
#endif
+ if (method_on_call_stack(oh, method)) {
+ printf("Fixme cannot unoptimizing because on call stack: '"); print_symbol(method->selector); printf("'\n");
+ return;
+ }
+
method->code = method->oldCode;
heap_store_into(oh, (struct Object*) method->code, (struct Object*) method->oldCode);
method->isInlined = oh->cached.false_object;
}
-bool method_on_call_stack(struct object_heap* oh, struct CompiledMethod* method) {
-
- struct Interpreter* i = oh->cached.interpreter;
- word_t fp = i->framePointer;
- struct Closure* closure = (struct Closure*)i->method;
- do {
- if (closure->method == method) return true;
- fp = object_to_smallint(i->stack->elements[fp - FRAME_OFFSET_PREVIOUS_FRAME_POINTER]);
- if (fp < FUNCTION_FRAME_SIZE) break;
- closure = (struct Closure*)i->stack->elements[fp - FRAME_OFFSET_METHOD];
- } while (fp >= FUNCTION_FRAME_SIZE);
-
- if (closure->method == method) return true;
- return false;
-}
void method_optimize(struct object_heap* oh, struct CompiledMethod* method) {
}
//whether to start with a fresh slate
//not starting may give us another degree of inlining
- //method->code = method->oldCode;
heap_store_into(oh, (struct Object*) method->oldCode, (struct Object*) method->code);
method->isInlined = oh->cached.true_object;
if (method->restVariable == oh->cached.true_object) return false;
struct Object* traitsWindow = method->base.map->delegates->elements[0];
if (traitsWindow == oh->cached.primitive_method_window) return false;
+ if (array_size(method->optionalKeywords) != 0) return false;
std::vector<struct Object*> code;
optimizer_append_code_to_vector(method->code, code);
if (code.size() > INLINER_MAX_METHOD_SIZE) return false;