Small patch

  • From: Dmitri Shubin <sbn@xxxxxxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Mon, 07 Jan 2013 15:55:25 +0400

Hi Mike,

While upgrading from 2.0.0-beta10 to 2.0.0 and re-applying our Solaris/x64 support patches I found the following changes that probably can be safely applied:

$ git diff
diff --git a/src/lj_mcode.c b/src/lj_mcode.c
index 34405b5..7526e99 100644
--- a/src/lj_mcode.c
+++ b/src/lj_mcode.c
@@ -223,8 +223,8 @@ static void *mcode_alloc(jit_State *J, size_t sz)
       if (mcode_validptr(p)) {
if ((uintptr_t)p + sz - target < range || target - (uintptr_t)p < range)
          return p;
-       mcode_free(J, p, sz);  /* Free badly placed area. */
       }
+      mcode_free(J, p, sz);  /* Free badly placed area. */
     }
     /* Next try probing pseudo-random addresses. */
     do {
diff --git a/src/vm_x86.dasc b/src/vm_x86.dasc
index e2b6a07..cc10ae7 100644
--- a/src/vm_x86.dasc
+++ b/src/vm_x86.dasc
@@ -6151,7 +6151,7 @@ static void emit_asm_debug(BuildCtx *ctx)
        "\t.align " SZPTR "\n"
        ".LEFDE1:\n\n", (int)ctx->codesz - fcofs);
 #endif
-#if (defined(__sun__) && defined(__svr4__)) || defined(__solaris_)
+#if (defined(__sun__) && defined(__svr4__)) || defined(__solaris__)
     fprintf(ctx->fp, "\t.section .eh_frame,\"aw\",@progbits\n");
 #else
     fprintf(ctx->fp, "\t.section .eh_frame,\"a\",@progbits\n");

The first one looks like memory leak, and the second one like a typo.
BTW where does this '__solaris__' macro come from, I haven't ever seen it before?

Thanks!

Other related posts: