Fix for table64 spec test
diff --git a/scripts/test/shared.py b/scripts/test/shared.py
index ad02b61..b145b1f 100644
--- a/scripts/test/shared.py
+++ b/scripts/test/shared.py
@@ -424,7 +424,6 @@
     'annotations.wast',  # String annotations IDs should be allowed
     'id.wast',       # Empty IDs should be disallowed
     'instance.wast',  # Requires support for table default elements
-    'table64.wast',   # Requires validations for table size
     'tag.wast',      # Non-empty tag results allowed by stack switching
     'local_init.wast',  # Requires local validation to respect unnamed blocks
     'ref_func.wast',   # Requires rejecting undeclared functions references
diff --git a/src/tools/fuzzing/fuzzing.cpp b/src/tools/fuzzing/fuzzing.cpp
index 0e7bab6..59ce47e 100644
--- a/src/tools/fuzzing/fuzzing.cpp
+++ b/src/tools/fuzzing/fuzzing.cpp
@@ -912,13 +912,13 @@
     // reasonable limit for the maximum table size.
     //
     // This also avoids an issue that arises from table->initial being an
-    // Address (64 bits) but Table::kMaxSize being an Index (32 bits), as a
-    // result of which we need to clamp to Table::kMaxSize as well in order for
+    // Address (64 bits) but Table::kMaxSize32 being an Index (32 bits), as a
+    // result of which we need to clamp to Table::kMaxSize32 as well in order for
     // the module to validate (but since we are clamping to a smaller value,
     // there is no need).
     const Address ReasonableMaxTableSize = 10000;
     table->initial = std::min(table->initial, ReasonableMaxTableSize);
-    assert(ReasonableMaxTableSize <= Table::kMaxSize);
+    assert(ReasonableMaxTableSize <= Table::kMaxSize32);
 
     table->max = oneIn(2) ? Address(Table::kUnlimitedSize) : table->initial;
 
diff --git a/src/wasm-builder.h b/src/wasm-builder.h
index cd73bab..22bd500 100644
--- a/src/wasm-builder.h
+++ b/src/wasm-builder.h
@@ -106,7 +106,7 @@
                                           Type type = Type(HeapType::func,
                                                            Nullable),
                                           Address initial = 0,
-                                          Address max = Table::kMaxSize,
+                                          Address max = Table::kUnlimitedSize,
                                           Type addressType = Type::i32) {
     auto table = std::make_unique<Table>();
     table->name = name;
diff --git a/src/wasm.h b/src/wasm.h
index c35b1ea..bd8aec3 100644
--- a/src/wasm.h
+++ b/src/wasm.h
@@ -2447,12 +2447,14 @@
 class Table : public Importable {
 public:
   static const Address::address32_t kPageSize = 1;
-  static const Index kUnlimitedSize = Index(-1);
-  // In wasm32/64, the maximum table size is limited by a 32-bit pointer: 4GB
-  static const Index kMaxSize = Index(-1);
+  static const Address::address64_t kUnlimitedSize = Address::address64_t(-1);
+
+  // The maximum table size is limited by a 32/64 bit index
+  static const Address::address32_t kMaxSize32 = Address::address32_t(-1);
+  static const Address::address64_t kMaxSize64 = Address::address64_t(-1);
 
   Address initial = 0;
-  Address max = kMaxSize;
+  Address max = kUnlimitedSize;
   Type addressType = Type::i32;
   Type type = Type(HeapType::func, Nullable);
 
@@ -2461,7 +2463,7 @@
   void clear() {
     name = "";
     initial = 0;
-    max = kMaxSize;
+    max = kUnlimitedSize;
   }
 };
 
diff --git a/src/wasm/wasm-binary.cpp b/src/wasm/wasm-binary.cpp
index 6783b1e..b419b80 100644
--- a/src/wasm/wasm-binary.cpp
+++ b/src/wasm/wasm-binary.cpp
@@ -5009,7 +5009,7 @@
 
 void WasmBinaryReader::readElementSegments() {
   auto num = getU32LEB();
-  if (num >= Table::kMaxSize) {
+  if (num >= Table::kMaxSize32) {
     throwError("Too many segments");
   }
   std::unordered_set<Name> usedNames;