<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[3441] MacRuby/trunk</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.macosforge.org/projects/ruby/changeset/3441">3441</a></dd>
<dt>Author</dt> <dd>lsansonetti@apple.com</dd>
<dt>Date</dt> <dd>2010-02-08 01:10:54 -0800 (Mon, 08 Feb 2010)</dd>
</dl>
<h3>Log Message</h3>
<pre>get rid of bad allocas, disable frame pointer elimination, simplified const lookup primitive</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#MacRubytrunkMacRubym">MacRuby/trunk/MacRuby.m</a></li>
<li><a href="#MacRubytrunkcompilercpp">MacRuby/trunk/compiler.cpp</a></li>
<li><a href="#MacRubytrunkcompilerh">MacRuby/trunk/compiler.h</a></li>
<li><a href="#MacRubytrunkdispatchercpp">MacRuby/trunk/dispatcher.cpp</a></li>
<li><a href="#MacRubytrunkobjcm">MacRuby/trunk/objc.m</a></li>
<li><a href="#MacRubytrunksprintfcpp">MacRuby/trunk/sprintf.cpp</a></li>
<li><a href="#MacRubytrunkvariablec">MacRuby/trunk/variable.c</a></li>
<li><a href="#MacRubytrunkvmcpp">MacRuby/trunk/vm.cpp</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="MacRubytrunkMacRubym"></a>
<div class="modfile"><h4>Modified: MacRuby/trunk/MacRuby.m (3440 => 3441)</h4>
<pre class="diff"><span>
<span class="info">--- MacRuby/trunk/MacRuby.m        2010-02-07 05:48:53 UTC (rev 3440)
+++ MacRuby/trunk/MacRuby.m        2010-02-08 09:10:54 UTC (rev 3441)
</span><span class="lines">@@ -71,9 +71,8 @@
</span><span class="cx"> {
</span><span class="cx"> VALUE *rargv = NULL;
</span><span class="cx"> if (argc > 0) {
</span><del>-        rargv = (VALUE *)alloca(sizeof(VALUE) * argc);
-        int i;
-        for (i = 0; i < argc; i++) {
</del><ins>+        rargv = (VALUE *)xmalloc(sizeof(VALUE) * argc);
+        for (int i = 0; i < argc; i++) {
</ins><span class="cx">          rargv[i] = OC2RB(argv[i]);
</span><span class="cx">         }
</span><span class="cx"> }
</span><span class="lines">@@ -88,18 +87,16 @@
</span><span class="cx"> id *argv;
</span><span class="cx">
</span><span class="cx"> if (firstArg != nil) {
</span><del>-        int i;
-
</del><span class="cx">         argc = 1;
</span><span class="cx">         va_start(args, firstArg);
</span><span class="cx">         while (va_arg(args, id) != NULL) {
</span><span class="cx">          argc++;
</span><span class="cx">         }
</span><span class="cx">         va_end(args);
</span><del>-        argv = alloca(sizeof(id) * argc);
</del><ins>+        argv = xmalloc(sizeof(id) * argc);
</ins><span class="cx">         va_start(args, firstArg);
</span><span class="cx">         argv[0] = firstArg;
</span><del>-        for (i = 1; i < argc; i++) {
</del><ins>+        for (int i = 1; i < argc; i++) {
</ins><span class="cx">          argv[i] = va_arg(args, id);
</span><span class="cx">         }
</span><span class="cx">         va_end(args);
</span></span></pre></div>
<a id="MacRubytrunkcompilercpp"></a>
<div class="modfile"><h4>Modified: MacRuby/trunk/compiler.cpp (3440 => 3441)</h4>
<pre class="diff"><span>
<span class="info">--- MacRuby/trunk/compiler.cpp        2010-02-07 05:48:53 UTC (rev 3440)
+++ MacRuby/trunk/compiler.cpp        2010-02-08 09:10:54 UTC (rev 3441)
</span><span class="lines">@@ -239,27 +239,14 @@
</span><span class="cx"> RoxorCompiler::compile_protected_call(Value *imp, std::vector<Value *> &params)
</span><span class="cx"> {
</span><span class="cx"> if (rescue_invoke_bb == NULL) {
</span><del>-        CallInst *dispatch = CallInst::Create(imp,
-                params.begin(),
-                params.end(),
-                "",
-                bb);
-        return dispatch;
</del><ins>+        return CallInst::Create(imp, params.begin(), params.end(), "", bb);
</ins><span class="cx"> }
</span><span class="cx"> else {
</span><span class="cx">         BasicBlock *normal_bb = BasicBlock::Create(context, "normal",
</span><span class="cx">                 bb->getParent());
</span><del>-
-        InvokeInst *dispatch = InvokeInst::Create(imp,
-                normal_bb,
-                rescue_invoke_bb,
-                params.begin(),
-                params.end(),
-                "",
-                bb);
-
</del><ins>+        InvokeInst *dispatch = InvokeInst::Create(imp, normal_bb,
+                rescue_invoke_bb, params.begin(), params.end(), "", bb);
</ins><span class="cx">         bb = normal_bb;
</span><del>-
</del><span class="cx">         return dispatch;
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -1374,22 +1361,29 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (getConstFunc == NULL) {
</span><del>-        // VALUE rb_vm_get_const(VALUE mod, unsigned char lexical_lookup,
-        //        struct ccache *cache, ID id, unsigned char dynamic_class);
</del><ins>+        // VALUE rb_vm_get_const(VALUE mod, struct ccache *cache, ID id,
+        //        int flags);
</ins><span class="cx">         getConstFunc = cast<Function>(module->getOrInsertFunction(
</span><span class="cx">                  "rb_vm_get_const",
</span><del>-                 RubyObjTy, RubyObjTy, Int8Ty, PtrTy, IntTy, Int8Ty,
</del><ins>+                 RubyObjTy, RubyObjTy, PtrTy, IntTy, Int32Ty,
</ins><span class="cx">                  NULL));
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> std::vector<Value *> params;
</span><span class="cx">
</span><span class="cx"> params.push_back(outer);
</span><del>- params.push_back(ConstantInt::get(Int8Ty, outer_given ? 0 : 1));
</del><span class="cx"> params.push_back(compile_ccache(id));
</span><span class="cx"> params.push_back(compile_id(id));
</span><del>- params.push_back(ConstantInt::get(Int8Ty, dynamic_class ? 1 : 0));
</del><span class="cx">
</span><ins>+ int flags = 0;
+ if (!outer_given) {
+        flags |= CONST_LOOKUP_LEXICAL;
+ }
+ if (dynamic_class) {
+        flags |= CONST_LOOKUP_DYNAMIC_CLASS;
+ }
+ params.push_back(ConstantInt::get(Int32Ty, flags));
+
</ins><span class="cx"> return compile_protected_call(getConstFunc, params);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -2804,16 +2798,22 @@
</span><span class="cx">         else {
</span><span class="cx">          UniChar *buf = (UniChar *)CFStringGetCharactersPtr(
</span><span class="cx">                  (CFStringRef)val);
</span><del>-
</del><ins>+         bool free_buf = false;
</ins><span class="cx">          if (buf == NULL) {
</span><del>-                buf = (UniChar *)alloca(sizeof(UniChar) * str_len);
</del><ins>+                buf = (UniChar *)malloc(sizeof(UniChar) * str_len);
</ins><span class="cx">                 CFStringGetCharacters((CFStringRef)val,
</span><span class="cx">                         CFRangeMake(0, str_len), buf);
</span><ins>+                free_buf = true;
</ins><span class="cx">          }
</span><span class="cx">
</span><span class="cx">          GlobalVariable *str_gvar = compile_const_global_ustring(buf,
</span><span class="cx">                  str_len, CFHash((CFTypeRef)val));
</span><span class="cx">
</span><ins>+         if (free_buf) {
+                free(buf);
+                buf = NULL;
+         }
+
</ins><span class="cx">          std::vector<Value *> idxs;
</span><span class="cx">          idxs.push_back(ConstantInt::get(Int32Ty, 0));
</span><span class="cx">          idxs.push_back(ConstantInt::get(Int32Ty, 0));
</span></span></pre></div>
<a id="MacRubytrunkcompilerh"></a>
<div class="modfile"><h4>Modified: MacRuby/trunk/compiler.h (3440 => 3441)</h4>
<pre class="diff"><span>
<span class="info">--- MacRuby/trunk/compiler.h        2010-02-07 05:48:53 UTC (rev 3440)
+++ MacRuby/trunk/compiler.h        2010-02-08 09:10:54 UTC (rev 3441)
</span><span class="lines">@@ -18,6 +18,10 @@
</span><span class="cx"> #define DISPATCH_SELF_ATTRASGN        4 // self attribute assignment
</span><span class="cx"> #define SPLAT_ARG_FOLLOWS        0xdeadbeef
</span><span class="cx">
</span><ins>+// For const lookup.
+#define CONST_LOOKUP_LEXICAL                1
+#define CONST_LOOKUP_DYNAMIC_CLASS        2
+
</ins><span class="cx"> // For defined?
</span><span class="cx"> #define DEFINED_IVAR         1
</span><span class="cx"> #define DEFINED_GVAR         2
</span></span></pre></div>
<a id="MacRubytrunkdispatchercpp"></a>
<div class="modfile"><h4>Modified: MacRuby/trunk/dispatcher.cpp (3440 => 3441)</h4>
<pre class="diff"><span>
<span class="info">--- MacRuby/trunk/dispatcher.cpp        2010-02-07 05:48:53 UTC (rev 3440)
+++ MacRuby/trunk/dispatcher.cpp        2010-02-08 09:10:54 UTC (rev 3441)
</span><span class="lines">@@ -76,7 +76,7 @@
</span><span class="cx">         IMP pimp, const rb_vm_arity_t &arity, int argc, const VALUE *argv)
</span><span class="cx"> {
</span><span class="cx"> if ((arity.real != argc) || (arity.max == -1)) {
</span><del>-        VALUE *new_argv = (VALUE *)alloca(sizeof(VALUE) * arity.real);
</del><ins>+        VALUE *new_argv = (VALUE *)xmalloc(sizeof(VALUE) * arity.real);
</ins><span class="cx">         __rb_vm_fix_args(argv, new_argv, arity, argc);
</span><span class="cx">         argv = new_argv;
</span><span class="cx">         argc = arity.real;
</span><span class="lines">@@ -117,7 +117,7 @@
</span><span class="cx">         int argc, const VALUE *argv)
</span><span class="cx"> {
</span><span class="cx"> if ((arity.real != argc) || (arity.max == -1)) {
</span><del>-        VALUE *new_argv = (VALUE *)alloca(sizeof(VALUE) * arity.real);
</del><ins>+        VALUE *new_argv = (VALUE *)xmalloc(sizeof(VALUE) * arity.real);
</ins><span class="cx">         __rb_vm_fix_args(argv, new_argv, arity, argc);
</span><span class="cx">         argv = new_argv;
</span><span class="cx">         argc = arity.real;
</span><span class="lines">@@ -337,7 +337,7 @@
</span><span class="cx">
</span><span class="cx"> GET_VM()->set_method_missing_reason(call_status);
</span><span class="cx">
</span><del>- VALUE *new_argv = (VALUE *)alloca(sizeof(VALUE) * (argc + 1));
</del><ins>+ VALUE *new_argv = (VALUE *)xmalloc(sizeof(VALUE) * (argc + 1));
</ins><span class="cx">
</span><span class="cx"> char buf[100];
</span><span class="cx"> int n = snprintf(buf, sizeof buf, "%s", sel_getName(sel));
</span><span class="lines">@@ -639,10 +639,11 @@
</span><span class="cx">          if (argc > 1) {
</span><span class="cx">                 const char *p = strchr(selname, ':');
</span><span class="cx">                 if (p != NULL && p + 1 != '\0') {
</span><del>-                 char *tmp = (char *)alloca(selname_len);
</del><ins>+                 char *tmp = (char *)malloc(selname_len);
</ins><span class="cx">                  strncpy(tmp, selname, p - selname + 1);
</span><span class="cx">                  tmp[p - selname + 1] = '\0';
</span><span class="cx">                  sel = sel_registerName(tmp);
</span><ins>+                 free(tmp);
</ins><span class="cx">                  VALUE h = rb_hash_new();
</span><span class="cx">                  bool ok = true;
</span><span class="cx">                  p += 1;
</span><span class="lines">@@ -1477,9 +1478,9 @@
</span><span class="cx">         VALUE *new_argv;
</span><span class="cx">         if (argc == 1 && TYPE(argv[0]) == T_ARRAY
</span><span class="cx">          && (arity.min > 1 || (arity.min == 1 && arity.min != arity.max))) {
</span><del>-         // Expand the array
</del><ins>+         // Expand the array.
</ins><span class="cx">          long ary_len = RARRAY_LEN(argv[0]);
</span><del>-         new_argv = (VALUE *)alloca(sizeof(VALUE) * ary_len);
</del><ins>+         new_argv = (VALUE *)xmalloc(sizeof(VALUE) * ary_len);
</ins><span class="cx">          for (int i = 0; i < ary_len; i++) {
</span><span class="cx">                 new_argv[i] = RARRAY_AT(argv[0], i);
</span><span class="cx">          }
</span><span class="lines">@@ -1499,7 +1500,7 @@
</span><span class="cx">         else {
</span><span class="cx">          new_argc = argc;
</span><span class="cx">         }
</span><del>-        new_argv = (VALUE *)alloca(sizeof(VALUE) * new_argc);
</del><ins>+        new_argv = (VALUE *)xmalloc(sizeof(VALUE) * new_argc);
</ins><span class="cx">         for (int i = 0; i < new_argc; i++) {
</span><span class="cx">          new_argv[i] = i < argc ? argv[i] : Qnil;
</span><span class="cx">         }
</span></span></pre></div>
<a id="MacRubytrunkobjcm"></a>
<div class="modfile"><h4>Modified: MacRuby/trunk/objc.m (3440 => 3441)</h4>
<pre class="diff"><span>
<span class="info">--- MacRuby/trunk/objc.m        2010-02-07 05:48:53 UTC (rev 3440)
+++ MacRuby/trunk/objc.m        2010-02-08 09:10:54 UTC (rev 3441)
</span><span class="lines">@@ -247,18 +247,16 @@
</span><span class="cx"> reload_class_constants(void)
</span><span class="cx"> {
</span><span class="cx"> static int class_count = 0;
</span><del>- int i, count;
- Class *buf;
</del><span class="cx">
</span><del>- count = objc_getClassList(NULL, 0);
</del><ins>+ const int count = objc_getClassList(NULL, 0);
</ins><span class="cx"> if (count == class_count) {
</span><span class="cx">         return;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- buf = (Class *)alloca(sizeof(Class) * count);
</del><ins>+ Class *buf = (Class *)malloc(sizeof(Class) * count);
</ins><span class="cx"> objc_getClassList(buf, count);
</span><span class="cx">
</span><del>- for (i = 0; i < count; i++) {
</del><ins>+ for (int i = 0; i < count; i++) {
</ins><span class="cx">         Class k = buf[i];
</span><span class="cx">         if (!RCLASS_RUBY(k)) {
</span><span class="cx">          long v = RCLASS_VERSION(k);
</span><span class="lines">@@ -291,6 +289,8 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> class_count = count;
</span><ins>+
+ free(buf);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> static void
</span></span></pre></div>
<a id="MacRubytrunksprintfcpp"></a>
<div class="modfile"><h4>Modified: MacRuby/trunk/sprintf.cpp (3440 => 3441)</h4>
<pre class="diff"><span>
<span class="info">--- MacRuby/trunk/sprintf.cpp        2010-02-07 05:48:53 UTC (rev 3440)
+++ MacRuby/trunk/sprintf.cpp        2010-02-08 09:10:54 UTC (rev 3441)
</span><span class="lines">@@ -479,7 +479,7 @@
</span><span class="cx">         fmt = rb_str_new2(new_fmt);
</span><span class="cx"> }
</span><span class="cx">
</span><del>- VALUE *stub_args = (VALUE *)alloca(sizeof(VALUE) * argc + 4);
</del><ins>+ VALUE *stub_args = (VALUE *)malloc(sizeof(VALUE) * (argc + 4));
</ins><span class="cx"> stub_args[0] = Qnil; // allocator
</span><span class="cx"> stub_args[1] = Qnil; // format options
</span><span class="cx"> stub_args[2] = fmt; // format string
</span><span class="lines">@@ -492,6 +492,7 @@
</span><span class="cx">
</span><span class="cx"> VALUE str = (*stub)((IMP)&CFStringCreateWithFormat, argc + 3, stub_args);
</span><span class="cx"> CFMakeCollectable((void *)str);
</span><ins>+ free(stub_args);
</ins><span class="cx"> return str;
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="MacRubytrunkvariablec"></a>
<div class="modfile"><h4>Modified: MacRuby/trunk/variable.c (3440 => 3441)</h4>
<pre class="diff"><span>
<span class="info">--- MacRuby/trunk/variable.c        2010-02-07 05:48:53 UTC (rev 3440)
+++ MacRuby/trunk/variable.c        2010-02-08 09:10:54 UTC (rev 3441)
</span><span class="lines">@@ -31,25 +31,26 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> static void
</span><del>-ivar_dict_foreach(VALUE hash, int (*func)(ANYARGS), VALUE farg)
</del><ins>+ivar_dict_foreach(CFDictionaryRef dict, int (*func)(ANYARGS), VALUE farg)
</ins><span class="cx"> {
</span><del>- CFIndex i, count;
- const void **keys;
- const void **values;
-
- count = CFDictionaryGetCount((CFDictionaryRef)hash);
- if (count == 0)
</del><ins>+ const long count = CFDictionaryGetCount(dict);
+ if (count == 0) {
</ins><span class="cx">         return;
</span><ins>+ }
</ins><span class="cx">
</span><del>- keys = (const void **)alloca(sizeof(void *) * count);
- values = (const void **)alloca(sizeof(void *) * count);
</del><ins>+ const void **keys = (const void **)malloc(sizeof(void *) * count);
+ const void **values = (const void **)malloc(sizeof(void *) * count);
</ins><span class="cx">
</span><del>- CFDictionaryGetKeysAndValues((CFDictionaryRef)hash, keys, values);
</del><ins>+ CFDictionaryGetKeysAndValues(dict, keys, values);
</ins><span class="cx">
</span><del>- for (i = 0; i < count; i++) {
-        if ((*func)(keys[i], values[i], farg) != ST_CONTINUE)
</del><ins>+ for (long i = 0; i < count; i++) {
+        if ((*func)(keys[i], values[i], farg) != ST_CONTINUE) {
</ins><span class="cx">          break;
</span><ins>+        }
</ins><span class="cx"> }
</span><ins>+
+ free(keys);
+ free(values);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> static CFDictionaryValueCallBacks rb_cfdictionary_value_cb = {
</span><span class="lines">@@ -134,7 +135,7 @@
</span><span class="cx">          arg.klass = res->klass;
</span><span class="cx">          arg.track = value;
</span><span class="cx">          arg.prev = res;
</span><del>-         ivar_dict_foreach((VALUE)iv_dict, fc_i, (VALUE)&arg);
</del><ins>+         ivar_dict_foreach(iv_dict, fc_i, (VALUE)&arg);
</ins><span class="cx">          if (arg.path) {
</span><span class="cx">                 res->path = arg.path;
</span><span class="cx">                 return ST_STOP;
</span><span class="lines">@@ -162,7 +163,7 @@
</span><span class="cx">
</span><span class="cx"> CFMutableDictionaryRef iv_dict = rb_class_ivar_dict(rb_cObject);
</span><span class="cx"> if (iv_dict != NULL) {
</span><del>-        ivar_dict_foreach((VALUE)iv_dict, fc_i, (VALUE)&arg);
</del><ins>+        ivar_dict_foreach(iv_dict, fc_i, (VALUE)&arg);
</ins><span class="cx"> }
</span><span class="cx"> if (arg.path == 0) {
</span><span class="cx">         st_foreach_safe(rb_class_tbl, fc_i, (st_data_t)&arg);
</span><span class="lines">@@ -1192,7 +1193,7 @@
</span><span class="cx">          {
</span><span class="cx">          CFMutableDictionaryRef iv_dict = rb_class_ivar_dict(obj);
</span><span class="cx">          if (iv_dict != NULL) {
</span><del>-                 ivar_dict_foreach((VALUE)iv_dict, func, arg);
</del><ins>+                 ivar_dict_foreach(iv_dict, func, arg);
</ins><span class="cx">          }
</span><span class="cx">          }
</span><span class="cx">          return;
</span><span class="lines">@@ -1673,7 +1674,7 @@
</span><span class="cx"> }
</span><span class="cx"> CFMutableDictionaryRef iv_dict = rb_class_ivar_dict(mod);
</span><span class="cx"> if (iv_dict != NULL) {
</span><del>-        ivar_dict_foreach((VALUE)iv_dict, sv_i, (VALUE)tbl);
</del><ins>+        ivar_dict_foreach(iv_dict, sv_i, (VALUE)tbl);
</ins><span class="cx"> }
</span><span class="cx"> return tbl;
</span><span class="cx"> }
</span><span class="lines">@@ -2016,7 +2017,7 @@
</span><span class="cx"> VALUE ary = rb_ary_new();
</span><span class="cx"> CFMutableDictionaryRef iv_dict = rb_class_ivar_dict(klass);
</span><span class="cx"> if (iv_dict != NULL) {
</span><del>-        ivar_dict_foreach((VALUE)iv_dict, cv_i, (VALUE)ary);
</del><ins>+        ivar_dict_foreach(iv_dict, cv_i, (VALUE)ary);
</ins><span class="cx"> }
</span><span class="cx"> return ary;
</span><span class="cx"> }
</span></span></pre></div>
<a id="MacRubytrunkvmcpp"></a>
<div class="modfile"><h4>Modified: MacRuby/trunk/vm.cpp (3440 => 3441)</h4>
<pre class="diff"><span>
<span class="info">--- MacRuby/trunk/vm.cpp        2010-02-07 05:48:53 UTC (rev 3440)
+++ MacRuby/trunk/vm.cpp        2010-02-08 09:10:54 UTC (rev 3441)
</span><span class="lines">@@ -1286,9 +1286,11 @@
</span><span class="cx">
</span><span class="cx"> extern "C"
</span><span class="cx"> VALUE
</span><del>-rb_vm_get_const(VALUE outer, unsigned char lexical_lookup,
-        struct ccache *cache, ID path, unsigned char dynamic_class)
</del><ins>+rb_vm_get_const(VALUE outer, struct ccache *cache, ID path, int flags)
</ins><span class="cx"> {
</span><ins>+ const bool lexical_lookup = (flags & CONST_LOOKUP_LEXICAL);
+ const bool dynamic_class = (flags & CONST_LOOKUP_DYNAMIC_CLASS);
+
</ins><span class="cx"> if (dynamic_class) {
</span><span class="cx">         Class k = GET_VM()->get_current_class();
</span><span class="cx">         if (lexical_lookup && k != NULL) {
</span><span class="lines">@@ -3047,7 +3049,8 @@
</span><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> use_found:
</span><del>- rb_vm_kept_local *locals = (rb_vm_kept_local *)alloca(sizeof(rb_vm_kept_local)*lvars_size);
</del><ins>+ rb_vm_kept_local *locals = (rb_vm_kept_local *)malloc(
+         sizeof(rb_vm_kept_local)*lvars_size);
</ins><span class="cx">
</span><span class="cx"> va_list ar;
</span><span class="cx"> va_start(ar, lvars_size);
</span><span class="lines">@@ -3105,6 +3108,7 @@
</span><span class="cx">         use_index = 0;
</span><span class="cx">         free(old_current);
</span><span class="cx"> }
</span><ins>+ free(locals);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> static inline rb_vm_local_t **
</span><span class="lines">@@ -4880,10 +4884,14 @@
</span><span class="cx"> void
</span><span class="cx"> Init_PreVM(void)
</span><span class="cx"> {
</span><del>- llvm::DwarfExceptionHandling = true; // required!
- llvm::JITEmitDebugInfo = true;
- // because pretty stack trace uses signal handling and thus breaks ours
</del><ins>+ // To emit DWARF exception tables.
+ llvm::DwarfExceptionHandling = true;
+ // To emit DWARF debug metadata.
+ llvm::JITEmitDebugInfo = true;
+ // To not interfere with our signal handling mechanism.
</ins><span class="cx"> llvm::DisablePrettyStackTrace = true;
</span><ins>+ // To not corrupt stack pointer (essential for backtracing).
+ llvm::NoFramePointerElim = true;
</ins><span class="cx">
</span><span class="cx"> RoxorCompiler::module = new llvm::Module("Roxor", getGlobalContext());
</span><span class="cx"> RoxorCompiler::module->setTargetTriple(TARGET_TRIPLE);
</span></span></pre>
</div>
</div>
</body>
</html>