mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +02:00
8213229: Investigate treating StringTable as weak in young collections
Reviewed-by: zgu, kbarrett
This commit is contained in:
parent
51e2252a73
commit
d800361151
42 changed files with 319 additions and 555 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2019, 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
|
||||
|
@ -376,68 +376,11 @@ oop StringTable::do_intern(Handle string_or_null_h, const jchar* name,
|
|||
} while(true);
|
||||
}
|
||||
|
||||
// GC support
|
||||
class StringTableIsAliveCounter : public BoolObjectClosure {
|
||||
BoolObjectClosure* _real_boc;
|
||||
public:
|
||||
size_t _count;
|
||||
size_t _count_total;
|
||||
StringTableIsAliveCounter(BoolObjectClosure* boc) : _real_boc(boc), _count(0),
|
||||
_count_total(0) {}
|
||||
bool do_object_b(oop obj) {
|
||||
bool ret = _real_boc->do_object_b(obj);
|
||||
if (!ret) {
|
||||
++_count;
|
||||
}
|
||||
++_count_total;
|
||||
return ret;
|
||||
}
|
||||
};
|
||||
|
||||
void StringTable::unlink_or_oops_do(BoolObjectClosure* is_alive, OopClosure* f,
|
||||
size_t* processed, size_t* removed) {
|
||||
DoNothingClosure dnc;
|
||||
assert(is_alive != NULL, "No closure");
|
||||
StringTableIsAliveCounter stiac(is_alive);
|
||||
OopClosure* tmp = f != NULL ? f : &dnc;
|
||||
|
||||
StringTable::the_table()->_weak_handles->weak_oops_do(&stiac, tmp);
|
||||
|
||||
// This is the serial case without ParState.
|
||||
// Just set the correct number and check for a cleaning phase.
|
||||
the_table()->_uncleaned_items_count = stiac._count;
|
||||
StringTable::the_table()->check_concurrent_work();
|
||||
|
||||
if (processed != NULL) {
|
||||
*processed = stiac._count_total;
|
||||
}
|
||||
if (removed != NULL) {
|
||||
*removed = stiac._count;
|
||||
}
|
||||
}
|
||||
|
||||
void StringTable::oops_do(OopClosure* f) {
|
||||
assert(f != NULL, "No closure");
|
||||
StringTable::the_table()->_weak_handles->oops_do(f);
|
||||
}
|
||||
|
||||
void StringTable::possibly_parallel_unlink(
|
||||
OopStorage::ParState<false, false>* _par_state_string, BoolObjectClosure* cl,
|
||||
size_t* processed, size_t* removed)
|
||||
{
|
||||
DoNothingClosure dnc;
|
||||
assert(cl != NULL, "No closure");
|
||||
StringTableIsAliveCounter stiac(cl);
|
||||
|
||||
_par_state_string->weak_oops_do(&stiac, &dnc);
|
||||
|
||||
// Accumulate the dead strings.
|
||||
the_table()->add_items_to_clean(stiac._count);
|
||||
|
||||
*processed = stiac._count_total;
|
||||
*removed = stiac._count;
|
||||
}
|
||||
|
||||
void StringTable::possibly_parallel_oops_do(
|
||||
OopStorage::ParState<false /* concurrent */, false /* const */>*
|
||||
_par_state_string, OopClosure* f)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue