Skip to content

Commit

Permalink
8297041: Remove the last remnants of sjavac
Browse files Browse the repository at this point in the history
Reviewed-by: cstein, erikj, jjg
  • Loading branch information
magicus committed Nov 17, 2022
1 parent 636040f commit 4527dc6
Show file tree
Hide file tree
Showing 112 changed files with 706 additions and 11,207 deletions.
6 changes: 3 additions & 3 deletions doc/building.html
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ <h1 class="title">Building the JDK</h1>
<li><a href="#ccache">Ccache</a></li>
<li><a href="#precompiled-headers">Precompiled Headers</a></li>
<li><a href="#icecc-icecream">Icecc / icecream</a></li>
<li><a href="#using-sjavac">Using sjavac</a></li>
<li><a href="#using-the-javac-server">Using the javac server</a></li>
<li><a href="#building-the-right-target">Building the Right Target</a></li>
</ul></li>
<li><a href="#troubleshooting">Troubleshooting</a><ul>
Expand Down Expand Up @@ -819,8 +819,8 @@ <h3 id="precompiled-headers">Precompiled Headers</h3>
<h3 id="icecc-icecream">Icecc / icecream</h3>
<p><a href="http://github.com/icecc/icecream">icecc/icecream</a> is a simple way to setup a distributed compiler network. If you have multiple machines available for building the JDK, you can drastically cut individual build times by utilizing it.</p>
<p>To use, setup an icecc network, and install icecc on the build machine. Then run <code>configure</code> using <code>--enable-icecc</code>.</p>
<h3 id="using-sjavac">Using sjavac</h3>
<p>To speed up compilation of Java code, especially during incremental compilations, the sjavac server is automatically enabled in the configuration step by default. To explicitly enable or disable sjavac, use either <code>--enable-javac-server</code> or <code>--disable-javac-server</code>.</p>
<h3 id="using-the-javac-server">Using the javac server</h3>
<p>To speed up compilation of Java code, especially during incremental compilations, the javac server is automatically enabled in the configuration step by default. To explicitly enable or disable the javac server, use either <code>--enable-javac-server</code> or <code>--disable-javac-server</code>.</p>
<h3 id="building-the-right-target">Building the Right Target</h3>
<p>Selecting the proper target to build can have dramatic impact on build time. For normal usage, <code>jdk</code> or the default target is just fine. You only need to build <code>images</code> for shipping, or if your tests require it.</p>
<p>See also <a href="#using-fine-grained-make-targets">Using Fine-Grained Make Targets</a> on how to build an even smaller subset of the product.</p>
Expand Down
10 changes: 5 additions & 5 deletions doc/building.md
Original file line number Diff line number Diff line change
Expand Up @@ -1333,12 +1333,12 @@ it.
To use, setup an icecc network, and install icecc on the build machine. Then
run `configure` using `--enable-icecc`.
### Using sjavac
### Using the javac server
To speed up compilation of Java code, especially during incremental compilations,
the sjavac server is automatically enabled in the configuration step by default.
To explicitly enable or disable sjavac, use either `--enable-javac-server`
or `--disable-javac-server`.
To speed up compilation of Java code, especially during incremental
compilations, the javac server is automatically enabled in the configuration
step by default. To explicitly enable or disable the javac server, use either
`--enable-javac-server` or `--disable-javac-server`.
### Building the Right Target
Expand Down
15 changes: 15 additions & 0 deletions make/CompileInterimLangtools.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -125,5 +125,20 @@ $(foreach m, $(INTERIM_LANGTOOLS_BASE_MODULES), \
)

################################################################################
# Setup the compilation of the javac server build tool. Technically, this is not
# really "interim" langtools, but just like it, it is needed henceforth for all
# java compilation using the interim compiler.
$(eval $(call SetupJavaCompilation, BUILD_JAVAC_SERVER, \
COMPILER := bootjdk, \
TARGET_RELEASE := $(TARGET_RELEASE_BOOTJDK), \
SRC := $(TOPDIR)/make/langtools/tools, \
INCLUDES := javacserver, \
BIN := $(BUILDTOOLS_OUTPUTDIR)/langtools_javacserver_classes, \
))

TARGETS += $(BUILD_JAVAC_SERVER)

################################################################################


all: $(TARGETS)
10 changes: 5 additions & 5 deletions make/Init.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ else # HAS_SPEC=true
ifneq ($(PARALLEL_TARGETS), )
$(call PrepareFailureLogs)
$(call StartGlobalTimer)
$(call PrepareSmartJavac)
$(call PrepareJavacServer)
# JOBS will only be empty for a bootcycle-images recursive call
# or if specified via a make argument directly. In those cases
# treat it as NOT using jobs at all.
Expand All @@ -339,7 +339,7 @@ else # HAS_SPEC=true
cd $(TOPDIR) && $(MAKE) $(MAKE_ARGS) -j 1 -f make/Init.gmk \
HAS_SPEC=true on-failure ; \
exit $$exitcode ) )
$(call CleanupSmartJavac)
$(call CleanupJavacServer)
$(call StopGlobalTimer)
$(call ReportBuildTimes)
endif
Expand All @@ -351,7 +351,7 @@ else # HAS_SPEC=true
endif

on-failure:
$(call CleanupSmartJavac)
$(call CleanupJavacServer)
$(call StopGlobalTimer)
$(call ReportBuildTimes)
$(call PrintFailureReports)
Expand All @@ -364,11 +364,11 @@ else # HAS_SPEC=true

# Support targets for COMPARE_BUILD, used for makefile development
pre-compare-build:
$(call WaitForSmartJavacFinish)
$(call WaitForJavacServerFinish)
$(call PrepareCompareBuild)

post-compare-build:
$(call WaitForSmartJavacFinish)
$(call WaitForJavacServerFinish)
$(call CleanupCompareBuild)
$(call CompareBuildDoComparison)

Expand Down
10 changes: 5 additions & 5 deletions make/InitSupport.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -493,15 +493,15 @@ else # $(HAS_SPEC)=true

# Remove any javac server logs and port files. This
# prevents a new make run to reuse the previous servers.
define PrepareSmartJavac
define PrepareJavacServer
$(if $(JAVAC_SERVER_DIR), \
$(RM) -r $(JAVAC_SERVER_DIR) 2> /dev/null && \
$(MKDIR) -p $(JAVAC_SERVER_DIR) \
)
endef

define CleanupSmartJavac
[ -f $(JAVAC_SERVER_DIR)/server.port ] && $(ECHO) Stopping sjavac server && \
define CleanupJavacServer
[ -f $(JAVAC_SERVER_DIR)/server.port ] && $(ECHO) Stopping javac server && \
$(TOUCH) $(JAVAC_SERVER_DIR)/server.port.stop; true
endef

Expand All @@ -510,13 +510,13 @@ else # $(HAS_SPEC)=true
# move or remove the build output directory. Since we have no proper
# synchronization process, wait for a while and hope it helps. This is only
# used by build comparisons.
define WaitForSmartJavacFinish
define WaitForJavacServerFinish
$(if $(JAVAC_SERVER_DIR), \
sleep 5\
)
endef
else
define WaitForSmartJavacFinish
define WaitForJavacServerFinish
endef
endif

Expand Down
2 changes: 1 addition & 1 deletion make/common/JavaCompilation.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ define SetupJavaCompilationBody
# Use java server if it is enabled, and the user does not want a specialized
# class path.
ifeq ($$(ENABLE_JAVAC_SERVER)+$$($1_CLASSPATH), true+)
$1_JAVAC := $$(INTERIM_LANGTOOLS_ARGS) -m jdk.compiler.interim/com.sun.tools.sjavac.Main
$1_JAVAC := $$(INTERIM_LANGTOOLS_ARGS) -cp $(BUILDTOOLS_OUTPUTDIR)/langtools_javacserver_classes javacserver.Main

# Create a configuration file with the needed information for the javac
# server to function properly.
Expand Down
22 changes: 0 additions & 22 deletions make/ide/idea/langtools/template/runConfigurations/sjavac.xml

This file was deleted.

1 change: 0 additions & 1 deletion make/langtools/build.properties
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ full.version = ${release}+${build.number}
tool.javac.main.class=com.sun.tools.javac.Main
tool.javadoc.main.class=jdk.javadoc.internal.tool.Main
tool.javap.main.class=com.sun.tools.javap.Main
tool.sjavac.main.class=com.sun.tools.sjavac.Main
tool.jshell.main.class=jdk.internal.jshell.tool.JShellToolProvider

#test configuration:
Expand Down
1 change: 0 additions & 1 deletion make/langtools/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,6 @@
<build-tool name="javadoc"/>
<build-tool name="javap"/>
<build-tool name="jdeps"/>
<build-tool name="sjavac"/>
<build-tool name="jshell"/>
</target>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand All @@ -23,7 +23,7 @@
* questions.
*/

package com.sun.tools.sjavac;
package javacserver;

import java.io.FilterWriter;
import java.io.IOException;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand All @@ -23,7 +23,7 @@
* questions.
*/

package com.sun.tools.sjavac;
package javacserver;

import java.io.PrintWriter;
import java.io.StringWriter;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand All @@ -23,14 +23,14 @@
* questions.
*/

package com.sun.tools.sjavac;

import static com.sun.tools.sjavac.options.Option.STARTSERVER;
package javacserver;

import java.util.Arrays;

import com.sun.tools.sjavac.client.ClientMain;
import com.sun.tools.sjavac.server.ServerMain;
import javacserver.client.ClientMain;
import javacserver.server.ServerMain;

import static javacserver.options.Option.STARTSERVER;

/**
* The application entry point of the smart javac wrapper tool.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand All @@ -23,33 +23,34 @@
* questions.
*/

package com.sun.tools.sjavac.comp;
package javacserver;

import javax.tools.FileObject;
import javax.tools.ForwardingFileObject;
import javax.tools.JavaFileManager.Location;

import com.sun.tools.javac.api.ClientCodeWrapper.Trusted;

@Trusted
public class FileObjectWithLocation<F extends FileObject> extends ForwardingFileObject<F> {

private final Location loc;

public FileObjectWithLocation(F delegate, Location loc) {
super(delegate);
this.loc = loc;
/** Result codes.
*/
public enum Result {
OK(0), // Compilation completed with no errors.
ERROR(1), // Completed but reported errors.
CMDERR(2), // Bad command-line arguments
SYSERR(3), // System error or resource exhaustion.
ABNORMAL(4); // Compiler terminated abnormally

Result(int exitCode) {
this.exitCode = exitCode;
}

public Location getLocation() {
return loc;
}
public static Result of(int exitcode) {
for (Result result : values()) {
if (result.exitCode == exitcode) {
return result;
}
}

public FileObject getDelegate() {
return fileObject;
return ABNORMAL;
}

public String toString() {
return "FileObjectWithLocation[" + fileObject + "]";
public boolean isOK() {
return (exitCode == 0);
}

public final int exitCode;
}
Loading

0 comments on commit 4527dc6

Please sign in to comment.