summaryrefslogtreecommitdiff
path: root/upb/pb/decoder.int.h
diff options
context:
space:
mode:
authorJoshua Haberman <jhaberman@gmail.com>2019-09-04 10:54:47 -0700
committerJoshua Haberman <jhaberman@gmail.com>2019-09-04 10:54:47 -0700
commitca4605b3af559d0600e8102dd4255d4a6261720c (patch)
tree0da7942d99ad9743bffa4d30ed60f810ee3de5a8 /upb/pb/decoder.int.h
parent2c869197700f5fd120dfbbb958ea460bc0dd4fef (diff)
Properly cache decoder methods, instead of regenerating every time.
This doesn't fully share bytecode. If you generate for message A which has B as a sub-message, then generate B, B's code will be generated twice. This could be optimized later if desired. But this addresses the leak in PHP. Also removed some obsolete JIT-only code.
Diffstat (limited to 'upb/pb/decoder.int.h')
-rw-r--r--upb/pb/decoder.int.h24
1 files changed, 1 insertions, 23 deletions
diff --git a/upb/pb/decoder.int.h b/upb/pb/decoder.int.h
index 3ed50df..9d5f583 100644
--- a/upb/pb/decoder.int.h
+++ b/upb/pb/decoder.int.h
@@ -80,7 +80,7 @@ struct upb_pbcodecache {
bool allow_jit;
bool lazy;
- /* Array of mgroups. */
+ /* Map of upb_msgdef -> mgroup. */
upb_inttable groups;
};
@@ -96,15 +96,6 @@ typedef struct {
/* The bytecode for our methods, if any exists. Owned by us. */
uint32_t *bytecode;
uint32_t *bytecode_end;
-
-#ifdef UPB_USE_JIT_X64
- /* JIT-generated machine code, if any. */
- upb_string_handlerfunc *jit_code;
- /* The size of the jit_code (required to munmap()). */
- size_t jit_size;
- char *debug_info;
- void *dl;
-#endif
} mgroup;
/* The maximum that any submessages can be nested. Matches proto2's limit.
@@ -215,19 +206,10 @@ struct upb_pbdecoder {
size_t stack_size;
upb_status *status;
-
-#ifdef UPB_USE_JIT_X64
- /* Used momentarily by the generated code to store a value while a user
- * function is called. */
- uint32_t tmp_len;
-
- const void *saved_rsp;
-#endif
};
/* Decoder entry points; used as handlers. */
void *upb_pbdecoder_startbc(void *closure, const void *pc, size_t size_hint);
-void *upb_pbdecoder_startjit(void *closure, const void *hd, size_t size_hint);
size_t upb_pbdecoder_decode(void *closure, const void *hd, const char *buf,
size_t size, const upb_bufhandle *handle);
bool upb_pbdecoder_end(void *closure, const void *handler_data);
@@ -251,10 +233,6 @@ extern const char *kPbDecoderSubmessageTooLong;
/* Access to decoderplan members needed by the decoder. */
const char *upb_pbdecoder_getopname(unsigned int op);
-/* JIT codegen entry point. */
-void upb_pbdecoder_jit(mgroup *group);
-void upb_pbdecoder_freejit(mgroup *group);
-
/* A special label that means "do field dispatch for this message and branch to
* wherever that takes you." */
#define LABEL_DISPATCH 0
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback