Comments (11)
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.
Any update on this? Its the current blocker for one of my projects.
from cafebabe.
@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.
@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 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.
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.
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.
Good to hear, for now im trying noak and its pretty nice. Although this project was a lot more elegant :)
from cafebabe.
FYI I added some bytecode parsing stuff. It's on the main branch but I haven't published a new release yet.
from cafebabe.
I've been trying it out, and its great, No complaints from me.
from cafebabe.
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)
- Add custom error types instead of using `String` as the error type HOT 4
- Testing? HOT 4
- Panic in `validate_classinfo_name` HOT 6
- Make ClassFile ownable(?) HOT 3
- Class parsing fails if local variable name contains '<' or '>' HOT 2
- Add a project license? HOT 2
- Method descriptor parser HOT 2
- Clippy warnings do not fail the build
- Consider backing class file data with an arena HOT 2
- new release for 0.6.0? HOT 2
- [Suggestion] Derive more traits? HOT 3
- Any plans for a class file writer? HOT 1
- Typed RecordComponentEntry::descriptor HOT 3
- `Anewarray`, `Checkcast`, `Instanceof` and `Multianewarray` in `OPCodes` should hold a `FieldType` or `FieldType::parse` be public HOT 2
- Failure to parse classfile HOT 5
- Parsing is locked to be single-threaded HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cafebabe.