Skip to content

Commit

Permalink
Update Soup
Browse files Browse the repository at this point in the history
  • Loading branch information
Sainan committed Dec 22, 2024
1 parent f731980 commit 448b1bc
Show file tree
Hide file tree
Showing 80 changed files with 2,217 additions and 3,333 deletions.
98 changes: 16 additions & 82 deletions Pluto.vcxproj

Large diffs are not rendered by default.

41 changes: 22 additions & 19 deletions Pluto.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,6 @@
<Filter>vendor\Soup\soup</Filter>
</ClCompile>
<ClCompile Include="src\lhttplib.cpp" />
<ClCompile Include="src\vendor\Soup\Intrin\aes_helper.cpp">
<Filter>vendor\Soup\Intrin</Filter>
</ClCompile>
<ClCompile Include="src\vendor\Soup\soup\adler32.cpp">
<Filter>vendor\Soup\soup</Filter>
</ClCompile>
Expand Down Expand Up @@ -265,9 +262,6 @@
<ClCompile Include="src\vendor\Soup\soup\DefaultRngInterface.cpp">
<Filter>vendor\Soup\soup</Filter>
</ClCompile>
<ClCompile Include="src\vendor\Soup\Intrin\hardware_rng.cpp">
<Filter>vendor\Soup\Intrin</Filter>
</ClCompile>
<ClCompile Include="src\vendor\Soup\soup\sha384.cpp">
<Filter>vendor\Soup\soup</Filter>
</ClCompile>
Expand All @@ -283,18 +277,9 @@
<ClCompile Include="src\vendor\Soup\soup\Server.cpp">
<Filter>vendor\Soup\soup</Filter>
</ClCompile>
<ClCompile Include="src\vendor\Soup\Intrin\crc32_intrin.cpp">
<Filter>vendor\Soup\Intrin</Filter>
</ClCompile>
<ClCompile Include="src\vendor\Soup\soup\alloc.cpp">
<Filter>vendor\Soup\soup</Filter>
</ClCompile>
<ClCompile Include="src\vendor\Soup\Intrin\sha1_transform.cpp">
<Filter>vendor\Soup\Intrin</Filter>
</ClCompile>
<ClCompile Include="src\vendor\Soup\Intrin\sha256_transform.cpp">
<Filter>vendor\Soup\Intrin</Filter>
</ClCompile>
<ClCompile Include="src\vendor\Soup\soup\os.cpp">
<Filter>vendor\Soup\soup</Filter>
</ClCompile>
Expand Down Expand Up @@ -349,6 +334,9 @@
<ClCompile Include="src\vendor\Soup\soup\QrCode.cpp">
<Filter>vendor\Soup\soup</Filter>
</ClCompile>
<ClCompile Include="src\vendor\Soup\soup\memAllocator.cpp">
<Filter>vendor\Soup\soup</Filter>
</ClCompile>
<ClCompile Include="src\vendor\Soup\soup\ResolveIpAddrTask.cpp">
<Filter>vendor\Soup\soup</Filter>
</ClCompile>
Expand Down Expand Up @@ -1087,6 +1075,24 @@
<ClInclude Include="src\vendor\Soup\soup\memCAllocator.hpp">
<Filter>vendor\Soup\soup</Filter>
</ClInclude>
<ClInclude Include="src\vendor\Soup\soup\utility.hpp">
<Filter>vendor\Soup\soup</Filter>
</ClInclude>
<ClInclude Include="src\vendor\Soup\soup\MemoryRefReader.hpp">
<Filter>vendor\Soup\soup</Filter>
</ClInclude>
<ClInclude Include="src\vendor\Soup\soup\aes_intrin.hpp">
<Filter>vendor\Soup\soup</Filter>
</ClInclude>
<ClInclude Include="src\vendor\Soup\soup\crc32_intrin.hpp">
<Filter>vendor\Soup\soup</Filter>
</ClInclude>
<ClInclude Include="src\vendor\Soup\soup\sha256_intrin.hpp">
<Filter>vendor\Soup\soup</Filter>
</ClInclude>
<ClInclude Include="src\vendor\Soup\soup\sha1_intrin.hpp">
<Filter>vendor\Soup\soup</Filter>
</ClInclude>
<ClInclude Include="src\vendor\Soup\soup\MemoryRefReader.hpp">
<Filter>vendor\Soup\soup</Filter>
</ClInclude>
Expand All @@ -1104,8 +1110,5 @@
<Filter Include="vendor\Soup\soup">
<UniqueIdentifier>{713ac335-27c4-4677-9da1-08c37c023a77}</UniqueIdentifier>
</Filter>
<Filter Include="vendor\Soup\Intrin">
<UniqueIdentifier>{f0adda43-f311-40e5-b4ec-284f248bad46}</UniqueIdentifier>
</Filter>
</ItemGroup>
</Project>
</Project>
6 changes: 2 additions & 4 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ SYSLIBS=

MYCFLAGS=
MYLDFLAGS=
MYLIBS=-Lvendor/Soup/soup -lsoup -Lvendor/Soup/Intrin -lsoupintrin
MYLIBS=-Lvendor/Soup/soup -lsoup
MYOBJS=

# Special flags for compiler modules; -Os reduces code size.
Expand Down Expand Up @@ -63,9 +63,8 @@ o: $(ALL_O)
a: $(ALL_A)

$(LUA_A): $(BASE_O)
cd vendor/Soup/Intrin && $(MAKE) && cd ../..
cd vendor/Soup/soup && $(MAKE) && cd ../..
$(AR) $@ $(BASE_O) vendor/Soup/Intrin/*.o vendor/Soup/soup/*.o
$(AR) $@ $(BASE_O) vendor/Soup/soup/*.o
$(RANLIB) $@

$(LUA_SO): $(BASE_O) $(LUA_A)
Expand All @@ -81,7 +80,6 @@ test:
./$(LUA_T) -v

clean:
cd vendor/Soup/Intrin && $(MAKE) clean && cd ../..
cd vendor/Soup/soup && $(MAKE) clean && cd ../..
$(RM) $(ALL_T) $(ALL_O)

Expand Down
15 changes: 0 additions & 15 deletions src/vendor/Soup/Intrin/.sun

This file was deleted.

28 changes: 0 additions & 28 deletions src/vendor/Soup/Intrin/Makefile

This file was deleted.

38 changes: 0 additions & 38 deletions src/vendor/Soup/Intrin/hardware_rng.cpp

This file was deleted.

2 changes: 1 addition & 1 deletion src/vendor/Soup/build_common.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
// Config
$clang = $argv[1] ?? "clang";
$clang .= " -std=c++17 -fno-rtti -DSOUP_USE_INTRIN -O3 -ffunction-sections -fdata-sections";
$clang .= " -std=c++17 -fno-rtti -O3 -ffunction-sections -fdata-sections";
if (defined("PHP_WINDOWS_VERSION_MAJOR"))
{
$clang .= " -D_CRT_SECURE_NO_WARNINGS";
Expand Down
22 changes: 0 additions & 22 deletions src/vendor/Soup/build_lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,28 +26,6 @@
array_push($objects, escapeshellarg("bin/int/$file.o"));
}
}
if(is_dir(__DIR__."/Intrin"))
{
if (php_uname("m") == "aarch64"
|| php_uname("m") == "arm64" // For people who think different
)
{
$clang .= " -march=armv8+crypto+crc";
}
else
{
$clang .= " -maes -mpclmul -mrdrnd -mrdseed -msha -msse4.1";
}
foreach(scandir(__DIR__."/Intrin") as $file)
{
if(substr($file, -4) == ".cpp")
{
$file = substr($file, 0, -4);
run_command_async("$clang -c ".__DIR__."/Intrin/$file.cpp -o ".__DIR__."/bin/int/$file.o");
array_push($objects, escapeshellarg("bin/int/$file.o"));
}
}
}
await_commands();

echo "Bundling static lib...\n";
Expand Down
3 changes: 0 additions & 3 deletions src/vendor/Soup/soup/.sun
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ cpp 17

arg -O3

require ../Intrin
arg -DSOUP_USE_INTRIN

if not windows
arg -fPIC
endif
8 changes: 4 additions & 4 deletions src/vendor/Soup/soup/Bigint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -760,7 +760,7 @@ NAMESPACE_SOUP
return res;
}

void Bigint::divide(const Bigint& divisor, Bigint& outQuotient, Bigint& outRemainder) const SOUP_EXCAL
void Bigint::divide(const Bigint& divisor, Bigint& SOUP_UNIQADDR outQuotient, Bigint& SOUP_UNIQADDR outRemainder) const SOUP_EXCAL
{
outQuotient.reset();
outRemainder.reset();
Expand Down Expand Up @@ -800,7 +800,7 @@ NAMESPACE_SOUP
return res;
}

void Bigint::divideUnsigned(const Bigint& divisor, Bigint& remainder) SOUP_EXCAL
void Bigint::divideUnsigned(const Bigint& divisor, Bigint& SOUP_UNIQADDR remainder) SOUP_EXCAL
{
remainder.reset();
SOUP_IF_LIKELY (!divisor.isZero())
Expand Down Expand Up @@ -1727,9 +1727,9 @@ NAMESPACE_SOUP

const Bigint two = (chunk_t)2u;
Bigint y = (*this / two);
Bigint x_over_y;
Bigint x_over_y, remainder;

while (x_over_y = (*this / y), y > x_over_y)
while (this->divide(y, x_over_y, remainder), y > x_over_y)
{
y = (x_over_y + y) / two;
}
Expand Down
4 changes: 2 additions & 2 deletions src/vendor/Soup/soup/Bigint.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,9 @@ NAMESPACE_SOUP
void operator/=(const Bigint& divisor) SOUP_EXCAL;
void operator%=(const Bigint& divisor) SOUP_EXCAL;
[[nodiscard]] std::pair<Bigint, Bigint> divide(const Bigint& divisor) const SOUP_EXCAL; // (Quotient, Remainder)
void divide(const Bigint& divisor, Bigint& outQuotient, Bigint& outRemainder) const SOUP_EXCAL;
void divide(const Bigint& divisor, Bigint& SOUP_UNIQADDR outQuotient, Bigint& SOUP_UNIQADDR outRemainder) const SOUP_EXCAL;
[[nodiscard]] std::pair<Bigint, Bigint> divideUnsigned(const Bigint& divisor) const SOUP_EXCAL; // (Quotient, Remainder)
void divideUnsigned(const Bigint& divisor, Bigint& remainder) SOUP_EXCAL;
void divideUnsigned(const Bigint& divisor, Bigint& SOUP_UNIQADDR remainder) SOUP_EXCAL;
[[nodiscard]] chunk_t divideUnsignedSmall(chunk_t divisor) noexcept;
[[nodiscard]] Bigint mod(const Bigint& m) const SOUP_EXCAL;
[[nodiscard]] Bigint modUnsigned(const Bigint& m) const SOUP_EXCAL;
Expand Down
11 changes: 11 additions & 0 deletions src/vendor/Soup/soup/Buffer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ NAMESPACE_SOUP
append(b);
}

Buffer(const std::string& b) SOUP_EXCAL
: Buffer(b.size())
{
append(b);
}

Buffer(Buffer&& b) noexcept
: m_data(b.m_data), m_size(b.m_size), m_capacity(b.m_capacity)
{
Expand Down Expand Up @@ -224,6 +230,11 @@ NAMESPACE_SOUP
append(src.m_data, src.m_size);
}

void append(const std::string& src) SOUP_EXCAL
{
append(src.data(), src.size());
}

void erase(size_t pos, size_t len) SOUP_EXCAL
{
memmove(&m_data[pos], &m_data[pos + len], m_size - len);
Expand Down
12 changes: 11 additions & 1 deletion src/vendor/Soup/soup/BufferRefWriter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@ NAMESPACE_SOUP
public:
Buffer& buf;

BufferRefWriter(Buffer& buf, Endian endian = ENDIAN_LITTLE)
BufferRefWriter(Buffer& buf)
: Writer(ENDIAN_LITTLE), buf(buf)
{
}

[[deprecated]] BufferRefWriter(Buffer& buf, Endian endian)
: Writer(endian), buf(buf)
{
}
Expand All @@ -30,5 +35,10 @@ NAMESPACE_SOUP
}
return true;
}

[[nodiscard]] size_t getPosition() final
{
return buf.size();
}
};
}
14 changes: 12 additions & 2 deletions src/vendor/Soup/soup/BufferWriter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,17 @@ NAMESPACE_SOUP
public:
Buffer buf{};

BufferWriter(Endian endian = ENDIAN_LITTLE)
BufferWriter()
: Writer(ENDIAN_LITTLE)
{
}

[[deprecated]] BufferWriter(Endian endian)
: Writer(endian)
{
}

BufferWriter(bool little_endian)
[[deprecated]] BufferWriter(bool little_endian)
: Writer(little_endian)
{
}
Expand All @@ -35,5 +40,10 @@ NAMESPACE_SOUP
}
return true;
}

[[nodiscard]] size_t getPosition() final
{
return buf.size();
}
};
}
Loading

0 comments on commit 448b1bc

Please sign in to comment.