Skip to content

Commit

Permalink
[SjLj] Remove old unused library methods (#21613)
Browse files Browse the repository at this point in the history
After llvm/llvm-project#84137 and #21502, these
methods are no longer used.
  • Loading branch information
aheejin authored Mar 26, 2024
1 parent d99707c commit 29be801
Showing 1 changed file with 0 additions and 50 deletions.
50 changes: 0 additions & 50 deletions system/lib/compiler-rt/emscripten_setjmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,58 +11,8 @@
#include <setjmp.h>
#include <threads.h>

// 0 - Nothing thrown
// 1 - Exception thrown
// Other values - jmpbuf pointer in the case that longjmp was thrown
static uintptr_t setjmpId = 0;

typedef struct TableEntry {
uintptr_t id;
uint32_t label;
} TableEntry;

extern void setTempRet0(uint32_t value);
extern void setThrew(uintptr_t threw, int value);

TableEntry* saveSetjmp(uintptr_t* env, uint32_t label, TableEntry* table, uint32_t size) {
// Not particularly fast: slow table lookup of setjmpId to label. But setjmp
// prevents relooping anyhow, so slowness is to be expected. And typical case
// is 1 setjmp per invocation, or less.
uint32_t i = 0;
setjmpId++;
*env = setjmpId;
while (i < size) {
if (table[i].id == 0) {
table[i].id = setjmpId;
table[i].label = label;
// prepare next slot
table[i + 1].id = 0;
setTempRet0(size);
return table;
}
i++;
}
// grow the table
size *= 2;
table = (TableEntry*)realloc(table, sizeof(TableEntry) * (size +1));
table = saveSetjmp(env, label, table, size);
setTempRet0(size); // FIXME: unneeded?
return table;
}

uint32_t testSetjmp(uintptr_t id, TableEntry* table, uint32_t size) {
uint32_t i = 0;
while (i < size) {
uintptr_t curr = table[i].id;
if (curr == 0) break;
if (curr == id) {
return table[i].label;
}
i++;
}
return 0;
}

#if !defined(__USING_WASM_SJLJ__)

#include "emscripten_internal.h"
Expand Down

0 comments on commit 29be801

Please sign in to comment.