aboutsummaryrefslogtreecommitdiff
path: root/src/share/vm/opto/graphKit.cpp
diff options
context:
space:
mode:
authordcubed <none@none>2010-02-01 17:35:05 -0700
committerdcubed <none@none>2010-02-01 17:35:05 -0700
commitdf7cb5f7fa422ddb60bc9f0151665dcbcb74f516 (patch)
tree07aa0cce7f24246ea5485336e68932f6b84716ef /src/share/vm/opto/graphKit.cpp
parentc404404df557087af477099dcdbeb7d5b0761a8d (diff)
6902182: 4/4 Starting with jdwp agent should not incur performance penalty
Summary: Rename can_post_exceptions support to can_post_on_exceptions. Add support for should_post_on_exceptions flag to permit per JavaThread optimizations. Reviewed-by: never, kvn, dcubed Contributed-by: tom.deneau@amd.com
Diffstat (limited to 'src/share/vm/opto/graphKit.cpp')
-rw-r--r--src/share/vm/opto/graphKit.cpp42
1 files changed, 35 insertions, 7 deletions
diff --git a/src/share/vm/opto/graphKit.cpp b/src/share/vm/opto/graphKit.cpp
index 57fea6480..d70fe1eef 100644
--- a/src/share/vm/opto/graphKit.cpp
+++ b/src/share/vm/opto/graphKit.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright 2001-2009 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 2001-2010 Sun Microsystems, Inc. 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
@@ -455,16 +455,44 @@ Bytecodes::Code GraphKit::java_bc() const {
return Bytecodes::_illegal;
}
+void GraphKit::uncommon_trap_if_should_post_on_exceptions(Deoptimization::DeoptReason reason,
+ bool must_throw) {
+ // if the exception capability is set, then we will generate code
+ // to check the JavaThread.should_post_on_exceptions flag to see
+ // if we actually need to report exception events (for this
+ // thread). If we don't need to report exception events, we will
+ // take the normal fast path provided by add_exception_events. If
+ // exception event reporting is enabled for this thread, we will
+ // take the uncommon_trap in the BuildCutout below.
+
+ // first must access the should_post_on_exceptions_flag in this thread's JavaThread
+ Node* jthread = _gvn.transform(new (C, 1) ThreadLocalNode());
+ Node* adr = basic_plus_adr(top(), jthread, in_bytes(JavaThread::should_post_on_exceptions_flag_offset()));
+ Node* should_post_flag = make_load(control(), adr, TypeInt::INT, T_INT, Compile::AliasIdxRaw, false);
+
+ // Test the should_post_on_exceptions_flag vs. 0
+ Node* chk = _gvn.transform( new (C, 3) CmpINode(should_post_flag, intcon(0)) );
+ Node* tst = _gvn.transform( new (C, 2) BoolNode(chk, BoolTest::eq) );
+
+ // Branch to slow_path if should_post_on_exceptions_flag was true
+ { BuildCutout unless(this, tst, PROB_MAX);
+ // Do not try anything fancy if we're notifying the VM on every throw.
+ // Cf. case Bytecodes::_athrow in parse2.cpp.
+ uncommon_trap(reason, Deoptimization::Action_none,
+ (ciKlass*)NULL, (char*)NULL, must_throw);
+ }
+
+}
+
//------------------------------builtin_throw----------------------------------
void GraphKit::builtin_throw(Deoptimization::DeoptReason reason, Node* arg) {
bool must_throw = true;
- if (env()->jvmti_can_post_exceptions()) {
- // Do not try anything fancy if we're notifying the VM on every throw.
- // Cf. case Bytecodes::_athrow in parse2.cpp.
- uncommon_trap(reason, Deoptimization::Action_none,
- (ciKlass*)NULL, (char*)NULL, must_throw);
- return;
+ if (env()->jvmti_can_post_on_exceptions()) {
+ // check if we must post exception events, take uncommon trap if so
+ uncommon_trap_if_should_post_on_exceptions(reason, must_throw);
+ // here if should_post_on_exceptions is false
+ // continue on with the normal codegen
}
// If this particular condition has not yet happened at this