[PATCH] D64612: [WebAssembly] i32.const operands should be signed

Thomas Lively via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 12 10:56:57 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL365930: [WebAssembly] i32.const operands should be signed (authored by tlively, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D64612?vs=209392&id=209533#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D64612/new/

https://reviews.llvm.org/D64612

Files:
  lld/trunk/test/wasm/data-segments.ll
  lld/trunk/wasm/Writer.cpp


Index: lld/trunk/test/wasm/data-segments.ll
===================================================================
--- lld/trunk/test/wasm/data-segments.ll
+++ lld/trunk/test/wasm/data-segments.ll
@@ -41,7 +41,7 @@
 
 @a = hidden global [6 x i8] c"hello\00", align 1
 @b = hidden global [8 x i8] c"goodbye\00", align 1
- at c = hidden global [9 x i8] c"whatever\00", align 1
+ at c = hidden global [10000 x i8] zeroinitializer, align 1
 @d = hidden global i32 42, align 4
 
 @e = private constant [9 x i8] c"constant\00", align 1
@@ -59,14 +59,21 @@
 ; ACTIVE-NEXT:      - SectionOffset:   7
 ; ACTIVE-NEXT:        InitFlags:       0
 ; ACTIVE-NEXT:        Offset:
-; ACTIVE-NEXT:        Opcode:          I32_CONST
-; ACTIVE-NEXT:        Value:           1024
-; ACTIVE-NEXT:        Content:         68656C6C6F00676F6F6462796500776861746576657200002A000000
-; ACTIVE-NEXT:      - SectionOffset:   41
+; ACTIVE-NEXT:          Opcode:          I32_CONST
+; ACTIVE-NEXT:          Value:           1024
+; ACTIVE-NEXT:        Content:         68656C6C6F00676F6F646279650000002A000000
+; ACTIVE-NEXT:      - SectionOffset:   34
 ; ACTIVE-NEXT:        InitFlags:       0
 ; ACTIVE-NEXT:        Offset:
-; ACTIVE-NEXT:        Opcode:          I32_CONST
-; ACTIVE-NEXT:        Value:           1052
+; ACTIVE-NEXT:          Opcode:          I32_CONST
+; ACTIVE-NEXT:          Value:           1044
+; ACTIVE-NEXT:        Content:         '0000000000
+; ACTIVE-SAME:                           0000000000'
+; ACTIVE-NEXT:      - SectionOffset:   10041
+; ACTIVE-NEXT:        InitFlags:       0
+; ACTIVE-NEXT:        Offset:
+; ACTIVE-NEXT:          Opcode:          I32_CONST
+; ACTIVE-NEXT:          Value:           11044
 ; ACTIVE-NEXT:        Content:         636F6E7374616E74000000002B
 ; ACTIVE-NEXT:  - Type:            CUSTOM
 ; ACTIVE-NEXT:    Name:            name
@@ -81,13 +88,17 @@
 ; PASSIVE-NEXT:        Body:            10010B
 ; PASSIVE-NEXT:      - Index:           1
 ; PASSIVE-NEXT:        Locals:          []
-; PASSIVE-NEXT:        Body:            4180084100411CFC080000FC0900419C084100410DFC080100FC09010B
+; PASSIVE-NEXT:        Body:            41800841004114FC080000FC090041940841004190CE00FC080100FC090141A4D6004100410DFC080200FC09020B
 ; PASSIVE-NEXT:  - Type:            DATA
 ; PASSIVE-NEXT:    Segments:
 ; PASSIVE-NEXT:      - SectionOffset:   3
 ; PASSIVE-NEXT:        InitFlags:       1
-; PASSIVE-NEXT:        Content:         68656C6C6F00676F6F6462796500776861746576657200002A000000
-; PASSIVE-NEXT:      - SectionOffset:   33
+; PASSIVE-NEXT:        Content:         68656C6C6F00676F6F646279650000002A000000
+; PASSIVE-NEXT:      - SectionOffset:   26
+; PASSIVE-NEXT:        InitFlags:       1
+; PASSIVE-NEXT:        Content:         '0000000000
+; PASSIVE-SAME:                           0000000000'
+; PASSIVE-NEXT:      - SectionOffset:   10028
 ; PASSIVE-NEXT:        InitFlags:       1
 ; PASSIVE-NEXT:        Content:         636F6E7374616E74000000002B
 ; PASSIVE-NEXT:  - Type:            CUSTOM
Index: lld/trunk/wasm/Writer.cpp
===================================================================
--- lld/trunk/wasm/Writer.cpp
+++ lld/trunk/wasm/Writer.cpp
@@ -658,13 +658,13 @@
       if (s->initFlags & WASM_SEGMENT_IS_PASSIVE) {
         // destination address
         writeU8(os, WASM_OPCODE_I32_CONST, "i32.const");
-        writeUleb128(os, s->startVA, "destination address");
+        writeSleb128(os, s->startVA, "destination address");
         // source segment offset
         writeU8(os, WASM_OPCODE_I32_CONST, "i32.const");
-        writeUleb128(os, 0, "segment offset");
+        writeSleb128(os, 0, "segment offset");
         // memory region size
         writeU8(os, WASM_OPCODE_I32_CONST, "i32.const");
-        writeUleb128(os, s->size, "memory region size");
+        writeSleb128(os, s->size, "memory region size");
         // memory.init instruction
         writeU8(os, WASM_OPCODE_MISC_PREFIX, "bulk-memory prefix");
         writeUleb128(os, WASM_OPCODE_MEMORY_INIT, "MEMORY.INIT");


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D64612.209533.patch
Type: text/x-patch
Size: 4040 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190712/8fc9472e/attachment.bin>


More information about the llvm-commits mailing list