1.8 marshal.c compatible with 1.6?

Hi everybody!

We are currently using ruby 1.6.8 on a number of projects.
Our code depends on the marshal functionality. From what I 've read
in the list, ruby 1.8 provides an optimized marshal implementation.
I wonder if it is possible to use the marshal.c file form the 1.8
distribution to compile a ‘custom’ 1.6.8 version. I dont want to
loose time with a backport if it is impossible for some reason.

Any info is really appreciated.

-g.

···


http://www.navel.gr

Hi,

···

At Sun, 20 Apr 2003 20:01:43 +0900, George Moschovitis wrote:

Our code depends on the marshal functionality. From what I 've read
in the list, ruby 1.8 provides an optimized marshal implementation.
I wonder if it is possible to use the marshal.c file form the 1.8
distribution to compile a ‘custom’ 1.6.8 version. I dont want to
loose time with a backport if it is impossible for some reason.

Although not tested, this may work.

Index: marshal.c

RCS file: /pub/cvs/ruby/src/ruby/marshal.c,v
retrieving revision 1.85
diff -u -2 -p -r1.85 marshal.c
— marshal.c 18 Apr 2003 18:04:48 -0000 1.85
+++ marshal.c 20 Apr 2003 12:41:50 -0000
@@ -18,4 +18,19 @@
#include <math.h>

+#define rb_obj_classname(obj) rb_class2name(CLASS_OF(obj))
+#define rb_str_buf_cat(buf, s, n) rb_str_cat(buf, s, n)
+#define rb_str_buf_new(n) rb_str_new(0, n)
+#define rb_struct_iv_get(obj, iv) rb_iv_get(obj, iv)
+#define StringValue(str) STR2CSTR(str)
+typedef char st_data_t;
+
+#if SIZEOF_INT
2 <= SIZEOF_LONG_LONG || SIZEOF_INT2 <= SIZEOF___INT64
+typedef unsigned int BDIGIT;
+#define SIZEOF_BDIGITS SIZEOF_INT
+#else
+typedef unsigned short BDIGIT;
+#define SIZEOF_BDIGITS SIZEOF_SHORT
+#endif
+
#define BITSPERSHORT (2
CHAR_BIT)
#define SHORTMASK ((1<<BITSPERSHORT)-1)


Nobu Nakada