comparison src/share/vm/graal/graalVmIds.cpp @ 3634:076542d505cd

Remove the need for a global stub array.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Mon, 14 Nov 2011 22:38:54 +0100
parents 136ea96eb7f8
children
comparison
equal deleted inserted replaced
3633:fc07cf6848fb 3634:076542d505cd
25 #include "graal/graalVmIds.hpp" 25 #include "graal/graalVmIds.hpp"
26 #include "ci/ciUtilities.hpp" 26 #include "ci/ciUtilities.hpp"
27 27
28 // VmIds implementation 28 // VmIds implementation
29 29
30 GrowableArray<address>* VmIds::_stubs = NULL;
31
32
33 void VmIds::initializeObjects() {
34 if (_stubs == NULL) {
35 assert(_localHandles == NULL, "inconsistent state");
36 _stubs = new (ResourceObj::C_HEAP) GrowableArray<address> (64, true);
37 }
38 assert(_localHandles->length() == 0, "invalid state");
39 }
40
41 jlong VmIds::addStub(address stub) { 30 jlong VmIds::addStub(address stub) {
42 assert(!_stubs->contains(stub), "duplicate stub"); 31 return (jlong)stub;
43 return _stubs->append(stub) | STUB;
44 } 32 }
45 33
46 address VmIds::getStub(jlong id) { 34 address VmIds::getStub(jlong id) {
47 assert((id & TYPE_MASK) == STUB, "wrong id type, STUB expected"); 35 return (address)id;
48 assert((id & ~TYPE_MASK) >= 0 && (id & ~TYPE_MASK) < _stubs->length(), "STUB index out of bounds");
49 return _stubs->at(id & ~TYPE_MASK);
50 } 36 }
51 37