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

Inject strictfp into player code #302

Open
kazimuth opened this issue Jan 7, 2017 · 8 comments
Open

Inject strictfp into player code #302

kazimuth opened this issue Jan 7, 2017 · 8 comments

Comments

@kazimuth
Copy link
Contributor

kazimuth commented Jan 7, 2017

Not sure how to do this

@nmccoy
Copy link
Contributor

nmccoy commented Jan 7, 2017

Possibly a dumb thought, but since server the class running robotplayer is strictfp, shouldn't all functions (including player code) within it be run with strictfp restrictions as well?

@kazimuth
Copy link
Contributor Author

kazimuth commented Jan 8, 2017

Server isn't really 'running' RobotPlayer, as the JVM understands it. Server is a loaded class, and RobotPlayer is also a loaded class. (RobotPlayer is loaded by a custom classloader, but that doesn't tell it anything about Server.)

@nmccoy
Copy link
Contributor

nmccoy commented Jan 9, 2017

Not exactly a fix (at all), but I just made examplefuncsplayer strictfp because I know a lot of teams use that file as a template.

@vontell
Copy link
Contributor

vontell commented Jan 9, 2017

Is it possible to use gradle to literally just iterate through all classes in a folder and insert strictfp into each class line?

@jbloxham
Copy link
Contributor

jbloxham commented Jan 9, 2017

I believe it would be better to accomplish this with the instrumenter somehow.

@nmccoy
Copy link
Contributor

nmccoy commented Jan 9, 2017

I can look into this now

@nmccoy
Copy link
Contributor

nmccoy commented Jan 9, 2017

I found a way to force strictfp by setting Opcodes.ACC_STRICT in MethodVisitor. This has an interesting consequence of making testLambdas() fail, as Method test in class instrumented/java/util/function/Predicate has illegal modifiers: 0xC01. I'm assuming this means java.util.function.Predicate is not compatible with strictfp, which means we either have to disallow Predicate or just not have fully-enforced strictfp.

@Pear0
Copy link
Contributor

Pear0 commented Jan 17, 2017

This is sort of a shot in the dark, but what if you set Opcodes.ACC_STRICT on the classes instead of the methods.

According to JLS §15.4:

If a class, interface, or method, X, is declared strictfp, then X and any class, interface, method, constructor, instance initializer, static initializer, or variable initializer within X is said to be FP-strict.

That would mean that all methods and lambdas which are really inner classes should also be evaluated with fpstrict rules.

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

No branches or pull requests

5 participants