Warn on passing large objects by value

NEW
Assigned to

Status

()

Core
Rewriting and Analysis
--
enhancement
8 years ago
7 years ago

People

(Reporter: Jesse Ruderman, Assigned: Toshiba T R)

Tracking

(Blocks: 1 bug, {perf, student-project})

Trunk
x86
Mac OS X
perf, student-project
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(2 attachments)

(Reporter)

Description

8 years ago
Would be nice to have an analysis to generate warnings like:

"Object of class nsFoo (80 bytes) passed by value. Consider passing by const ref instead."
Keywords: student-project
(Assignee)

Comment 1

7 years ago
I am a student from SJCE, Mysore India and would like to take up this bug.
Assignee: nobody → toshiba.ctr
(Assignee)

Comment 2

7 years ago
Created attachment 442903 [details]
This JS warns if "class" or "struct " objects of size greater than 64 bytes is passed by value.Please look at this and give your opinion.

This is not a patch but just a first cut.
(Assignee)

Comment 3

7 years ago
Created attachment 444146 [details]
This JS warns if "class" or "struct " objects of size greater than 64 bytes is passed by value.
(Assignee)

Comment 4

7 years ago
Comment on attachment 444146 [details]
This JS warns if "class" or "struct " objects of size greater than 64 bytes is passed by value. 

Hi Taras,

Please give feedback.

Regards,
Toshiba

Comment 5

7 years ago
(In reply to comment #4)
> (From update of attachment 444146 [details])
> Hi Taras,
> 
> Please give feedback.
> 
> Regards,
> Toshiba

Upload a list of pass-by-value locations this script finds in mozilla trunk.
(Assignee)

Comment 6

7 years ago
(In reply to comment #5)
> (In reply to comment #4)
> > (From update of attachment 444146 [details] [details])
> > Hi Taras,
> > 
> > Please give feedback.
> > 
> > Regards,
> > Toshiba
> 
> Upload a list of pass-by-value locations this script finds in mozilla trunk.

Is it alright if warnings are generated for files in the tests folder also?
(Assignee)

Comment 7

7 years ago
(In reply to comment #0)
> Would be nice to have an analysis to generate warnings like:
> 
> "Object of class nsFoo (80 bytes) passed by value. Consider passing by const
> ref instead."

May I know how this thought came?
(Reporter)

Updated

7 years ago
Blocks: 5416

Comment 8

7 years ago
(In reply to comment #6)

> Is it alright if warnings are generated for files in the tests folder also?

please filter our irrelevant stuff like tests.

(In reply to comment #7)
> > "Object of class nsFoo (80 bytes) passed by value. Consider passing by const
> > ref instead."
> 
> May I know how this thought came?

I'm not sure what you mean. Point of this analysis is to avoid needless memcpy()ing.
(Assignee)

Comment 9

7 years ago
(In reply to comment #8)
> (In reply to comment #6)
> 
> > Is it alright if warnings are generated for files in the tests folder also?
> 
> please filter our irrelevant stuff like tests.
> 
> (In reply to comment #7)
> > > "Object of class nsFoo (80 bytes) passed by value. Consider passing by const
> > > ref instead."
> > 
> > May I know how this thought came?
> 
> I'm not sure what you mean. Point of this analysis is to avoid needless
> memcpy()ing.

I meant are there  any pass-by-values of size  64 bytes above in mozilla trunk?
I got only few for 36 bytes and 20 bytes and many for 12 bytes and 8 bytes?
You need to log in before you can comment on or make changes to this bug.