13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #include "precompiled.hpp"
26 #include "ci/ciMethod.hpp"
27 #include "ci/ciUtilities.inline.hpp"
28 #include "compiler/abstractCompiler.hpp"
29 #include "compiler/compilerDirectives.hpp"
30 #include "compiler/compilerOracle.hpp"
31 #include "memory/allocation.inline.hpp"
32 #include "memory/resourceArea.hpp"
33
34 CompilerDirectives::CompilerDirectives() : _next(NULL), _match(NULL), _ref_count(0) {
35 _c1_store = new DirectiveSet(this);
36 _c2_store = new DirectiveSet(this);
37 };
38
39 CompilerDirectives::~CompilerDirectives() {
40 if (_c1_store != NULL) {
41 delete _c1_store;
42 }
43 if (_c2_store != NULL) {
44 delete _c2_store;
45 }
46
47 // remove all linked method matchers
48 BasicMatcher* tmp = _match;
49 while (tmp != NULL) {
50 BasicMatcher* next = tmp->next();
51 delete tmp;
52 tmp = next;
382 tmp = tmp->next();
383 }
384 st->cr();
385 }
386 }
387
388 bool DirectiveSet::is_intrinsic_disabled(const methodHandle& method) {
389 vmIntrinsics::ID id = method->intrinsic_id();
390 assert(id != vmIntrinsics::_none, "must be a VM intrinsic");
391
392 ResourceMark rm;
393
394 // Create a copy of the string that contains the list of disabled
395 // intrinsics. The copy is created because the string
396 // will be modified by strtok(). Then, the list is tokenized with
397 // ',' as a separator.
398 size_t length = strlen(DisableIntrinsicOption);
399 char* local_list = NEW_RESOURCE_ARRAY(char, length + 1);
400 strncpy(local_list, DisableIntrinsicOption, length + 1);
401
402 char* token = strtok(local_list, ",");
403 while (token != NULL) {
404 if (strcmp(token, vmIntrinsics::name_at(id)) == 0) {
405 return true;
406 } else {
407 token = strtok(NULL, ",");
408 }
409 }
410
411 return false;
412 }
413
414 DirectiveSet* DirectiveSet::clone(DirectiveSet const* src) {
415 DirectiveSet* set = new DirectiveSet(NULL);
416 memcpy(set->_modified, src->_modified, sizeof(src->_modified));
417
418 InlineMatcher* tmp = src->_inlinematchers;
419 while (tmp != NULL) {
420 set->append_inline(tmp->clone());
421 tmp = tmp->next();
422 }
423
424 #define copy_members_definition(name, type, dvalue, cc_flag) set->name##Option = src->name##Option;
425 compilerdirectives_common_flags(copy_members_definition)
426 compilerdirectives_c2_flags(copy_members_definition)
427 compilerdirectives_c1_flags(copy_members_definition)
|
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #include "precompiled.hpp"
26 #include "ci/ciMethod.hpp"
27 #include "ci/ciUtilities.inline.hpp"
28 #include "compiler/abstractCompiler.hpp"
29 #include "compiler/compilerDirectives.hpp"
30 #include "compiler/compilerOracle.hpp"
31 #include "memory/allocation.inline.hpp"
32 #include "memory/resourceArea.hpp"
33 #include "runtime/os.inline.hpp"
34
35 CompilerDirectives::CompilerDirectives() : _next(NULL), _match(NULL), _ref_count(0) {
36 _c1_store = new DirectiveSet(this);
37 _c2_store = new DirectiveSet(this);
38 };
39
40 CompilerDirectives::~CompilerDirectives() {
41 if (_c1_store != NULL) {
42 delete _c1_store;
43 }
44 if (_c2_store != NULL) {
45 delete _c2_store;
46 }
47
48 // remove all linked method matchers
49 BasicMatcher* tmp = _match;
50 while (tmp != NULL) {
51 BasicMatcher* next = tmp->next();
52 delete tmp;
53 tmp = next;
383 tmp = tmp->next();
384 }
385 st->cr();
386 }
387 }
388
389 bool DirectiveSet::is_intrinsic_disabled(const methodHandle& method) {
390 vmIntrinsics::ID id = method->intrinsic_id();
391 assert(id != vmIntrinsics::_none, "must be a VM intrinsic");
392
393 ResourceMark rm;
394
395 // Create a copy of the string that contains the list of disabled
396 // intrinsics. The copy is created because the string
397 // will be modified by strtok(). Then, the list is tokenized with
398 // ',' as a separator.
399 size_t length = strlen(DisableIntrinsicOption);
400 char* local_list = NEW_RESOURCE_ARRAY(char, length + 1);
401 strncpy(local_list, DisableIntrinsicOption, length + 1);
402
403 char *save_ptr;
404 char* token = os::strtok(local_list, ",", &save_ptr);
405 while (token != NULL) {
406 if (strcmp(token, vmIntrinsics::name_at(id)) == 0) {
407 return true;
408 } else {
409 token = os::strtok(NULL, ",", &save_ptr);
410 }
411 }
412
413 return false;
414 }
415
416 DirectiveSet* DirectiveSet::clone(DirectiveSet const* src) {
417 DirectiveSet* set = new DirectiveSet(NULL);
418 memcpy(set->_modified, src->_modified, sizeof(src->_modified));
419
420 InlineMatcher* tmp = src->_inlinematchers;
421 while (tmp != NULL) {
422 set->append_inline(tmp->clone());
423 tmp = tmp->next();
424 }
425
426 #define copy_members_definition(name, type, dvalue, cc_flag) set->name##Option = src->name##Option;
427 compilerdirectives_common_flags(copy_members_definition)
428 compilerdirectives_c2_flags(copy_members_definition)
429 compilerdirectives_c1_flags(copy_members_definition)
|