Related articles |
---|
[4 earlier articles] |
Re: Is this a form of Data Flow Analysis, and what is the proper way s paolo.bonzini@gmail.com (2006-01-17) |
Re: Is this a form of Data Flow Analysis, and what is the proper way s owong@castortech.com (Oliver Wong) (2006-01-20) |
Re: Is this a form of Data Flow Analysis, and what is the proper way s gneuner2@comcast.net (George Neuner) (2006-01-26) |
Re: Is this a form of Data Flow Analysis, and what is the proper way s paolo.bonzini@gmail.com (2006-01-26) |
Re: Is this a form of Data Flow Analysis, and what is the proper way s pohjalai@cc.helsinki.fi (A Pietu Pohjalainen) (2006-01-26) |
Re: Is this a form of Data Flow Analysis, and what is the proper way s owong@castortech.com (Oliver Wong) (2006-01-28) |
Re: Is this a form of Data Flow Analysis, and what is the proper way s pohjalai@cc.helsinki.fi (A Pietu Pohjalainen) (2006-02-03) |
From: | A Pietu Pohjalainen <pohjalai@cc.helsinki.fi> |
Newsgroups: | comp.compilers |
Date: | 3 Feb 2006 18:40:48 -0500 |
Organization: | University of Helsinki |
References: | 06-01-037 06-01-055 06-01-079 06-01-103 |
Keywords: | analysis |
Posted-Date: | 03 Feb 2006 18:40:48 EST |
Oliver Wong <owong@castortech.com> wrote:
> "A Pietu Pohjalainen" <pohjalai@cc.helsinki.fi> wrote
>> Java compiler does to bytecode level:
>> read c; duplicate; write b; write a;
>>
>> There is no read from b.
> Note sure about the bytecode, but from the JLS 3rd edition:
> a=b=c means a=(b=c), which assigns the value of c to b and then assigns the
> value of b to a.
> Probably my original terminology or phrasing "there is a read etc." was
> flawed, which may have caused some confusion.
I think that the bytecode produced by javac just doesn't follow the
given clausule in the language spec, as the value assigned to a is the
value directly read from c.
I have no idea whether this means anything (e.g. with volatile variables
and multiple writer threads to b in practise. Having e.g. two threads
such that
thread 1)
while(true) {
a = b = 1;
if(a == 2) {
System.out.println("foobar");
}
}
and then there's another thread 2)
while(true) {
b = 2;
}
Under my understanding, using JLS semantics (the variables are
volatile..), this 'foobar' would be "sometime" written. Using javac
semantics, it is never written.
br,
Pietu
Return to the
comp.compilers page.
Search the
comp.compilers archives again.