[vm] Small fixes

Some small fixes split off from
https://dart-review.googlesource.com/c/sdk/+/246241.

* Print code comments on disassembly if the code object exists.
* Add Struct to the NativeType API.
* Fix typo.
* Add documentation.

TEST=Only cosmetic changes, build/run CI should be enough.

Change-Id: Ie193243573b034c52e41401b4d384d556c212fdd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250165
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
diff --git a/runtime/vm/compiler/assembler/disassembler.h b/runtime/vm/compiler/assembler/disassembler.h
index d58a0c9..7d090e4 100644
--- a/runtime/vm/compiler/assembler/disassembler.h
+++ b/runtime/vm/compiler/assembler/disassembler.h
@@ -144,7 +144,11 @@
 #if !defined(PRODUCT) || defined(FORCE_INCLUDE_DISASSEMBLER)
     DisassembleToStdout stdout_formatter;
     LogBlock lb;
-    Disassemble(start, end, &stdout_formatter, code);
+    if (!code.IsNull()) {
+      Disassemble(start, end, &stdout_formatter, code, &code.comments());
+    } else {
+      Disassemble(start, end, &stdout_formatter, code);
+    }
 #else
     UNREACHABLE();
 #endif
diff --git a/runtime/vm/compiler/ffi/native_type.cc b/runtime/vm/compiler/ffi/native_type.cc
index 27fc39d..ea0582b 100644
--- a/runtime/vm/compiler/ffi/native_type.cc
+++ b/runtime/vm/compiler/ffi/native_type.cc
@@ -58,6 +58,11 @@
   return static_cast<const NativeCompoundType&>(*this);
 }
 
+const NativeStructType& NativeType::AsStruct() const {
+  ASSERT(IsStruct());
+  return static_cast<const NativeStructType&>(*this);
+}
+
 bool NativePrimitiveType::IsInt() const {
   switch (representation_) {
     case kInt8:
diff --git a/runtime/vm/compiler/ffi/native_type.h b/runtime/vm/compiler/ffi/native_type.h
index e85f091..25ecfbe 100644
--- a/runtime/vm/compiler/ffi/native_type.h
+++ b/runtime/vm/compiler/ffi/native_type.h
@@ -31,6 +31,7 @@
 class NativePrimitiveType;
 class NativeArrayType;
 class NativeCompoundType;
+class NativeStructType;
 
 // NativeTypes are the types used in calling convention specifications:
 // integers, floats, and compounds.
@@ -74,6 +75,8 @@
   const NativeArrayType& AsArray() const;
   virtual bool IsCompound() const { return false; }
   const NativeCompoundType& AsCompound() const;
+  virtual bool IsStruct() const { return false; }
+  const NativeStructType& AsStruct() const;
 
   virtual bool IsInt() const { return false; }
   virtual bool IsFloat() const { return false; }
@@ -348,6 +351,8 @@
     return member_offsets_;
   }
 
+  virtual bool IsStruct() const { return true; }
+
 #if !defined(DART_PRECOMPILED_RUNTIME)
   virtual bool ContainsOnlyFloats(Range range) const;
 #endif  // !defined(DART_PRECOMPILED_RUNTIME)
diff --git a/runtime/vm/object.h b/runtime/vm/object.h
index 1b32e7e..0ed84a6 100644
--- a/runtime/vm/object.h
+++ b/runtime/vm/object.h
@@ -12687,7 +12687,7 @@
 //
 // This helper class can then be used via
 //
-//     using CallTableView = ArrayOfTuplesVied<
+//     using CallTableView = ArrayOfTuplesView<
 //         Code::Kind, std::tuple<Smi, Function, Code>>;
 //
 //     auto& array = Array::Handle(code.static_calls_targets_table());
diff --git a/runtime/vm/raw_object.h b/runtime/vm/raw_object.h
index 2e4ad32..b4fb7b6 100644
--- a/runtime/vm/raw_object.h
+++ b/runtime/vm/raw_object.h
@@ -1174,6 +1174,7 @@
   /* a forwarder which performs type checks for arguments of a dynamic call */ \
   /* (i.e., those checks omitted by the caller for interface calls). */        \
   V(DynamicInvocationForwarder)                                                \
+  /* A `dart:ffi` call or callback trampoline. */                              \
   V(FfiTrampoline)
 
   enum Kind {