This presentation is the property of its rightful owner.
Sponsored Links
1 / 84

به نام خدا PowerPoint PPT Presentation


  • 55 Views
  • Uploaded on
  • Presentation posted in: General

به نام خدا. فصل نهم کنترل زیربرنامه. استاد مربوطه: استاد بیدکی. رویا ادراکی فاطمه مصلحی. فهرست. مفاهیم زیربرنامه ها و تعاریف اولیه زبربرنامه ساده فراخوانی –برگشت زیربرنامه های بازگشتی صفات کنترل داده حوزه ایستا و پویا وابستگی ها و محیط های ارجاع مفاهیم اصلی کنترل داده

Download Presentation

به نام خدا

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


6086128

:


6086128


6086128

.

.

.


6086128

: .

:1. . 2. . 3.

. 4. . 5.

.

-


6086128

1. : : . : A B B A .

.


6086128

2. : .

  • 3.

    .

.

.


6086128

4. : .

  • 5. :

    .

.


6086128

:

:

.

:

.

:

.


6086128

: : .: ... : .

1. : . :

2. : .

.

.

.

.


6086128

((CIP

  • .

.

((CEP


6086128

* CEP CIP .

* .

:

X X .


6086128

  • CEP CIP .

CEP CIP

CEP CIP . .

: (CIPCEP)


6086128

  • 295


6086128

  • .

  • ( )

  • CEP .

.


6086128

(-)

  • - .

  • CIP ( ) .

.


6086128

-

  • 296


6086128

:

  • .

  • .

  • .

.


6086128

  • 298


6086128

: A . : CEPCIP . CEPCIP retutrn pop .


6086128

.

: B,A A B B A .

.

:

Procedure A( ( ;forward;


6086128

:( )

anomly .

S 2 3 forward .

Program anomaly;

procedure S; {1}

begin {of S}

end; {of S}

procedure T;

{missing procedure S; forward; here}

procedure U;

begin {of U}

S; {2}

end; {of U}

procedure S; {3}

begin {of S}

end; {of S}

begin {of T}

U;

end; {of T}

begin {of anomaly


6086128

. :

1- .

2- .

3- .


6086128

:

X:=y+2*Z . :y

1- y . y ( ).2- y .3- y .


6086128

.

  • .

  • .

  • ( )


6086128

:

1- : . : ) . ) : 2*Z x:=y+2*Z y .

2- : .

.


6086128

: ...

: .

:A A A[3] .

.

:1- 2- 3-


6086128

  • () .

  • .

  • ( )

:

: () .

:

.

.

:

A:=B+fun(C) . A,B,C fun .


6086128

. : 1- 2- 3- 4- 5-


6086128

  • .

  • .

  • :

  • 1- 2-

  • 3- 4-

( ) .


6086128

.

: ...

.: fg f G .


6086128

.

*** .

. .: .


6086128

( )

.

.

.

  • .

  • ( ).


6086128

  • :

.

.

APL .

: ( )


6086128

.

.

.

: .


6086128

. . . :

Ref_op: id* refrencing_environmentdata_object or subprogram


6086128

  • .

Program main(output);

Var I : integer;

Procedure sub1(var J: integer);

begin

{ I and J refer to same }

end; { data object here }

Procedure sub2;

var I : integer;

begin

sub1(I); { I is visible, J is not}

end;

Begin

Sub2{I is visible, J is not}

End.

(b) I and J are aliased in sub1

Program main(output)

Procedure sub1(var J : Iinteger)

begin

{J is visible , I not }

end;

Procedure sub2;

var I : integer;

sub1(I);{I is visible , J is not }

end;

begin

sub2{ neither is visible }

end.

(a) NO aliasing


6086128

  • .

X := A + B ;

Y := C + D ;

:

X,Y .

X,C .

  • .


6086128

  • .

  • .

  • ( ) .

  • .


6086128

  • :

1. . ( ) .

2. .

3. .

4. . .

: Procedure p ( A : real )

  • P .

  • A p

  • P A .


6086128

.

  • :

  • K l m n .


6086128

  • ( ) .

  • .

  • .

:

  • 2.

: x .

: X .


6086128

:

.

Procedure R;

End;

Procedure Q;

Var X : integer := 30;

Begin

write(X);

R;

X := X + 1;

write(X);

End;

Procedure P;

Q;

End;

x 31 .

x Q30 .

  • C 4 APL

  • PL/I


6086128

  • .

  • .


6086128

  • :

  • .

  • sub .

  • ( ) .


6086128

  • :

  • sub sub .

  • sub .( .)

  • sub Y Y Y CEP .


6086128

:

1. ( ) .

  • .

  • static

  • automatic

2. :

3. .

4.

. .


6086128

:

  • .

  • .

  • .

  • .

  • .


6086128

:

. :


6086128

  • .

  • .

  • .


6086128

1. 2.

: . Sub(Y=>B,X=>27)

  • : .

  • .


6086128

.

:

( )

( )

( )


6086128

()

-

. :


6086128

  • / .

  • () .

  • .

  • :

Procedure p(X , Y , Z)

{

int i , i=7;

A = i+(7/(B+2))*(27+3);

}

Procedure p(X , Y , Z)

{

int i , i=7;

X = I+(7/Y)*Z;

}

:

P(A,B+2,27+3)


Thunk p a b 2 27 3

(thunk) .

thunk .

Jump to subroutine p

Address of thunk1 to return L_value(A)

Address of thunk2 to return R_value(A)

Address of thunk3 to return L_value(B+2)

Address of thunk4 to return R_value(B+2)

Address of thunk5 to return L_value(27+3)

Address of thunk6 to return R_value(27+3)

: thunk . p(A,b+2,27+3):

Thunk

.

X

Thunk1 .

X

Thunk2 .


6086128

.

( ) .

.

:

Void fn(int x , int y) {

x= -4; y= -6;

print f(%d %d , x,y);

}

Main() {

int a=1 , b=3;

print f( %d % d , a,b);

F(n) (&a , &b);

print f(%d %d , a ,b);

{

( )


6086128

.

.

Void fn(int x , int y) {

x= -4; y= -6;

print f(%d %d , x,y);

}

Main() {

int a=1 , b=3;

print f( %d % d , a,b);

F(n) (a , b);

print f(%d %d , a ,b);

{


6086128

.

.

.

-

- .

-W .


6086128

.

.

  • .

  • .

  • .

.


6086128

:

.

.

  • :

  • .

  • .

  • CEP( ) CIP( ) .

  • .


6086128

. .

. . .

2) :


6086128

.( )

. .( )

:


6086128

Q (&(a+b), &b)

:

a+b :

.

P .

( (p Q .

p .

p Q

( )


6086128

.

:

: .

( )

  • : (

  • ) .

  • .


6086128

.

.

: ()

Procedure Q( x: integer ; function R(y,z:integer):integer)

Q() : 1. X 2. R()

R() .

Q(27,fn) fn : R : ()


6086128

.

( R(I,x) )

.

1. 2. ( )

:


6086128

.

: .

( ) Fn z (FN) .

: ( ) .


6086128

(1)

Program main

var x0: integer;

procedure Q( var I0:integer ; function R(j: integer): integer);

var x1 : integer;

begin

X1 := 4;

write ( in Q , before call of R , I = ,I0 , x = ,x1);

I0 := R(I)

End;

Procedure p;

var I1: integer;

function FN (k: integer): integer;

begin

x0 := X0 + k;

FN := I1 + k;

write (in p , I =,I1, k= ,K, x=,X0)

end;

begin

I1 := 2;

Q(x0 , FN);

write ( in p, I = ,I1 , x=, x0)

end;

(2)

begin

X0 :=7;

P();

writeln(in main,x=,x0);

END


6086128

  • .

  • .

  • COMMON package extern C C++ .

  • .


6086128

:

package :

  • package with .

With shared_table;

  • package:

Shared-table.T1;


6086128

  • with .

  • .

  • .

  • ( ) .

  • .


6086128

  • .

  • .( define )

:

  • .(uses )


6086128

  • .

  • (p ) (p ) .

  • .

:

1. 2.


6086128

1. :

  • .

  • .

  • .


6086128

2. :

  • .( )

  • .

  • .

  • .

  • .


6086128

  • .

  • ( ) .

  • .


6086128

:


6086128

:

1. .

2. . .


6086128

:( )

( ) X :

X X ( ).

.

:

Procedure A is

procedure B is

procedure C is

end;:

end;

end;


6086128

:

  • .

  • .

  • .

  • . .


6086128

.


  • Login