summaryrefslogtreecommitdiff
path: root/src/upb_decoder.h
diff options
context:
space:
mode:
authorJoshua Haberman <joshua@reverberate.org>2011-04-01 15:40:06 -0700
committerJoshua Haberman <joshua@reverberate.org>2011-04-01 15:40:06 -0700
commit9eb4d695c49a85f7f72ad68c3c31affd61fef984 (patch)
tree79b7fde57e6f31a19405688a5f9e29e3f9cf7ab2 /src/upb_decoder.h
parent19517cc6f39871abf4a0705b49cfed9049ca6033 (diff)
First rough version of the JIT.
It can successfully parse SpeedMessage1. Preliminary results: 750MB/s on Core2 2.4GHz. This number is 2.5x proto2. This isn't apples-to-apples, because proto2 is parsing to a struct and we are just doing stream parsing, but for apps that are currently using proto2, this is the improvement they would see if they could move to stream-based processing. Unfortunately perf-regression-test.py is broken, and I'm not 100% sure why. It would be nice to fix it first (to ensure that there are no performance regressions for the table-based decoder) but I'm really impatient to get the JIT checked in.
Diffstat (limited to 'src/upb_decoder.h')
-rw-r--r--src/upb_decoder.h19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/upb_decoder.h b/src/upb_decoder.h
index bb54930..1be31c4 100644
--- a/src/upb_decoder.h
+++ b/src/upb_decoder.h
@@ -27,13 +27,12 @@ extern "C" {
/* upb_decoder *****************************************************************/
+struct dasm_State;
+
struct _upb_decoder {
// Bytesrc from which we pull serialized data.
upb_bytesrc *bytesrc;
- // Dispatcher to which we push parsed data.
- upb_dispatcher dispatcher;
-
// String to hold our input buffer; is only active if d->buf != NULL.
upb_string *bufstr;
@@ -48,6 +47,7 @@ struct _upb_decoder {
// End of this buffer, relative to *ptr.
const char *end;
+ const char *jit_end;
// Members which may also be written by the JIT:
@@ -57,8 +57,21 @@ struct _upb_decoder {
// End of this submessage, relative to *ptr.
const char *submsg_end;
+ // MIN(end, submsg_end)
+ const char *effective_end;
+
// Where we will store any errors that occur.
upb_status *status;
+
+ // Dispatcher to which we push parsed data.
+ upb_dispatcher dispatcher;
+
+ // JIT-generated machine code (else NULL).
+ char *jit_code;
+ size_t jit_size;
+ char *debug_info;
+
+ struct dasm_State *dynasm;
};
// A upb_decoder decodes the binary protocol buffer format, writing the data it
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback