Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 5e41e52

Browse filesBrowse files
danmcdtargos
authored andcommitted
deps: patch V8 for illumos
illumos pointers are VA48, can allocate from the top of the 64-bit range as well. PR-URL: #59805 Reviewed-By: Filip Skokan <panva.ip@gmail.com> Reviewed-By: Richard Lau <richard.lau@ibm.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
1 parent 2243e58 commit 5e41e52
Copy full SHA for 5e41e52

4 files changed

+40-1Lines changed: 40 additions & 1 deletion

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎common.gypi‎

Copy file name to clipboardExpand all lines: common.gypi
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838

3939
# Reset this number to 0 on major V8 upgrades.
4040
# Increment by one for each non-official patch applied to deps/v8.
41-
'v8_embedder_string': '-node.4',
41+
'v8_embedder_string': '-node.5',
4242

4343
##### V8 defaults for Node.js #####
4444

Collapse file

‎deps/v8/src/codegen/code-stub-assembler.cc‎

Copy file name to clipboardExpand all lines: deps/v8/src/codegen/code-stub-assembler.cc
+9Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2043,7 +2043,16 @@ TNode<Code> CodeStubAssembler::LoadCodeObjectFromJSDispatchTable(
20432043
TNode<UintPtrT> shifted_value;
20442044
if (JSDispatchEntry::kObjectPointerOffset == 0) {
20452045
shifted_value =
2046+
#if defined(__illumos__) && defined(V8_HOST_ARCH_64_BIT)
2047+
// Pointers in illumos span both the low 2^47 range and the high 2^47 range
2048+
// as well. Checking the high bit being set in illumos means all higher bits
2049+
// need to be set to 1 after shifting right.
2050+
// Use WordSar() so any high-bit check wouldn't be necessary.
2051+
UncheckedCast<UintPtrT>(WordSar(UncheckedCast<IntPtrT>(value),
2052+
IntPtrConstant(JSDispatchEntry::kObjectPointerShift)));
2053+
#else
20462054
WordShr(value, UintPtrConstant(JSDispatchEntry::kObjectPointerShift));
2055+
#endif /* __illumos__ and 64-bit */
20472056
} else {
20482057
shifted_value = UintPtrAdd(
20492058
WordShr(value, UintPtrConstant(JSDispatchEntry::kObjectPointerShift)),
Collapse file

‎deps/v8/src/sandbox/js-dispatch-table-inl.h‎

Copy file name to clipboardExpand all lines: deps/v8/src/sandbox/js-dispatch-table-inl.h
+15Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,15 @@ void JSDispatchEntry::MakeJSDispatchEntry(Address object, Address entrypoint,
2525
uint16_t parameter_count,
2626
bool mark_as_alive) {
2727
DCHECK_EQ(object & kHeapObjectTag, 0);
28+
#if !defined(__illumos__) || !defined(V8_TARGET_ARCH_64_BIT)
2829
DCHECK_EQ((((object - kObjectPointerOffset) << kObjectPointerShift) >>
2930
kObjectPointerShift) +
3031
kObjectPointerOffset,
3132
object);
3233
DCHECK_EQ((object - kObjectPointerOffset) + kObjectPointerOffset, object);
3334
DCHECK_LT((object - kObjectPointerOffset),
3435
1ULL << ((sizeof(encoded_word_) * 8) - kObjectPointerShift));
36+
#endif /* __illumos__ & 64-bit */
3537

3638
Address payload = ((object - kObjectPointerOffset) << kObjectPointerShift) |
3739
(parameter_count & kParameterCountMask);
@@ -57,8 +59,16 @@ Address JSDispatchEntry::GetCodePointer() const {
5759
// and so may be 0 or 1 here. As the return value is a tagged pointer, the
5860
// bit must be 1 when returned, so we need to set it here.
5961
Address payload = encoded_word_.load(std::memory_order_acquire);
62+
#if defined(__illumos__) && defined(V8_TARGET_ARCH_64_BIT)
63+
// Unsigned types won't sign-extend on shift-right, but we need to do
64+
// this with illumos VA48 addressing.
65+
DCHECK_EQ(kObjectPointerOffset, 0);
66+
return (Address)((intptr_t)payload >> (int)kObjectPointerShift) |
67+
kHeapObjectTag;
68+
#else
6069
return ((payload >> kObjectPointerShift) + kObjectPointerOffset) |
6170
kHeapObjectTag;
71+
#endif /* __illumos__ & 64-bit */
6272
}
6373

6474
Tagged<Code> JSDispatchEntry::GetCode() const {
@@ -220,7 +230,12 @@ void JSDispatchEntry::MakeFreelistEntry(uint32_t next_entry_index) {
220230
bool JSDispatchEntry::IsFreelistEntry() const {
221231
#ifdef V8_TARGET_ARCH_64_BIT
222232
auto entrypoint = entrypoint_.load(std::memory_order_relaxed);
233+
#ifdef __illumos__
234+
// See the illumos definition of kFreeEntryTag for why we have to do this.
235+
return (entrypoint & 0xffff000000000000ull) == kFreeEntryTag;
236+
#else
223237
return (entrypoint & kFreeEntryTag) == kFreeEntryTag;
238+
#endif /* __illumos__ */
224239
#else
225240
return next_free_entry_.load(std::memory_order_relaxed) != 0;
226241
#endif
Collapse file

‎deps/v8/src/sandbox/js-dispatch-table.h‎

Copy file name to clipboardExpand all lines: deps/v8/src/sandbox/js-dispatch-table.h
+15Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,22 @@ struct JSDispatchEntry {
9090
#if defined(V8_TARGET_ARCH_64_BIT)
9191
// Freelist entries contain the index of the next free entry in their lower 32
9292
// bits and are tagged with this tag.
93+
#ifdef __illumos__
94+
// In illumos 64-bit apps, pointers are allocated both the bottom 2^47 range
95+
// AND the top 2^47 range in the 64-bit space. Instead of 47 bits of VA space
96+
// we have 48 bits. This means, however, the top 16-bits may be 0xffff. We
97+
// therefore pick a different value for the kFreeEntryTag. If/when we go to
98+
// VA57, aka 5-level paging, we'll need to revisit this again, as will node
99+
// by default, since the fixed-bits on the high end will shrink from top
100+
// 16-bits to top 8-bits.
101+
//
102+
// Unless illumos ships an Oracle-Solaris-like VA47 link-time options to
103+
// restrict pointers from allocating from above the Virtual Address hole,
104+
// we need to be mindful of this.
105+
static constexpr Address kFreeEntryTag = 0xfeed000000000000ull;
106+
#else
93107
static constexpr Address kFreeEntryTag = 0xffff000000000000ull;
108+
#endif /* __illumos__ */
94109
#ifdef V8_TARGET_BIG_ENDIAN
95110
// 2-byte parameter count is on the least significant side of encoded_word_.
96111
static constexpr int kBigEndianParamCountOffset =

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.