Title: [294395] trunk/Source/_javascript_Core/wasm
Revision
294395
Author
[email protected]
Date
2022-05-18 06:48:43 -0700 (Wed, 18 May 2022)

Log Message

[WASM-GC] Rtt types are represented as 64-bit values

Patch by Geza Lore <[email protected]> on 2022-05-18
https://bugs.webkit.org/show_bug.cgi?id=239493

Reviewed by Yusuke Suzuki.

Rtt types are 64-bit reference-like values, so represent them as
B3::Int64.

* wasm/WasmAirIRGenerator.cpp:
(JSC::Wasm::AirIRGenerator::gRtt):
(JSC::Wasm::AirIRGenerator::tmpForType):
(JSC::Wasm::AirIRGenerator::addRttCanon):
* wasm/WasmB3IRGenerator.cpp:
(JSC::Wasm::B3IRGenerator::addRttCanon):
* wasm/wasm.json:

# Please populate the above commit message. Lines starting
# with '#' will be ignored

# On branch eng/WASM-GC-Introduce-rtt-types
# Changes to be committed:
#   (use "git restore --staged <file>..." to unstage)
# 	modified:   Source/_javascript_Core/ChangeLog
#
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
# 	.clion.source.upload.marker
# 	clion-remote-release/
#

Canonical link: https://commits.webkit.org/250689@main

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/wasm/WasmAirIRGenerator.cpp (294394 => 294395)


--- trunk/Source/_javascript_Core/wasm/WasmAirIRGenerator.cpp	2022-05-18 13:10:27 UTC (rev 294394)
+++ trunk/Source/_javascript_Core/wasm/WasmAirIRGenerator.cpp	2022-05-18 13:48:43 UTC (rev 294395)
@@ -514,6 +514,7 @@
     TypedTmp gExternref() { return { newTmp(B3::GP), Types::Externref }; }
     TypedTmp gFuncref() { return { newTmp(B3::GP), Types::Funcref }; }
     TypedTmp gRef(Type type) { return { newTmp(B3::GP), type }; }
+    TypedTmp gRtt() { return { newTmp(B3::GP), Types::Rtt }; }
     TypedTmp f32() { return { newTmp(B3::FP), Types::F32 }; }
     TypedTmp f64() { return { newTmp(B3::FP), Types::F64 }; }
 
@@ -528,8 +529,9 @@
             return gFuncref();
         case TypeKind::Ref:
         case TypeKind::RefNull:
+            return gRef(type);
         case TypeKind::Rtt:
-            return gRef(type);
+            return gRtt();
         case TypeKind::Externref:
             return gExternref();
         case TypeKind::F32:
@@ -715,6 +717,7 @@
             case TypeKind::Funcref:
             case TypeKind::Ref:
             case TypeKind::RefNull:
+            case TypeKind::Rtt:
                 resultType = B3::Int64;
                 break;
             case TypeKind::F32:
@@ -3001,7 +3004,7 @@
 
 auto AirIRGenerator::addRttCanon(uint32_t typeIndex, ExpressionType& result) -> PartialResult
 {
-    result = tmpForType(Types::I32);
+    result = gRtt();
     emitCCall(&operationWasmRttCanon, result, instanceValue(), addConstant(Types::I32, typeIndex));
 
     return { };

Modified: trunk/Source/_javascript_Core/wasm/WasmB3IRGenerator.cpp (294394 => 294395)


--- trunk/Source/_javascript_Core/wasm/WasmB3IRGenerator.cpp	2022-05-18 13:10:27 UTC (rev 294394)
+++ trunk/Source/_javascript_Core/wasm/WasmB3IRGenerator.cpp	2022-05-18 13:48:43 UTC (rev 294395)
@@ -2256,7 +2256,7 @@
 
 auto B3IRGenerator::addRttCanon(uint32_t typeIndex, ExpressionType& result) -> PartialResult
 {
-    result = push(m_currentBlock->appendNew<CCallValue>(m_proc, toB3Type(Types::I32), origin(),
+    result = push(m_currentBlock->appendNew<CCallValue>(m_proc, toB3Type(Types::Rtt), origin(),
         m_currentBlock->appendNew<ConstPtrValue>(m_proc, origin(), tagCFunction<OperationPtrTag>(operationWasmRttCanon)),
         instanceValue(), m_currentBlock->appendNew<Const32Value>(m_proc, origin(), typeIndex)));
 

Modified: trunk/Source/_javascript_Core/wasm/wasm.json (294394 => 294395)


--- trunk/Source/_javascript_Core/wasm/wasm.json	2022-05-18 13:10:27 UTC (rev 294394)
+++ trunk/Source/_javascript_Core/wasm/wasm.json	2022-05-18 13:48:43 UTC (rev 294395)
@@ -17,7 +17,7 @@
         "ref":       { "type": "varint7", "value":  -21, "b3type": "B3::Int64" },
         "func":      { "type": "varint7", "value":  -32, "b3type": "B3::Void" },
         "struct":    { "type": "varint7", "value":  -33, "b3type": "B3::Void" },
-        "rtt":       { "type": "varint7", "value":  -24, "b3type": "B3::Void" },
+        "rtt":       { "type": "varint7", "value":  -24, "b3type": "B3::Int64" },
         "void":      { "type": "varint7", "value":  -64, "b3type": "B3::Void" }
     },
     "value_type": ["i32", "i64", "f32", "f64", "externref", "funcref"],
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to