@@ -44,22 +44,6 @@ std::unordered_map<std::string, WasmForeignFunction> *foreign_functions = nullpt
44
44
45
45
const std::string INLINE_STRING = " <inline>" ;
46
46
47
- const uint8_t *decodeVarint (const uint8_t *pos, const uint8_t *end, uint32_t *out) {
48
- uint32_t ret = 0 ;
49
- int shift = 0 ;
50
- while (pos < end && (*pos & 0x80 )) {
51
- ret |= (*pos & 0x7f ) << shift;
52
- shift += 7 ;
53
- pos++;
54
- }
55
- if (pos < end) {
56
- ret |= *pos << shift;
57
- pos++;
58
- }
59
- *out = ret;
60
- return pos;
61
- }
62
-
63
47
std::string Sha256 (std::string_view data) {
64
48
std::vector<unsigned char > hash (picosha2::k_digest_size);
65
49
picosha2::hash256 (data.begin (), data.end (), hash.begin (), hash.end ());
@@ -302,36 +286,6 @@ bool WasmBase::initialize(const std::string &code, bool allow_precompiled) {
302
286
if (!ok) {
303
287
return false ;
304
288
}
305
- auto metadata = wasm_vm_->getCustomSection (" emscripten_metadata" );
306
- if (!metadata.empty ()) {
307
- // See https://github.com/emscripten-core/emscripten/blob/incoming/tools/shared.py#L3059
308
- is_emscripten_ = true ;
309
- auto start = reinterpret_cast <const uint8_t *>(metadata.data ());
310
- auto end = reinterpret_cast <const uint8_t *>(metadata.data () + metadata.size ());
311
- start = decodeVarint (start, end, &emscripten_metadata_major_version_);
312
- start = decodeVarint (start, end, &emscripten_metadata_minor_version_);
313
- start = decodeVarint (start, end, &emscripten_abi_major_version_);
314
- start = decodeVarint (start, end, &emscripten_abi_minor_version_);
315
- uint32_t temp;
316
- if (emscripten_metadata_major_version_ > 0 || emscripten_metadata_minor_version_ > 1 ) {
317
- // metadata 0.2 - added: wasm_backend.
318
- start = decodeVarint (start, end, &temp);
319
- }
320
- start = decodeVarint (start, end, &temp);
321
- start = decodeVarint (start, end, &temp);
322
- if (emscripten_metadata_major_version_ > 0 || emscripten_metadata_minor_version_ > 0 ) {
323
- // metadata 0.1 - added: global_base, dynamic_base, dynamictop_ptr and tempdouble_ptr.
324
- start = decodeVarint (start, end, &temp);
325
- start = decodeVarint (start, end, &temp);
326
- start = decodeVarint (start, end, &temp);
327
- decodeVarint (start, end, &temp);
328
- if (emscripten_metadata_major_version_ > 0 || emscripten_metadata_minor_version_ > 2 ) {
329
- // metadata 0.3 - added: standalone_wasm.
330
- start = decodeVarint (start, end, &emscripten_standalone_wasm_);
331
- }
332
- }
333
- }
334
-
335
289
code_ = code;
336
290
allow_precompiled_ = allow_precompiled;
337
291
}
0 commit comments