Skip to content

Add Env#getSupportedMimeTypes() #17

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

Merged
merged 7 commits into from
Jan 28, 2016
Merged

Add Env#getSupportedMimeTypes() #17

merged 7 commits into from
Jan 28, 2016

Conversation

chrisseaton
Copy link
Contributor

I want to know what languages are supported in a PolyglotEngine. The pressing use-case is in JRuby+Truffle where I want to know if I have a JS interpreter available. I'm currently doing this by just trying to eval with application/javascript and catching any error as an indication that it isn't available. This patch instead checks what languages are available first.

jruby/jruby@truffle-execjs...truffle-execjs-list-languages#diff-0c9caf96978e9602deec3f1fca2d97a8L68

The workaround before this patch is slow, even if I end up not using the JavaScript interpreter after finding that it is available. This is 3rd party code for the most part so I can't redesign much.

This is a new API, so a 'large' review. @jtulach @chumer @woess

@jtulach
Copy link
Contributor

jtulach commented Jan 26, 2016

The test coverage seems to be zero. Please increase it a bit.

* @return a non-null array of a string for each supported MIME type
*/
public String[] getSupportedMimeTypes() {
return API.getSupportedMimeTypes(vm);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I understand your use-case a method like

public boolean isMimeTypeSupported(String mimeType);

would work for you as well. If so, I prefer it to the array of all mime types.

@chrisseaton
Copy link
Contributor Author

I switched from getSupportedMimeTypes to isMimeTypeSupported.

Where is the best place to test this? I couldn't see a collection of Env tests. Do I need to set up a dummy language of my own to get at Env?

@smarr
Copy link
Contributor

smarr commented Jan 26, 2016

I added a similar test to EngineTest class. But be careful not to use internal APIs in the tests (which are available in that package). @jtulach does not like that :)

@jtulach
Copy link
Contributor

jtulach commented Jan 27, 2016

There are few testing languages along EngineTest. Feel free to improve them for testing the mime types.

@jtulach
Copy link
Contributor

jtulach commented Jan 28, 2016

Nice test - no hacks, close to the way people will use this API. Once the formatting is fixed, please merge. I'll work on tagging the release then.

@chrisseaton
Copy link
Contributor Author

I'm not sure how to fix these javadoc warnings. When I run mx javadoc locally I get tons of other warnings, and Eclipse doesn't have a problem with the classes and methods I've referenced.

Am I missing something?

https://travis-ci.org/graalvm/truffle/jobs/105453975

@jtulach
Copy link
Contributor

jtulach commented Jan 28, 2016

The right command is:

mx javadoc - unified

chrisseaton added a commit that referenced this pull request Jan 28, 2016
@chrisseaton chrisseaton merged commit 7f679ea into oracle:master Jan 28, 2016
@chrisseaton chrisseaton deleted the feature/list-languages branch January 28, 2016 18:24
dougxc pushed a commit that referenced this pull request Apr 19, 2016
…truffle:master to master

* commit '8e4dd223cf5ce03b873573c1decf40e1b84a526e':
  mx testdownstream should only be optional check
  Gilles suggested this to fix #173: 0.13-SNAPSHOT of truffle-dsl-processor not published
XiaohongGong pushed a commit to XiaohongGong/graal that referenced this pull request Feb 24, 2020
This patch adds the following match rules to generate bitfield
move instruction on AArch64:
* (RightShift (LeftShift value a) b)         -> SBFX/SBFIZ
* (UnsignedRightShift (LeftShift value a) b) -> UBFX/UBFIZ
* (LeftShift (SignExtend value) a)           -> SBFIZ
Eg:
  lsl    w0, w1, oracle#8
  asr    w0, w0, oracle#15
is optimized to:
  sbfx   w0, w1, oracle#7, oracle#17

It also adds the rules to integrate the ZeroExtend with unsigned
bitfield move operation.
Eg:
  ubfiz  w0, w1, oracle#5, oracle#12
  and    x0, x0, #0xffffffff
is optimized to:
  ubfiz  x0, x1, oracle#5, oracle#12

Change-Id: I2b635d4895db0d5f4c30630176f336e9a226ccaf
vic-ma pushed a commit to vic-ma/graal that referenced this pull request Apr 21, 2021
…d classloaders (oracle#17)

* Implement/fix constant pool writing for classes, packages, modules and classloaders

* Fetch JFR type IDs from host JDK instead of hardwiring them.

* Precompute and cache type IDs

* Fold writing of packages, modules and classloaders into JfrTypeRepository

* Removed debug printlns

* Renamed count variables to poolCount

* Simplify some collections accessors

* Return int from JfrTraceIdLoadBarrier.classCount()

* Improve comment

* Improve JfrTypes enum construction

* Add previousEpoch field to all JfrSymbolRepository.getSymbolId()

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

Successfully merging this pull request may close these issues.

4 participants