ox 1.6.2 → 1.6.3
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of ox might be problematic. Click here for more details.
- data/README.md +3 -3
- data/ext/ox/cache8.c +51 -47
- data/ext/ox/cache8.h +8 -6
- data/ext/ox/cache8_test.c +10 -10
- data/ext/ox/dump.c +3 -3
- data/lib/ox/node.rb +1 -1
- data/lib/ox/version.rb +1 -1
- metadata +2 -2
data/README.md
CHANGED
@@ -20,7 +20,7 @@ A fast XML parser and Object marshaller as a Ruby gem.
|
|
20
20
|
|
21
21
|
## <a name="build_status">Build Status</a>
|
22
22
|
|
23
|
-
[![Build Status](
|
23
|
+
[![Build Status](https://secure.travis-ci.org/ohler55/ox.png?branch=master)](http://travis-ci.org/ohler55/ox)
|
24
24
|
|
25
25
|
## <a name="links">Links of Interest</a>
|
26
26
|
|
@@ -34,9 +34,9 @@ A fast XML parser and Object marshaller as a Ruby gem.
|
|
34
34
|
|
35
35
|
## <a name="release">Release Notes</a>
|
36
36
|
|
37
|
-
### Release 1.6.
|
37
|
+
### Release 1.6.3
|
38
38
|
|
39
|
-
-
|
39
|
+
- Fixed compatibility issues with Linux (Ubuntu) mostly related to pointer sizes.
|
40
40
|
|
41
41
|
## <a name="description">Description</a>
|
42
42
|
|
data/ext/ox/cache8.c
CHANGED
@@ -8,29 +8,31 @@
|
|
8
8
|
#include "ruby.h"
|
9
9
|
#include "cache8.h"
|
10
10
|
|
11
|
-
#define BITS
|
12
|
-
#define MASK
|
13
|
-
#define SLOT_CNT
|
14
|
-
#define DEPTH
|
11
|
+
#define BITS 4
|
12
|
+
#define MASK 0x000000000000000FULL
|
13
|
+
#define SLOT_CNT 16
|
14
|
+
#define DEPTH 16
|
15
|
+
|
16
|
+
typedef union {
|
17
|
+
struct _Cache8 *child;
|
18
|
+
slot_t value;
|
19
|
+
} Bucket;
|
15
20
|
|
16
21
|
struct _Cache8 {
|
17
|
-
|
18
|
-
struct _Cache8 *slots[SLOT_CNT];
|
19
|
-
unsigned long values[SLOT_CNT];
|
20
|
-
};
|
22
|
+
Bucket buckets[SLOT_CNT];
|
21
23
|
};
|
22
24
|
|
23
|
-
static void
|
24
|
-
static void
|
25
|
+
static void cache8_delete(Cache8 cache, int depth);
|
26
|
+
static void slot_print(Cache8 cache, sid_t key, unsigned int depth);
|
25
27
|
|
26
28
|
void
|
27
29
|
ox_cache8_new(Cache8 *cache) {
|
28
|
-
|
29
|
-
int
|
30
|
+
Bucket *b;
|
31
|
+
int i;
|
30
32
|
|
31
33
|
*cache = ALLOC(struct _Cache8);
|
32
|
-
for (i = SLOT_CNT,
|
33
|
-
|
34
|
+
for (i = SLOT_CNT, b = (*cache)->buckets; 0 < i; i--, b++) {
|
35
|
+
b->value = 0;
|
34
36
|
}
|
35
37
|
}
|
36
38
|
|
@@ -41,34 +43,35 @@ ox_cache8_delete(Cache8 cache) {
|
|
41
43
|
|
42
44
|
static void
|
43
45
|
cache8_delete(Cache8 cache, int depth) {
|
44
|
-
|
45
|
-
unsigned int
|
46
|
+
Bucket *b;
|
47
|
+
unsigned int i;
|
46
48
|
|
47
|
-
for (i = 0,
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
49
|
+
for (i = 0, b = cache->buckets; i < SLOT_CNT; i++, b++) {
|
50
|
+
if (0 != b->child) {
|
51
|
+
if (DEPTH - 1 != depth) {
|
52
|
+
cache8_delete(b->child, depth + 1);
|
53
|
+
}
|
54
|
+
}
|
53
55
|
}
|
54
56
|
xfree(cache);
|
55
57
|
}
|
56
58
|
|
57
59
|
slot_t
|
58
|
-
ox_cache8_get(Cache8 cache,
|
59
|
-
|
60
|
-
int
|
61
|
-
|
60
|
+
ox_cache8_get(Cache8 cache, sid_t key, slot_t **slot) {
|
61
|
+
Bucket *b;
|
62
|
+
int i;
|
63
|
+
sid_t k8 = (sid_t)key;
|
64
|
+
sid_t k;
|
62
65
|
|
63
66
|
for (i = 64 - BITS; 0 < i; i -= BITS) {
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
67
|
+
k = (k8 >> i) & MASK;
|
68
|
+
b = cache->buckets + k;
|
69
|
+
if (0 == b->child) {
|
70
|
+
ox_cache8_new(&b->child);
|
71
|
+
}
|
72
|
+
cache = b->child;
|
70
73
|
}
|
71
|
-
*slot = cache->
|
74
|
+
*slot = &(cache->buckets + (k8 & MASK))->value;
|
72
75
|
|
73
76
|
return **slot;
|
74
77
|
}
|
@@ -80,20 +83,21 @@ ox_cache8_print(Cache8 cache) {
|
|
80
83
|
}
|
81
84
|
|
82
85
|
static void
|
83
|
-
slot_print(Cache8 c,
|
84
|
-
|
85
|
-
unsigned int
|
86
|
-
|
86
|
+
slot_print(Cache8 c, sid_t key, unsigned int depth) {
|
87
|
+
Bucket *b;
|
88
|
+
unsigned int i;
|
89
|
+
sid_t k8 = (sid_t)key;
|
90
|
+
sid_t k;
|
87
91
|
|
88
|
-
for (i = 0,
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
92
|
+
for (i = 0, b = c->buckets; i < SLOT_CNT; i++, b++) {
|
93
|
+
if (0 != b->child) {
|
94
|
+
k = (k8 << BITS) | i;
|
95
|
+
/*printf("*** key: 0x%016llx depth: %u i: %u\n", k, depth, i); */
|
96
|
+
if (DEPTH - 1 == depth) {
|
97
|
+
printf("0x%016llx: %4llu\n", k, b->value);
|
98
|
+
} else {
|
99
|
+
slot_print(b->child, k, depth + 1);
|
100
|
+
}
|
101
|
+
}
|
98
102
|
}
|
99
103
|
}
|
data/ext/ox/cache8.h
CHANGED
@@ -32,15 +32,17 @@
|
|
32
32
|
#define __OX_CACHE8_H__
|
33
33
|
|
34
34
|
#include "ruby.h"
|
35
|
+
#include "stdint.h"
|
35
36
|
|
36
|
-
typedef struct _Cache8
|
37
|
-
typedef
|
37
|
+
typedef struct _Cache8 *Cache8;
|
38
|
+
typedef uint64_t slot_t;
|
39
|
+
typedef uint64_t sid_t;
|
38
40
|
|
39
|
-
extern void
|
40
|
-
extern void
|
41
|
+
extern void ox_cache8_new(Cache8 *cache);
|
42
|
+
extern void ox_cache8_delete(Cache8 cache);
|
41
43
|
|
42
|
-
extern slot_t
|
44
|
+
extern slot_t ox_cache8_get(Cache8 cache, sid_t key, slot_t **slot);
|
43
45
|
|
44
|
-
extern void
|
46
|
+
extern void ox_cache8_print(Cache8 cache);
|
45
47
|
|
46
48
|
#endif /* __OX_CACHE8_H__ */
|
data/ext/ox/cache8_test.c
CHANGED
@@ -32,13 +32,13 @@
|
|
32
32
|
#include "cache8.h"
|
33
33
|
|
34
34
|
static slot_t data[] = {
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
35
|
+
0x000000A0A0A0A0A0ULL,
|
36
|
+
0x0000000000ABCDEFULL,
|
37
|
+
0x0123456789ABCDEFULL,
|
38
|
+
0x0000000000000001ULL,
|
39
|
+
0x0000000000000002ULL,
|
40
|
+
0x0000000000000003ULL,
|
41
|
+
0x0000000000000004ULL,
|
42
42
|
0
|
43
43
|
};
|
44
44
|
|
@@ -55,13 +55,13 @@ ox_cache8_test() {
|
|
55
55
|
v = ox_cache8_get(c, *d, &slot);
|
56
56
|
if (0 == v) {
|
57
57
|
if (0 == slot) {
|
58
|
-
printf("*** failed to get a slot for 0x%
|
58
|
+
printf("*** failed to get a slot for 0x%016llx\n", *d);
|
59
59
|
} else {
|
60
|
-
printf("*** adding 0x%
|
60
|
+
printf("*** adding 0x%016llx to cache with value %llu\n", *d, cnt);
|
61
61
|
*slot = cnt++;
|
62
62
|
}
|
63
63
|
} else {
|
64
|
-
printf("*** get on 0x%
|
64
|
+
printf("*** get on 0x%016llx returned %llu\n", *d, v);
|
65
65
|
}
|
66
66
|
/*ox_cache8_print(c); */
|
67
67
|
}
|
data/ext/ox/dump.c
CHANGED
@@ -229,9 +229,9 @@ ulong2str(ulong num, char *end) {
|
|
229
229
|
|
230
230
|
static int
|
231
231
|
check_circular(Out out, VALUE obj, Element e) {
|
232
|
-
|
233
|
-
|
234
|
-
int
|
232
|
+
slot_t *slot;
|
233
|
+
slot_t id;
|
234
|
+
int result;
|
235
235
|
|
236
236
|
if (0 == (id = ox_cache8_get(out->circ_cache, obj, &slot))) {
|
237
237
|
out->circ_cnt++;
|
data/lib/ox/node.rb
CHANGED
data/lib/ox/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ox
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.6.
|
4
|
+
version: 1.6.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-10-
|
12
|
+
date: 2012-10-22 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: ! "A fast XML parser and object serializer that uses only standard C
|
15
15
|
lib.\n \nOptimized XML (Ox), as the name implies was written to provide
|