Coder Social home page Coder Social logo

Comments (11)

staktrace avatar staktrace commented on September 17, 2024

I've been meaning to work on exposing the code data in a better way. The library could implement bytecode parsing and return opcodes with their associated data (including constant pool references) as first class data structures.

I'd be interested in hearing more about your use case for the library to design the API accordingly.

The API you suggested is slightly more complicated than it might first seem because some entries in the constant pool (long/double values) take up two indices and you'd have to account for that. Not hard, but it would be a linear iteration rather than constant time.

from cafebabe.

accusitive avatar accusitive commented on September 17, 2024

Any update on this? Its the current blocker for one of my projects.

from cafebabe.

staktrace avatar staktrace commented on September 17, 2024

@accusitive can you provide more details on your use case and what you're trying to do? It would help inform the API design.

from cafebabe.

zigazeljko avatar zigazeljko commented on September 17, 2024

@accusitive I suggest using the noak crate.

@staktrace Check out the ConstantPool::get method in the linked crate for an idea for the API.

from cafebabe.

staktrace avatar staktrace commented on September 17, 2024

@staktrace Check out the ConstantPool::get method in the linked crate for an idea for the API.

Coming up with an API isn't hard. That's not the point. The point is to understand the use cases so that the API can be properly designed. My expectation when writing this library was that in the majority of cases users wouldn't need to manually iterate through the constant pool. Instead, the library could provider higher-level abstractions that make the manual iteration unnecessary. If that's not the case then I'd like to understand why.

from cafebabe.

accusitive avatar accusitive commented on September 17, 2024

Hey, sorry for not responding, I've been rewriting my program a few times to try to solve an unrelated problem.

My use case is a jvm bytecode to llvm compiler, for fun.
In this case I needed it to support calling something like System.out.println(), since basic functions themselves was working, but couldn't do much more than basic math, variables, and calling other functions (implemented in C or Java).

from cafebabe.

staktrace avatar staktrace commented on September 17, 2024

Thanks. Yeah for bytecode manipulation In thinking of writing a strongly-typed structure that provides direct access to the resolved constant pool entries referenced by the bytecode. So you wouldn't need to iterate through the constant pool yourself, the code would provide all the associated constants directly.

At some point I'll get around to implementing that, but this is a back-burner project for me at the moment so I can't commit to timelines.

from cafebabe.

accusitive avatar accusitive commented on September 17, 2024

Good to hear, for now im trying noak and its pretty nice. Although this project was a lot more elegant :)

from cafebabe.

staktrace avatar staktrace commented on September 17, 2024

FYI I added some bytecode parsing stuff. It's on the main branch but I haven't published a new release yet.

from cafebabe.

accusitive avatar accusitive commented on September 17, 2024

I've been trying it out, and its great, No complaints from me.

from cafebabe.

accusitive avatar accusitive commented on September 17, 2024

The bytecode parsing stuff just helped me implement branching, which I'd been trying for 4 days. (see: I've been rewriting my program a few times to try to solve an unrelated problem.)
I can't thank you enough for this :)

from cafebabe.

Related Issues (17)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.