Revision: 761 http://trac.macosforge.org/projects/ruby/changeset/761 Author: lsansonetti@apple.com Date: 2008-11-30 19:13:32 -0800 (Sun, 30 Nov 2008) Log Message: ----------- fixing some regressions Modified Paths: -------------- MacRuby/trunk/insns.def MacRuby/trunk/objc.m MacRuby/trunk/vm_insnhelper.c Modified: MacRuby/trunk/insns.def =================================================================== --- MacRuby/trunk/insns.def 2008-11-29 05:53:03 UTC (rev 760) +++ MacRuby/trunk/insns.def 2008-12-01 03:13:32 UTC (rev 761) @@ -1090,12 +1090,32 @@ recv = GET_SELF(); vm_search_superclass(GET_CFP(), GET_ISEQ(), recv, TOPN(num), &id, &klass); - mn = rb_objc_method_node(klass, id, NULL, &sel); #if WITH_OBJC + static ID idNew = 0, idNew2 = 0, idNew3 = 0; struct rb_method_cache mcache; void *mcachep; + if (idNew == 0) { + idNew = rb_intern("new"); + idNew2 = rb_intern("new:"); + idNew3 = rb_intern("__new__"); + } + + /* because #new is added on every new NSObject subclasses, and if overriden + we should still call our implementation with super */ + if ((id == idNew || id == idNew2) && klass == *(VALUE *)rb_cNSObject) { + VALUE k = CLASS_OF(recv); + if ((mn = rb_objc_method_node(k, idNew3, NULL, &sel)) == NULL) { + rb_bug("can't look up __new__ in klass `%s'\n", + class_getName((Class)k)); + } + klass = k; + } + else { + mn = rb_objc_method_node(klass, id, NULL, &sel); + } + if (mn != NULL) { mcache.flags = RB_MCACHE_RCALL_FLAG; mcache.as.rcall.sel = sel; Modified: MacRuby/trunk/objc.m =================================================================== --- MacRuby/trunk/objc.m 2008-11-29 05:53:03 UTC (rev 760) +++ MacRuby/trunk/objc.m 2008-12-01 03:13:32 UTC (rev 761) @@ -2780,14 +2780,14 @@ if (!ok) { rb_raise(rb_eRuntimeError, "%s", error); } -#if defined(__LP64__) -# if MAC_OS_X_VERSION_MAX_ALLOWED <= 1060 - /* XXX work around for <rdar://problem/6399046> NSNotFound 64-bit value is incorrect - * XXX we should introduce the possibility to write prelude scripts per +#if MAC_OS_X_VERSION_MAX_ALLOWED <= 1060 + /* XXX we should introduce the possibility to write prelude scripts per * frameworks where this kind of changes could be located. */ - static bool nsnotfound_fixed = false; - if (!nsnotfound_fixed) { +#if defined(__LP64__) + static bool R6399046_fixed = false; + /* XXX work around for <rdar://problem/6399046> NSNotFound 64-bit value is incorrect */ + if (!R6399046_fixed) { ID nsnotfound = rb_intern("NSNotFound"); VALUE val = (VALUE)CFDictionaryGetValue(rb_cObject_dict, (void *)nsnotfound); @@ -2795,11 +2795,33 @@ CFDictionarySetValue(rb_cObject_dict, (const void *)nsnotfound, (const void *)ULL2NUM(NSNotFound)); - nsnotfound_fixed = true; + R6399046_fixed = true; + DLOG("XXX", "applied work-around for rdar://problem/6399046"); } } -# endif #endif + static bool R6401816_fixed = false; + /* XXX work around for <rdar://problem/6401816> -[NSObject performSelector:withObject:] has wrong sel_of_type attributes*/ + if (!R6401816_fixed) { + bs_element_method_t *bs_method = + rb_bs_find_method((Class)rb_cNSObject, + @selector(performSelector:withObject:)); + if (bs_method != NULL) { + bs_element_arg_t *arg = bs_method->args; + while (arg != NULL) { + if (arg->index == 0 + && arg->sel_of_type != NULL + && arg->sel_of_type[0] != '@') { + arg->sel_of_type[0] = '@'; + R6401816_fixed = true; + DLOG("XXX", "applied work-around for rdar://problem/6401816"); + break; + } + arg++; + } + } + } +#endif } static VALUE Modified: MacRuby/trunk/vm_insnhelper.c =================================================================== --- MacRuby/trunk/vm_insnhelper.c 2008-11-29 05:53:03 UTC (rev 760) +++ MacRuby/trunk/vm_insnhelper.c 2008-12-01 03:13:32 UTC (rev 761) @@ -1433,7 +1433,6 @@ static inline VALUE vm_search_normal_superclass(VALUE klass, VALUE recv, ID mid) { - static ID idNew = 0, idNew2 = 0, idNew3 = 0; VALUE k, ary; int i, count; bool klass_located; @@ -1477,22 +1476,6 @@ (void *)recv, class_getName((Class)k)); - if (idNew == 0) { - idNew = rb_intern("new"); - idNew2 = rb_intern("new:"); - idNew3 = rb_intern("__new__"); - } - - /* because #new is added on every new NSObject subclasses, and if overriden - we should still call our implementation with super */ - if ((mid == idNew || mid == idNew2) && k == *(VALUE *)rb_cNSObject) { - if (rb_objc_method_node(klass, idNew3, NULL, NULL) == NULL) { - rb_bug("can't look up __new__ in klass `%s'\n", - class_getName((Class)klass)); - } - k = klass; - } - return k; } #endif
participants (1)
-
source_changes@macosforge.org