[PATCH] D54131: [WebAssembly] Add shared memory support to limits field

Derek Schuff via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 6 09:30:14 PST 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL346246: [WebAssembly] Add shared memory support to limits field (authored by dschuff, committed by ).

Repository:
  rL LLVM

https://reviews.llvm.org/D54131

Files:
  llvm/trunk/include/llvm/BinaryFormat/Wasm.h
  llvm/trunk/lib/Object/WasmObjectFile.cpp
  llvm/trunk/lib/ObjectYAML/WasmYAML.cpp
  llvm/trunk/test/ObjectYAML/wasm/import_memory_shared.yaml


Index: llvm/trunk/lib/Object/WasmObjectFile.cpp
===================================================================
--- llvm/trunk/lib/Object/WasmObjectFile.cpp
+++ llvm/trunk/lib/Object/WasmObjectFile.cpp
@@ -193,7 +193,7 @@
 
 static wasm::WasmLimits readLimits(WasmObjectFile::ReadContext &Ctx) {
   wasm::WasmLimits Result;
-  Result.Flags = readVaruint1(Ctx);
+  Result.Flags = readVaruint32(Ctx);
   Result.Initial = readVaruint32(Ctx);
   if (Result.Flags & wasm::WASM_LIMITS_FLAG_HAS_MAX)
     Result.Maximum = readVaruint32(Ctx);
Index: llvm/trunk/lib/ObjectYAML/WasmYAML.cpp
===================================================================
--- llvm/trunk/lib/ObjectYAML/WasmYAML.cpp
+++ llvm/trunk/lib/ObjectYAML/WasmYAML.cpp
@@ -416,6 +416,7 @@
     IO &IO, WasmYAML::LimitFlags &Value) {
 #define BCase(X) IO.bitSetCase(Value, #X, wasm::WASM_LIMITS_FLAG_##X)
   BCase(HAS_MAX);
+  BCase(IS_SHARED);
 #undef BCase
 }
 
Index: llvm/trunk/include/llvm/BinaryFormat/Wasm.h
===================================================================
--- llvm/trunk/include/llvm/BinaryFormat/Wasm.h
+++ llvm/trunk/include/llvm/BinaryFormat/Wasm.h
@@ -214,6 +214,7 @@
 
 enum : unsigned {
   WASM_LIMITS_FLAG_HAS_MAX = 0x1,
+  WASM_LIMITS_FLAG_IS_SHARED = 0x2,
 };
 
 // Kind codes used in the custom "name" section
Index: llvm/trunk/test/ObjectYAML/wasm/import_memory_shared.yaml
===================================================================
--- llvm/trunk/test/ObjectYAML/wasm/import_memory_shared.yaml
+++ llvm/trunk/test/ObjectYAML/wasm/import_memory_shared.yaml
@@ -0,0 +1,36 @@
+# RUN: yaml2obj %s | obj2yaml | FileCheck %s
+--- !WASM
+FileHeader:
+  Version:         0x00000001
+Sections:
+  - Type:            TYPE
+    Signatures:
+      - Index:           0
+        ReturnType:      I32
+        ParamTypes:
+          - I32
+  - Type:            IMPORT
+    Imports:
+      - Module:          foo
+        Field:           imported_memory
+        Kind:            MEMORY
+        Memory:
+          Flags:           [ HAS_MAX, IS_SHARED ]
+          Initial:         0x00000010
+          Maximum:         0x00000011
+
+...
+# CHECK: --- !WASM
+# CHECK: FileHeader:
+# CHECK:   Version:           0x00000001
+# CHECK: Sections:
+# CHECK:   - Type:            IMPORT
+# CHECK:     Imports:         
+# CHECK:       - Module:          foo
+# CHECK:         Field:           imported_memory
+# CHECK:         Kind:            MEMORY
+# CHECK:         Memory:
+# CHECK:           Flags:           [ HAS_MAX, IS_SHARED ]
+# CHECK:           Initial:         0x00000010
+# CHECK:           Maximum:         0x00000011
+# CHECK: ...


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D54131.172780.patch
Type: text/x-patch
Size: 2645 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181106/a61091e9/attachment.bin>


More information about the llvm-commits mailing list