Shop OBEX P1 Docs P2 Docs Learn Events
PNut/Spin2 Latest Version (v44 -Data Structures Added, New Methods for Memory Testing/Manipulation) - Page 63 — Parallax Forums

PNut/Spin2 Latest Version (v44 -Data Structures Added, New Methods for Memory Testing/Manipulation)

1575859606163»

Comments

  • It's something like 16 longs I think.

  • JonnyMacJonnyMac Posts: 8,924
    edited 2024-03-13 20:32

    @Rayman said:
    Doesn't Spin2 have some limit on amount of longs you can pass by value?
    Is it 2 longs?

    I believe it's 16 as that's the number of parameters you can pass to a method.
    In the P2 meeting Chip just said that its 128 longs.

  • evanhevanh Posts: 15,187
    edited 2024-03-13 23:36

    That's a quarter of total cogRAM! If you use all that then I bet you'll be taking an axe to usable space for things like regload().

  • cgraceycgracey Posts: 14,133

    @Rayman said:
    Doesn't Spin2 have some limit on amount of longs you can pass by value?
    Is it 2 longs?

    @Rayman said:
    Doesn't Spin2 have some limit on amount of longs you can pass by value?
    Is it 2 longs?

    Parameters can be from 0 to 127 longs .

    Return values can be from 0 to 15 longs.

  • RaymanRayman Posts: 13,860

    Ok, seems like enough to pass some sensibly sized structures by value then

  • cgraceycgracey Posts: 14,133

    @Electrodude said:

    @cgracey said:
    What would be better than ^ ?

    Perhaps PRI drawLines(pLine: sLine, count) | i, i.e. var: type? This is what Python and Rust do. But would this interact badly with specifying types on return variables?

    We went over this in the live forum meeting today and decided to just keep the ^.

    I am going to add passing and returning of whole structures that can fit in the method parameters and return values. Tonight I added passing structures whole, and I think returning whole structures only requires some compiler changes. Lots to think about and it overflows my mental stack a bit.

  • RaymanRayman Posts: 13,860

    Is the order of elements within the structure kept as written or reordered in some way?

    Also is everything stored in longs even if bytes? Or, compacted?

  • cgraceycgracey Posts: 14,133

    @Rayman said:
    Is the order of elements within the structure kept as written or reordered in some way?

    Also is everything stored in longs even if bytes? Or, compacted?

    Everything is kept in the order. It was declared and it is all packed without regard to alignments.

    When structures get passed on the stack as parameters and return values, they will need to be rounded up to the next long, in size, so they amount to a number of whole longs.

  • Hi Chip, i have a Problem with PNUT v44.
    My P2 Projekt ist very big and I want to rewrite it with the new structures in V44.
    With PNUT v35u it compiles without Errors.
    With PNUT v44 it compiles with Error: "OBJ data exceeds 1024k limit."
    Can you expand the OBJ data space in v44?

    I think the structures in V44 are very very useful, but I need a built-In Method sizeof(struct) witch return the structure length in bytes.

  • maccamacca Posts: 722

    Please update the Spin interpreter source (and any other updated sources) in both the package and git repository.
    Thanks.

  • Hi Chip, I try the other PNUT versions.
    The Error: "OBJ data exceeds 1024k limit." comes with v37 - v44.
    In v37 "Parameterization to child-object instantiations" is added and I think this will take much more OBJ data space.

  • cgraceycgracey Posts: 14,133

    @macca said:
    Please update the Spin interpreter source (and any other updated sources) in both the package and git repository.
    Thanks.

    Will do, but there is a problem:

    I have been changing the way data structures work, so that in the next version, there may be differences in how you use them. I hope to have this done soon, but it will need another week of time to get ironed out.

  • cgraceycgracey Posts: 14,133
    edited 2024-03-25 07:19

    @wummi said:
    Hi Chip, I try the other PNUT versions.
    The Error: "OBJ data exceeds 1024k limit." comes with v37 - v44.
    In v37 "Parameterization to child-object instantiations" is added and I think this will take much more OBJ data space.

    I need to discover why this is happening. I think it may have to do with CON data being treated as part of the binary image space, initially, but I am not sure yet.

  • maccamacca Posts: 722

    @cgracey said:

    @macca said:
    Please update the Spin interpreter source (and any other updated sources) in both the package and git repository.
    Thanks.

    Will do, but there is a problem:

    I have been changing the way data structures work, so that in the next version, there may be differences in how you use them. I hope to have this done soon, but it will need another week of time to get ironed out.

    No problem, it was a "general remainder" to update the sources, I noticed that even in v43 the source was still a bit older.

    I'm a bit behind with the structure implementation and for now I'm more interested in implementing the new methods since they have renumbered the existing bytecodes.

  • Thanks Chip,
    I removed the parallel arrays from my LED Matrix driver and replaced them with data structures.

    HydraHacker

  • frank freedmanfrank freedman Posts: 1,975
    edited 2024-04-10 01:22

    @cgracey

    Any further thoughts or progress on enabling command line specification of the comm port for download?

    Thanks,

Sign In or Register to comment.