hphp/runtime/vm/jit/vasm-llvm.cpp
/*
 * Parse a .gcc_except_table section as generated by LLVM, extracting regions
 * with nonzero landingpads. This function was also adapted from the
 * ExceptionDemo.cpp example in llvm.
 */
Parse a .gcc_except_table section as generated by LLVM, extracting regions
with nonzero landingpads. This function was also adapted from the
ExceptionDemo.cpp example in llvm.
Parse a . gcc_except_table section as generated by LLVM extracting regions with nonzero landingpads . This function was also adapted from the ExceptionDemo . cpp example in llvm .
jit::vector<EHInfo> parse_gcc_except_table(const uint8_t* ptr) {
  jit::vector<EHInfo> ret;
  FTRACE(2, "Parsing exception table at {}\n", ptr);
  uint8_t lpStartEncoding = *ptr++;
  if (lpStartEncoding != DW_EH_PE_omit) {
    readEncodedPointer(ptr, lpStartEncoding);
  }
  uint8_t ttypeEncoding = *ptr++;
  if (ttypeEncoding != DW_EH_PE_omit) {
    readULEB128(ptr);
  }
  uint8_t         callSiteEncoding = *ptr++;
  uint32_t        callSiteTableLength = readULEB128(ptr);
  const uint8_t*  callSiteTableStart = ptr;
  const uint8_t*  callSiteTableEnd = callSiteTableStart + callSiteTableLength;
  const uint8_t*  callSitePtr = callSiteTableStart;
  while (callSitePtr < callSiteTableEnd) {
    uintptr_t start = readEncodedPointer(callSitePtr, callSiteEncoding);
    uintptr_t length = readEncodedPointer(callSitePtr, callSiteEncoding);
    uintptr_t landingPad = readEncodedPointer(callSitePtr, callSiteEncoding);
    uintptr_t actionEntry = readULEB128(callSitePtr);
    always_assert(actionEntry == 0);
    if (landingPad == 0) continue;
    FTRACE(2, "Adding entry: [{},{}): landingPad {}\n",
           start, start + length, landingPad);
    ret.emplace_back(EHInfo{start, length, landingPad});
  }
  return ret;
}
jit :: vector < EHInfo > parse_gcc_except_table ( const uint8_t * ptr ) { jit :: vector < EHInfo > ret ; FTRACE ( 2 , " \n " , ptr ) ; uint8_t lpStartEncoding = * ptr ++ ; if ( lpStartEncoding != DW_EH_PE_omit ) { readEncodedPointer ( ptr , lpStartEncoding ) ; } uint8_t ttypeEncoding = * ptr ++ ; if ( ttypeEncoding != DW_EH_PE_omit ) { readULEB128 ( ptr ) ; } uint8_t callSiteEncoding = * ptr ++ ; uint32_t callSiteTableLength = readULEB128 ( ptr ) ; const uint8_t * callSiteTableStart = ptr ; const uint8_t * callSiteTableEnd = callSiteTableStart + callSiteTableLength ; const uint8_t * callSitePtr = callSiteTableStart ; while ( callSitePtr < callSiteTableEnd ) { uintptr_t start = readEncodedPointer ( callSitePtr , callSiteEncoding ) ; uintptr_t length = readEncodedPointer ( callSitePtr , callSiteEncoding ) ; uintptr_t landingPad = readEncodedPointer ( callSitePtr , callSiteEncoding ) ; uintptr_t actionEntry = readULEB128 ( callSitePtr ) ; always_assert ( actionEntry == 0 ) ; if ( landingPad == 0 ) continue ; FTRACE ( 2 , " \n " , start , start + length , landingPad ) ; ret . emplace_back ( EHInfo { start , length , landingPad } ) ; } return ret ; }
Parse a .gcc_except_table section as generated by LLVM, extracting regions
 with nonzero landingpads.
Parse a . gcc_except_table section as generated by LLVM extracting regions with nonzero landingpads .
// 0 indicates a cleanup entry, the only kind we generate