Parcourir la source

UserspaceEmulator: Move the SoftCPU stream virtuals to the header

They don't actually get inlined yet, but at least this devirtualizes
them which is nice.
Andreas Kling il y a 5 ans
Parent
commit
2f81c20002
2 fichiers modifiés avec 33 ajouts et 33 suppressions
  1. 0 33
      DevTools/UserspaceEmulator/SoftCPU.cpp
  2. 33 0
      DevTools/UserspaceEmulator/SoftCPU.h

+ 0 - 33
DevTools/UserspaceEmulator/SoftCPU.cpp

@@ -74,39 +74,6 @@ void SoftCPU::update_code_cache()
     m_cached_code_end = region->cacheable_ptr(region->size());
 }
 
-u8 SoftCPU::read8()
-{
-    if (!m_cached_code_ptr || m_cached_code_ptr >= m_cached_code_end)
-        update_code_cache();
-
-    u8 value = *m_cached_code_ptr;
-    m_cached_code_ptr += 1;
-    m_eip += 1;
-    return value;
-}
-
-u16 SoftCPU::read16()
-{
-    if (!m_cached_code_ptr || (m_cached_code_ptr + 2) >= m_cached_code_end)
-        update_code_cache();
-
-    u16 value = *reinterpret_cast<const u16*>(m_cached_code_ptr);
-    m_cached_code_ptr += 2;
-    m_eip += 2;
-    return value;
-}
-
-u32 SoftCPU::read32()
-{
-    if (!m_cached_code_ptr || (m_cached_code_ptr + 4) >= m_cached_code_end)
-        update_code_cache();
-
-    u32 value = *reinterpret_cast<const u32*>(m_cached_code_ptr);
-    m_cached_code_ptr += 4;
-    m_eip += 4;
-    return value;
-}
-
 u8 SoftCPU::read_memory8(X86::LogicalAddress address)
 {
     ASSERT(address.selector() == 0x18 || address.selector() == 0x20 || address.selector() == 0x28);

+ 33 - 0
DevTools/UserspaceEmulator/SoftCPU.h

@@ -812,4 +812,37 @@ private:
     const u8* m_cached_code_end { nullptr };
 };
 
+ALWAYS_INLINE u8 SoftCPU::read8()
+{
+    if (!m_cached_code_ptr || m_cached_code_ptr >= m_cached_code_end)
+        update_code_cache();
+
+    u8 value = *m_cached_code_ptr;
+    m_cached_code_ptr += 1;
+    m_eip += 1;
+    return value;
+}
+
+ALWAYS_INLINE u16 SoftCPU::read16()
+{
+    if (!m_cached_code_ptr || (m_cached_code_ptr + 2) >= m_cached_code_end)
+        update_code_cache();
+
+    u16 value = *reinterpret_cast<const u16*>(m_cached_code_ptr);
+    m_cached_code_ptr += 2;
+    m_eip += 2;
+    return value;
+}
+
+ALWAYS_INLINE u32 SoftCPU::read32()
+{
+    if (!m_cached_code_ptr || (m_cached_code_ptr + 4) >= m_cached_code_end)
+        update_code_cache();
+
+    u32 value = *reinterpret_cast<const u32*>(m_cached_code_ptr);
+    m_cached_code_ptr += 4;
+    m_eip += 4;
+    return value;
+}
+
 }