Skip to content

Commit 379b864

Browse files
author
Wenyu Zhao
committed
Update openjdk to tag: jdk-11+28-mmtk (for future mmtk-barrier support)
1 parent 0b6e603 commit 379b864

13 files changed

+75
-43
lines changed

.gitmodules

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[submodule "repos/openjdk"]
22
path = repos/openjdk
33
url = ../openjdk.git
4-
branch = mmtk
4+
branch = jdk-11+28-mmtk
55
[submodule "repos/mmtk-core"]
66
path = repos/mmtk-core
77
url = ../mmtk-core.git

ThirdPartyHeap.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
```makefile
1717
# TOPDIR points to openjdk root directory
1818
JVM_SRC_DIRS += $(TOPDIR)/my_third_party_heap
19-
JVM_CFLAGS += -DTHIRD_PARTY_HEAP -DTHIRD_PARTY_HEAP_SRC=$(TOPDIR)/my_third_party_heap
19+
JVM_CFLAGS += -DINCLUDE_THIRD_PARTY_HEAP -DTHIRD_PARTY_HEAP_SRC=$(TOPDIR)/my_third_party_heap
2020
```
2121
This will compile every `.cpp` files under `$PWD/my_third_party_heap` and link to _libjava.so_.
2222

openjdk/CompileThirdPartyHeap.gmk

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,6 @@ FORCE:
2222

2323
TARGETS += $(LIB_MMTK)
2424
JVM_SRC_DIRS += $(MMTK_CPP_ROOT)
25-
JVM_CFLAGS += -DTHIRD_PARTY_HEAP -DTHIRD_PARTY_HEAP_SRC=$(MMTK_CPP_ROOT)
25+
JVM_CFLAGS += -DINCLUDE_THIRD_PARTY_HEAP -DTHIRD_PARTY_HEAP_SRC=$(MMTK_CPP_ROOT)
2626

2727
$(BUILD_LIBJVM): $(LIB_MMTK)

openjdk/barrier.cpp

+16-5
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,26 @@
2424

2525
#include "barrier.hpp"
2626

27+
#ifdef COMPILER1
28+
#include "gc/shared/c1/barrierSetC1.hpp"
29+
#endif
30+
#ifdef COMPILER2
31+
#include "gc/shared/c2/barrierSetC2.hpp"
32+
#endif
33+
34+
35+
NoBarrier::NoBarrier(MemRegion whole_heap): BarrierSet(
36+
make_barrier_set_assembler<BarrierSetAssembler>(),
37+
make_barrier_set_c1<BarrierSetC1>(),
38+
make_barrier_set_c2<BarrierSetC2>(),
39+
BarrierSet::FakeRtti(BarrierSet::NoBarrier)
40+
)
41+
, _whole_heap(whole_heap) {}
42+
2743
void NoBarrier::write_ref_array_work(MemRegion mr) {
2844
guarantee(false, "NoBarrier::write_ref_arrey_work not supported");
2945
}
3046

31-
void NoBarrier::write_region_work(MemRegion mr) {
32-
//guarantee(false, "NoBarrier::write_region_work not supported");
33-
}
34-
35-
3647
// Inform the BarrierSet that the the covered heap region that starts
3748
// with "base" has been changed to have the given size (possibly from 0,
3849
// for initialization.)

openjdk/barrier.hpp

+25-17
Original file line numberDiff line numberDiff line change
@@ -38,34 +38,26 @@
3838

3939
class NoBarrier : public BarrierSet {
4040
friend class VMStructs;
41-
private:
42-
MemRegion _whole_heap;
41+
private:
42+
MemRegion _whole_heap;
4343

4444
protected:
4545
virtual void write_ref_array_work(MemRegion mr) ;
4646

47-
protected:
48-
virtual void write_region_work(MemRegion mr) ;
49-
5047
public:
51-
52-
NoBarrier(MemRegion whole_heap): BarrierSet((BarrierSet::FakeRtti(BarrierSet::NoBarrier))
53-
.add_tag(BarrierSet::NoBarrier)),
54-
_whole_heap(whole_heap){
55-
56-
}
48+
NoBarrier(MemRegion whole_heap);
5749

5850
// Inform the BarrierSet that the the covered heap region that starts
5951
// with "base" has been changed to have the given size (possibly from 0,
6052
// for initialization.)
61-
virtual void resize_covered_region(MemRegion new_region) ;
53+
virtual void resize_covered_region(MemRegion new_region);
6254

6355
// If the barrier set imposes any alignment restrictions on boundaries
6456
// within the heap, this function tells whether they are met.
65-
virtual bool is_aligned(HeapWord* addr) ;
57+
virtual bool is_aligned(HeapWord* addr);
6658

6759
// Print a description of the memory for the barrier set
68-
virtual void print_on(outputStream* st) const ;
60+
virtual void print_on(outputStream* st) const;
6961

7062

7163
// The AccessBarrier of a BarrierSet subclass is called by the Access API
@@ -79,10 +71,26 @@ class NoBarrier : public BarrierSet {
7971
// 1) Provide an enum "name" for the BarrierSet in barrierSetConfig.hpp
8072
// 2) Make sure the barrier set headers are included from barrierSetConfig.inline.hpp
8173
// 3) Provide specializations for BarrierSet::GetName and BarrierSet::GetType.
82-
template <DecoratorSet decorators, typename BarrierSetT = NoBarrier>
74+
template <DecoratorSet decorators, typename BarrierSetT = NoBarrier>
8375
class AccessBarrier: public BarrierSet::AccessBarrier<decorators, BarrierSetT> {
84-
85-
};
76+
private:
77+
typedef RawAccessBarrier<decorators> Raw;
78+
public:
79+
template <typename T>
80+
static void oop_store_in_heap(T* addr, oop value) {
81+
// printf("oop_store_in_heap(addr=%p, value=%p)\n", addr, value);
82+
Raw::oop_store(addr, value);
83+
}
84+
85+
static void oop_store_in_heap_at(oop base, ptrdiff_t offset, oop value) {
86+
// printf("oop_store_in_heap_at(base=%p, offset=%ld, value=%p)\n", base, offset, value);
87+
Raw::oop_store_at(base, offset, value);
88+
}
89+
};
90+
91+
// void post_barrier(LIR_OprDesc* addr, LIR_OprDesc* new_val) {
92+
93+
// }
8694
};
8795

8896

openjdk/mmtkArguments.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ size_t MMTkArguments::conservative_max_heap_alignment() {
3939
return CollectorPolicy::compute_heap_alignment();
4040
}
4141

42-
void MMTkArguments::initialize_flags() {
43-
GCArguments::initialize_flags();
42+
void MMTkArguments::initialize() {
43+
GCArguments::initialize();
4444
assert(UseThirdPartyHeap , "Error, should UseThirdPartyHeap");
4545
FLAG_SET_DEFAULT(UseTLAB, false);
4646

openjdk/mmtkArguments.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class CollectedHeap;
3131

3232
class MMTkArguments : public GCArguments {
3333
public:
34-
virtual void initialize_flags();
34+
virtual void initialize();
3535
virtual size_t conservative_max_heap_alignment();
3636
virtual CollectedHeap* create_heap();
3737
};

openjdk/mmtkHeap.cpp

+13-6
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,12 @@ object iterator??!!
6060

6161
MMTkHeap* MMTkHeap::_heap = NULL;
6262

63+
MMTkHeap::MMTkHeap(MMTkCollectorPolicy* policy) : CollectedHeap(), _collector_policy(policy), _root_tasks(new SubTasksDone(MMTk_NumElements)), _n_workers(0), _gc_lock(new Monitor(Mutex::safepoint, "MMTkHeap::_gc_lock", true, Monitor::_safepoint_check_sometimes))
64+
// , _par_state_string(StringTable::weak_storage())
65+
{
66+
_heap = this;
67+
}
68+
6369
jint MMTkHeap::initialize() {
6470

6571
const size_t heap_size = collector_policy()->max_heap_byte_size();
@@ -92,7 +98,7 @@ jint MMTkHeap::initialize() {
9298

9399
NoBarrier* const barrier_set = new NoBarrier(reserved_region());
94100
//barrier_set->initialize();
95-
set_barrier_set(barrier_set);
101+
BarrierSet::set_barrier_set(barrier_set);
96102

97103
// Set up the GCTaskManager
98104
// _mmtk_gc_task_manager = mmtkGCTaskManager::create(ParallelGCThreads);
@@ -325,10 +331,11 @@ void MMTkHeap::scan_global_roots(OopClosure& cl) {
325331
if (!_root_tasks->is_task_claimed(MMTk_Management_oops_do)) Management::oops_do(&cl);
326332
if (!_root_tasks->is_task_claimed(MMTk_jvmti_oops_do)) JvmtiExport::oops_do(&cl);
327333
if (UseAOT && !_root_tasks->is_task_claimed(MMTk_aot_oops_do)) AOTLoader::oops_do(&cl);
328-
if (!_root_tasks->is_task_claimed(MMTk_SystemDictionary_oops_do)) SystemDictionary::roots_oops_do(&cl, &cl);
334+
if (!_root_tasks->is_task_claimed(MMTk_SystemDictionary_oops_do)) SystemDictionary::oops_do(&cl);
329335
if (!_root_tasks->is_task_claimed(MMTk_CodeCache_oops_do)) CodeCache::blobs_do(&cb_cl);
330336

331-
StringTable::possibly_parallel_oops_do(&cl);
337+
OopStorage::ParState<false, false> _par_state_string(StringTable::weak_storage());
338+
StringTable::possibly_parallel_oops_do(&_par_state_string, &cl);
332339

333340
// if (!_root_tasks->is_task_claimed(MMTk_ClassLoaderDataGraph_oops_do)) ClassLoaderDataGraph::roots_cld_do(&cld_cl, &cld_cl);
334341
if (!_root_tasks->is_task_claimed(MMTk_ClassLoaderDataGraph_oops_do)) ClassLoaderDataGraph::cld_do(&cld_cl);
@@ -348,7 +355,7 @@ void MMTkHeap::scan_thread_roots(OopClosure& cl) {
348355
if (_root_tasks->all_tasks_completed(_n_workers) == 0) {
349356
nmethod::oops_do_marking_prologue();
350357
Threads::change_thread_claim_parity();
351-
StringTable::clear_parallel_claimed_index();
358+
// StringTable::clear_parallel_claimed_index();
352359
}
353360
}
354361
CodeBlobToOopClosure cb_cl(&cl, false);
@@ -375,13 +382,13 @@ void MMTkHeap::scan_roots(OopClosure& cl) {
375382
Management::oops_do(&cl);
376383
JvmtiExport::oops_do(&cl);
377384
if (UseAOT) AOTLoader::oops_do(&cl);
378-
SystemDictionary::roots_oops_do(&cl, &cl);
385+
SystemDictionary::oops_do(&cl);
379386
{
380387
MutexLockerEx lock(CodeCache_lock, Mutex::_no_safepoint_check_flag);
381388
CodeCache::blobs_do(&cb_cl);
382389
}
383390
if (is_parallel) {
384-
StringTable::possibly_parallel_oops_do(&cl);
391+
StringTable::possibly_parallel_oops_do(NULL, &cl);
385392
} else {
386393
StringTable::oops_do(&cl);
387394
}

openjdk/mmtkHeap.hpp

+5-4
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727

2828
#include "gc/shared/collectedHeap.hpp"
2929
#include "gc/shared/collectorPolicy.hpp"
30+
#include "gc/shared/oopStorage.hpp"
3031
#include "gc/shared/gcPolicyCounters.hpp"
3132
#include "gc/shared/gcWhen.hpp"
3233
#include "gc/shared/strongRootsScope.hpp"
@@ -37,7 +38,7 @@
3738
#include "memory/iterator.hpp"
3839
#include "gc/shared/workgroup.hpp"
3940
#include "mmtkCollectorPolicy.hpp"
40-
41+
#include "gc/shared/oopStorageParState.hpp"
4142

4243
class GCMemoryManager;
4344
class MemoryPool;
@@ -54,6 +55,7 @@ class MMTkHeap : public CollectedHeap {
5455
SubTasksDone* _root_tasks;
5556
size_t _n_workers;
5657
Monitor* _gc_lock;
58+
ContiguousSpace* _space;
5759

5860
enum mmtk_strong_roots_tasks {
5961
MMTk_Universe_oops_do,
@@ -72,13 +74,12 @@ class MMTkHeap : public CollectedHeap {
7274

7375
private:
7476
// static mmtkGCTaskManager* _mmtk_gc_task_manager;
77+
// OopStorage::ParState<false, false> _par_state_string;
7578

7679

7780
public:
7881

79-
MMTkHeap(MMTkCollectorPolicy* policy) : CollectedHeap(), _collector_policy(policy), _root_tasks(new SubTasksDone(MMTk_NumElements)), _n_workers(0), _gc_lock(new Monitor(Mutex::safepoint, "MMTkHeap::_gc_lock", true, Monitor::_safepoint_check_sometimes)) {
80-
_heap = this;
81-
}
82+
MMTkHeap(MMTkCollectorPolicy* policy);
8283

8384
inline static MMTkHeap* heap() {
8485
return _heap;

openjdk/mmtkRootsClosure.hpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ class MMTkRootsClosure : public OopClosure {
2121

2222
virtual void do_oop(oop* p) { do_oop_work(p); }
2323
virtual void do_oop(narrowOop* p) {
24-
printf("narrowoop root %p -> %d %p %p\n", (void*) p, *p, *((void**) p), (void*) oopDesc::load_decode_heap_oop(p));
24+
// printf("narrowoop root %p -> %d %p %p\n", (void*) p, *p, *((void**) p), (void*) oopDesc::load_decode_heap_oop(p));
2525
do_oop_work(p);
2626
}
2727
};
2828

29-
class MMTkScanObjectClosure : public ExtendedOopClosure {
29+
class MMTkScanObjectClosure : public BasicOopIterateClosure {
3030
void* _trace;
3131
CLDToOopClosure follow_cld_closure;
3232

@@ -41,7 +41,7 @@ class MMTkScanObjectClosure : public ExtendedOopClosure {
4141

4242
virtual void do_oop(oop* p) { do_oop_work(p); }
4343
virtual void do_oop(narrowOop* p) {
44-
printf("narrowoop edge %p -> %d %p %p\n", (void*) p, *p, *((void**) p), (void*) oopDesc::load_decode_heap_oop(p));
44+
// printf("narrowoop edge %p -> %d %p %p\n", (void*) p, *p, *((void**) p), (void*) oopDesc::load_decode_heap_oop(p));
4545
do_oop_work(p);
4646
}
4747

openjdk/mmtkUpcalls.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
#include "runtime/threadSMR.hpp"
4343
#include "classfile/stringTable.hpp"
4444
#include "code/nmethod.hpp"
45+
#include "memory/iterator.inline.hpp"
4546

4647
static bool gcInProgress = false;
4748

openjdk/thirdPartyHeap.cpp

+5-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
#include "mmtk.h"
44
#include "mmtkArguments.hpp"
55

6+
// GCArguments* mmtk_new_gc_arguments() {
7+
// return new MMTkArguments();
8+
// }
9+
610
namespace third_party_heap {
711

812
class MutatorContext;
@@ -12,7 +16,7 @@ MutatorContext* bind_mutator(::Thread* current) {
1216
}
1317

1418
GCArguments* new_gc_arguments() {
15-
return new MMTkArguments();
19+
return NULL;
1620
}
1721

1822
};

repos/openjdk

Submodule openjdk updated 23069 files

0 commit comments

Comments
 (0)