From 2df678e4670517eaac40d1d2d9541d3b706b324b Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Tue, 18 Jun 2024 18:20:49 -0700 Subject: [threads] Shared basic heap types (#6667) Implement binary and text parsing and printing of shared basic heap types and incorporate them into the type hierarchy. To avoid the massive amount of code duplication that would be necessary if we were to add separate enum variants for each of the shared basic heap types, use bit 0 to indicate whether the type is shared and replace `getBasic()` with `getBasic(Unshared)`, which clears that bit. Update all the use sites to record whether the original type was shared and produce shared or unshared output without code duplication. --- src/binaryen-c.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/binaryen-c.cpp') diff --git a/src/binaryen-c.cpp b/src/binaryen-c.cpp index 4e7fb0b61..841fa61ee 100644 --- a/src/binaryen-c.cpp +++ b/src/binaryen-c.cpp @@ -78,7 +78,7 @@ BinaryenLiteral toBinaryenLiteral(Literal x) { assert(x.type.isRef()); auto heapType = x.type.getHeapType(); if (heapType.isBasic()) { - switch (heapType.getBasic()) { + switch (heapType.getBasic(Unshared)) { case HeapType::i31: WASM_UNREACHABLE("TODO: i31"); case HeapType::ext: @@ -132,7 +132,7 @@ Literal fromBinaryenLiteral(BinaryenLiteral x) { assert(type.isRef()); auto heapType = type.getHeapType(); if (heapType.isBasic()) { - switch (heapType.getBasic()) { + switch (heapType.getBasic(Unshared)) { case HeapType::i31: WASM_UNREACHABLE("TODO: i31"); case HeapType::ext: -- cgit v1.2.3