annotate runtime/transaction.h @ 186:ba35ab624ec2

Add support for raw C function output from C backend as well as an option to use Boehm-GC instead of reference counting
author Mike Pavone <pavone@retrodev.com>
date Fri, 07 Oct 2011 00:10:02 -0700
parents a68e6828d896
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
139
a68e6828d896 Global stores and transactions are working. Definately leaks memory on retries. Probably a fair number of bugs to work out. However, a basic test program works.
Mike Pavone <pavone@retrodev.com>
parents: 138
diff changeset
1 #ifndef TRANSACTION_H_
a68e6828d896 Global stores and transactions are working. Definately leaks memory on retries. Probably a fair number of bugs to work out. However, a basic test program works.
Mike Pavone <pavone@retrodev.com>
parents: 138
diff changeset
2 #define TRANSACTION_H_
138
1411de6050e1 First stab at transaction data structures, needs work
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
3
1411de6050e1 First stab at transaction data structures, needs work
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
4 #include "object.h"
139
a68e6828d896 Global stores and transactions are working. Definately leaks memory on retries. Probably a fair number of bugs to work out. However, a basic test program works.
Mike Pavone <pavone@retrodev.com>
parents: 138
diff changeset
5 #include "thread.h"
138
1411de6050e1 First stab at transaction data structures, needs work
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
6
1411de6050e1 First stab at transaction data structures, needs work
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
7 typedef struct
1411de6050e1 First stab at transaction data structures, needs work
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
8 {
1411de6050e1 First stab at transaction data structures, needs work
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
9 object header;
1411de6050e1 First stab at transaction data structures, needs work
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
10 object * data;
1411de6050e1 First stab at transaction data structures, needs work
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
11 int32_t version;
1411de6050e1 First stab at transaction data structures, needs work
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
12 } mutable_object;
1411de6050e1 First stab at transaction data structures, needs work
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
13
139
a68e6828d896 Global stores and transactions are working. Definately leaks memory on retries. Probably a fair number of bugs to work out. However, a basic test program works.
Mike Pavone <pavone@retrodev.com>
parents: 138
diff changeset
14 typedef struct trans_cell
138
1411de6050e1 First stab at transaction data structures, needs work
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
15 {
139
a68e6828d896 Global stores and transactions are working. Definately leaks memory on retries. Probably a fair number of bugs to work out. However, a basic test program works.
Mike Pavone <pavone@retrodev.com>
parents: 138
diff changeset
16 mutable_object *obj;
a68e6828d896 Global stores and transactions are working. Definately leaks memory on retries. Probably a fair number of bugs to work out. However, a basic test program works.
Mike Pavone <pavone@retrodev.com>
parents: 138
diff changeset
17 struct trans_cell *parent;
a68e6828d896 Global stores and transactions are working. Definately leaks memory on retries. Probably a fair number of bugs to work out. However, a basic test program works.
Mike Pavone <pavone@retrodev.com>
parents: 138
diff changeset
18 object *local_data;
a68e6828d896 Global stores and transactions are working. Definately leaks memory on retries. Probably a fair number of bugs to work out. However, a basic test program works.
Mike Pavone <pavone@retrodev.com>
parents: 138
diff changeset
19 int32_t orig_version;
a68e6828d896 Global stores and transactions are working. Definately leaks memory on retries. Probably a fair number of bugs to work out. However, a basic test program works.
Mike Pavone <pavone@retrodev.com>
parents: 138
diff changeset
20 int32_t local_version;
138
1411de6050e1 First stab at transaction data structures, needs work
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
21 } trans_cell;
1411de6050e1 First stab at transaction data structures, needs work
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
22
1411de6050e1 First stab at transaction data structures, needs work
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
23
1411de6050e1 First stab at transaction data structures, needs work
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
24 typedef struct transaction
1411de6050e1 First stab at transaction data structures, needs work
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
25 {
1411de6050e1 First stab at transaction data structures, needs work
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
26 struct transaction *parent;
1411de6050e1 First stab at transaction data structures, needs work
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
27 rh_mutex(lock)
139
a68e6828d896 Global stores and transactions are working. Definately leaks memory on retries. Probably a fair number of bugs to work out. However, a basic test program works.
Mike Pavone <pavone@retrodev.com>
parents: 138
diff changeset
28 struct transaction *chain;
138
1411de6050e1 First stab at transaction data structures, needs work
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
29 int32_t num_cells;
139
a68e6828d896 Global stores and transactions are working. Definately leaks memory on retries. Probably a fair number of bugs to work out. However, a basic test program works.
Mike Pavone <pavone@retrodev.com>
parents: 138
diff changeset
30 trans_cell cells[1];
138
1411de6050e1 First stab at transaction data structures, needs work
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
31 } transaction;
1411de6050e1 First stab at transaction data structures, needs work
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
32
139
a68e6828d896 Global stores and transactions are working. Definately leaks memory on retries. Probably a fair number of bugs to work out. However, a basic test program works.
Mike Pavone <pavone@retrodev.com>
parents: 138
diff changeset
33 #include "context.h"
a68e6828d896 Global stores and transactions are working. Definately leaks memory on retries. Probably a fair number of bugs to work out. However, a basic test program works.
Mike Pavone <pavone@retrodev.com>
parents: 138
diff changeset
34
a68e6828d896 Global stores and transactions are working. Definately leaks memory on retries. Probably a fair number of bugs to work out. However, a basic test program works.
Mike Pavone <pavone@retrodev.com>
parents: 138
diff changeset
35 trans_cell * find_obj_cell(transaction * trans, mutable_object * to_find);
186
ba35ab624ec2 Add support for raw C function output from C backend as well as an option to use Boehm-GC instead of reference counting
Mike Pavone <pavone@retrodev.com>
parents: 139
diff changeset
36 #ifdef RAW_FUNC
ba35ab624ec2 Add support for raw C function output from C backend as well as an option to use Boehm-GC instead of reference counting
Mike Pavone <pavone@retrodev.com>
parents: 139
diff changeset
37 #define begin_transaction(ct, numobjs, ...) real_begin_transaction(numobjs, __VA_ARGS__)
ba35ab624ec2 Add support for raw C function output from C backend as well as an option to use Boehm-GC instead of reference counting
Mike Pavone <pavone@retrodev.com>
parents: 139
diff changeset
38 void real_begin_transaction(int numobjs,...);
ba35ab624ec2 Add support for raw C function output from C backend as well as an option to use Boehm-GC instead of reference counting
Mike Pavone <pavone@retrodev.com>
parents: 139
diff changeset
39 #define commit_transaction(ct, readonly) real_commit_transaction(readonly)
ba35ab624ec2 Add support for raw C function output from C backend as well as an option to use Boehm-GC instead of reference counting
Mike Pavone <pavone@retrodev.com>
parents: 139
diff changeset
40 int32_t real_commit_transaction(int32_t readonly);
ba35ab624ec2 Add support for raw C function output from C backend as well as an option to use Boehm-GC instead of reference counting
Mike Pavone <pavone@retrodev.com>
parents: 139
diff changeset
41 #define prep_retry(ct) real_prep_retry()
ba35ab624ec2 Add support for raw C function output from C backend as well as an option to use Boehm-GC instead of reference counting
Mike Pavone <pavone@retrodev.com>
parents: 139
diff changeset
42 void prep_retry();
ba35ab624ec2 Add support for raw C function output from C backend as well as an option to use Boehm-GC instead of reference counting
Mike Pavone <pavone@retrodev.com>
parents: 139
diff changeset
43 extern transaction * cur_transaction;
ba35ab624ec2 Add support for raw C function output from C backend as well as an option to use Boehm-GC instead of reference counting
Mike Pavone <pavone@retrodev.com>
parents: 139
diff changeset
44 #else
139
a68e6828d896 Global stores and transactions are working. Definately leaks memory on retries. Probably a fair number of bugs to work out. However, a basic test program works.
Mike Pavone <pavone@retrodev.com>
parents: 138
diff changeset
45 void begin_transaction(struct context * ct, int numobjs,...);
a68e6828d896 Global stores and transactions are working. Definately leaks memory on retries. Probably a fair number of bugs to work out. However, a basic test program works.
Mike Pavone <pavone@retrodev.com>
parents: 138
diff changeset
46 int32_t commit_transaction(struct context * ct, int32_t readonly);
a68e6828d896 Global stores and transactions are working. Definately leaks memory on retries. Probably a fair number of bugs to work out. However, a basic test program works.
Mike Pavone <pavone@retrodev.com>
parents: 138
diff changeset
47 void prep_retry(struct context * ct);
186
ba35ab624ec2 Add support for raw C function output from C backend as well as an option to use Boehm-GC instead of reference counting
Mike Pavone <pavone@retrodev.com>
parents: 139
diff changeset
48 #define cur_transaction ct->transaction
ba35ab624ec2 Add support for raw C function output from C backend as well as an option to use Boehm-GC instead of reference counting
Mike Pavone <pavone@retrodev.com>
parents: 139
diff changeset
49 #endif
139
a68e6828d896 Global stores and transactions are working. Definately leaks memory on retries. Probably a fair number of bugs to work out. However, a basic test program works.
Mike Pavone <pavone@retrodev.com>
parents: 138
diff changeset
50
a68e6828d896 Global stores and transactions are working. Definately leaks memory on retries. Probably a fair number of bugs to work out. However, a basic test program works.
Mike Pavone <pavone@retrodev.com>
parents: 138
diff changeset
51 #endif //TRANSACTION_H_