[svn:parrot] r38334 - in trunk: include/parrot src/ops

whiteknight at svn.parrot.org whiteknight at svn.parrot.org
Fri Apr 24 22:48:52 UTC 2009


Author: whiteknight
Date: Fri Apr 24 22:48:51 2009
New Revision: 38334
URL: https://trac.parrot.org/parrot/changeset/38334

Log:
Remove some weird macros for converting a pointer value to an opcode_t value. These macros were only used in one place and were used incorrectly (although I don't think the incorrect usage raised any warnings, which is weird). I've replaced it with a better macro for handling ptr->INTVAL conversions

Modified:
   trunk/include/parrot/parrot.h
   trunk/src/ops/core.ops

Modified: trunk/include/parrot/parrot.h
==============================================================================
--- trunk/include/parrot/parrot.h	Fri Apr 24 21:31:49 2009	(r38333)
+++ trunk/include/parrot/parrot.h	Fri Apr 24 22:48:51 2009	(r38334)
@@ -154,20 +154,6 @@
 #define PTR2INTVAL(p)    INTVAL2PTR(INTVAL, (p))
 #define PTR2UINTVAL(p)    UINTVAL2PTR(UINTVAL, (p))
 
-/* Use similar macros for casting between pointers and opcode_t.
-   (We can't assume that sizeof (opcode_t) == sizeof (intval).
-*/
-#if (OPCODE_T_SIZE == PTR_SIZE)
-#  define OPCODE_T2PTR(any, d)    (any)(d)
-#else
-#  if PTR_SIZE == LONG_SIZE
-#    define OPCODE_T2PTR(any, d)    (any)(unsigned long)(d)
-#  else
-#    define OPCODE_T2PTR(any, d)    (any)(unsigned int)(d)
-#  endif /* PTR_SIZE == LONG_SIZE */
-#endif /* OPCODE_T_SIZE == PTR_SIZE */
-#define PTR2OPCODE_T(p)    OPCODE_T2PTR(opcode_t, (p))
-
 /*
  * some compilers don't like lvalue casts, so macroize them
  *

Modified: trunk/src/ops/core.ops
==============================================================================
--- trunk/src/ops/core.ops	Fri Apr 24 21:31:49 2009	(r38333)
+++ trunk/src/ops/core.ops	Fri Apr 24 22:48:51 2009	(r38334)
@@ -733,7 +733,7 @@
 =cut
 
 inline op set_addr(out INT, inconst LABEL) {
-    $1 = PTR2OPCODE_T(CUR_OPCODE + $2);
+    $1 = PTR2INTVAL(CUR_OPCODE + $2);
 }
 
 inline op set_addr(invar PMC, inconst LABEL) {


More information about the parrot-commits mailing list