8284161: Implementation of Virtual Threads (Preview)

Co-authored-by: Ron Pressler <rpressler@openjdk.org>
Co-authored-by: Alan Bateman <alanb@openjdk.org>
Co-authored-by: Erik Österlund <eosterlund@openjdk.org>
Co-authored-by: Andrew Haley <aph@openjdk.org>
Co-authored-by: Rickard Bäckman <rbackman@openjdk.org>
Co-authored-by: Markus Grönlund <mgronlun@openjdk.org>
Co-authored-by: Leonid Mesnik <lmesnik@openjdk.org>
Co-authored-by: Serguei Spitsyn <sspitsyn@openjdk.org>
Co-authored-by: Chris Plummer <cjplummer@openjdk.org>
Co-authored-by: Coleen Phillimore <coleenp@openjdk.org>
Co-authored-by: Robbin Ehn <rehn@openjdk.org>
Co-authored-by: Stefan Karlsson <stefank@openjdk.org>
Co-authored-by: Thomas Schatzl <tschatzl@openjdk.org>
Co-authored-by: Sergey Kuksenko <skuksenko@openjdk.org>
Reviewed-by: lancea, eosterlund, rehn, sspitsyn, stefank, tschatzl, dfuchs, lmesnik, dcubed, kevinw, amenkov, dlong, mchung, psandoz, bpb, coleenp, smarks, egahlin, mseledtsov, coffeys, darcy
This commit is contained in:
Alan Bateman 2022-05-07 08:06:16 +00:00
parent 5212535a27
commit 9583e3657e
1133 changed files with 95935 additions and 8335 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -28,6 +28,7 @@
#include "memory/iterator.hpp"
#include "classfile/classLoaderData.hpp"
#include "code/nmethod.hpp"
#include "oops/access.inline.hpp"
#include "oops/compressedOops.inline.hpp"
#include "oops/klass.hpp"
@ -35,6 +36,7 @@
#include "oops/instanceMirrorKlass.inline.hpp"
#include "oops/instanceClassLoaderKlass.inline.hpp"
#include "oops/instanceRefKlass.inline.hpp"
#include "oops/instanceStackChunkKlass.inline.hpp"
#include "oops/objArrayKlass.inline.hpp"
#include "oops/typeArrayKlass.inline.hpp"
#include "utilities/debug.hpp"
@ -52,6 +54,15 @@ inline void ClaimMetadataVisitingOopIterateClosure::do_klass(Klass* k) {
ClaimMetadataVisitingOopIterateClosure::do_cld(cld);
}
inline void ClaimMetadataVisitingOopIterateClosure::do_nmethod(nmethod* nm) {
nm->follow_nmethod(this);
}
inline void ClaimMetadataVisitingOopIterateClosure::do_method(Method* m) {
// Mark interpreted frames for class redefinition
m->record_gc_epoch();
}
// Implementation of the non-virtual do_oop dispatch.
//
// The same implementation is used for do_metadata, do_klass, and do_cld.
@ -169,6 +180,25 @@ void Devirtualizer::do_cld(OopClosureType* closure, ClassLoaderData* cld) {
call_do_cld(&OopClosureType::do_cld, &OopIterateClosure::do_cld, closure, cld);
}
// Implementation of the non-virtual do_derived_oop dispatch.
template <typename Receiver, typename Base, typename DerivedOopClosureType>
static typename EnableIf<IsSame<Receiver, Base>::value, void>::type
call_do_derived_oop(void (Receiver::*)(oop*, derived_pointer*), void (Base::*)(oop*, derived_pointer*), DerivedOopClosureType* closure, oop* base, derived_pointer* derived) {
closure->do_derived_oop(base, derived);
}
template <typename Receiver, typename Base, typename DerivedOopClosureType>
static typename EnableIf<!IsSame<Receiver, Base>::value, void>::type
call_do_derived_oop(void (Receiver::*)(oop*, derived_pointer*), void (Base::*)(oop*, derived_pointer*), DerivedOopClosureType* closure, oop* base, derived_pointer* derived) {
closure->DerivedOopClosureType::do_derived_oop(base, derived);
}
template <typename DerivedOopClosureType>
inline void Devirtualizer::do_derived_oop(DerivedOopClosureType* closure, oop* base, derived_pointer* derived) {
call_do_derived_oop(&DerivedOopClosureType::do_derived_oop, &DerivedOopClosure::do_derived_oop, closure, base, derived);
}
// Dispatch table implementation for *Klass::oop_oop_iterate
//
// It allows for a single call to do a multi-dispatch to an optimized version
@ -252,6 +282,7 @@ private:
set_init_function<InstanceRefKlass>();
set_init_function<InstanceMirrorKlass>();
set_init_function<InstanceClassLoaderKlass>();
set_init_function<InstanceStackChunkKlass>();
set_init_function<ObjArrayKlass>();
set_init_function<TypeArrayKlass>();
}
@ -314,6 +345,7 @@ private:
set_init_function<InstanceRefKlass>();
set_init_function<InstanceMirrorKlass>();
set_init_function<InstanceClassLoaderKlass>();
set_init_function<InstanceStackChunkKlass>();
set_init_function<ObjArrayKlass>();
set_init_function<TypeArrayKlass>();
}
@ -376,6 +408,7 @@ private:
set_init_function<InstanceRefKlass>();
set_init_function<InstanceMirrorKlass>();
set_init_function<InstanceClassLoaderKlass>();
set_init_function<InstanceStackChunkKlass>();
set_init_function<ObjArrayKlass>();
set_init_function<TypeArrayKlass>();
}