本文整理汇总了C++中GrowableArray::append方法的典型用法代码示例。如果您正苦于以下问题:C++ GrowableArray::append方法的具体用法?C++ GrowableArray::append怎么用?C++ GrowableArray::append使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GrowableArray
的用法示例。
在下文中一共展示了GrowableArray::append方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: generate_exception_handler_table
void Compilation::generate_exception_handler_table() {
// Generate an ExceptionHandlerTable from the exception handler
// information accumulated during the compilation.
ExceptionInfoList* info_list = exception_info_list();
if (info_list->length() == 0) {
return;
}
// allocate some arrays for use by the collection code.
const int num_handlers = 5;
GrowableArray<intptr_t>* bcis = new GrowableArray<intptr_t>(num_handlers);
GrowableArray<intptr_t>* scope_depths = new GrowableArray<intptr_t>(num_handlers);
GrowableArray<intptr_t>* pcos = new GrowableArray<intptr_t>(num_handlers);
for (int i = 0; i < info_list->length(); i++) {
ExceptionInfo* info = info_list->at(i);
XHandlers* handlers = info->exception_handlers();
// empty the arrays
bcis->trunc_to(0);
scope_depths->trunc_to(0);
pcos->trunc_to(0);
for (int i = 0; i < handlers->length(); i++) {
XHandler* handler = handlers->handler_at(i);
assert(handler->entry_pco() != -1, "must have been generated");
int e = bcis->find(handler->handler_bci());
if (e >= 0 && scope_depths->at(e) == handler->scope_count()) {
// two different handlers are declared to dispatch to the same
// catch bci. During parsing we created edges for each
// handler but we really only need one. The exception handler
// table will also get unhappy if we try to declare both since
// it's nonsensical. Just skip this handler.
continue;
}
bcis->append(handler->handler_bci());
if (handler->handler_bci() == -1) {
// insert a wildcard handler at scope depth 0 so that the
// exception lookup logic with find it.
scope_depths->append(0);
} else {
scope_depths->append(handler->scope_count());
}
pcos->append(handler->entry_pco());
// stop processing once we hit a catch any
if (handler->is_catch_all()) {
assert(i == handlers->length() - 1, "catch all must be last handler");
}
}
exception_handler_table()->add_subtable(info->pco(), bcis, scope_depths, pcos);
}
}
示例2: collect
void CodeBlobCollector::collect() {
assert_locked_or_safepoint(CodeCache_lock);
assert(_global_code_blobs == NULL, "checking");
// create the global list
_global_code_blobs = new (ResourceObj::C_HEAP, mtInternal) GrowableArray<JvmtiCodeBlobDesc*>(50,true);
// iterate over the stub code descriptors and put them in the list first.
for (StubCodeDesc* desc = StubCodeDesc::first(); desc != NULL; desc = StubCodeDesc::next(desc)) {
_global_code_blobs->append(new JvmtiCodeBlobDesc(desc->name(), desc->begin(), desc->end()));
}
// Vtable stubs are not described with StubCodeDesc,
// process them separately
VtableStubs::vtable_stub_do(do_vtable_stub);
// next iterate over all the non-nmethod code blobs and add them to
// the list - as noted above this will filter out duplicates and
// enclosing blobs.
CodeCache::blobs_do(do_blob);
// make the global list the instance list so that it can be used
// for other iterations.
_code_blobs = _global_code_blobs;
_global_code_blobs = NULL;
}
示例3: while
static GrowableArray<HistoEntry*>* sorted_array(int* array, int length) {
GrowableArray<HistoEntry*>* a = new GrowableArray<HistoEntry*>(length);
int i = length;
while (i-- > 0) a->append(new HistoEntry(i, array[i]));
a->sort(HistoEntry::compare);
return a;
}
示例4: assert
GrowableArray<MonitorInfo*>* javaVFrame::locked_monitors() {
assert(SafepointSynchronize::is_at_safepoint() || JavaThread::current() == thread(),
"must be at safepoint or it's a java frame of the current thread");
GrowableArray<MonitorInfo*>* mons = monitors();
GrowableArray<MonitorInfo*>* result = new GrowableArray<MonitorInfo*>(mons->length());
if (mons->is_empty()) return result;
bool found_first_monitor = false;
ObjectMonitor *pending_monitor = thread()->current_pending_monitor();
ObjectMonitor *waiting_monitor = thread()->current_waiting_monitor();
oop pending_obj = (pending_monitor != NULL ? (oop) pending_monitor->object() : (oop) NULL);
oop waiting_obj = (waiting_monitor != NULL ? (oop) waiting_monitor->object() : (oop) NULL);
for (int index = (mons->length()-1); index >= 0; index--) {
MonitorInfo* monitor = mons->at(index);
if (monitor->eliminated() && is_compiled_frame()) continue; // skip eliminated monitor
oop obj = monitor->owner();
if (obj == NULL) continue; // skip unowned monitor
//
// Skip the monitor that the thread is blocked to enter or waiting on
//
if (!found_first_monitor && (obj == pending_obj || obj == waiting_obj)) {
continue;
}
found_first_monitor = true;
result->append(monitor);
}
return result;
}
示例5: do_blob
void CodeBlobCollector::do_blob(CodeBlob* cb) {
// ignore nmethods
if (cb->is_nmethod()) {
return;
}
// exclude VtableStubs, which are processed separately
if (cb->is_buffer_blob() && strcmp(cb->name(), "vtable chunks") == 0) {
return;
}
// check if this starting address has been seen already - the
// assumption is that stubs are inserted into the list before the
// enclosing BufferBlobs.
address addr = cb->code_begin();
for (int i=0; i<_global_code_blobs->length(); i++) {
JvmtiCodeBlobDesc* scb = _global_code_blobs->at(i);
if (addr == scb->code_begin()) {
return;
}
}
// record the CodeBlob details as a JvmtiCodeBlobDesc
JvmtiCodeBlobDesc* scb = new JvmtiCodeBlobDesc(cb->name(), cb->code_begin(), cb->code_end());
_global_code_blobs->append(scb);
}
示例6: rm
// Returns MonitorInfos for all objects locked on this thread in youngest to oldest order
static GrowableArray<MonitorInfo*>* get_or_compute_monitor_info(JavaThread* thread) {
GrowableArray<MonitorInfo*>* info = thread->cached_monitor_info();
if (info != NULL) {
return info;
}
info = new GrowableArray<MonitorInfo*>();
// It's possible for the thread to not have any Java frames on it,
// i.e., if it's the main thread and it's already returned from main()
if (thread->has_last_Java_frame()) {
RegisterMap rm(thread);
for (javaVFrame* vf = thread->last_java_vframe(&rm); vf != NULL; vf = vf->java_sender()) {
GrowableArray<MonitorInfo*> *monitors = vf->monitors();
if (monitors != NULL) {
int len = monitors->length();
// Walk monitors youngest to oldest
for (int i = len - 1; i >= 0; i--) {
MonitorInfo* mon_info = monitors->at(i);
if (mon_info->eliminated()) continue;
oop owner = mon_info->owner();
if (owner != NULL) {
info->append(mon_info);
}
}
}
}
}
thread->set_cached_monitor_info(info);
return info;
}
示例7: Thread
Thread(HANDLE handle, int id, void* stackLimit) : thread_handle(handle), thread_id(id), stack_limit(stackLimit) {
int index = threads->find(NULL, equals);
if (index < 0)
threads->append(this);
else
threads->at_put(index, this);
}
示例8: collect
void CodeBlobCollector::collect() {
assert_locked_or_safepoint(CodeCache_lock);
assert(_global_code_blobs == NULL, "checking");
// create the global list
_global_code_blobs = new (ResourceObj::C_HEAP) GrowableArray<JvmtiCodeBlobDesc*>(50,true);
// iterate over the stub code descriptors and put them in the list first.
int index = 0;
StubCodeDesc* desc;
while ((desc = StubCodeDesc::desc_for_index(++index)) != NULL) {
_global_code_blobs->append(new JvmtiCodeBlobDesc(desc->name(), desc->begin(), desc->end()));
}
// next iterate over all the non-nmethod code blobs and add them to
// the list - as noted above this will filter out duplicates and
// enclosing blobs.
Unimplemented();
//CodeCache::blobs_do(do_blob);
// make the global list the instance list so that it can be used
// for other iterations.
_code_blobs = _global_code_blobs;
_global_code_blobs = NULL;
}
示例9: iterator
GrowableArray<klassOop>* IC::receiver_klasses() const {
GrowableArray<klassOop>* result = new GrowableArray<klassOop>();
IC_Iterator* it = iterator();
it->init_iteration();
while (!it->at_end()) {
result->append(it->klass());
it->advance();
}
return result;
}
示例10: add_loaded_class
static void add_loaded_class(klassOop k) {
// FIXME: For now - don't include array klasses
// The spec is unclear at this point to count array klasses or not
// and also indirect creation of array of super class and secondaries
//
// for (klassOop l = k; l != NULL; l = Klass::cast(l)->array_klass_or_null()) {
// KlassHandle h(_current_thread, l);
// _loaded_classes->append(h);
// }
KlassHandle h(_current_thread, k);
_loaded_classes->append(h);
}
示例11: add_to_worklist
// Put node on worklist if it is (or was) not there.
inline void add_to_worklist(PointsToNode* pt) {
PointsToNode* ptf = pt;
uint pidx_bias = 0;
if (PointsToNode::is_base_use(pt)) {
// Create a separate entry in _in_worklist for a marked base edge
// because _worklist may have an entry for a normal edge pointing
// to the same node. To separate them use _next_pidx as bias.
ptf = PointsToNode::get_use_node(pt)->as_Field();
pidx_bias = _next_pidx;
}
if (!_in_worklist.test_set(ptf->pidx() + pidx_bias)) {
_worklist.append(pt);
}
}
示例12: do_blob
void CodeBlobCollector::do_blob(CodeBlob* cb) {
// ignore nmethods
if (cb->is_nmethod()) {
return;
}
// check if this starting address has been seen already - the
// assumption is that stubs are inserted into the list before the
// enclosing BufferBlobs.
address addr = cb->instructions_begin();
for (int i=0; i<_global_code_blobs->length(); i++) {
JvmtiCodeBlobDesc* scb = _global_code_blobs->at(i);
if (addr == scb->code_begin()) {
return;
}
}
// we must name the CodeBlob - some CodeBlobs already have names :-
// - stubs used by compiled code to call a (static) C++ runtime routine
// - non-relocatable machine code such as the interpreter, stubroutines, etc.
// - various singleton blobs
//
// others are unnamed so we create a name :-
// - OSR adapter (interpreter frame that has been on-stack replaced)
// - I2C and C2I adapters
const char* name = NULL;
if (cb->is_runtime_stub()) {
name = ((RuntimeStub*)cb)->name();
}
if (cb->is_buffer_blob()) {
name = ((BufferBlob*)cb)->name();
}
if (cb->is_deoptimization_stub() || cb->is_safepoint_stub()) {
name = ((SingletonBlob*)cb)->name();
}
if (cb->is_uncommon_trap_stub() || cb->is_exception_stub()) {
name = ((SingletonBlob*)cb)->name();
}
// record the CodeBlob details as a JvmtiCodeBlobDesc
JvmtiCodeBlobDesc* scb = new JvmtiCodeBlobDesc(name, cb->instructions_begin(),
cb->instructions_end());
_global_code_blobs->append(scb);
}
示例13: hoistTypeTests
void CompiledLoop::hoistTypeTests() {
// collect all type tests that can be hoisted out of the loop
_loopHeader->_tests = _hoistableTests = new GrowableArray<HoistedTypeTest*>(10);
TTHoister tth(this, _hoistableTests);
_scope->subScopesDo(&tth);
// add type tests to loop header for testing (avoid duplicates)
// (currently quadratic algorithm but there should be very few)
GrowableArray<HoistedTypeTest*>* headerTests = new GrowableArray<HoistedTypeTest*>(_hoistableTests->length());
for (int i = _hoistableTests->length() - 1; i >= 0; i--) {
HoistedTypeTest* t = _hoistableTests->at(i);
PReg* tested = t->testedPR;
for (int j = headerTests->length() - 1; j >= 0; j--) {
if (headerTests->at(j)->testedPR == tested) {
// already testing this PReg
if (isEquivalentType(headerTests->at(j)->klasses, t->klasses)) {
// nothing to do
} else {
// Whoa! The same PReg is tested for different types in different places.
// Possible but rare.
headerTests->at(j)->invalid = t->invalid = true;
if (WizardMode) {
compiler_warning("CompiledLoop::hoistTypeTests: PReg tested for different types\n");
t->print();
headerTests->at(j)->print();
}
}
tested = NULL; // don't add it to list
break;
}
}
if (tested) headerTests->append(t);
}
// now delete all hoisted type tests from loop body
for (i = _hoistableTests->length() - 1; i >= 0; i--) {
HoistedTypeTest* t = _hoistableTests->at(i);
if (!t->invalid) {
t->node->assert_preg_type(t->testedPR, t->klasses, _loopHeader);
}
}
if (!_loopHeader->isActivated()) _loopHeader->activate();
}
示例14: do_nmethod
void nmethodCollector::do_nmethod(nmethod* nm) {
// ignore zombies
if (!nm->is_alive()) {
return;
}
assert(nm->method() != NULL, "checking");
// create the location map for the nmethod.
jvmtiAddrLocationMap* map;
jint map_length;
JvmtiCodeBlobEvents::build_jvmti_addr_location_map(nm, &map, &map_length);
// record the nmethod details
methodHandle mh(nm->method());
nmethodDesc* snm = new nmethodDesc(mh,
nm->code_begin(),
nm->code_end(),
map,
map_length);
_global_nmethods->append(snm);
}
示例15: do_blob
void CodeBlobCollector::do_blob(CodeBlob* cb) {
if(cb->is_methodCode()){
return;
}
// check if this starting address has been seen already - the
// assumption is that stubs are inserted into the list before the
// enclosing BufferBlobs.
address addr=cb->code_begins();
for (int i=0; i<_global_code_blobs->length(); i++) {
JvmtiCodeBlobDesc* scb = _global_code_blobs->at(i);
if (addr == scb->code_begin()) {
return;
}
}
// we must name the CodeBlob - some CodeBlobs already have names :-
// - stubs used by compiled code to call a (static) C++ runtime routine
// - non-relocatable machine code such as the interpreter, stubroutines, etc.
// - various singleton blobs
//
// others are unnamed so we create a name :-
// - OSR adapter (interpreter frame that has been on-stack replaced)
// - I2C and C2I adapters
//
// CodeBlob::name() should return any defined name string, first.
const char* name = cb->methodname(); // returns NULL or methodname+signature
if (! name ) {
name = cb->name(); // returns generic name...
} else {
ShouldNotReachHere();
}
// record the CodeBlob details as a JvmtiCodeBlobDesc
JvmtiCodeBlobDesc*scb=new JvmtiCodeBlobDesc(name,cb->code_begins(),
cb->code_ends());
_global_code_blobs->append(scb);
}