table_indicator = 1 << 2; // LDT #else // We use a GDT entry on Linux.
user_desc gdt_entry;
memset(&gdt_entry, 0, sizeof(gdt_entry));
// On Linux, there are 3 TLS GDT entries. We use one of those to to store our segment descriptor // data. // // This entry must be shared, as the kernel only guarantees three TLS entries. For simplicity // (and locality), use this local global, which practically becomes readonly after the first // (startup) thread of the runtime has been initialized (during Runtime::Start()). // // We also share this between all runtimes in the process. This is both for simplicity (one // well-known slot) as well as to avoid the three-slot limitation. Downside is that we cannot // free the slot when it is known that a runtime stops. staticunsignedint gdt_entry_number = -1;
// Check that the reads from %fs point to this Thread*.
Thread* self_check;
__asm__ __volatile__("movl %%fs:(%1), %0"
: "=r"(self_check) // output
: "r"(THREAD_SELF_OFFSET) // input
:); // clobber
CHECK_EQ(self_check, this);
// Extract the LDT entry number from the FS register.
uint16_t selector;
__asm__ __volatile__("movw %%fs, %w0"
: "=q"(selector) // output
: // input
:); // clobber
// Free LDT entry. #ifdefined(__APPLE__) // TODO: release selectors on OS/X this is a leak which will cause ldt entries to be exhausted // after enough threads are created. However, the following code results in kernel panics in OS/X // 10.9.
UNUSED(selector); // i386_set_ldt(selector >> 3, 0, 1); #else // Note if we wanted to clean up the GDT entry, we would do that here, when the *last* thread // is being deleted. But see the comment on gdt_entry_number. Code would look like this: // // user_desc gdt_entry; // memset(&gdt_entry, 0, sizeof(gdt_entry)); // gdt_entry.entry_number = selector >> 3; // gdt_entry.contents = MODIFY_LDT_CONTENTS_DATA; // // "Empty" = Delete = seg_not_present==1 && read_exec_only==1. // gdt_entry.seg_not_present = 1; // gdt_entry.read_exec_only = 1; // syscall(__NR_set_thread_area, &gdt_entry);
UNUSED(selector); #endif
}
} // namespace art
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.1 Sekunden
(vorverarbeitet am 2026-06-29)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.