Setting up for working on Graal sources in OpenJDK repo

Jorn Vernee jbvernee at xs4all.nl
Mon Dec 3 15:27:47 UTC 2018


Thanks Doug,

> Not sure if it helps, but you can develop GitHub Graal sources against
> an OpenJDK build by setting JAVA_HOME to the latter and following the
> instructions at
> https://github.com/oracle/graal/tree/master/compiler#ide-configuration

This isn't a complete picture for me, since (AFACT) it doesn't allow me 
to create a jdk image with both the Graal changes and the repo specific 
stuff. I need to use the OpenJDK build system since it adds a bunch of 
steps for the specific branch I'm working on.

Actually, it's good that you mention Github Graal; I looked and noticed 
the graal/compiler suite has a command called `updategraalinopenjdk` 
with the description: "updates the Graal sources in OpenJDK". The help 
message isn't very useful, but looking at the sources for it [1], it has 
a 'jdkrepo' argument. So I think I can dev on github Graal, and then use 
this command to push the updated sources into the OpenJDK repo I'm 
working on.

FWIW it did need patching to ignore `?` files from hg status (it's 
checking for uncommitted changes).

```
diff --git a/compiler/mx.compiler/mx_updategraalinopenjdk.py 
b/compiler/mx.compiler/mx_updategraalinopenjdk.py
index e58121c45f2..07281979270 100644
--- a/compiler/mx.compiler/mx_updategraalinopenjdk.py
+++ b/compiler/mx.compiler/mx_updategraalinopenjdk.py
@@ -126,7 +126,11 @@ def updategraalinopenjdk(args):
          m_src_dir = join('src', m.name)
          mx.log('Checking ' + m_src_dir)
          out = run_output(['hg', 'status', m_src_dir], cwd=jdkrepo)
-        if out:
+        status = []
+        for file in out.split('\n'):
+            if file and not file.startswith('?'):
+                status.append(file)
+        if status:
              mx.abort(jdkrepo + ' is not "hg clean":' + '\n' + 
out[:min(200, len(out))] + '...')

      for dirpath, _, filenames in os.walk(join(jdkrepo, 'make')):
```

The other problem is that my local copy of the Github Graal repo seems 
to be using CRLF line endings, so this is generating a lot of spurious 
diffs from the copy. I'm not sure what to do about that.

Jorn

[1] : 
https://github.com/oracle/graal/blob/master/compiler/mx.compiler/mx_updategraalinopenjdk.py#L67

Doug Simon schreef op 2018-12-03 13:54:
> Hi Jorn,
> 
>> On 3 Dec 2018, at 13:26, Jorn Vernee <jbvernee at xs4all.nl> wrote:
>> 
>> Hi,
>> 
>> I was wondering what the right way is to generate intellij (or other
>> IDE) configs for the Graal sources in OpenJDK?
>> 
>> Specifically I'm working on the module `jdk.internal.vm.compiler`.
>> I've tried `bin/.idea.sh jdk.internal.vm.compiler` but this
>> generates a project that has a bunch of missing dependencies (I've
>> only worked with java.base before so I'm not sure how that is
>> supposed to work tbh).
>> 
>> There's also an mx.graal suite in that module's directory, but when
>> running `mx ideinit` this just creates a project for the actual
>> suite files, and not for the Graal sources itself it seems.
>> 
>> What's the expected/recommended workflow for working on Graal
>> sources in an OpenJDK repo?
> 
> I do not know about OpenJDK support for IDE development but it
> wouldn’t surprise me that doesn’t work with the Graal sources
> given their non-standard layout. I’ve cc’ed the hotspot compiler
> list in case someone there has some tips.
> 
> Not sure if it helps, but you can develop GitHub Graal sources against
> an OpenJDK build by setting JAVA_HOME to the latter and following the
> instructions at
> https://github.com/oracle/graal/tree/master/compiler#ide-configuration
> 
> -Doug


More information about the graal-dev mailing list