amitkumar3968 / ambienttalk

Automatically exported from code.google.com/p/ambienttalk
0 stars 0 forks source link

Serialization of the root object #44

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Modify the creation of global lexical scope as follows:

private static NATObject createGlobalLexicalScope() {
        NATObject root = new NATObject(OBJLexicalRoot._INSTANCE_) {
            // override meta_pass to avoid the creation of a far reference 
            // when the root object gets parameter passed.
            public ATObject meta_pass() throws InterpreterException {
                return createSerializedLexicalRoot();
            }   
        };
        return root;
    }

2. Run an AT application in Android.

What is the expected output? What do you see instead?

You will get an java.lang.StackOverflowError during the serialization of an 
NATASyncMessage caused by the serialization of Evaluator.

Please use labels and text to provide additional information.

Original issue reported on code.google.com by egonzal...@gmail.com on 10 Dec 2010 at 12:24

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
The exception seems to be caused because the JVM gets confused serializing the 
anonymous inner classes (created in the serialization of the global lexical 
scope), and gets into an infinite loop.

For the moment the global lexical scope is passed by far reference. This 
solution will create an unnnecessary remote far references for the global 
lexical scope taken along in isolates since its serialization rebinds the 
lexicalParent_ upon arrival.  This means we will create some unnecessary 
objects in the AT VM, but at least no thread is created anymore since we have 
now a ThreadPool for remote far references.

Original comment by egonzal...@gmail.com on 10 Dec 2010 at 12:47

GoogleCodeExporter commented 9 years ago
I will investigate whether the lexicalParent_ field of NATCallFrames (and thus 
also NATObjects that are marked as isolates) can be made transient such that 
the root is never implicitly parameter-passed.

When the root is explicitly parameter-passed in a message, e.g. `obj<-m(root)` 
then it's OK to pass it by-far-reference.

Original comment by tvcut...@gmail.com on 10 Dec 2010 at 4:11

GoogleCodeExporter commented 9 years ago
We cannot come up with a reason why this was necessary.

Original comment by Botje.linux@gmail.com on 24 May 2013 at 1:48