intrinsic that makes runtime choice whether to revert to java
Deneau, Tom
tom.deneau at amd.com
Fri Jul 6 15:05:22 PDT 2012
As a result in ParseGenerator::generate() when we create the parser from
Parse parser(jvms, method(), _expected_uses);
the line in the Parse::Parse contructor
merge_common(entry_block, entry_block->next_path_num());
inside merge_common, when we get to
// Make a region if we know there are multiple or unpredictable inputs.
// (Also, if this is a plain fall-through, we might see another region,
// which must not be allowed into this block's map.)
if (pnum > PhiNode::Input // Known multiple inputs.
|| target->is_handler() // These have unpredictable inputs.
|| target->is_loop_head() // Known multiple inputs
|| control()->is_Region()) { // We must hide this guy.
we die since control() returns (Node *) NULL
-- Tom
-----Original Message-----
From: Deneau, Tom
Sent: Friday, July 06, 2012 4:01 PM
To: 'Vladimir Kozlov'
Cc: hotspot-compiler-dev at openjdk.java.net
Subject: RE: intrinsic that makes runtime choice whether to revert to java
Vladimir --
Having gotten past the gen_instanceof problem, I am now hitting
the following which I don't understand:
I have copied the template you provided in your webrev shown below, but when
I call generate_guard, I am hitting the following exit condition. Any suggestions?
// Build an if node and its projections.
// If test is true we take the slow path, which we assume is uncommon.
if (_gvn.type(test) == TypeInt::ZERO) {
// The slow branch is never taken. No need to build this guard.
return NULL;
}
-- Tom
+ _sp += nargs; // gen_instanceof might do an uncommon trap
+ Node* inst = gen_instanceof(val, makecon(TypeKlassPtr::make(klass)));
+ _sp -= nargs;
+ Node* cmp = _gvn.transform(new (C, 3) CmpINode(inst, intcon(1)));
+ Node* bol = _gvn.transform(new (C, 2) BoolNode(cmp, BoolTest::ne));
+
+ Node* inst_false = generate_guard(bol, NULL, PROB_MIN);
+ //instanceOf == true, fallthrough
+
+ return inst_false;
a SEGV when PredictedIntrinsicGenerator::generate() has called
Node* slow_ctl = _intrinsic->generate_predicate(kit.sync_jvms());
-----Original Message-----
From: Vladimir Kozlov [mailto:vladimir.kozlov at oracle.com]
Sent: Monday, July 02, 2012 9:57 PM
To: Deneau, Tom
Cc: hotspot-compiler-dev at openjdk.java.net
Subject: Re: intrinsic that makes runtime choice whether to revert to java
I finally had time today to look on this. Here is code:
http://cr.openjdk.java.net/~kvn/pred_intr/webrev
But I did not test or optimize it (part of new code in callGenerator.cpp should
be shared with PredictedCallGenerator from which it was cloned).
Vladimir
Deneau, Tom wrote:
> Hi all --
>
> I am writing a hotspot intrinsic but I want it to make a runtime
> choice whether to execute the intrinsic code or to execute the regular
> java code.
>
> I got the suggestion below from Vladimir but I am not experienced
> enough with the graphkit functionality to see how to do this. Would
> someone be able to provide the code skeleton for this? I can generate
> the region to actually do my intrinsic and I believe I can generate the
> BoolNode which determines which path to take.
>
> The other choice would be to modify the actual JDK library routine to
> do the runtime tests and call a new routine which the intrinsic would
> hook into. I have done this for testing but I am assuming this is more
> intrusive since on some architectures the intrinsic will not even be generated.
>
> -- Tom Deneau
>
>> We don't have such mechanism currently. But it is not difficult to implement.
>> Look on the code in doCall.cpp and callGenerator files. Instead of calling
>> find_intrinsic() you need to do something special for your case. Like code for
>> CallGenerator::for_method_handle_call() where you will generate class check and
>> on one path you will get intrinsic (by calling find_intrinsic()) and on other
>> path is regular CallGenerator::for_inline().
>
>
More information about the hotspot-compiler-dev
mailing list