Profiling Scalar Replacement
Vladimir Kozlov
vladimir.kozlov at oracle.com
Mon Oct 11 11:06:43 PDT 2010
Chenguang,
I would suggest to build not product VM (optimized or
fastdebug) and run with -XX:+PrintEliminateAllocations flag
to see if you are getting scalar replaced objects.
Add -Xbatch -XX:+PrintCompilation to see in which method you
have replaced objects. Then use
-XX:CompileCommand=print,<class>::<method> to print generated
code for the method to see if your call is generated.
Note: use CallLeafNoFPNode since you don't have java memory
side effects.
Vladimir
ChenGuang Sun wrote:
> Hi,
>
> I'm trying to profile the number of allocations scalarized by
> escape analysis. I modified
> PhaseMacroExpand::process_users_of_allocation like follows:
>
> ...
>
> const TypeFunc *increment_call_type =
> OptoRuntime::increment_alloc_count_Type();
> int size = increment_call_type->domain()->cnt();
> CallNode *call = (CallNode*)new (C,
> increment_call_type->domain()->cnt()) CallLeafNode(
> increment_call_type,
> CAST_FROM_FN_PTR(address, SharedRuntime::increment_alloc_count),
> "increment_alloc_count",
> TypeRawPtr::BOTTOM);
>
> // Set fixed predefined input arguments
> call->init_req( TypeFunc::Control, alloc->in(TypeFunc::Control) );
> call->init_req( TypeFunc::I_O, alloc->in(TypeFunc::I_O) );
> // Narrow memory as only memory input
> call->init_req( TypeFunc::Memory, alloc->in(TypeFunc::Memory));
> call->init_req( TypeFunc::FramePtr, top() /* frameptr() */ );
> call->init_req( TypeFunc::ReturnAdr, top() );
> call->init_req(TypeFunc::Parms+0, transform_later( new (C, 1)
> ThreadLocalNode() ));
> call = (CallNode*)transform_later(call);
> /*
> if (_fallthroughcatchproj != NULL) {
> _igvn.replace_node(_fallthroughcatchproj, alloc->in(TypeFunc::Control));
> }
> if (_memproj_fallthrough != NULL) {
> _igvn.replace_node(_memproj_fallthrough, alloc->in(TypeFunc::Memory));
> }
> */
> if (_fallthroughcatchproj != NULL) {
> _igvn.replace_node(_fallthroughcatchproj, transform_later( new (C,
> 1) ProjNode(call, TypeFunc::Control) ));
> }
> if (_memproj_fallthrough != NULL) {
> _igvn.replace_node(_memproj_fallthrough, transform_later( new (C,
> 1) ProjNode(call, TypeFunc::Memory) ));
> }
> if (_memproj_catchall != NULL) {
> _igvn.replace_node(_memproj_catchall, C->top());
> }
> if (_ioproj_fallthrough != NULL) {
> _igvn.replace_node(_ioproj_fallthrough, transform_later( new (C,
> 1) ProjNode(call, TypeFunc::I_O) ));
> }
> if (_ioproj_catchall != NULL) {
> _igvn.replace_node(_ioproj_catchall, C->top());
> }
> if (_catchallcatchproj != NULL) {
> _igvn.replace_node(_catchallcatchproj, C->top());
> }
>
>
> But the functions corresponding to the CallLeafNode is never called.
> Could any one tell me what's wrong with my modification please?
>
> Thanks,
> Chenguang
More information about the hotspot-compiler-dev
mailing list