From ca4605b3af559d0600e8102dd4255d4a6261720c Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Wed, 4 Sep 2019 10:54:47 -0700 Subject: 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. --- upb/pb/decoder.int.h | 24 +----------------------- 1 file changed, 1 insertion(+), 23 deletions(-) (limited to 'upb/pb/decoder.int.h') 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 -- cgit v1.2.3