Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

block objects #5

Open
dlech opened this issue May 10, 2019 · 3 comments
Open

block objects #5

dlech opened this issue May 10, 2019 · 3 comments

Comments

@dlech
Copy link
Member

dlech commented May 10, 2019

Currently, block objects are not properly implemented.

Block objects have a couple of interesting properties:

  1. They share local variables with an "owner" object
  2. They have a trigger count n that must be > 0 and the object must be triggered n times before it actually starts (via OBJECT_TRIG)

So, we need to figure out how to encode these two properties in the assembly language.

Also we need to fix the allocation of local variables. There are comments in the LMS2012 source code that indicate that the object header for blocks should have a local variable size of 0. However, code generated by the official EV3 programming software uses the same size as the owner object instead of 0.

@dlech
Copy link
Member Author

dlech commented May 10, 2019

One idea I had for designating the "owner" of a block is only allowing block objects to be declared within the body of another block.

// compile error: block object cannot be top-level object
block Bad {
}

vmthread Thread1 {
    DATA8 v1

    block Block1 {
        // compile error: block cannot contain local variables
        DATA8 v2

        MOVE8_8(1,v1) // OK

        block Block2 {
             // block in block is OK
             // is owner Block1 or Thread1? probably Thread1 since it has the local variables
        }
    }
}

@iCheh
Copy link

iCheh commented Nov 24, 2019

Hello.
Are there any changes in using a block object in a program?

@dlech
Copy link
Member Author

dlech commented Nov 24, 2019

No, these changes have not been made yet. So using block objects is limited at this time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants