public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Storing specified variables in the same memory page!
@ 2004-10-11 15:53 Vinay
  2004-10-11 15:57 ` Sriharsha Vedurmudi
  0 siblings, 1 reply; 11+ messages in thread
From: Vinay @ 2004-10-11 15:53 UTC (permalink / raw)
  To: gcc-help

Hi,

I would like to know if there is any way by which I
can inform the compiler to store certain  variables in
the same memory page. This would really help my
project. If not possible, is there a way to change the
source code of GCC to implement the same.

Thanks,
Vinay

________________________________________________________________________
Yahoo! India Matrimony: Find your life partner online
Go to: http://yahoo.shaadi.com/india-matrimony

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Storing specified variables in the same memory page!
  2004-10-11 15:53 Storing specified variables in the same memory page! Vinay
@ 2004-10-11 15:57 ` Sriharsha Vedurmudi
  2004-10-11 16:08   ` Vinay
  0 siblings, 1 reply; 11+ messages in thread
From: Sriharsha Vedurmudi @ 2004-10-11 15:57 UTC (permalink / raw)
  To: Vinay; +Cc: gcc

Will global/static variables not be stored stored consistantly in one page?

-Harsha

Vinay wrote:

>Hi,
>
>I would like to know if there is any way by which I
>can inform the compiler to store certain  variables in
>the same memory page. This would really help my
>project. If not possible, is there a way to change the
>source code of GCC to implement the same.
>
>Thanks,
>Vinay
>
>________________________________________________________________________
>Yahoo! India Matrimony: Find your life partner online
>Go to: http://yahoo.shaadi.com/india-matrimony
>  
>

-- 
 *****************************
 * Sriharsha Vedurmudi			
 * Software Engineer		
 * 
 * Redpine Signals Inc.	
 * Gate #395, Plot 87,88			
 * Sagar Society, Road #2, 
 * Banjara Hills,		
 * Hyderabad - 500 034			
 * www.redpinesignals.com	
 *							
 * +91-40-23559911  (Office)
 * +91-9849133133   (Mobile)
 *****************************

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Storing specified variables in the same memory page!
  2004-10-11 15:57 ` Sriharsha Vedurmudi
@ 2004-10-11 16:08   ` Vinay
  2004-10-13  8:51     ` energon
  0 siblings, 1 reply; 11+ messages in thread
From: Vinay @ 2004-10-11 16:08 UTC (permalink / raw)
  To: Sriharsha Vedurmudi; +Cc: gcc-help

Hi Harsha,

But the variables I would like to specify can be local
also. I need a way by which I can specify any type of
variable and they must be stored in the same memory
page.

Thanks,
Vinay
 --- Sriharsha Vedurmudi
<sriharsha.v@redpinesignals.com> wrote: 
> Will global/static variables not be stored stored
> consistantly in one page?
> 
> -Harsha
> 
> Vinay wrote:
> 
> >Hi,
> >
> >I would like to know if there is any way by which I
> >can inform the compiler to store certain  variables
> in
> >the same memory page. This would really help my
> >project. If not possible, is there a way to change
> the
> >source code of GCC to implement the same.
> >
> >Thanks,
> >Vinay
> >
>
>________________________________________________________________________
> >Yahoo! India Matrimony: Find your life partner
> online
> >Go to: http://yahoo.shaadi.com/india-matrimony
> >  
> >
> 
> -- 
>  *****************************
>  * Sriharsha Vedurmudi			
>  * Software Engineer		
>  * 
>  * Redpine Signals Inc.	
>  * Gate #395, Plot 87,88			
>  * Sagar Society, Road #2, 
>  * Banjara Hills,		
>  * Hyderabad - 500 034			
>  * www.redpinesignals.com	
>  *							
>  * +91-40-23559911  (Office)
>  * +91-9849133133   (Mobile)
>  *****************************
> 
>  

________________________________________________________________________
Yahoo! India Matrimony: Find your life partner online
Go to: http://yahoo.shaadi.com/india-matrimony

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Storing specified variables in the same memory page!
  2004-10-11 16:08   ` Vinay
@ 2004-10-13  8:51     ` energon
  2004-10-13 18:49       ` (Question reframed)Storing " Vinay
  0 siblings, 1 reply; 11+ messages in thread
From: energon @ 2004-10-13  8:51 UTC (permalink / raw)
  To: gcc-help; +Cc: Vinay, Sriharsha Vedurmudi


Well, you can define a struct with the necessary variable types and
allocate some shared memory and map the struct into the shared memory.

Typically, shared memory is allocated in size of page size chunks.
So, if your data set size does not span the memory page size, you'll
have your data in one page.

Do you need to avoid your data from being paged out of the RAM?


=====
-energon0


		
_______________________________
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: (Question reframed)Storing specified variables in the same memory page!
  2004-10-13  8:51     ` energon
@ 2004-10-13 18:49       ` Vinay
  2004-10-13 18:59         ` Eljay Love-Jensen
  2004-10-14  5:13         ` Sriharsha Vedurmudi
  0 siblings, 2 replies; 11+ messages in thread
From: Vinay @ 2004-10-13 18:49 UTC (permalink / raw)
  To: gcc-help

Hello all,

Thank you very much for all your replies. But the
project requirements are different. The problem is as
follows.

A main program shall be running. An user source
program is given as input to the main program. Along
with the source program, some variables present in the
source program shall also be specified. From the main
program, I need to inform the compiler to allocate
successive memory locations for these variables so
that they reside on the same memory page. 

The main program is not allowed to change the type of
the variables.

Please give suggestions.

Thanks,
Vinay
--- energon <energon0@yahoo.com> wrote: 
> 
> Well, you can define a struct with the necessary
> variable types and
> allocate some shared memory and map the struct into
> the shared memory.
> 
> Typically, shared memory is allocated in size of
> page size chunks.
> So, if your data set size does not span the memory
> page size, you'll
> have your data in one page.
> 
> Do you need to avoid your data from being paged out
> of the RAM?
> 
> 
> =====
> -energon0
> 
> 
> 		
> _______________________________
> Do you Yahoo!?
> Declare Yourself - Register online to vote today!
> http://vote.yahoo.com
>  

________________________________________________________________________
Yahoo! India Matrimony: Find your life partner online
Go to: http://yahoo.shaadi.com/india-matrimony

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: (Question reframed)Storing specified variables in the same  memory page!
  2004-10-13 18:49       ` (Question reframed)Storing " Vinay
@ 2004-10-13 18:59         ` Eljay Love-Jensen
  2004-10-14  5:13         ` Sriharsha Vedurmudi
  1 sibling, 0 replies; 11+ messages in thread
From: Eljay Love-Jensen @ 2004-10-13 18:59 UTC (permalink / raw)
  To: Vinay, gcc-help

Hi Vinay,

Before worrying about this memory optimization, first get the program to 
work the normal way.

Then, after the program is working, try to optimize the variable placement 
by allocating a chunk of memory.  Put the variables in that allocated 
memory chunk.

HTH,
--Eljay

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: (Question reframed)Storing specified variables in the same memory page!
  2004-10-13 18:49       ` (Question reframed)Storing " Vinay
  2004-10-13 18:59         ` Eljay Love-Jensen
@ 2004-10-14  5:13         ` Sriharsha Vedurmudi
  2004-10-15 13:29           ` energon
  1 sibling, 1 reply; 11+ messages in thread
From: Sriharsha Vedurmudi @ 2004-10-14  5:13 UTC (permalink / raw)
  To: Vinay; +Cc: gcc

Hi Vinay,
    is your aim something like an intelligent program editor where-in 
you write a program and execute the 'compile' option in the editor. Here 
the editor picks up the source program and passes it on to the compiler 
for compilation. The extra functionality you need is that some of the 
variables that are explicitly specified should be allocated in 
contiguous/successive memory locations? Is it?

    Well, I am not aware of any such options for gcc atleast, but I feel 
that such things are to be taken care in the source program itself. 
Encapsulate them in a structure, as suggested earlier.

    Still I wonder why you would want them on a same memory page? Is it 
purely for speed optimization?

Regards,
Harsha.

Vinay wrote:

>Hello all,
>
>Thank you very much for all your replies. But the
>project requirements are different. The problem is as
>follows.
>
>A main program shall be running. An user source
>program is given as input to the main program. Along
>with the source program, some variables present in the
>source program shall also be specified. From the main
>program, I need to inform the compiler to allocate
>successive memory locations for these variables so
>that they reside on the same memory page. 
>
>The main program is not allowed to change the type of
>the variables.
>
>Please give suggestions.
>
>Thanks,
>Vinay
>--- energon <energon0@yahoo.com> wrote: 
>  
>
>>Well, you can define a struct with the necessary
>>variable types and
>>allocate some shared memory and map the struct into
>>the shared memory.
>>
>>Typically, shared memory is allocated in size of
>>page size chunks.
>>So, if your data set size does not span the memory
>>page size, you'll
>>have your data in one page.
>>
>>Do you need to avoid your data from being paged out
>>of the RAM?
>>
>>
>>=====
>>-energon0
>>
>>
>>		
>>_______________________________
>>Do you Yahoo!?
>>Declare Yourself - Register online to vote today!
>>http://vote.yahoo.com
>> 
>>    
>>
>
>________________________________________________________________________
>Yahoo! India Matrimony: Find your life partner online
>Go to: http://yahoo.shaadi.com/india-matrimony
>  
>

-- 
 *****************************
 * Sriharsha Vedurmudi			
 * Software Engineer		
 * 
 * Redpine Signals Inc.	
 * Gate #395, Plot 87,88			
 * Sagar Society, Road #2, 
 * Banjara Hills,		
 * Hyderabad - 500 034			
 * www.redpinesignals.com	
 *							
 * +91-40-23559911  (Office)
 * +91-9849133133   (Mobile)
 *****************************

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: (Question reframed)Storing specified variables in the same memory page!
  2004-10-14  5:13         ` Sriharsha Vedurmudi
@ 2004-10-15 13:29           ` energon
  0 siblings, 0 replies; 11+ messages in thread
From: energon @ 2004-10-15 13:29 UTC (permalink / raw)
  To: Sriharsha Vedurmudi; +Cc: gcc-help


1. or maybe, tag your variables with a specific tag,

2. a. then write a filter program to generate code with
      a struct getting populated with the specially tagged
      variables as members
   b. then map accesses to the tagged  variables as members
      of the struct
   c. the memory for the struct could be on the stack or the
      heap, and the code generated appropriately

3. then pass this generated code to the actual GCC


=====
-energon0


		
_______________________________
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com

^ permalink raw reply	[flat|nested] 11+ messages in thread

* RE: Storing specified variables in the same memory page!
  2004-10-11 18:27 ` Virender Kashyap
@ 2004-10-11 18:31   ` Eljay Love-Jensen
  0 siblings, 0 replies; 11+ messages in thread
From: Eljay Love-Jensen @ 2004-10-11 18:31 UTC (permalink / raw)
  To: Virender Kashyap, lrtaylor; +Cc: vinaymr_02, sriharsha.v, GCC HELP

Hi Virender,

Put all those global variables in a struct, to give them a contained locality.

--Eljay

^ permalink raw reply	[flat|nested] 11+ messages in thread

* RE: Storing specified variables in the same memory page!
  2004-10-11 16:17 Storing " lrtaylor
@ 2004-10-11 18:27 ` Virender Kashyap
  2004-10-11 18:31   ` Eljay Love-Jensen
  0 siblings, 1 reply; 11+ messages in thread
From: Virender Kashyap @ 2004-10-11 18:27 UTC (permalink / raw)
  To: lrtaylor; +Cc: vinaymr_02, sriharsha.v, GCC HELP

global variables are store in data area rather than on stack .

On Mon, 11 Oct 2004 lrtaylor@micron.com wrote:

> Aren't local, non-static variables always stored on the stack?  It
> wouldn't make sense to me to put them anywhere else...
>
> Thanks,
> Lyle
>
>
> -----Original Message-----
> From: gcc-help-owner@gcc.gnu.org [mailto:gcc-help-owner@gcc.gnu.org] On
> Behalf Of Vinay
> Sent: Monday, October 11, 2004 10:03 AM
> To: Sriharsha Vedurmudi
> Cc: gcc-help@gcc.gnu.org
> Subject: Re: Storing specified variables in the same memory page!
>
> Hi Harsha,
>
> But the variables I would like to specify can be local
> also. I need a way by which I can specify any type of
> variable and they must be stored in the same memory
> page.
>
> Thanks,
> Vinay
> --- Sriharsha Vedurmudi
> <sriharsha.v@redpinesignals.com> wrote:
>> Will global/static variables not be stored stored
>> consistantly in one page?
>>
>> -Harsha
>>
>> Vinay wrote:
>>
>>> Hi,
>>>
>>> I would like to know if there is any way by which I
>>> can inform the compiler to store certain  variables
>> in
>>> the same memory page. This would really help my
>>> project. If not possible, is there a way to change
>> the
>>> source code of GCC to implement the same.
>>>
>>> Thanks,
>>> Vinay
>>>
>>
>> _______________________________________________________________________
> _
>>> Yahoo! India Matrimony: Find your life partner
>> online
>>> Go to: http://yahoo.shaadi.com/india-matrimony
>>>
>>>
>>
>> --
>>  *****************************
>>  * Sriharsha Vedurmudi
>>  * Software Engineer
>>  *
>>  * Redpine Signals Inc.
>>  * Gate #395, Plot 87,88
>>  * Sagar Society, Road #2,
>>  * Banjara Hills,
>>  * Hyderabad - 500 034
>>  * www.redpinesignals.com
>>  *
>>  * +91-40-23559911  (Office)
>>  * +91-9849133133   (Mobile)
>>  *****************************
>>
>>
>
> ________________________________________________________________________
> Yahoo! India Matrimony: Find your life partner online
> Go to: http://yahoo.shaadi.com/india-matrimony
>

-- 
Regards.
Virender
----------------------------------------------
Virender Kashyap
Senior Undergraduate Student
Roll No 00d05011
ADD:
Room 182 ,Hostel 2
IIT Bombay ,Powaii
Mumbai -400076
Homepage: www.cse.iitb.ac.in/~virenk
Email : viren16@rediffmail.com

^ permalink raw reply	[flat|nested] 11+ messages in thread

* RE: Storing specified variables in the same memory page!
@ 2004-10-11 16:17 lrtaylor
  2004-10-11 18:27 ` Virender Kashyap
  0 siblings, 1 reply; 11+ messages in thread
From: lrtaylor @ 2004-10-11 16:17 UTC (permalink / raw)
  To: vinaymr_02, sriharsha.v; +Cc: gcc-help

Aren't local, non-static variables always stored on the stack?  It
wouldn't make sense to me to put them anywhere else...

Thanks,
Lyle


-----Original Message-----
From: gcc-help-owner@gcc.gnu.org [mailto:gcc-help-owner@gcc.gnu.org] On
Behalf Of Vinay
Sent: Monday, October 11, 2004 10:03 AM
To: Sriharsha Vedurmudi
Cc: gcc-help@gcc.gnu.org
Subject: Re: Storing specified variables in the same memory page!

Hi Harsha,

But the variables I would like to specify can be local
also. I need a way by which I can specify any type of
variable and they must be stored in the same memory
page.

Thanks,
Vinay
 --- Sriharsha Vedurmudi
<sriharsha.v@redpinesignals.com> wrote: 
> Will global/static variables not be stored stored
> consistantly in one page?
> 
> -Harsha
> 
> Vinay wrote:
> 
> >Hi,
> >
> >I would like to know if there is any way by which I
> >can inform the compiler to store certain  variables
> in
> >the same memory page. This would really help my
> >project. If not possible, is there a way to change
> the
> >source code of GCC to implement the same.
> >
> >Thanks,
> >Vinay
> >
>
>_______________________________________________________________________
_
> >Yahoo! India Matrimony: Find your life partner
> online
> >Go to: http://yahoo.shaadi.com/india-matrimony
> >  
> >
> 
> -- 
>  *****************************
>  * Sriharsha Vedurmudi			
>  * Software Engineer		
>  * 
>  * Redpine Signals Inc.	
>  * Gate #395, Plot 87,88			
>  * Sagar Society, Road #2, 
>  * Banjara Hills,		
>  * Hyderabad - 500 034			
>  * www.redpinesignals.com	
>  *							
>  * +91-40-23559911  (Office)
>  * +91-9849133133   (Mobile)
>  *****************************
> 
>  

________________________________________________________________________
Yahoo! India Matrimony: Find your life partner online
Go to: http://yahoo.shaadi.com/india-matrimony

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2004-10-15 13:29 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-11 15:53 Storing specified variables in the same memory page! Vinay
2004-10-11 15:57 ` Sriharsha Vedurmudi
2004-10-11 16:08   ` Vinay
2004-10-13  8:51     ` energon
2004-10-13 18:49       ` (Question reframed)Storing " Vinay
2004-10-13 18:59         ` Eljay Love-Jensen
2004-10-14  5:13         ` Sriharsha Vedurmudi
2004-10-15 13:29           ` energon
2004-10-11 16:17 Storing " lrtaylor
2004-10-11 18:27 ` Virender Kashyap
2004-10-11 18:31   ` Eljay Love-Jensen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).