You've already forked linux-packaging-mono
Imported Upstream version 3.10.0
Former-commit-id: 172c8e3c300b39d5785c7a3e8dfb08ebdbc1a99b
This commit is contained in:
222
external/ikvm/awt/graphics.cs
vendored
222
external/ikvm/awt/graphics.cs
vendored
@ -1,7 +1,7 @@
|
||||
/*
|
||||
Copyright (C) 2002, 2004, 2005, 2006, 2007 Jeroen Frijters
|
||||
Copyright (C) 2006 Active Endpoints, Inc.
|
||||
Copyright (C) 2006 - 2013 Volker Berlin (i-net software)
|
||||
Copyright (C) 2006 - 2014 Volker Berlin (i-net software)
|
||||
Copyright (C) 2011 Karsten Heinrich (i-net software)
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
@ -40,17 +40,29 @@ namespace ikvm.awt
|
||||
internal class BitmapGraphics : NetGraphics
|
||||
{
|
||||
private readonly Bitmap bitmap;
|
||||
private readonly BufferedImage image;
|
||||
|
||||
internal BitmapGraphics(Bitmap bitmap, java.awt.Font font, Color fgcolor, Color bgcolor)
|
||||
: base(createGraphics(bitmap), font, fgcolor, bgcolor)
|
||||
internal BitmapGraphics(Bitmap bitmap, Object destination, java.awt.Font font, Color fgcolor, Color bgcolor)
|
||||
: base(createGraphics(bitmap), destination, font, fgcolor, bgcolor)
|
||||
{
|
||||
this.bitmap = bitmap;
|
||||
image = destination as BufferedImage;
|
||||
}
|
||||
|
||||
internal BitmapGraphics(Bitmap bitmap)
|
||||
: base(createGraphics(bitmap), null, Color.White, Color.Black)
|
||||
internal BitmapGraphics(Bitmap bitmap, Object destination)
|
||||
: this(bitmap, destination, null, Color.White, Color.Black)
|
||||
{
|
||||
this.bitmap = bitmap;
|
||||
}
|
||||
|
||||
internal override Graphics g
|
||||
{
|
||||
get {
|
||||
if (image != null)
|
||||
{
|
||||
image.toBitmap();
|
||||
}
|
||||
return base.g;
|
||||
}
|
||||
}
|
||||
|
||||
protected override SizeF GetSize() {
|
||||
@ -89,8 +101,8 @@ namespace ikvm.awt
|
||||
{
|
||||
private readonly Control control;
|
||||
|
||||
internal ComponentGraphics(Control control, java.awt.Color fgColor, java.awt.Color bgColor, java.awt.Font font)
|
||||
: base(control.CreateGraphics(), font, J2C.ConvertColor(fgColor), J2C.ConvertColor(bgColor))
|
||||
internal ComponentGraphics(Control control, java.awt.Component target, java.awt.Color fgColor, java.awt.Color bgColor, java.awt.Font font)
|
||||
: base(control.CreateGraphics(), target, font, J2C.ConvertColor(fgColor), J2C.ConvertColor(bgColor))
|
||||
{
|
||||
this.control = control;
|
||||
}
|
||||
@ -116,12 +128,17 @@ namespace ikvm.awt
|
||||
return (Point)this.control.Invoke(new Converter<Point,Point>(getPointToScreenImpl),point);
|
||||
}
|
||||
|
||||
public override void copyArea(int x, int y, int width, int height, int dx, int dy)
|
||||
{
|
||||
Point src = getPointToScreen(new Point(x + (int)this.g.Transform.OffsetX, y + (int)this.g.Transform.OffsetY));
|
||||
Point dest = new Point(x + (int)this.g.Transform.OffsetX + dx, y + (int)this.g.Transform.OffsetY + dy);
|
||||
this.g.CopyFromScreen(src, dest, new Size(width, height));
|
||||
}
|
||||
public override void copyArea(int x, int y, int width, int height, int dx, int dy)
|
||||
{
|
||||
Matrix t = g.Transform;
|
||||
Point src = getPointToScreen(new Point(x + (int)t.OffsetX, y + (int)t.OffsetY));
|
||||
Bitmap copy = new Bitmap(width, height);
|
||||
using (Graphics gCopy = Graphics.FromImage(copy))
|
||||
{
|
||||
gCopy.CopyFromScreen(src, new Point(0, 0), new Size(width, height));
|
||||
}
|
||||
g.DrawImageUnscaled(copy, x + dx, y + dy);
|
||||
}
|
||||
|
||||
public override void clip(java.awt.Shape shape)
|
||||
{
|
||||
@ -150,7 +167,7 @@ namespace ikvm.awt
|
||||
private bool isBase = true;
|
||||
|
||||
internal PrintGraphics(Graphics g)
|
||||
: base(g, null, Color.White, Color.Black)
|
||||
: base(g, null, null, Color.White, Color.Black)
|
||||
{
|
||||
baseContext = new PrintGraphicsContext();
|
||||
baseContext.Current = this;
|
||||
@ -744,7 +761,7 @@ namespace ikvm.awt
|
||||
netG.g.Clip = Clip;
|
||||
netG.g.SmoothingMode = SmoothingMode;
|
||||
netG.g.PixelOffsetMode = PixelOffsetMode;
|
||||
netG.g.TextRenderingHint = TextRenderingHint;
|
||||
netG.setTextRenderingHint(TextRenderingHint);
|
||||
netG.g.InterpolationMode = InterpolationMode;
|
||||
netG.g.CompositingMode = CompositingMode;
|
||||
}
|
||||
@ -768,10 +785,9 @@ namespace ikvm.awt
|
||||
}
|
||||
}
|
||||
|
||||
internal abstract class NetGraphics : java.awt.Graphics2D
|
||||
internal abstract class NetGraphics : java.awt.Graphics2D//sun.java2d.SunGraphics2D
|
||||
{
|
||||
internal Graphics g;
|
||||
internal Graphics JGraphics { get { return g; } }
|
||||
private Graphics graphics;
|
||||
private java.awt.Color javaColor;
|
||||
private java.awt.Paint javaPaint;
|
||||
internal Color color;
|
||||
@ -780,6 +796,7 @@ namespace ikvm.awt
|
||||
private java.awt.Stroke stroke;
|
||||
private static java.awt.BasicStroke defaultStroke = new java.awt.BasicStroke();
|
||||
private Font netfont;
|
||||
private int baseline;
|
||||
internal Brush brush;
|
||||
internal Pen pen;
|
||||
private CompositeHelper composite;
|
||||
@ -787,7 +804,16 @@ namespace ikvm.awt
|
||||
private Object textAntialiasHint;
|
||||
private Object fractionalHint = java.awt.RenderingHints.VALUE_FRACTIONALMETRICS_DEFAULT;
|
||||
|
||||
protected NetGraphics(Graphics g, java.awt.Font font, Color fgcolor, Color bgcolor)
|
||||
private static System.Collections.Generic.Dictionary<String, Int32> baselines = new System.Collections.Generic.Dictionary<String, Int32>();
|
||||
|
||||
internal static readonly StringFormat FORMAT = new StringFormat(StringFormat.GenericTypographic);
|
||||
static NetGraphics()
|
||||
{
|
||||
FORMAT.FormatFlags = StringFormatFlags.MeasureTrailingSpaces | StringFormatFlags.NoWrap | StringFormatFlags.FitBlackBox;
|
||||
FORMAT.Trimming = StringTrimming.None;
|
||||
}
|
||||
|
||||
protected NetGraphics(Graphics g, Object destination, java.awt.Font font, Color fgcolor, Color bgcolor) //: base( new sun.java2d.SurfaceData(destination) )
|
||||
{
|
||||
if (font == null)
|
||||
{
|
||||
@ -801,12 +827,21 @@ namespace ikvm.awt
|
||||
init(g);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The current C# Graphics
|
||||
/// </summary>
|
||||
internal virtual Graphics g
|
||||
{
|
||||
get { return graphics; }
|
||||
set { graphics = value; }
|
||||
}
|
||||
|
||||
protected void init(Graphics graphics)
|
||||
{
|
||||
NetGraphicsState state = new NetGraphicsState();
|
||||
state.saveGraphics(this);
|
||||
g = graphics;
|
||||
state.restoreGraphics(this);
|
||||
state.restoreGraphics(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -850,7 +885,7 @@ namespace ikvm.awt
|
||||
{
|
||||
if (pen!=null) pen.Dispose();
|
||||
if (brush!=null) brush.Dispose();
|
||||
g.Dispose();
|
||||
graphics.Dispose(); //for dispose we does not need to synchronize the buffer of a bitmap
|
||||
}
|
||||
|
||||
public override void drawArc(int x, int y, int width, int height, int startAngle, int arcAngle)
|
||||
@ -1190,6 +1225,7 @@ namespace ikvm.awt
|
||||
{
|
||||
netfont = f.getNetFont();
|
||||
font = f;
|
||||
baseline = getBaseline( netfont, g.TextRenderingHint );
|
||||
}
|
||||
}
|
||||
|
||||
@ -1278,30 +1314,33 @@ namespace ikvm.awt
|
||||
drawString(str, (float)x, (float)y);
|
||||
}
|
||||
|
||||
public override void drawString(String text, float x, float y)
|
||||
{
|
||||
if (text.Length == 0)
|
||||
{
|
||||
public override void drawString(String text, float x, float y) {
|
||||
if (text.Length == 0) {
|
||||
return;
|
||||
}
|
||||
bool fractional = isFractionalMetrics();
|
||||
StringFormat format = new StringFormat(StringFormat.GenericTypographic);
|
||||
format.FormatFlags = StringFormatFlags.MeasureTrailingSpaces | StringFormatFlags.NoWrap | StringFormatFlags.FitBlackBox;
|
||||
format.Trimming = StringTrimming.None;
|
||||
if (fractional || !sun.font.StandardGlyphVector.isSimpleString(font, text))
|
||||
{
|
||||
g.DrawString(text, netfont, brush, x, y - font.getSize(), format);
|
||||
}
|
||||
else
|
||||
{
|
||||
// fixed metric for simple text, we position every character to simulate the Java behaviour
|
||||
java.awt.font.FontRenderContext frc = new java.awt.font.FontRenderContext(null, isAntiAlias(), fractional);
|
||||
sun.font.FontDesignMetrics metrics = sun.font.FontDesignMetrics.getMetrics(font, frc);
|
||||
y -= font.getSize();
|
||||
for (int i = 0; i < text.Length; i++)
|
||||
{
|
||||
g.DrawString(text.Substring(i, 1), netfont, brush, x, y, format);
|
||||
x += metrics.charWidth(text[i]);
|
||||
CompositingMode origCM = g.CompositingMode;
|
||||
try {
|
||||
if (origCM != CompositingMode.SourceOver) {
|
||||
// Java has a different behaviar for AlphaComposite and Text Antialiasing
|
||||
g.CompositingMode = CompositingMode.SourceOver;
|
||||
}
|
||||
|
||||
bool fractional = isFractionalMetrics();
|
||||
if (fractional || !sun.font.StandardGlyphVector.isSimpleString(font, text)) {
|
||||
g.DrawString(text, netfont, brush, x, y - baseline, FORMAT);
|
||||
} else {
|
||||
// fixed metric for simple text, we position every character to simulate the Java behaviour
|
||||
java.awt.font.FontRenderContext frc = new java.awt.font.FontRenderContext(null, isAntiAlias(), fractional);
|
||||
sun.font.FontDesignMetrics metrics = sun.font.FontDesignMetrics.getMetrics(font, frc);
|
||||
y -= baseline;
|
||||
for (int i = 0; i < text.Length; i++) {
|
||||
g.DrawString(text.Substring(i, 1), netfont, brush, x, y, FORMAT);
|
||||
x += metrics.charWidth(text[i]);
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
if (origCM != CompositingMode.SourceOver) {
|
||||
g.CompositingMode = origCM;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1345,6 +1384,9 @@ namespace ikvm.awt
|
||||
|
||||
public override void setComposite(java.awt.Composite comp)
|
||||
{
|
||||
if (javaComposite == comp) {
|
||||
return;
|
||||
}
|
||||
if (comp == null)
|
||||
{
|
||||
throw new java.lang.IllegalArgumentException("null Composite");
|
||||
@ -1750,13 +1792,13 @@ namespace ikvm.awt
|
||||
if (hintValue == java.awt.RenderingHints.VALUE_TEXT_ANTIALIAS_DEFAULT ||
|
||||
hintValue == java.awt.RenderingHints.VALUE_TEXT_ANTIALIAS_OFF)
|
||||
{
|
||||
g.TextRenderingHint = TextRenderingHint.SingleBitPerPixelGridFit;
|
||||
setTextRenderingHint(TextRenderingHint.SingleBitPerPixelGridFit);
|
||||
textAntialiasHint = hintValue;
|
||||
return;
|
||||
}
|
||||
if (hintValue == java.awt.RenderingHints.VALUE_TEXT_ANTIALIAS_ON)
|
||||
{
|
||||
g.TextRenderingHint = TextRenderingHint.AntiAlias;
|
||||
setTextRenderingHint(TextRenderingHint.AntiAlias);
|
||||
textAntialiasHint = hintValue;
|
||||
return;
|
||||
}
|
||||
@ -1933,6 +1975,71 @@ namespace ikvm.awt
|
||||
return stroke;
|
||||
}
|
||||
|
||||
internal void setTextRenderingHint(TextRenderingHint hint)
|
||||
{
|
||||
g.TextRenderingHint = hint;
|
||||
baseline = getBaseline(netfont, hint);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Caclulate the baseline from a font and a TextRenderingHint
|
||||
/// </summary>
|
||||
/// <param name="font">the font</param>
|
||||
/// <param name="hint">the used TextRenderingHint</param>
|
||||
/// <returns></returns>
|
||||
private static int getBaseline(Font font, TextRenderingHint hint)
|
||||
{
|
||||
lock (baselines)
|
||||
{
|
||||
String key = font.ToString() + hint.ToString();
|
||||
int baseline;
|
||||
if (!baselines.TryGetValue(key, out baseline))
|
||||
{
|
||||
FontFamily family = font.FontFamily;
|
||||
FontStyle style = font.Style;
|
||||
float ascent = family.GetCellAscent(style);
|
||||
float lineSpace = family.GetLineSpacing(style);
|
||||
|
||||
baseline = (int)Math.Round(font.GetHeight() * ascent / lineSpace);
|
||||
|
||||
// Until this point the calulation use only the Font. But with different TextRenderingHint there are smal differences.
|
||||
// There is no API that calulate the offset from TextRenderingHint that we messure it.
|
||||
const int w = 3;
|
||||
const int h = 3;
|
||||
|
||||
Bitmap bitmap = new Bitmap(w, h);
|
||||
Graphics g = Graphics.FromImage(bitmap);
|
||||
g.TextRenderingHint = hint;
|
||||
g.FillRectangle(new SolidBrush(Color.White), 0, 0, w, h);
|
||||
g.DrawString("A", font, new SolidBrush(Color.Black), 0, -baseline, FORMAT);
|
||||
g.DrawString("X", font, new SolidBrush(Color.Black), 0, -baseline, FORMAT);
|
||||
g.Dispose();
|
||||
|
||||
int y = 0;
|
||||
LINE:
|
||||
while (y < h)
|
||||
{
|
||||
for (int x = 0; x < w; x++)
|
||||
{
|
||||
Color color = bitmap.GetPixel(x, y);
|
||||
if (color.GetBrightness() < 0.5)
|
||||
{
|
||||
//there is a black pixel, we continue in the next line.
|
||||
baseline++;
|
||||
y++;
|
||||
goto LINE;
|
||||
}
|
||||
}
|
||||
break; // there was a line without black pixel
|
||||
}
|
||||
|
||||
|
||||
baselines[key] = baseline;
|
||||
}
|
||||
return baseline;
|
||||
}
|
||||
}
|
||||
|
||||
private bool isAntiAlias()
|
||||
{
|
||||
switch (g.TextRenderingHint)
|
||||
@ -1962,6 +2069,7 @@ namespace ikvm.awt
|
||||
Matrix currentMatrix = null;
|
||||
Font currentFont = netfont;
|
||||
TextRenderingHint currentHint = g.TextRenderingHint;
|
||||
int currentBaseline = baseline;
|
||||
try
|
||||
{
|
||||
java.awt.Font javaFont = gv.getFont();
|
||||
@ -1969,19 +2077,22 @@ namespace ikvm.awt
|
||||
{
|
||||
netfont = javaFont.getNetFont();
|
||||
}
|
||||
TextRenderingHint hint;
|
||||
if (frc.isAntiAliased()) {
|
||||
if( frc.usesFractionalMetrics() ){
|
||||
g.TextRenderingHint = TextRenderingHint.AntiAlias;
|
||||
hint = TextRenderingHint.AntiAlias;
|
||||
} else {
|
||||
g.TextRenderingHint = TextRenderingHint.AntiAliasGridFit;
|
||||
hint = TextRenderingHint.AntiAliasGridFit;
|
||||
}
|
||||
} else {
|
||||
if (frc.usesFractionalMetrics()) {
|
||||
g.TextRenderingHint = TextRenderingHint.SingleBitPerPixel;
|
||||
hint = TextRenderingHint.SingleBitPerPixel;
|
||||
} else {
|
||||
g.TextRenderingHint = TextRenderingHint.SingleBitPerPixelGridFit;
|
||||
hint = TextRenderingHint.SingleBitPerPixelGridFit;
|
||||
}
|
||||
}
|
||||
g.TextRenderingHint = hint;
|
||||
baseline = getBaseline(netfont, hint);
|
||||
if (!frc.getTransform().equals(getTransform()))
|
||||
{
|
||||
// save the old context and use the transformation from the renderContext
|
||||
@ -1994,6 +2105,7 @@ namespace ikvm.awt
|
||||
{
|
||||
// Restore the old context if needed
|
||||
g.TextRenderingHint = currentHint;
|
||||
baseline = currentBaseline;
|
||||
netfont = currentFont;
|
||||
if (currentMatrix != null)
|
||||
{
|
||||
@ -2144,14 +2256,20 @@ namespace ikvm.awt
|
||||
}
|
||||
}
|
||||
|
||||
public class NetGraphicsEnvironment : java.awt.GraphicsEnvironment
|
||||
public class NetGraphicsEnvironment : sun.java2d.SunGraphicsEnvironment
|
||||
{
|
||||
|
||||
public override bool isDisplayLocal()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// Create a bitmap with the dimensions of the argument image. Then
|
||||
// create a graphics objects from the bitmap. All paint operations will
|
||||
// then paint the bitmap.
|
||||
public override java.awt.Graphics2D createGraphics(BufferedImage bi)
|
||||
{
|
||||
return new BitmapGraphics(bi.getBitmap());
|
||||
return new BitmapGraphics(bi.getBitmap(), bi );
|
||||
}
|
||||
|
||||
public override java.awt.Font[] getAllFonts()
|
||||
|
@ -1 +1 @@
|
||||
4341b9c30b528a9c448533ed715fc437369b3561
|
||||
474cfafc92a8fad74e36e71fb612ebd44209bce8
|
15
external/ikvm/bin/ikvm.exe.manifest
vendored
Normal file
15
external/ikvm/bin/ikvm.exe.manifest
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
|
||||
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
|
||||
<application>
|
||||
<!-- Windows 8.1 -->
|
||||
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
|
||||
<!-- Windows 8 -->
|
||||
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
|
||||
<!--The ID below indicates application support for Windows 7 -->
|
||||
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
|
||||
<!--The ID below indicates application support for Windows Vista -->
|
||||
<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
|
||||
</application>
|
||||
</compatibility>
|
||||
</assembly>
|
380
external/ikvm/classpath/java/util/concurrent/atomic/Striped64.java
vendored
Normal file
380
external/ikvm/classpath/java/util/concurrent/atomic/Striped64.java
vendored
Normal file
@ -0,0 +1,380 @@
|
||||
/*
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file is available under and governed by the GNU General Public
|
||||
* License version 2 only, as published by the Free Software Foundation.
|
||||
* However, the following notice accompanied the original version of this
|
||||
* file:
|
||||
*
|
||||
* Written by Doug Lea with assistance from members of JCP JSR-166
|
||||
* Expert Group and released to the public domain, as explained at
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/
|
||||
*/
|
||||
|
||||
package java.util.concurrent.atomic;
|
||||
import java.util.function.LongBinaryOperator;
|
||||
import java.util.function.DoubleBinaryOperator;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
|
||||
/**
|
||||
* A package-local class holding common representation and mechanics
|
||||
* for classes supporting dynamic striping on 64bit values. The class
|
||||
* extends Number so that concrete subclasses must publicly do so.
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
abstract class Striped64 extends Number {
|
||||
/*
|
||||
* This class maintains a lazily-initialized table of atomically
|
||||
* updated variables, plus an extra "base" field. The table size
|
||||
* is a power of two. Indexing uses masked per-thread hash codes.
|
||||
* Nearly all declarations in this class are package-private,
|
||||
* accessed directly by subclasses.
|
||||
*
|
||||
* Table entries are of class Cell; a variant of AtomicLong padded
|
||||
* (via @sun.misc.Contended) to reduce cache contention. Padding
|
||||
* is overkill for most Atomics because they are usually
|
||||
* irregularly scattered in memory and thus don't interfere much
|
||||
* with each other. But Atomic objects residing in arrays will
|
||||
* tend to be placed adjacent to each other, and so will most
|
||||
* often share cache lines (with a huge negative performance
|
||||
* impact) without this precaution.
|
||||
*
|
||||
* In part because Cells are relatively large, we avoid creating
|
||||
* them until they are needed. When there is no contention, all
|
||||
* updates are made to the base field. Upon first contention (a
|
||||
* failed CAS on base update), the table is initialized to size 2.
|
||||
* The table size is doubled upon further contention until
|
||||
* reaching the nearest power of two greater than or equal to the
|
||||
* number of CPUS. Table slots remain empty (null) until they are
|
||||
* needed.
|
||||
*
|
||||
* A single spinlock ("cellsBusy") is used for initializing and
|
||||
* resizing the table, as well as populating slots with new Cells.
|
||||
* There is no need for a blocking lock; when the lock is not
|
||||
* available, threads try other slots (or the base). During these
|
||||
* retries, there is increased contention and reduced locality,
|
||||
* which is still better than alternatives.
|
||||
*
|
||||
* The Thread probe fields maintained via ThreadLocalRandom serve
|
||||
* as per-thread hash codes. We let them remain uninitialized as
|
||||
* zero (if they come in this way) until they contend at slot
|
||||
* 0. They are then initialized to values that typically do not
|
||||
* often conflict with others. Contention and/or table collisions
|
||||
* are indicated by failed CASes when performing an update
|
||||
* operation. Upon a collision, if the table size is less than
|
||||
* the capacity, it is doubled in size unless some other thread
|
||||
* holds the lock. If a hashed slot is empty, and lock is
|
||||
* available, a new Cell is created. Otherwise, if the slot
|
||||
* exists, a CAS is tried. Retries proceed by "double hashing",
|
||||
* using a secondary hash (Marsaglia XorShift) to try to find a
|
||||
* free slot.
|
||||
*
|
||||
* The table size is capped because, when there are more threads
|
||||
* than CPUs, supposing that each thread were bound to a CPU,
|
||||
* there would exist a perfect hash function mapping threads to
|
||||
* slots that eliminates collisions. When we reach capacity, we
|
||||
* search for this mapping by randomly varying the hash codes of
|
||||
* colliding threads. Because search is random, and collisions
|
||||
* only become known via CAS failures, convergence can be slow,
|
||||
* and because threads are typically not bound to CPUS forever,
|
||||
* may not occur at all. However, despite these limitations,
|
||||
* observed contention rates are typically low in these cases.
|
||||
*
|
||||
* It is possible for a Cell to become unused when threads that
|
||||
* once hashed to it terminate, as well as in the case where
|
||||
* doubling the table causes no thread to hash to it under
|
||||
* expanded mask. We do not try to detect or remove such cells,
|
||||
* under the assumption that for long-running instances, observed
|
||||
* contention levels will recur, so the cells will eventually be
|
||||
* needed again; and for short-lived ones, it does not matter.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Padded variant of AtomicLong supporting only raw accesses plus CAS.
|
||||
*
|
||||
* JVM intrinsics note: It would be possible to use a release-only
|
||||
* form of CAS here, if it were provided.
|
||||
*/
|
||||
@sun.misc.Contended static final class Cell {
|
||||
volatile long value;
|
||||
Cell(long x) { value = x; }
|
||||
@ikvm.internal.InterlockedCompareAndSet("value")
|
||||
final native boolean cas(long cmp, long val);
|
||||
}
|
||||
|
||||
/** Number of CPUS, to place bound on table size */
|
||||
static final int NCPU = Runtime.getRuntime().availableProcessors();
|
||||
|
||||
/**
|
||||
* Table of cells. When non-null, size is a power of 2.
|
||||
*/
|
||||
transient volatile Cell[] cells;
|
||||
|
||||
/**
|
||||
* Base value, used mainly when there is no contention, but also as
|
||||
* a fallback during table initialization races. Updated via CAS.
|
||||
*/
|
||||
transient volatile long base;
|
||||
|
||||
/**
|
||||
* Spinlock (locked via CAS) used when resizing and/or creating Cells.
|
||||
*/
|
||||
transient volatile int cellsBusy;
|
||||
|
||||
/**
|
||||
* Package-private default constructor
|
||||
*/
|
||||
Striped64() {
|
||||
}
|
||||
|
||||
/**
|
||||
* CASes the base field.
|
||||
*/
|
||||
@ikvm.internal.InterlockedCompareAndSet("base")
|
||||
final native boolean casBase(long cmp, long val);
|
||||
|
||||
/**
|
||||
* CASes the cellsBusy field from 0 to 1 to acquire lock.
|
||||
*/
|
||||
final boolean casCellsBusy() {
|
||||
return casCellsBusy(0, 1);
|
||||
}
|
||||
|
||||
@ikvm.internal.InterlockedCompareAndSet("cellsBusy")
|
||||
private native boolean casCellsBusy(int cmp, int newVal);
|
||||
|
||||
/**
|
||||
* Returns the probe value for the current thread.
|
||||
* Duplicated from ThreadLocalRandom because of packaging restrictions.
|
||||
*/
|
||||
static final int getProbe() {
|
||||
return Thread.currentThread().threadLocalRandomProbe;
|
||||
}
|
||||
|
||||
/**
|
||||
* Pseudo-randomly advances and records the given probe value for the
|
||||
* given thread.
|
||||
* Duplicated from ThreadLocalRandom because of packaging restrictions.
|
||||
*/
|
||||
static final int advanceProbe(int probe) {
|
||||
probe ^= probe << 13; // xorshift
|
||||
probe ^= probe >>> 17;
|
||||
probe ^= probe << 5;
|
||||
Thread.currentThread().threadLocalRandomProbe = probe;
|
||||
return probe;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles cases of updates involving initialization, resizing,
|
||||
* creating new Cells, and/or contention. See above for
|
||||
* explanation. This method suffers the usual non-modularity
|
||||
* problems of optimistic retry code, relying on rechecked sets of
|
||||
* reads.
|
||||
*
|
||||
* @param x the value
|
||||
* @param fn the update function, or null for add (this convention
|
||||
* avoids the need for an extra field or function in LongAdder).
|
||||
* @param wasUncontended false if CAS failed before call
|
||||
*/
|
||||
final void longAccumulate(long x, LongBinaryOperator fn,
|
||||
boolean wasUncontended) {
|
||||
int h;
|
||||
if ((h = getProbe()) == 0) {
|
||||
ThreadLocalRandom.current(); // force initialization
|
||||
h = getProbe();
|
||||
wasUncontended = true;
|
||||
}
|
||||
boolean collide = false; // True if last slot nonempty
|
||||
for (;;) {
|
||||
Cell[] as; Cell a; int n; long v;
|
||||
if ((as = cells) != null && (n = as.length) > 0) {
|
||||
if ((a = as[(n - 1) & h]) == null) {
|
||||
if (cellsBusy == 0) { // Try to attach new Cell
|
||||
Cell r = new Cell(x); // Optimistically create
|
||||
if (cellsBusy == 0 && casCellsBusy()) {
|
||||
boolean created = false;
|
||||
try { // Recheck under lock
|
||||
Cell[] rs; int m, j;
|
||||
if ((rs = cells) != null &&
|
||||
(m = rs.length) > 0 &&
|
||||
rs[j = (m - 1) & h] == null) {
|
||||
rs[j] = r;
|
||||
created = true;
|
||||
}
|
||||
} finally {
|
||||
cellsBusy = 0;
|
||||
}
|
||||
if (created)
|
||||
break;
|
||||
continue; // Slot is now non-empty
|
||||
}
|
||||
}
|
||||
collide = false;
|
||||
}
|
||||
else if (!wasUncontended) // CAS already known to fail
|
||||
wasUncontended = true; // Continue after rehash
|
||||
else if (a.cas(v = a.value, ((fn == null) ? v + x :
|
||||
fn.applyAsLong(v, x))))
|
||||
break;
|
||||
else if (n >= NCPU || cells != as)
|
||||
collide = false; // At max size or stale
|
||||
else if (!collide)
|
||||
collide = true;
|
||||
else if (cellsBusy == 0 && casCellsBusy()) {
|
||||
try {
|
||||
if (cells == as) { // Expand table unless stale
|
||||
Cell[] rs = new Cell[n << 1];
|
||||
for (int i = 0; i < n; ++i)
|
||||
rs[i] = as[i];
|
||||
cells = rs;
|
||||
}
|
||||
} finally {
|
||||
cellsBusy = 0;
|
||||
}
|
||||
collide = false;
|
||||
continue; // Retry with expanded table
|
||||
}
|
||||
h = advanceProbe(h);
|
||||
}
|
||||
else if (cellsBusy == 0 && cells == as && casCellsBusy()) {
|
||||
boolean init = false;
|
||||
try { // Initialize table
|
||||
if (cells == as) {
|
||||
Cell[] rs = new Cell[2];
|
||||
rs[h & 1] = new Cell(x);
|
||||
cells = rs;
|
||||
init = true;
|
||||
}
|
||||
} finally {
|
||||
cellsBusy = 0;
|
||||
}
|
||||
if (init)
|
||||
break;
|
||||
}
|
||||
else if (casBase(v = base, ((fn == null) ? v + x :
|
||||
fn.applyAsLong(v, x))))
|
||||
break; // Fall back on using base
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Same as longAccumulate, but injecting long/double conversions
|
||||
* in too many places to sensibly merge with long version, given
|
||||
* the low-overhead requirements of this class. So must instead be
|
||||
* maintained by copy/paste/adapt.
|
||||
*/
|
||||
final void doubleAccumulate(double x, DoubleBinaryOperator fn,
|
||||
boolean wasUncontended) {
|
||||
int h;
|
||||
if ((h = getProbe()) == 0) {
|
||||
ThreadLocalRandom.current(); // force initialization
|
||||
h = getProbe();
|
||||
wasUncontended = true;
|
||||
}
|
||||
boolean collide = false; // True if last slot nonempty
|
||||
for (;;) {
|
||||
Cell[] as; Cell a; int n; long v;
|
||||
if ((as = cells) != null && (n = as.length) > 0) {
|
||||
if ((a = as[(n - 1) & h]) == null) {
|
||||
if (cellsBusy == 0) { // Try to attach new Cell
|
||||
Cell r = new Cell(Double.doubleToRawLongBits(x));
|
||||
if (cellsBusy == 0 && casCellsBusy()) {
|
||||
boolean created = false;
|
||||
try { // Recheck under lock
|
||||
Cell[] rs; int m, j;
|
||||
if ((rs = cells) != null &&
|
||||
(m = rs.length) > 0 &&
|
||||
rs[j = (m - 1) & h] == null) {
|
||||
rs[j] = r;
|
||||
created = true;
|
||||
}
|
||||
} finally {
|
||||
cellsBusy = 0;
|
||||
}
|
||||
if (created)
|
||||
break;
|
||||
continue; // Slot is now non-empty
|
||||
}
|
||||
}
|
||||
collide = false;
|
||||
}
|
||||
else if (!wasUncontended) // CAS already known to fail
|
||||
wasUncontended = true; // Continue after rehash
|
||||
else if (a.cas(v = a.value,
|
||||
((fn == null) ?
|
||||
Double.doubleToRawLongBits
|
||||
(Double.longBitsToDouble(v) + x) :
|
||||
Double.doubleToRawLongBits
|
||||
(fn.applyAsDouble
|
||||
(Double.longBitsToDouble(v), x)))))
|
||||
break;
|
||||
else if (n >= NCPU || cells != as)
|
||||
collide = false; // At max size or stale
|
||||
else if (!collide)
|
||||
collide = true;
|
||||
else if (cellsBusy == 0 && casCellsBusy()) {
|
||||
try {
|
||||
if (cells == as) { // Expand table unless stale
|
||||
Cell[] rs = new Cell[n << 1];
|
||||
for (int i = 0; i < n; ++i)
|
||||
rs[i] = as[i];
|
||||
cells = rs;
|
||||
}
|
||||
} finally {
|
||||
cellsBusy = 0;
|
||||
}
|
||||
collide = false;
|
||||
continue; // Retry with expanded table
|
||||
}
|
||||
h = advanceProbe(h);
|
||||
}
|
||||
else if (cellsBusy == 0 && cells == as && casCellsBusy()) {
|
||||
boolean init = false;
|
||||
try { // Initialize table
|
||||
if (cells == as) {
|
||||
Cell[] rs = new Cell[2];
|
||||
rs[h & 1] = new Cell(Double.doubleToRawLongBits(x));
|
||||
cells = rs;
|
||||
init = true;
|
||||
}
|
||||
} finally {
|
||||
cellsBusy = 0;
|
||||
}
|
||||
if (init)
|
||||
break;
|
||||
}
|
||||
else if (casBase(v = base,
|
||||
((fn == null) ?
|
||||
Double.doubleToRawLongBits
|
||||
(Double.longBitsToDouble(v) + x) :
|
||||
Double.doubleToRawLongBits
|
||||
(fn.applyAsDouble
|
||||
(Double.longBitsToDouble(v), x)))))
|
||||
break; // Fall back on using base
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
5
external/ikvm/ikvmc.8.csproj
vendored
5
external/ikvm/ikvmc.8.csproj
vendored
@ -35,7 +35,7 @@
|
||||
<CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
|
||||
<ConfigurationOverrideFile>
|
||||
</ConfigurationOverrideFile>
|
||||
<DefineConstants>TRACE;DEBUG;STATIC_COMPILER;IKVM_REF_EMIT</DefineConstants>
|
||||
<DefineConstants>TRACE;DEBUG;STATIC_COMPILER;EMITTERS</DefineConstants>
|
||||
<DocumentationFile>
|
||||
</DocumentationFile>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
@ -91,6 +91,7 @@
|
||||
<Compile Include="runtime\BigEndianBinaryReader.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="runtime\Boxer.cs" />
|
||||
<Compile Include="runtime\ByteCode.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
@ -119,10 +120,12 @@
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="runtime\JsrInliner.cs" />
|
||||
<Compile Include="runtime\LambdaMetafactory.cs" />
|
||||
<Compile Include="runtime\LocalVars.cs" />
|
||||
<Compile Include="runtime\MemberWrapper.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="runtime\MethodHandleUtil.cs" />
|
||||
<Compile Include="runtime\profiler.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
|
111
external/ikvm/ikvmc/AotTypeWrapper.cs
vendored
111
external/ikvm/ikvmc/AotTypeWrapper.cs
vendored
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (C) 2002-2009 Jeroen Frijters
|
||||
Copyright (C) 2002-2014 Jeroen Frijters
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
@ -48,14 +48,14 @@ namespace IKVM.Internal
|
||||
private WorkaroundBaseClass workaroundBaseClass;
|
||||
|
||||
internal AotTypeWrapper(ClassFile f, CompilerClassLoader loader)
|
||||
: base(f, loader, null)
|
||||
: base(null, f, loader, null)
|
||||
{
|
||||
}
|
||||
|
||||
protected override Type GetBaseTypeForDefineType()
|
||||
{
|
||||
TypeWrapper baseTypeWrapper = BaseTypeWrapper;
|
||||
if (this.IsPublic && this.IsAbstract && baseTypeWrapper.IsPublic && baseTypeWrapper.IsAbstract)
|
||||
if (this.IsPublic && this.IsAbstract && baseTypeWrapper.IsPublic && baseTypeWrapper.IsAbstract && classLoader.WorkaroundAbstractMethodWidening)
|
||||
{
|
||||
// FXBUG
|
||||
// if the current class widens access on an abstract base class method,
|
||||
@ -78,7 +78,7 @@ namespace IKVM.Internal
|
||||
}
|
||||
if (methods != null)
|
||||
{
|
||||
string name = "__WorkaroundBaseClass__." + Name;
|
||||
string name = "__WorkaroundBaseClass__." + UnicodeUtil.EscapeInvalidSurrogates(Name);
|
||||
while (!classLoader.ReserveName(name))
|
||||
{
|
||||
name = "_" + name;
|
||||
@ -297,10 +297,7 @@ namespace IKVM.Internal
|
||||
}
|
||||
if(!found)
|
||||
{
|
||||
FieldWrapper[] newFields = new FieldWrapper[fields.Length + 1];
|
||||
Array.Copy(fields, newFields, fields.Length);
|
||||
fields = newFields;
|
||||
fields[fields.Length - 1] = FieldWrapper.Create(this, null, null, field.Name, field.Sig, new ExModifiers((Modifiers)field.Modifiers, false));
|
||||
fields = ArrayUtil.Concat(fields, FieldWrapper.Create(this, null, null, field.Name, field.Sig, new ExModifiers((Modifiers)field.Modifiers, false)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -471,9 +468,7 @@ namespace IKVM.Internal
|
||||
if(setter != null)
|
||||
{
|
||||
MethodWrapper mw = setter;
|
||||
Type[] args = new Type[indexer.Length + 1];
|
||||
indexer.CopyTo(args, 0);
|
||||
args[args.Length - 1] = typeWrapper.TypeAsSignatureType;
|
||||
Type[] args = ArrayUtil.Concat(indexer, typeWrapper.TypeAsSignatureType);
|
||||
if(!CheckPropertyArgs(args, mw.GetParametersForDefineMethod()))
|
||||
{
|
||||
Console.Error.WriteLine("Warning: ignoring invalid property setter for {0}::{1}", clazz.Name, prop.Name);
|
||||
@ -512,36 +507,6 @@ namespace IKVM.Internal
|
||||
}
|
||||
}
|
||||
|
||||
protected override bool IsPInvokeMethod(ClassFile.Method m)
|
||||
{
|
||||
Dictionary<string, IKVM.Internal.MapXml.Class> mapxml = classLoader.GetMapXmlClasses();
|
||||
if(mapxml != null)
|
||||
{
|
||||
IKVM.Internal.MapXml.Class clazz;
|
||||
if(mapxml.TryGetValue(this.Name, out clazz) && clazz.Methods != null)
|
||||
{
|
||||
foreach(IKVM.Internal.MapXml.Method method in clazz.Methods)
|
||||
{
|
||||
if(method.Name == m.Name && method.Sig == m.Signature)
|
||||
{
|
||||
if(method.Attributes != null)
|
||||
{
|
||||
foreach(IKVM.Internal.MapXml.Attribute attr in method.Attributes)
|
||||
{
|
||||
if(StaticCompiler.GetType(classLoader, attr.Type) == JVM.Import(typeof(System.Runtime.InteropServices.DllImportAttribute)))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return base.IsPInvokeMethod(m);
|
||||
}
|
||||
|
||||
private static void MapModifiers(MapXml.MapModifiers mapmods, bool isConstructor, out bool setmodifiers, ref MethodAttributes attribs)
|
||||
{
|
||||
setmodifiers = false;
|
||||
@ -716,14 +681,14 @@ namespace IKVM.Internal
|
||||
// are we adding a new method?
|
||||
if(GetMethodWrapper(method.Name, method.Sig, false) == null)
|
||||
{
|
||||
if(method.body == null)
|
||||
bool setmodifiers = false;
|
||||
MethodAttributes attribs = method.MethodAttributes;
|
||||
MapModifiers(method.Modifiers, false, out setmodifiers, ref attribs);
|
||||
if(method.body == null && (attribs & MethodAttributes.Abstract) == 0)
|
||||
{
|
||||
Console.Error.WriteLine("Error: Method {0}.{1}{2} in xml remap file doesn't have a body.", clazz.Name, method.Name, method.Sig);
|
||||
continue;
|
||||
}
|
||||
bool setmodifiers = false;
|
||||
MethodAttributes attribs = method.MethodAttributes;
|
||||
MapModifiers(method.Modifiers, false, out setmodifiers, ref attribs);
|
||||
Type returnType;
|
||||
Type[] parameterTypes;
|
||||
MapSignature(method.Sig, out returnType, out parameterTypes);
|
||||
@ -739,9 +704,12 @@ namespace IKVM.Internal
|
||||
typeBuilder.DefineMethodOverride(mb, (MethodInfo)mw.GetMethod());
|
||||
}
|
||||
CompilerClassLoader.AddDeclaredExceptions(mb, method.throws);
|
||||
CodeEmitter ilgen = CodeEmitter.Create(mb);
|
||||
method.Emit(classLoader, ilgen);
|
||||
ilgen.DoEmit();
|
||||
if(method.body != null)
|
||||
{
|
||||
CodeEmitter ilgen = CodeEmitter.Create(mb);
|
||||
method.Emit(classLoader, ilgen);
|
||||
ilgen.DoEmit();
|
||||
}
|
||||
if(method.Attributes != null)
|
||||
{
|
||||
foreach(IKVM.Internal.MapXml.Attribute attr in method.Attributes)
|
||||
@ -804,11 +772,14 @@ namespace IKVM.Internal
|
||||
}
|
||||
}
|
||||
|
||||
protected override MethodBuilder DefineGhostMethod(string name, MethodAttributes attribs, MethodWrapper mw)
|
||||
protected override MethodBuilder DefineGhostMethod(TypeBuilder typeBuilder, string name, MethodAttributes attribs, MethodWrapper mw)
|
||||
{
|
||||
if(typeBuilderGhostInterface != null)
|
||||
if(typeBuilderGhostInterface != null && mw.IsVirtual)
|
||||
{
|
||||
return mw.GetDefineMethodHelper().DefineMethod(this, typeBuilderGhostInterface, name, attribs);
|
||||
DefineMethodHelper helper = mw.GetDefineMethodHelper();
|
||||
MethodBuilder stub = helper.DefineMethod(this, typeBuilder, name, MethodAttributes.Public);
|
||||
((GhostMethodWrapper)mw).SetGhostMethod(stub);
|
||||
return helper.DefineMethod(this, typeBuilderGhostInterface, name, attribs);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -820,11 +791,12 @@ namespace IKVM.Internal
|
||||
// TODO consider adding methods from base interface and java.lang.Object as well
|
||||
for(int i = 0; i < methods.Length; i++)
|
||||
{
|
||||
// skip <clinit>
|
||||
if(!methods[i].IsStatic)
|
||||
// skip <clinit> and non-virtual interface methods introduced in Java 8
|
||||
GhostMethodWrapper gmw = methods[i] as GhostMethodWrapper;
|
||||
if(gmw != null)
|
||||
{
|
||||
TypeWrapper[] args = methods[i].GetParameters();
|
||||
MethodBuilder stub = methods[i].GetDefineMethodHelper().DefineMethod(this, typeBuilder, methods[i].Name, MethodAttributes.Public);
|
||||
MethodBuilder stub = gmw.GetGhostMethod();
|
||||
AddParameterMetadata(stub, methods[i]);
|
||||
AttributeHelper.SetModifiers(stub, methods[i].Modifiers, methods[i].IsInternal);
|
||||
CodeEmitter ilgen = CodeEmitter.Create(stub);
|
||||
@ -850,13 +822,32 @@ namespace IKVM.Internal
|
||||
ilgen.Emit(OpCodes.Isinst, implementers[j].TypeAsTBD);
|
||||
label = ilgen.DefineLabel();
|
||||
ilgen.EmitBrfalse(label);
|
||||
ilgen.Emit(OpCodes.Castclass, implementers[j].TypeAsTBD);
|
||||
for(int k = 0; k < args.Length; k++)
|
||||
{
|
||||
ilgen.EmitLdarg(k + 1);
|
||||
}
|
||||
MethodWrapper mw = implementers[j].GetMethodWrapper(methods[i].Name, methods[i].Signature, true);
|
||||
mw.EmitCallvirt(ilgen);
|
||||
if(mw == null)
|
||||
{
|
||||
if(methods[i].IsAbstract)
|
||||
{
|
||||
// This should only happen for remapped types (defined in map.xml), because normally you'd get a miranda method.
|
||||
throw new FatalCompilerErrorException(Message.GhostInterfaceMethodMissing, implementers[j].Name, Name, methods[i].Name, methods[i].Signature);
|
||||
}
|
||||
// We're inheriting a default method
|
||||
ilgen.Emit(OpCodes.Pop);
|
||||
ilgen.Emit(OpCodes.Ldarg_0);
|
||||
for (int k = 0; k < args.Length; k++)
|
||||
{
|
||||
ilgen.EmitLdarg(k + 1);
|
||||
}
|
||||
ilgen.Emit(OpCodes.Call, DefaultInterfaceMethodWrapper.GetImpl(methods[i]));
|
||||
}
|
||||
else
|
||||
{
|
||||
ilgen.Emit(OpCodes.Castclass, implementers[j].TypeAsTBD);
|
||||
for (int k = 0; k < args.Length; k++)
|
||||
{
|
||||
ilgen.EmitLdarg(k + 1);
|
||||
}
|
||||
mw.EmitCallvirt(ilgen);
|
||||
}
|
||||
ilgen.EmitBr(end);
|
||||
ilgen.MarkLabel(label);
|
||||
}
|
||||
|
85
external/ikvm/ikvmc/Compiler.cs
vendored
85
external/ikvm/ikvmc/Compiler.cs
vendored
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (C) 2002-2013 Jeroen Frijters
|
||||
Copyright (C) 2002-2014 Jeroen Frijters
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
@ -156,6 +156,13 @@ sealed class FatalCompilerErrorException : Exception
|
||||
return "The type '{0}' is defined in an assembly that is not referenced. You must add a reference to assembly '{1}'";
|
||||
case IKVM.Internal.Message.FileNotFound:
|
||||
return "File not found: {0}";
|
||||
case IKVM.Internal.Message.RuntimeMethodMissing:
|
||||
return "Runtime method '{0}' not found";
|
||||
case IKVM.Internal.Message.MapFileFieldNotFound:
|
||||
return "Field '{0}' referenced in remap file was not found in class '{1}'";
|
||||
case IKVM.Internal.Message.GhostInterfaceMethodMissing:
|
||||
return "Remapped class '{0}' does not implement ghost interface method\n" +
|
||||
"\t({1}.{2}{3})";
|
||||
default:
|
||||
return "Missing Error Message. Please file a bug.";
|
||||
}
|
||||
@ -167,7 +174,6 @@ sealed class IkvmcCompiler
|
||||
private bool nonleaf;
|
||||
private string manifestMainClass;
|
||||
private string defaultAssemblyName;
|
||||
private List<string> classesToExclude = new List<string>();
|
||||
private static bool time;
|
||||
private static string runtimeAssembly;
|
||||
private static bool nostdlib;
|
||||
@ -515,6 +521,8 @@ sealed class IkvmcCompiler
|
||||
Console.Error.WriteLine("-lib:<dir> Additional directories to search for references");
|
||||
Console.Error.WriteLine("-highentropyva Enable high entropy ASLR");
|
||||
Console.Error.WriteLine("-static Disable dynamic binding");
|
||||
Console.Error.WriteLine("-assemblyattributes:<file> Read assembly custom attributes from specified");
|
||||
Console.Error.WriteLine(" class file.");
|
||||
}
|
||||
|
||||
void ParseCommandLine(IEnumerator<string> arglist, List<CompilerOptions> targets, CompilerOptions options)
|
||||
@ -543,7 +551,6 @@ sealed class IkvmcCompiler
|
||||
IkvmcCompiler nestedLevel = new IkvmcCompiler();
|
||||
nestedLevel.manifestMainClass = manifestMainClass;
|
||||
nestedLevel.defaultAssemblyName = defaultAssemblyName;
|
||||
nestedLevel.classesToExclude = new List<string>(classesToExclude);
|
||||
nestedLevel.ContinueParseCommandLine(arglist, targets, options.Copy());
|
||||
}
|
||||
else if(s == "}")
|
||||
@ -775,7 +782,7 @@ sealed class IkvmcCompiler
|
||||
}
|
||||
else if(s.StartsWith("-exclude:"))
|
||||
{
|
||||
ProcessExclusionFile(classesToExclude, s.Substring(9));
|
||||
ProcessExclusionFile(ref options.classesToExclude, s.Substring(9));
|
||||
}
|
||||
else if(s.StartsWith("-version:"))
|
||||
{
|
||||
@ -977,12 +984,25 @@ sealed class IkvmcCompiler
|
||||
}
|
||||
else if(s == "-static")
|
||||
{
|
||||
options.codegenoptions |= CodeGenOptions.DisableDynamicBinding;
|
||||
// we abuse -static to also enable support for NoRefEmit scenarios
|
||||
options.codegenoptions |= CodeGenOptions.DisableDynamicBinding | CodeGenOptions.NoRefEmitHelpers;
|
||||
}
|
||||
else if(s == "-nojarstubs") // undocumented temporary option to mitigate risk
|
||||
{
|
||||
options.nojarstubs = true;
|
||||
}
|
||||
else if(s.StartsWith("-assemblyattributes:", StringComparison.Ordinal))
|
||||
{
|
||||
ProcessAttributeAnnotationsClass(ref options.assemblyAttributeAnnotations, s.Substring(20));
|
||||
}
|
||||
else if(s == "-w4") // undocumented option to always warn if a class isn't found
|
||||
{
|
||||
options.warningLevelHigh = true;
|
||||
}
|
||||
else if(s == "-noparameterreflection") // undocumented option to compile core class libraries with, to disable MethodParameter attribute
|
||||
{
|
||||
options.noParameterReflection = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new FatalCompilerErrorException(Message.UnrecognizedOption, s);
|
||||
@ -1032,7 +1052,6 @@ sealed class IkvmcCompiler
|
||||
StaticCompiler.IssueMessage(options, Message.MainMethodFromManifest, manifestMainClass);
|
||||
options.mainClass = manifestMainClass;
|
||||
}
|
||||
options.classesToExclude = classesToExclude.ToArray();
|
||||
targets.Add(options);
|
||||
}
|
||||
|
||||
@ -1180,7 +1199,7 @@ sealed class IkvmcCompiler
|
||||
{
|
||||
foreach (CompilerOptions peer in targets)
|
||||
{
|
||||
if (peer.assembly.Equals(reference, StringComparison.InvariantCultureIgnoreCase))
|
||||
if (peer.assembly.Equals(reference, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
ArrayAppend(ref target.peerReferences, peer.assembly);
|
||||
goto next_reference;
|
||||
@ -1238,10 +1257,22 @@ sealed class IkvmcCompiler
|
||||
}
|
||||
else
|
||||
{
|
||||
T[] temp = new T[array.Length + 1];
|
||||
Array.Copy(array, 0, temp, 0, array.Length);
|
||||
temp[temp.Length - 1] = element;
|
||||
array = temp;
|
||||
array = ArrayUtil.Concat(array, element);
|
||||
}
|
||||
}
|
||||
|
||||
private static void ArrayAppend<T>(ref T[] array, T[] append)
|
||||
{
|
||||
if (array == null)
|
||||
{
|
||||
array = append;
|
||||
}
|
||||
else if (append != null)
|
||||
{
|
||||
T[] tmp = new T[array.Length + append.Length];
|
||||
Array.Copy(array, tmp, array.Length);
|
||||
Array.Copy(append, 0, tmp, array.Length, append.Length);
|
||||
array = tmp;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1262,7 +1293,7 @@ sealed class IkvmcCompiler
|
||||
ClassFile cf;
|
||||
try
|
||||
{
|
||||
cf = new ClassFile(buf, 0, buf.Length, "<unknown>", ClassFileParseOptions.None);
|
||||
cf = new ClassFile(buf, 0, buf.Length, "<unknown>", ClassFileParseOptions.None, null);
|
||||
}
|
||||
catch (ClassFormatError)
|
||||
{
|
||||
@ -1290,7 +1321,7 @@ sealed class IkvmcCompiler
|
||||
return true;
|
||||
}
|
||||
|
||||
private static bool IsStubLegacy(CompilerOptions options, ZipEntry ze, byte[] data)
|
||||
private static bool IsExcludedOrStubLegacy(CompilerOptions options, ZipEntry ze, byte[] data)
|
||||
{
|
||||
if (ze.Name.EndsWith(".class", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
@ -1298,7 +1329,7 @@ sealed class IkvmcCompiler
|
||||
{
|
||||
bool stub;
|
||||
string name = ClassFile.GetClassName(data, 0, data.Length, out stub);
|
||||
if (stub && EmitStubWarning(options, data))
|
||||
if (options.IsExcludedClass(name) || (stub && EmitStubWarning(options, data)))
|
||||
{
|
||||
// we use stubs to add references, but otherwise ignore them
|
||||
return true;
|
||||
@ -1356,7 +1387,7 @@ sealed class IkvmcCompiler
|
||||
{
|
||||
found = true;
|
||||
byte[] data = ReadFromZip(zf, ze);
|
||||
if (IsStubLegacy(options, ze, data))
|
||||
if (IsExcludedOrStubLegacy(options, ze, data))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@ -1405,6 +1436,10 @@ sealed class IkvmcCompiler
|
||||
{
|
||||
bool stub;
|
||||
string name = ClassFile.GetClassName(data, 0, data.Length, out stub);
|
||||
if (options.IsExcludedClass(name))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (stub && EmitStubWarning(options, data))
|
||||
{
|
||||
// we use stubs to add references, but otherwise ignore them
|
||||
@ -1474,10 +1509,11 @@ sealed class IkvmcCompiler
|
||||
}
|
||||
|
||||
//This processes an exclusion file with a single regular expression per line
|
||||
private static void ProcessExclusionFile(List<string> classesToExclude, String filename)
|
||||
private static void ProcessExclusionFile(ref string[] classesToExclude, string filename)
|
||||
{
|
||||
try
|
||||
{
|
||||
List<string> list = classesToExclude == null ? new List<string>() : new List<string>(classesToExclude);
|
||||
using(StreamReader file = new StreamReader(filename))
|
||||
{
|
||||
String line;
|
||||
@ -1486,14 +1522,29 @@ sealed class IkvmcCompiler
|
||||
line = line.Trim();
|
||||
if(!line.StartsWith("//") && line.Length != 0)
|
||||
{
|
||||
classesToExclude.Add(line);
|
||||
list.Add(line);
|
||||
}
|
||||
}
|
||||
}
|
||||
classesToExclude = list.ToArray();
|
||||
}
|
||||
catch(Exception x)
|
||||
{
|
||||
throw new FatalCompilerErrorException(Message.ErrorReadingFile, filename, x.Message);
|
||||
}
|
||||
}
|
||||
|
||||
private static void ProcessAttributeAnnotationsClass(ref object[] annotations, string filename)
|
||||
{
|
||||
try
|
||||
{
|
||||
byte[] buf = File.ReadAllBytes(filename);
|
||||
ClassFile cf = new ClassFile(buf, 0, buf.Length, null, ClassFileParseOptions.None, null);
|
||||
ArrayAppend(ref annotations, cf.Annotations);
|
||||
}
|
||||
catch (Exception x)
|
||||
{
|
||||
throw new FatalCompilerErrorException(Message.ErrorReadingFile, filename, x.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
e7247c17ca6a6a7139699d9fdb9ddf15796f40b4
|
||||
b71e0f94bba2f37126b0c66cbd774ef9d76cd588
|
191
external/ikvm/ikvmc/Proxy.cs
vendored
191
external/ikvm/ikvmc/Proxy.cs
vendored
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (C) 2011 Jeroen Frijters
|
||||
Copyright (C) 2011-2014 Jeroen Frijters
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
@ -23,6 +23,7 @@
|
||||
*/
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using IKVM.Attributes;
|
||||
using IKVM.Reflection;
|
||||
using IKVM.Reflection.Emit;
|
||||
using Type = IKVM.Reflection.Type;
|
||||
@ -143,6 +144,7 @@ namespace IKVM.Internal
|
||||
// Check for duplicates
|
||||
if (!MethodExists(methods, mw))
|
||||
{
|
||||
mw.Link();
|
||||
methods.Add(mw);
|
||||
}
|
||||
}
|
||||
@ -220,9 +222,20 @@ namespace IKVM.Internal
|
||||
|
||||
private static void CreateNoFail(CompilerClassLoader loader, TypeWrapper[] interfaces, List<ProxyMethod> methods)
|
||||
{
|
||||
bool ispublic = true;
|
||||
Type[] interfaceTypes = new Type[interfaces.Length];
|
||||
for (int i = 0; i < interfaceTypes.Length; i++)
|
||||
{
|
||||
ispublic &= interfaces[i].IsPublic;
|
||||
interfaceTypes[i] = interfaces[i].TypeAsBaseType;
|
||||
}
|
||||
TypeAttributes attr = TypeAttributes.Class | TypeAttributes.Sealed;
|
||||
attr |= ispublic ? TypeAttributes.NestedPublic : TypeAttributes.NestedAssembly;
|
||||
DynamicClassLoader factory = (DynamicClassLoader)loader.GetTypeWrapperFactory();
|
||||
TypeBuilder tb = factory.DefineProxy(proxyClass, interfaces);
|
||||
TypeBuilder tb = factory.DefineProxy(TypeNameUtil.GetProxyNestedName(interfaces), attr, proxyClass.TypeAsBaseType, interfaceTypes);
|
||||
AttributeHelper.SetImplementsAttribute(tb, interfaces);
|
||||
// we apply an InnerClass attribute to avoid the CompiledTypeWrapper heuristics for figuring out the modifiers
|
||||
AttributeHelper.SetInnerClass(tb, null, ispublic ? Modifiers.Public | Modifiers.Final : Modifiers.Final);
|
||||
CreateConstructor(tb);
|
||||
for (int i = 0; i < methods.Count; i++)
|
||||
{
|
||||
@ -232,7 +245,7 @@ namespace IKVM.Internal
|
||||
{
|
||||
CreateMethod(loader, tb, method);
|
||||
}
|
||||
CreateStaticInitializer(tb, methods);
|
||||
CreateStaticInitializer(tb, methods, loader);
|
||||
}
|
||||
|
||||
private static void CreateConstructor(TypeBuilder tb)
|
||||
@ -297,7 +310,7 @@ namespace IKVM.Internal
|
||||
}
|
||||
else if (returnType.IsPrimitive)
|
||||
{
|
||||
Boxer.EmitUnbox(ilgen, returnType);
|
||||
Boxer.EmitUnbox(ilgen, returnType, true);
|
||||
}
|
||||
else if (returnType != CoreClasses.java.lang.Object.Wrapper)
|
||||
{
|
||||
@ -341,9 +354,9 @@ namespace IKVM.Internal
|
||||
ilgen.DoEmit();
|
||||
}
|
||||
|
||||
private static void CreateStaticInitializer(TypeBuilder tb, List<ProxyMethod> methods)
|
||||
private static void CreateStaticInitializer(TypeBuilder tb, List<ProxyMethod> methods, CompilerClassLoader loader)
|
||||
{
|
||||
CodeEmitter ilgen = CodeEmitter.Create(ReflectUtil.DefineTypeInitializer(tb));
|
||||
CodeEmitter ilgen = CodeEmitter.Create(ReflectUtil.DefineTypeInitializer(tb, loader));
|
||||
CodeEmitterLocal callerID = ilgen.DeclareLocal(CoreClasses.ikvm.@internal.CallerID.Wrapper.TypeAsSignatureType);
|
||||
TypeBuilder tbCallerID = DynamicTypeWrapper.FinishContext.EmitCreateCallerID(tb, ilgen);
|
||||
ilgen.Emit(OpCodes.Stloc, callerID);
|
||||
@ -401,7 +414,10 @@ namespace IKVM.Internal
|
||||
Dictionary<string, MethodWrapper> methods = new Dictionary<string, MethodWrapper>();
|
||||
foreach (MethodWrapper mw in tw.GetMethods())
|
||||
{
|
||||
methods.Add(mw.Name + mw.Signature, mw);
|
||||
if (mw.IsVirtual)
|
||||
{
|
||||
methods.Add(mw.Name + mw.Signature, mw);
|
||||
}
|
||||
}
|
||||
foreach (TypeWrapper iface in tw.Interfaces)
|
||||
{
|
||||
@ -438,165 +454,4 @@ namespace IKVM.Internal
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static class Boxer
|
||||
{
|
||||
private static readonly TypeWrapper javaLangByte;
|
||||
private static readonly MethodWrapper byteValue;
|
||||
private static readonly MethodWrapper valueOfByte;
|
||||
private static readonly TypeWrapper javaLangBoolean;
|
||||
private static readonly MethodWrapper booleanValue;
|
||||
private static readonly MethodWrapper valueOfBoolean;
|
||||
private static readonly TypeWrapper javaLangShort;
|
||||
private static readonly MethodWrapper shortValue;
|
||||
private static readonly MethodWrapper valueOfShort;
|
||||
private static readonly TypeWrapper javaLangCharacter;
|
||||
private static readonly MethodWrapper charValue;
|
||||
private static readonly MethodWrapper valueOfCharacter;
|
||||
private static readonly TypeWrapper javaLangInteger;
|
||||
private static readonly MethodWrapper intValue;
|
||||
private static readonly MethodWrapper valueOfInteger;
|
||||
private static readonly TypeWrapper javaLangFloat;
|
||||
private static readonly MethodWrapper floatValue;
|
||||
private static readonly MethodWrapper valueOfFloat;
|
||||
private static readonly TypeWrapper javaLangLong;
|
||||
private static readonly MethodWrapper longValue;
|
||||
private static readonly MethodWrapper valueOfLong;
|
||||
private static readonly TypeWrapper javaLangDouble;
|
||||
private static readonly MethodWrapper doubleValue;
|
||||
private static readonly MethodWrapper valueOfDouble;
|
||||
|
||||
static Boxer()
|
||||
{
|
||||
ClassLoaderWrapper bootClassLoader = ClassLoaderWrapper.GetBootstrapClassLoader();
|
||||
javaLangByte = bootClassLoader.LoadClassByDottedNameFast("java.lang.Byte");
|
||||
byteValue = javaLangByte.GetMethodWrapper("byteValue", "()B", false);
|
||||
byteValue.Link();
|
||||
valueOfByte = javaLangByte.GetMethodWrapper("valueOf", "(B)Ljava.lang.Byte;", false);
|
||||
valueOfByte.Link();
|
||||
javaLangBoolean = bootClassLoader.LoadClassByDottedNameFast("java.lang.Boolean");
|
||||
booleanValue = javaLangBoolean.GetMethodWrapper("booleanValue", "()Z", false);
|
||||
booleanValue.Link();
|
||||
valueOfBoolean = javaLangBoolean.GetMethodWrapper("valueOf", "(Z)Ljava.lang.Boolean;", false);
|
||||
valueOfBoolean.Link();
|
||||
javaLangShort = bootClassLoader.LoadClassByDottedNameFast("java.lang.Short");
|
||||
shortValue = javaLangShort.GetMethodWrapper("shortValue", "()S", false);
|
||||
shortValue.Link();
|
||||
valueOfShort = javaLangShort.GetMethodWrapper("valueOf", "(S)Ljava.lang.Short;", false);
|
||||
valueOfShort.Link();
|
||||
javaLangCharacter = bootClassLoader.LoadClassByDottedNameFast("java.lang.Character");
|
||||
charValue = javaLangCharacter.GetMethodWrapper("charValue", "()C", false);
|
||||
charValue.Link();
|
||||
valueOfCharacter = javaLangCharacter.GetMethodWrapper("valueOf", "(C)Ljava.lang.Character;", false);
|
||||
valueOfCharacter.Link();
|
||||
javaLangInteger = bootClassLoader.LoadClassByDottedNameFast("java.lang.Integer");
|
||||
intValue = javaLangInteger.GetMethodWrapper("intValue", "()I", false);
|
||||
intValue.Link();
|
||||
valueOfInteger = javaLangInteger.GetMethodWrapper("valueOf", "(I)Ljava.lang.Integer;", false);
|
||||
valueOfInteger.Link();
|
||||
javaLangFloat = bootClassLoader.LoadClassByDottedNameFast("java.lang.Float");
|
||||
floatValue = javaLangFloat.GetMethodWrapper("floatValue", "()F", false);
|
||||
floatValue.Link();
|
||||
valueOfFloat = javaLangFloat.GetMethodWrapper("valueOf", "(F)Ljava.lang.Float;", false);
|
||||
valueOfFloat.Link();
|
||||
javaLangLong = bootClassLoader.LoadClassByDottedNameFast("java.lang.Long");
|
||||
longValue = javaLangLong.GetMethodWrapper("longValue", "()J", false);
|
||||
longValue.Link();
|
||||
valueOfLong = javaLangLong.GetMethodWrapper("valueOf", "(J)Ljava.lang.Long;", false);
|
||||
valueOfLong.Link();
|
||||
javaLangDouble = bootClassLoader.LoadClassByDottedNameFast("java.lang.Double");
|
||||
doubleValue = javaLangDouble.GetMethodWrapper("doubleValue", "()D", false);
|
||||
doubleValue.Link();
|
||||
valueOfDouble = javaLangDouble.GetMethodWrapper("valueOf", "(D)Ljava.lang.Double;", false);
|
||||
valueOfDouble.Link();
|
||||
}
|
||||
|
||||
internal static void EmitUnbox(CodeEmitter ilgen, TypeWrapper tw)
|
||||
{
|
||||
if (tw == PrimitiveTypeWrapper.BYTE)
|
||||
{
|
||||
javaLangByte.EmitCheckcast(ilgen);
|
||||
byteValue.EmitCall(ilgen);
|
||||
}
|
||||
else if (tw == PrimitiveTypeWrapper.BOOLEAN)
|
||||
{
|
||||
javaLangBoolean.EmitCheckcast(ilgen);
|
||||
booleanValue.EmitCall(ilgen);
|
||||
}
|
||||
else if (tw == PrimitiveTypeWrapper.SHORT)
|
||||
{
|
||||
javaLangShort.EmitCheckcast(ilgen);
|
||||
shortValue.EmitCall(ilgen);
|
||||
}
|
||||
else if (tw == PrimitiveTypeWrapper.CHAR)
|
||||
{
|
||||
javaLangCharacter.EmitCheckcast(ilgen);
|
||||
charValue.EmitCall(ilgen);
|
||||
}
|
||||
else if (tw == PrimitiveTypeWrapper.INT)
|
||||
{
|
||||
javaLangInteger.EmitCheckcast(ilgen);
|
||||
intValue.EmitCall(ilgen);
|
||||
}
|
||||
else if (tw == PrimitiveTypeWrapper.FLOAT)
|
||||
{
|
||||
javaLangFloat.EmitCheckcast(ilgen);
|
||||
floatValue.EmitCall(ilgen);
|
||||
}
|
||||
else if (tw == PrimitiveTypeWrapper.LONG)
|
||||
{
|
||||
javaLangLong.EmitCheckcast(ilgen);
|
||||
longValue.EmitCall(ilgen);
|
||||
}
|
||||
else if (tw == PrimitiveTypeWrapper.DOUBLE)
|
||||
{
|
||||
javaLangDouble.EmitCheckcast(ilgen);
|
||||
doubleValue.EmitCall(ilgen);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new InvalidOperationException();
|
||||
}
|
||||
}
|
||||
|
||||
internal static void EmitBox(CodeEmitter ilgen, TypeWrapper tw)
|
||||
{
|
||||
if (tw == PrimitiveTypeWrapper.BYTE)
|
||||
{
|
||||
valueOfByte.EmitCall(ilgen);
|
||||
}
|
||||
else if (tw == PrimitiveTypeWrapper.BOOLEAN)
|
||||
{
|
||||
valueOfBoolean.EmitCall(ilgen);
|
||||
}
|
||||
else if (tw == PrimitiveTypeWrapper.SHORT)
|
||||
{
|
||||
valueOfShort.EmitCall(ilgen);
|
||||
}
|
||||
else if (tw == PrimitiveTypeWrapper.CHAR)
|
||||
{
|
||||
valueOfCharacter.EmitCall(ilgen);
|
||||
}
|
||||
else if (tw == PrimitiveTypeWrapper.INT)
|
||||
{
|
||||
valueOfInteger.EmitCall(ilgen);
|
||||
}
|
||||
else if (tw == PrimitiveTypeWrapper.FLOAT)
|
||||
{
|
||||
valueOfFloat.EmitCall(ilgen);
|
||||
}
|
||||
else if (tw == PrimitiveTypeWrapper.LONG)
|
||||
{
|
||||
valueOfLong.EmitCall(ilgen);
|
||||
}
|
||||
else if (tw == PrimitiveTypeWrapper.DOUBLE)
|
||||
{
|
||||
valueOfDouble.EmitCall(ilgen);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new InvalidOperationException();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
28
external/ikvm/ikvmc/ikvmc.build
vendored
28
external/ikvm/ikvmc/ikvmc.build
vendored
@ -1,9 +1,32 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
Copyright (C) 2002-2013 Jeroen Frijters
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
Jeroen Frijters
|
||||
jeroen@frijters.net
|
||||
|
||||
-->
|
||||
<project name="ikvmc" default="ikvmc">
|
||||
<include buildfile="../ikvm.include" />
|
||||
|
||||
<target name="ikvmc">
|
||||
<property name="defs" value="TRACE;STATIC_COMPILER" />
|
||||
<property name="defs" value="TRACE;STATIC_COMPILER;EMITTERS" />
|
||||
<if test="${property::exists('signed')}">
|
||||
<property name="defs" value="${defs};${signed}" />
|
||||
</if>
|
||||
@ -25,6 +48,7 @@
|
||||
<include name="../runtime/atomic.cs" />
|
||||
<include name="../runtime/attributes.cs" />
|
||||
<include name="../runtime/BigEndianBinaryReader.cs" />
|
||||
<include name="../runtime/Boxer.cs" />
|
||||
<include name="../runtime/ByteCode.cs" />
|
||||
<include name="../runtime/ClassFile.cs" />
|
||||
<include name="../runtime/ClassLoaderWrapper.cs" />
|
||||
@ -37,8 +61,10 @@
|
||||
<include name="../runtime/intrinsics.cs" />
|
||||
<include name="../runtime/JavaException.cs" />
|
||||
<include name="../runtime/JsrInliner.cs" />
|
||||
<include name="../runtime/LambdaMetafactory.cs" />
|
||||
<include name="../runtime/LocalVars.cs" />
|
||||
<include name="../runtime/MemberWrapper.cs" />
|
||||
<include name="../runtime/MethodHandleUtil.cs" />
|
||||
<include name="../runtime/profiler.cs" />
|
||||
<include name="../runtime/ReflectUtil.cs" />
|
||||
<include name="../runtime/RuntimeHelperTypes.cs" />
|
||||
|
21
external/ikvm/openjdk/FORKED
vendored
21
external/ikvm/openjdk/FORKED
vendored
@ -30,18 +30,7 @@ jdk/src/share/classes/java/io/RandomAccessFile.java=java/io/RandomAccessFile.jav
|
||||
jdk/src/share/classes/java/lang/Class.java=java/lang/Class.java
|
||||
jdk/src/share/classes/java/lang/ClassLoader.java=java/lang/ClassLoader.java
|
||||
jdk/src/share/classes/java/lang/Enum.java=java/lang/Enum.java
|
||||
jdk/src/share/classes/java/lang/invoke/AdapterMethodHandle.java=java/lang/invoke/AdapterMethodHandle.java
|
||||
jdk/src/share/classes/java/lang/invoke/BoundMethodHandle.java=java/lang/invoke/BoundMethodHandle.java
|
||||
jdk/src/share/classes/java/lang/invoke/CallSite.java=java/lang/invoke/CallSite.java
|
||||
jdk/src/share/classes/java/lang/invoke/ConstantCallSite.java=java/lang/invoke/ConstantCallSite.java
|
||||
jdk/src/share/classes/java/lang/invoke/DirectMethodHandle.java=java/lang/invoke/DirectMethodHandle.java
|
||||
jdk/src/share/classes/java/lang/invoke/MethodHandleImpl.java=java/lang/invoke/MethodHandleImpl.java
|
||||
jdk/src/share/classes/java/lang/invoke/MethodHandleNatives.java=java/lang/invoke/MethodHandleNatives.java
|
||||
jdk/src/share/classes/java/lang/invoke/MethodHandles.java=java/lang/invoke/MethodHandles.java
|
||||
jdk/src/share/classes/java/lang/invoke/MutableCallSite.java=java/lang/invoke/MutableCallSite.java
|
||||
jdk/src/share/classes/java/lang/invoke/VolatileCallSite.java=java/lang/invoke/VolatileCallSite.java
|
||||
jdk/src/share/classes/java/lang/management/PlatformComponent.java=java/lang/management/PlatformComponent.java
|
||||
jdk/src/share/classes/java/lang/Package.java=java/lang/Package.java
|
||||
jdk/src/share/classes/java/lang/ref/SoftReference.java=java/lang/ref/SoftReference.java
|
||||
jdk/src/share/classes/java/lang/reflect/Constructor.java=java/lang/reflect/Constructor.java
|
||||
jdk/src/share/classes/java/lang/reflect/Field.java=java/lang/reflect/Field.java
|
||||
@ -57,7 +46,6 @@ jdk/src/share/classes/java/net/SocketOutputStream.java=java/net/SocketOutputStre
|
||||
jdk/src/share/classes/java/nio/Bits.java=java/nio/Bits.java
|
||||
jdk/src/share/classes/java/security/AccessController.java=java/security/AccessController.java
|
||||
jdk/src/share/classes/java/security/ProtectionDomain.java=java/security/ProtectionDomain.java
|
||||
jdk/src/share/classes/java/sql/DriverManager.java=java/sql/DriverManager.java
|
||||
jdk/src/share/classes/java/util/concurrent/atomic/AtomicBoolean.java=../classpath/java/util/concurrent/atomic/AtomicBoolean.java
|
||||
jdk/src/share/classes/java/util/concurrent/atomic/AtomicInteger.java=../classpath/java/util/concurrent/atomic/AtomicInteger.java
|
||||
jdk/src/share/classes/java/util/concurrent/atomic/AtomicIntegerArray.java=../classpath/java/util/concurrent/atomic/AtomicIntegerArray.java
|
||||
@ -67,9 +55,6 @@ jdk/src/share/classes/java/util/concurrent/atomic/AtomicReference.java=../classp
|
||||
jdk/src/share/classes/java/util/concurrent/atomic/AtomicReferenceArray.java=../classpath/java/util/concurrent/atomic/AtomicReferenceArray.java
|
||||
jdk/src/share/classes/java/util/concurrent/locks/AbstractQueuedSynchronizer.java=java/util/concurrent/locks/AbstractQueuedSynchronizer.java
|
||||
jdk/src/share/classes/java/util/concurrent/locks/LockSupport.java=java/util/concurrent/locks/LockSupport.java
|
||||
jdk/src/share/classes/java/util/ResourceBundle.java=java/util/ResourceBundle.java
|
||||
jdk/src/share/classes/java/util/TimeZone.java=java/util/TimeZone.java
|
||||
jdk/src/share/classes/sun/awt/AppContext.java=sun/awt/AppContext.java
|
||||
jdk/src/share/classes/sun/awt/EmbeddedFrame.java=sun/awt/EmbeddedFrame.java
|
||||
jdk/src/share/classes/sun/awt/image/ByteInterleavedRaster.java=sun/awt/image/ByteInterleavedRaster.java
|
||||
jdk/src/share/classes/sun/awt/image/ImagingLib.java=sun/awt/image/ImagingLib.java
|
||||
@ -79,11 +64,8 @@ jdk/src/share/classes/sun/awt/image/ToolkitImage.java=sun/awt/image/ToolkitImage
|
||||
jdk/src/share/classes/sun/awt/SunToolkit.java=sun/awt/SunToolkit.java
|
||||
jdk/src/share/classes/sun/font/FontManager.java=sun/font/FontManager.java
|
||||
jdk/src/share/classes/sun/font/StrikeCache.java=sun/font/StrikeCache.java
|
||||
jdk/src/share/classes/sun/management/GcInfoBuilder.java=sun/management/GcInfoBuilder.java
|
||||
jdk/src/share/classes/sun/management/ManagementFactoryHelper.java=sun/management/ManagementFactoryHelper.java
|
||||
jdk/src/share/classes/sun/management/VMManagementImpl.java=sun/management/VMManagementImpl.java
|
||||
jdk/src/share/classes/sun/misc/IoTrace.java=sun/misc/IoTrace.java
|
||||
jdk/src/share/classes/sun/misc/JavaAWTAccess.java=sun/misc/JavaAWTAccess.java
|
||||
jdk/src/share/classes/sun/misc/SharedSecrets.java=sun/misc/SharedSecrets.java
|
||||
jdk/src/share/classes/sun/misc/VM.java=sun/misc/VM.java
|
||||
jdk/src/share/classes/sun/net/sdp/SdpSupport.java=sun/net/sdp/SdpSupport.java
|
||||
@ -94,9 +76,8 @@ jdk/src/share/classes/sun/nio/ch/IOUtil.java=sun/nio/ch/IOUtil.java
|
||||
jdk/src/share/classes/sun/nio/ch/NativeDispatcher.java=sun/nio/ch/NativeDispatcher.java
|
||||
jdk/src/share/classes/sun/nio/ch/Net.java=sun/nio/ch/Net.java
|
||||
jdk/src/share/classes/sun/nio/ch/Util.java=sun/nio/ch/Util.java
|
||||
jdk/src/share/classes/sun/reflect/CallerSensitive.java=sun/reflect/CallerSensitive.java
|
||||
jdk/src/share/classes/sun/reflect/annotation/AnnotationType.java=sun/reflect/annotation/AnnotationType.java
|
||||
jdk/src/share/classes/sun/reflect/MethodAccessor.java=sun/reflect/MethodAccessor.java
|
||||
jdk/src/share/classes/sun/reflect/misc/ReflectUtil.java=sun/reflect/misc/ReflectUtil.java
|
||||
jdk/src/share/classes/sun/reflect/Reflection.java=sun/reflect/Reflection.java
|
||||
jdk/src/share/classes/sun/reflect/ReflectionFactory.java=sun/reflect/ReflectionFactory.java
|
||||
jdk/src/solaris/classes/sun/nio/fs/UnixUriUtils.java=sun/nio/fs/UnixUriUtils.java
|
||||
|
@ -1 +1 @@
|
||||
533d7645e2bb496cbbac8996759c133993dcc1bb
|
||||
4911d54d998b7a044246f97683fb62901e9dc052
|
@ -236,12 +236,14 @@ public abstract class AnnotationAttributeBase
|
||||
{
|
||||
// TODO consider checking that the type matches
|
||||
// (or better yet (?), remove the first two redundant elements from the array)
|
||||
decodeValues(values, annotationType, annotationType.getClassLoader(), definition);
|
||||
decodeValues(values, annotationType, annotationType.getClassLoader(), unescapeInvalidSurrogates(definition));
|
||||
definition = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static native Object[] unescapeInvalidSurrogates(Object[] definition);
|
||||
|
||||
private static void decodeValues(HashMap map, Class annotationClass, ClassLoader loader, Object[] array)
|
||||
{
|
||||
for (int i = 2; i < array.length; i += 2)
|
||||
|
@ -1 +1 @@
|
||||
bbc1d241f632078e8ecf146e9398406c5719dd2f
|
||||
07fd7bd567e5b0ae8b3ae9c32741b56f6f363b0a
|
88
external/ikvm/openjdk/java/lang/LangHelper.java
vendored
88
external/ikvm/openjdk/java/lang/LangHelper.java
vendored
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (C) 2007-2011 Jeroen Frijters
|
||||
Copyright (C) 2007-2014 Jeroen Frijters
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
@ -24,80 +24,40 @@
|
||||
|
||||
package java.lang;
|
||||
|
||||
import ikvm.runtime.AssemblyClassLoader;
|
||||
import java.io.IOException;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.security.AccessController;
|
||||
import java.util.Enumeration;
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.lang.reflect.Executable;
|
||||
import java.security.AccessControlContext;
|
||||
import java.util.Map;
|
||||
import sun.nio.ch.Interruptible;
|
||||
import sun.reflect.annotation.AnnotationType;
|
||||
import sun.security.action.GetPropertyAction;
|
||||
|
||||
@ikvm.lang.Internal
|
||||
public class LangHelper
|
||||
{
|
||||
private static boolean addedSystemPackages;
|
||||
|
||||
private static void addSystemPackage(Map pkgMap)
|
||||
{
|
||||
// NOTE caller must have acquired lock on pkgMap
|
||||
if (!addedSystemPackages)
|
||||
{
|
||||
addedSystemPackages = true;
|
||||
String[] pkgs = getBootClassPackages();
|
||||
for (int i = 0; i < pkgs.length; i++)
|
||||
{
|
||||
pkgMap.put(pkgs[i],
|
||||
new Package(pkgs[i],
|
||||
VMSystemProperties.SPEC_TITLE, // specTitle
|
||||
VMSystemProperties.SPEC_VERSION, // specVersion
|
||||
VMSystemProperties.SPEC_VENDOR, // specVendor
|
||||
"IKVM.NET OpenJDK", // implTitle
|
||||
PropertyConstants.openjdk_version, // implVersion
|
||||
"Oracle Corporation & others", // implVendor
|
||||
null, // sealBase
|
||||
null)); // class loader
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static native String[] getBootClassPackages();
|
||||
|
||||
/* this method gets called by Package.getSystemPackage() via a redefined method in map.xml */
|
||||
static Package getSystemPackage(Map pkgs, String name)
|
||||
{
|
||||
synchronized (pkgs)
|
||||
{
|
||||
addSystemPackage(pkgs);
|
||||
return (Package)pkgs.get(name);
|
||||
}
|
||||
}
|
||||
|
||||
/* this method gets called by Package.getSystemPackages() via a redefined method in map.xml */
|
||||
static Package[] getSystemPackages(Map pkgs)
|
||||
{
|
||||
synchronized (pkgs)
|
||||
{
|
||||
addSystemPackage(pkgs);
|
||||
return (Package[])pkgs.values().toArray(new Package[pkgs.size()]);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public static sun.misc.JavaLangAccess getJavaLangAccess()
|
||||
{
|
||||
return new sun.misc.JavaLangAccess() {
|
||||
public sun.reflect.ConstantPool getConstantPool(Class klass) {
|
||||
return null;
|
||||
return klass.getConstantPool();
|
||||
}
|
||||
public void setAnnotationType(Class klass, AnnotationType type) {
|
||||
klass.setAnnotationType(type);
|
||||
public boolean casAnnotationType(Class<?> klass, AnnotationType oldType, AnnotationType newType) {
|
||||
return klass.casAnnotationType(oldType, newType);
|
||||
}
|
||||
public AnnotationType getAnnotationType(Class klass) {
|
||||
return klass.getAnnotationType();
|
||||
}
|
||||
public Map<Class<? extends Annotation>, Annotation> getDeclaredAnnotationMap(Class<?> klass) {
|
||||
return klass.getDeclaredAnnotationMap();
|
||||
}
|
||||
public byte[] getRawClassAnnotations(Class<?> klass) {
|
||||
throw new InternalError();
|
||||
}
|
||||
public byte[] getRawClassTypeAnnotations(Class<?> klass) {
|
||||
return klass.getRawTypeAnnotations();
|
||||
}
|
||||
public byte[] getRawExecutableTypeAnnotations(Executable executable) {
|
||||
return Class.getExecutableTypeAnnotationBytes(executable);
|
||||
}
|
||||
public <E extends Enum<E>>
|
||||
E[] getEnumConstantsShared(Class<E> klass) {
|
||||
return klass.getEnumConstantsShared();
|
||||
@ -114,8 +74,14 @@ public class LangHelper
|
||||
public StackTraceElement getStackTraceElement(Throwable t, int i) {
|
||||
return t.getStackTraceElement(i);
|
||||
}
|
||||
public int getStringHash32(String string) {
|
||||
return StringHelper.hash32(string);
|
||||
public String newStringUnsafe(char[] chars) {
|
||||
return String.valueOf(chars);
|
||||
}
|
||||
public Thread newThreadWithAcc(Runnable target, AccessControlContext acc) {
|
||||
return new Thread(target, acc);
|
||||
}
|
||||
public void invokeFinalize(Object o) throws Throwable {
|
||||
// we don't actually support invoking the finalize method explicitly
|
||||
}
|
||||
};
|
||||
}
|
||||
|
355
external/ikvm/openjdk/java/lang/ProcessImpl.java
vendored
355
external/ikvm/openjdk/java/lang/ProcessImpl.java
vendored
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1995, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1995, 2013, 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
|
||||
@ -42,9 +42,15 @@ import java.io.BufferedOutputStream;
|
||||
import java.lang.ProcessBuilder.Redirect;
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedAction;
|
||||
import java.util.ArrayList;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import cli.System.AsyncCallback;
|
||||
import cli.System.IAsyncResult;
|
||||
import cli.System.Diagnostics.ProcessStartInfo;
|
||||
import cli.System.EventArgs;
|
||||
import cli.System.EventHandler;
|
||||
import cli.System.IO.FileAccess;
|
||||
import cli.System.IO.FileShare;
|
||||
import cli.System.IO.FileMode;
|
||||
@ -146,8 +152,17 @@ final class ProcessImpl extends Process {
|
||||
|
||||
return new ProcessImpl(cmdarray, environment, dir,
|
||||
stdHandles, redirectErrorStream);
|
||||
} catch (Throwable t) {
|
||||
if (f0 != null)
|
||||
f0.close();
|
||||
if (f1 != null)
|
||||
f1.close();
|
||||
if (f2 != null)
|
||||
f2.close();
|
||||
throw t;
|
||||
} finally {
|
||||
// HACK prevent the File[In|Out]putStream objects from closing the streams
|
||||
// (the System.IO.FileStream will eventually be closed explicitly or by its finalizer)
|
||||
if (f0 != null)
|
||||
cli.System.GC.SuppressFinalize(f0);
|
||||
if (f1 != null)
|
||||
@ -158,50 +173,240 @@ final class ProcessImpl extends Process {
|
||||
|
||||
}
|
||||
|
||||
private static class LazyPattern {
|
||||
// Escape-support version:
|
||||
// "(\")((?:\\\\\\1|.)+?)\\1|([^\\s\"]+)";
|
||||
private static final Pattern PATTERN =
|
||||
Pattern.compile("[^\\s\"]+|\"[^\"]*\"");
|
||||
};
|
||||
|
||||
/* Parses the command string parameter into the executable name and
|
||||
* program arguments.
|
||||
*
|
||||
* The command string is broken into tokens. The token separator is a space
|
||||
* or quota character. The space inside quotation is not a token separator.
|
||||
* There are no escape sequences.
|
||||
*/
|
||||
private static String[] getTokensFromCommand(String command) {
|
||||
ArrayList<String> matchList = new ArrayList<>(8);
|
||||
Matcher regexMatcher = LazyPattern.PATTERN.matcher(command);
|
||||
while (regexMatcher.find())
|
||||
matchList.add(regexMatcher.group());
|
||||
return matchList.toArray(new String[matchList.size()]);
|
||||
}
|
||||
|
||||
private static final int VERIFICATION_CMD_BAT = 0;
|
||||
private static final int VERIFICATION_WIN32 = 1;
|
||||
private static final int VERIFICATION_LEGACY = 2;
|
||||
private static final char ESCAPE_VERIFICATION[][] = {
|
||||
// We guarantee the only command file execution for implicit [cmd.exe] run.
|
||||
// http://technet.microsoft.com/en-us/library/bb490954.aspx
|
||||
{' ', '\t', '<', '>', '&', '|', '^'},
|
||||
|
||||
{' ', '\t', '<', '>'},
|
||||
{' ', '\t'}
|
||||
};
|
||||
|
||||
private static String createCommandLine(int verificationType,
|
||||
final String executablePath,
|
||||
final String cmd[])
|
||||
{
|
||||
StringBuilder cmdbuf = new StringBuilder(80);
|
||||
|
||||
cmdbuf.append(executablePath);
|
||||
|
||||
for (int i = 1; i < cmd.length; ++i) {
|
||||
cmdbuf.append(' ');
|
||||
String s = cmd[i];
|
||||
if (needsEscaping(verificationType, s)) {
|
||||
cmdbuf.append('"').append(s);
|
||||
|
||||
// The code protects the [java.exe] and console command line
|
||||
// parser, that interprets the [\"] combination as an escape
|
||||
// sequence for the ["] char.
|
||||
// http://msdn.microsoft.com/en-us/library/17w5ykft.aspx
|
||||
//
|
||||
// If the argument is an FS path, doubling of the tail [\]
|
||||
// char is not a problem for non-console applications.
|
||||
//
|
||||
// The [\"] sequence is not an escape sequence for the [cmd.exe]
|
||||
// command line parser. The case of the [""] tail escape
|
||||
// sequence could not be realized due to the argument validation
|
||||
// procedure.
|
||||
if ((verificationType != VERIFICATION_CMD_BAT) && s.endsWith("\\")) {
|
||||
cmdbuf.append('\\');
|
||||
}
|
||||
cmdbuf.append('"');
|
||||
} else {
|
||||
cmdbuf.append(s);
|
||||
}
|
||||
}
|
||||
return cmdbuf.toString();
|
||||
}
|
||||
|
||||
private static boolean isQuoted(boolean noQuotesInside, String arg,
|
||||
String errorMessage) {
|
||||
int lastPos = arg.length() - 1;
|
||||
if (lastPos >=1 && arg.charAt(0) == '"' && arg.charAt(lastPos) == '"') {
|
||||
// The argument has already been quoted.
|
||||
if (noQuotesInside) {
|
||||
if (arg.indexOf('"', 1) != lastPos) {
|
||||
// There is ["] inside.
|
||||
throw new IllegalArgumentException(errorMessage);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (noQuotesInside) {
|
||||
if (arg.indexOf('"') >= 0) {
|
||||
// There is ["] inside.
|
||||
throw new IllegalArgumentException(errorMessage);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private static boolean needsEscaping(int verificationType, String arg) {
|
||||
// Switch off MS heuristic for internal ["].
|
||||
// Please, use the explicit [cmd.exe] call
|
||||
// if you need the internal ["].
|
||||
// Example: "cmd.exe", "/C", "Extended_MS_Syntax"
|
||||
|
||||
// For [.exe] or [.com] file the unpaired/internal ["]
|
||||
// in the argument is not a problem.
|
||||
boolean argIsQuoted = isQuoted(
|
||||
(verificationType == VERIFICATION_CMD_BAT),
|
||||
arg, "Argument has embedded quote, use the explicit CMD.EXE call.");
|
||||
|
||||
if (!argIsQuoted) {
|
||||
char testEscape[] = ESCAPE_VERIFICATION[verificationType];
|
||||
for (int i = 0; i < testEscape.length; ++i) {
|
||||
if (arg.indexOf(testEscape[i]) >= 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private static String getExecutablePath(String path)
|
||||
throws IOException
|
||||
{
|
||||
boolean pathIsQuoted = isQuoted(true, path,
|
||||
"Executable name has embedded quote, split the arguments");
|
||||
|
||||
// Win32 CreateProcess requires path to be normalized
|
||||
File fileToRun = new File(pathIsQuoted
|
||||
? path.substring(1, path.length() - 1)
|
||||
: path);
|
||||
|
||||
// From the [CreateProcess] function documentation:
|
||||
//
|
||||
// "If the file name does not contain an extension, .exe is appended.
|
||||
// Therefore, if the file name extension is .com, this parameter
|
||||
// must include the .com extension. If the file name ends in
|
||||
// a period (.) with no extension, or if the file name contains a path,
|
||||
// .exe is not appended."
|
||||
//
|
||||
// "If the file name !does not contain a directory path!,
|
||||
// the system searches for the executable file in the following
|
||||
// sequence:..."
|
||||
//
|
||||
// In practice ANY non-existent path is extended by [.exe] extension
|
||||
// in the [CreateProcess] funcion with the only exception:
|
||||
// the path ends by (.)
|
||||
|
||||
return fileToRun.getPath();
|
||||
}
|
||||
|
||||
|
||||
private boolean isShellFile(String executablePath) {
|
||||
String upPath = executablePath.toUpperCase();
|
||||
return (upPath.endsWith(".CMD") || upPath.endsWith(".BAT"));
|
||||
}
|
||||
|
||||
private String quoteString(String arg) {
|
||||
StringBuilder argbuf = new StringBuilder(arg.length() + 2);
|
||||
return argbuf.append('"').append(arg).append('"').toString();
|
||||
}
|
||||
|
||||
|
||||
private cli.System.Diagnostics.Process handle;
|
||||
private OutputStream stdin_stream;
|
||||
private InputStream stdout_stream;
|
||||
private InputStream stderr_stream;
|
||||
|
||||
private ProcessImpl(final String cmd[],
|
||||
private ProcessImpl(String cmd[],
|
||||
final java.util.Map<String,String> envblock,
|
||||
final String path,
|
||||
final Stream[] stdHandles,
|
||||
final boolean redirectErrorStream)
|
||||
throws IOException
|
||||
{
|
||||
// Win32 CreateProcess requires cmd[0] to be normalized
|
||||
cmd[0] = new File(cmd[0]).getPath();
|
||||
|
||||
// give the runtime an opportunity to map executables from VFS to a real executable
|
||||
cmd[0] = mapVfsExecutable(cmd[0]);
|
||||
|
||||
StringBuilder cmdbuf = new StringBuilder(80);
|
||||
for (int i = 0; i < cmd.length; i++) {
|
||||
if (i > 0) {
|
||||
cmdbuf.append(' ');
|
||||
}
|
||||
String s = cmd[i];
|
||||
if (s.indexOf(' ') >= 0 || s.indexOf('\t') >= 0) {
|
||||
if (s.charAt(0) != '"') {
|
||||
cmdbuf.append('"');
|
||||
cmdbuf.append(s);
|
||||
if (s.endsWith("\\")) {
|
||||
cmdbuf.append("\\");
|
||||
}
|
||||
cmdbuf.append('"');
|
||||
} else if (s.endsWith("\"")) {
|
||||
/* The argument has already been quoted. */
|
||||
cmdbuf.append(s);
|
||||
} else {
|
||||
/* Unmatched quote for the argument. */
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
} else {
|
||||
cmdbuf.append(s);
|
||||
}
|
||||
String cmdstr;
|
||||
SecurityManager security = System.getSecurityManager();
|
||||
boolean allowAmbiguousCommands = false;
|
||||
if (security == null) {
|
||||
allowAmbiguousCommands = true;
|
||||
String value = System.getProperty("jdk.lang.Process.allowAmbiguousCommands");
|
||||
if (value != null)
|
||||
allowAmbiguousCommands = !"false".equalsIgnoreCase(value);
|
||||
}
|
||||
if (allowAmbiguousCommands) {
|
||||
// Legacy mode.
|
||||
|
||||
// Normalize path if possible.
|
||||
String executablePath = new File(cmd[0]).getPath();
|
||||
|
||||
// No worry about internal, unpaired ["], and redirection/piping.
|
||||
if (needsEscaping(VERIFICATION_LEGACY, executablePath) )
|
||||
executablePath = quoteString(executablePath);
|
||||
|
||||
cmdstr = createCommandLine(
|
||||
//legacy mode doesn't worry about extended verification
|
||||
VERIFICATION_LEGACY,
|
||||
executablePath,
|
||||
cmd);
|
||||
} else {
|
||||
String executablePath;
|
||||
try {
|
||||
executablePath = getExecutablePath(cmd[0]);
|
||||
} catch (IllegalArgumentException e) {
|
||||
// Workaround for the calls like
|
||||
// Runtime.getRuntime().exec("\"C:\\Program Files\\foo\" bar")
|
||||
|
||||
// No chance to avoid CMD/BAT injection, except to do the work
|
||||
// right from the beginning. Otherwise we have too many corner
|
||||
// cases from
|
||||
// Runtime.getRuntime().exec(String[] cmd [, ...])
|
||||
// calls with internal ["] and escape sequences.
|
||||
|
||||
// Restore original command line.
|
||||
StringBuilder join = new StringBuilder();
|
||||
// terminal space in command line is ok
|
||||
for (String s : cmd)
|
||||
join.append(s).append(' ');
|
||||
|
||||
// Parse the command line again.
|
||||
cmd = getTokensFromCommand(join.toString());
|
||||
executablePath = getExecutablePath(cmd[0]);
|
||||
|
||||
// Check new executable name once more
|
||||
if (security != null)
|
||||
security.checkExec(executablePath);
|
||||
}
|
||||
|
||||
// Quotation protects from interpretation of the [path] argument as
|
||||
// start of longer path with spaces. Quotation has no influence to
|
||||
// [.exe] extension heuristic.
|
||||
cmdstr = createCommandLine(
|
||||
// We need the extended verification procedure for CMD files.
|
||||
isShellFile(executablePath)
|
||||
? VERIFICATION_CMD_BAT
|
||||
: VERIFICATION_WIN32,
|
||||
quoteString(executablePath),
|
||||
cmd);
|
||||
}
|
||||
String cmdstr = cmdbuf.toString();
|
||||
|
||||
handle = create(cmdstr, envblock, path,
|
||||
stdHandles, redirectErrorStream);
|
||||
@ -261,6 +466,7 @@ final class ProcessImpl extends Process {
|
||||
throw new InterruptedException();
|
||||
return exitValue();
|
||||
}
|
||||
|
||||
private static void waitForInterruptibly(cli.System.Diagnostics.Process handle) throws InterruptedException {
|
||||
// to be interruptable we have to use polling
|
||||
// (on .NET 2.0 WaitForExit is actually interruptible, but this isn't documented)
|
||||
@ -269,7 +475,53 @@ final class ProcessImpl extends Process {
|
||||
;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean waitFor(long timeout, TimeUnit unit)
|
||||
throws InterruptedException
|
||||
{
|
||||
if (handle.get_HasExited()) return true;
|
||||
if (timeout <= 0) return false;
|
||||
|
||||
long msTimeout = unit.toMillis(timeout);
|
||||
|
||||
waitForTimeoutInterruptibly(handle, msTimeout);
|
||||
if (Thread.interrupted())
|
||||
throw new InterruptedException();
|
||||
return handle.get_HasExited();
|
||||
}
|
||||
|
||||
private static void waitForTimeoutInterruptibly(
|
||||
cli.System.Diagnostics.Process handle, long timeout) {
|
||||
long now = System.currentTimeMillis();
|
||||
long exp = now + timeout;
|
||||
if (exp < now) {
|
||||
// if we overflowed, just wait for a really long time
|
||||
exp = Long.MAX_VALUE;
|
||||
}
|
||||
Thread current = Thread.currentThread();
|
||||
for (;;) {
|
||||
if (current.isInterrupted()) {
|
||||
return;
|
||||
}
|
||||
// wait for a maximum of 100 ms to be interruptible
|
||||
if (handle.WaitForExit((int)Math.min(100, exp - now))) {
|
||||
return;
|
||||
}
|
||||
now = System.currentTimeMillis();
|
||||
if (now >= exp) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void destroy() { terminateProcess(handle); }
|
||||
|
||||
@Override
|
||||
public Process destroyForcibly() {
|
||||
destroy();
|
||||
return this;
|
||||
}
|
||||
|
||||
private static void terminateProcess(cli.System.Diagnostics.Process handle) {
|
||||
try {
|
||||
if (false) throw new cli.System.ComponentModel.Win32Exception();
|
||||
@ -280,10 +532,21 @@ final class ProcessImpl extends Process {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAlive() {
|
||||
return isProcessAlive(handle);
|
||||
}
|
||||
|
||||
private static boolean isProcessAlive(cli.System.Diagnostics.Process handle) {
|
||||
return !handle.get_HasExited();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a process using the win32 function CreateProcess.
|
||||
* The method is synchronized due to MS kb315939 problem.
|
||||
* All native handles should restore the inherit flag at the end of call.
|
||||
*
|
||||
* @param cmdstr the Windows commandline
|
||||
* @param cmdstr the Windows command line
|
||||
* @param envblock NUL-separated, double-NUL-terminated list of
|
||||
* environment strings in VAR=VALUE form
|
||||
* @param dir the working directory of the process, or null if
|
||||
@ -312,7 +575,8 @@ final class ProcessImpl extends Process {
|
||||
argumentsStart++;
|
||||
}
|
||||
|
||||
ProcessStartInfo si = new ProcessStartInfo(cmdstr.substring(0, programEnd), cmdstr.substring(argumentsStart));
|
||||
String fileName = cmdstr.substring(0, programEnd);
|
||||
ProcessStartInfo si = new ProcessStartInfo(mapVfsExecutable(fileName), cmdstr.substring(argumentsStart));
|
||||
si.set_UseShellExecute(false);
|
||||
si.set_RedirectStandardError(true);
|
||||
si.set_RedirectStandardOutput(true);
|
||||
@ -338,6 +602,27 @@ final class ProcessImpl extends Process {
|
||||
} catch (cli.System.InvalidOperationException x2) {
|
||||
throw new IOException(x2.getMessage());
|
||||
}
|
||||
|
||||
// if any of the handles is redirected to/from a file,
|
||||
// we need to close the files as soon as the process exits
|
||||
if (stdHandles[0] instanceof FileStream
|
||||
|| stdHandles[1] instanceof FileStream
|
||||
|| stdHandles[2] instanceof FileStream) {
|
||||
final Stream s0 = stdHandles[0];
|
||||
final Stream s1 = stdHandles[1];
|
||||
final Stream s2 = stdHandles[2];
|
||||
proc.set_EnableRaisingEvents(true);
|
||||
proc.add_Exited(new EventHandler(new EventHandler.Method() {
|
||||
public void Invoke(Object sender, EventArgs e) {
|
||||
if (s0 instanceof FileStream)
|
||||
s0.Close();
|
||||
if (s1 instanceof FileStream)
|
||||
s1.Close();
|
||||
if (s2 instanceof FileStream)
|
||||
s2.Close();
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
Stream stdin = proc.get_StandardInput().get_BaseStream();
|
||||
Stream stdout = proc.get_StandardOutput().get_BaseStream();
|
||||
|
2578
external/ikvm/openjdk/java/lang/Thread.java
vendored
2578
external/ikvm/openjdk/java/lang/Thread.java
vendored
File diff suppressed because it is too large
Load Diff
1
external/ikvm/openjdk/java/lang/Thread.java.REMOVED.git-id
vendored
Normal file
1
external/ikvm/openjdk/java/lang/Thread.java.REMOVED.git-id
vendored
Normal file
@ -0,0 +1 @@
|
||||
7ab53c76bb97c702c39866643a2547962ef3ead6
|
2
external/ikvm/openjdk/map.xml.REMOVED.git-id
vendored
2
external/ikvm/openjdk/map.xml.REMOVED.git-id
vendored
@ -1 +1 @@
|
||||
33393ac257cbddfb25bbbbef28c2d70a939dcc57
|
||||
df6a641f2325337bd9354a4d23537dc48a60d0ee
|
193
external/ikvm/openjdk/openjdk.build
vendored
193
external/ikvm/openjdk/openjdk.build
vendored
@ -1,16 +1,42 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
Copyright (C) 2002-2014 Jeroen Frijters
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
|
||||
Jeroen Frijters
|
||||
jeroen@frijters.net
|
||||
|
||||
-->
|
||||
<project name="ClassLibrary" default="all">
|
||||
<include buildfile="../ikvm.include" />
|
||||
<property name="pathsep" value=":" />
|
||||
<property overwrite="false" name="signoption" value="" />
|
||||
<property overwrite="false" name="SkipSystemCoreDependency" value="false" />
|
||||
<property name="OPENJDK_VERSION" value="OpenJDK 7u6 b24" />
|
||||
<property name="OpenJDK7.dir" value="${project::get-base-directory()}/../../openjdk-7u6-b24" />
|
||||
<property name="OPENJDK_VERSION" value="OpenJDK 8 b132" />
|
||||
<property name="IMPLEMENTATION_VERSION" value="1.8.0" />
|
||||
<property name="SPECIFICATION_VERSION" value="1.8" />
|
||||
<property name="FULL_VERSION" value="1.8.0-b132" />
|
||||
<property name="OpenJDK.dir" value="${project::get-base-directory()}/../../openjdk-8-b132" />
|
||||
<if test="${platform::is-win32()}">
|
||||
<property name="pathsep" value=";" />
|
||||
</if>
|
||||
|
||||
<target name="all" depends="classes rmi vfs resources core">
|
||||
<target name="all" depends="classes rmi run-nasgen vfs resources core">
|
||||
</target>
|
||||
|
||||
<target name="version">
|
||||
@ -26,7 +52,7 @@
|
||||
<copy file="allsources.lst" tofile="allsources.gen.lst" outputencoding="ascii" overwrite="true">
|
||||
<filterchain>
|
||||
<replacetokens>
|
||||
<token key="OPENJDK7" value="${OpenJDK7.dir}" />
|
||||
<token key="OPENJDK" value="${OpenJDK.dir}" />
|
||||
</replacetokens>
|
||||
</filterchain>
|
||||
</copy>
|
||||
@ -70,27 +96,38 @@
|
||||
</delete>
|
||||
</target>
|
||||
|
||||
<target name="classes" depends="version copyright allsources.gen.lst System.Core">
|
||||
<target name="clean-classes">
|
||||
<delete>
|
||||
<fileset basedir="../classpath">
|
||||
<include name="**.class"/>
|
||||
</fileset>
|
||||
</delete>
|
||||
<delete>
|
||||
<fileset basedir="${OpenJDK7.dir}">
|
||||
<fileset basedir="${OpenJDK.dir}">
|
||||
<include name="**.class"/>
|
||||
</fileset>
|
||||
</delete>
|
||||
<delete>
|
||||
<fileset basedir=".">
|
||||
<include name="**.class"/>
|
||||
</fileset>
|
||||
</delete>
|
||||
</target>
|
||||
|
||||
<target name="clean-stubjars">
|
||||
<delete>
|
||||
<fileset basedir=".">
|
||||
<include name="mscorlib.jar" />
|
||||
<include name="System.jar" />
|
||||
<include name="System.Core.jar" />
|
||||
<include name="System.Data.jar" />
|
||||
<include name="System.Drawing.jar" />
|
||||
<include name="System.XML.jar" />
|
||||
</fileset>
|
||||
</delete>
|
||||
</target>
|
||||
|
||||
<target name="stubjars" depends="clean-stubjars System.Core">
|
||||
<exec program="${project::get-base-directory()}/../bin/ikvmstub.exe" commandline="-bootstrap mscorlib" useruntimeengine="true" />
|
||||
<exec program="${project::get-base-directory()}/../bin/ikvmstub.exe" commandline="-bootstrap System" useruntimeengine="true" />
|
||||
<exec program="${project::get-base-directory()}/../bin/ikvmstub.exe" commandline="-bootstrap System.Core" useruntimeengine="true" unless="${SkipSystemCoreDependency}" />
|
||||
@ -99,20 +136,33 @@
|
||||
</if>
|
||||
<exec program="${project::get-base-directory()}/../bin/ikvmstub.exe" commandline="-bootstrap System.Data" useruntimeengine="true" />
|
||||
<exec program="${project::get-base-directory()}/../bin/ikvmstub.exe" commandline="-bootstrap System.Drawing" useruntimeengine="true" />
|
||||
<exec program="${project::get-base-directory()}/../bin/ikvmstub.exe" commandline="-bootstrap System.XML" useruntimeengine="true" />
|
||||
</target>
|
||||
|
||||
<target name="runtime-identity">
|
||||
<property name="IKVM.Runtime" value="IKVM.Runtime" />
|
||||
<property name="IKVM.AWT.WinForms" value="IKVM.AWT.WinForms" />
|
||||
<if test="${signoption != ''}">
|
||||
<loadfile file="../tools/pubkey.txt" property="publickey" />
|
||||
<property name="IKVM.Runtime" value="IKVM.Runtime, PublicKey=${publickey}" />
|
||||
<property name="IKVM.AWT.WinForms" value="IKVM.AWT.WinForms, PublicKey=${publickey}" />
|
||||
</if>
|
||||
</target>
|
||||
|
||||
<target name="AssemblyInfo.java" depends="runtime-identity version copyright">
|
||||
<copy file="AssemblyInfo.java.in" tofile="AssemblyInfo.java" outputencoding="ascii" overwrite="true">
|
||||
<filterchain>
|
||||
<replacetokens>
|
||||
<token key="RUNTIME" value="${IKVM.Runtime}" />
|
||||
<token key="AWTWINFORMS" value="${IKVM.AWT.WinForms}" />
|
||||
<token key="VERSION" value="${VERSION}" />
|
||||
<token key="COPYRIGHT" value="${COPYRIGHT}" />
|
||||
</replacetokens>
|
||||
</filterchain>
|
||||
</copy>
|
||||
</target>
|
||||
|
||||
<target name="PropertyConstants.java" depends="version">
|
||||
<copy file="java/lang/PropertyConstants.java.in" tofile="java/lang/PropertyConstants.java" outputencoding="ascii" overwrite="true">
|
||||
<filterchain>
|
||||
<replacetokens>
|
||||
@ -122,14 +172,28 @@
|
||||
</replacetokens>
|
||||
</filterchain>
|
||||
</copy>
|
||||
<exec program="javac" commandline="-J-Xmx1536M -implicit:none -g -nowarn -cp dummy -bootclasspath mscorlib.jar${pathsep}System.jar${pathsep}System.Core.jar${pathsep}System.Data.jar${pathsep}System.Drawing.jar${pathsep}../runtime/IKVM.Runtime.jar @allsources.gen.lst" useruntimeengine="false" />
|
||||
</target>
|
||||
|
||||
<target name="classes" depends="clean-classes stubjars allsources.gen.lst AssemblyInfo.java PropertyConstants.java">
|
||||
<exec program="javac" useruntimeengine="false">
|
||||
<arg value="-J-Xmx1536M" />
|
||||
<arg value="-g" />
|
||||
<arg value="-nowarn" />
|
||||
<arg value="-implicit:none" />
|
||||
<arg value="-parameters" />
|
||||
<arg line="-cp dummy" />
|
||||
<arg value="-bootclasspath" />
|
||||
<arg path="mscorlib.jar;System.jar;System.Core.jar;System.Data.jar;System.Drawing.jar;System.XML.jar;../runtime/IKVM.Runtime.jar" />
|
||||
<arg value="@allsources.gen.lst" />
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
<target name="rmi">
|
||||
<property name="VMARGS" value="-J-client -J-Xmx896m -J-Xms128m -J-XX:PermSize=32m -J-XX:MaxPermSize=160m" />
|
||||
<property name="CLASSPATH" value="${OpenJDK7.dir}/jdk/src/share/classes/${pathsep}${OpenJDK7.dir}/build/linux-amd64/impsrc/${pathsep}." />
|
||||
<property name="OUTPUT" value="${OpenJDK7.dir}/build/linux-amd64/classes/" />
|
||||
<property name="ARGS" value="${VMARGS} -bootclasspath ${CLASSPATH} -d ${OUTPUT}" />
|
||||
<mkdir dir="rmistubs" />
|
||||
<property name="VMARGS" value="-J-client -J-Xmx896m -J-Xms128m" />
|
||||
<property name="CLASSPATH" value="mscorlib.jar${pathsep}System.Xml.jar${pathsep}${OpenJDK.dir}/jdk/src/share/classes/${pathsep}${OpenJDK.dir}/corba/src/share/classes" />
|
||||
<property name="OUTPUT" value="rmistubs" />
|
||||
<property name="ARGS" value="${VMARGS} -nowarn -bootclasspath ${CLASSPATH} -d ${OUTPUT}" />
|
||||
<exec program="rmic" commandline="${ARGS} -v1.1 sun.rmi.registry.RegistryImpl" />
|
||||
<exec program="rmic" commandline="${ARGS} -v1.1 sun.rmi.transport.DGCImpl" />
|
||||
<exec program="rmic" commandline="${ARGS} -v1.2 sun.rmi.server.Activation$ActivationSystemImpl" />
|
||||
@ -147,10 +211,30 @@
|
||||
<exec program="rmic" commandline="${ARGS} -iiop -standardPackage javax.management.remote.rmi.RMIServer" />
|
||||
</target>
|
||||
|
||||
<target name="run-nasgen">
|
||||
<!-- nasgen doesn't understand the MethodParameters attribute, so we have to recompile the classes it processes without parameters -->
|
||||
<exec program="javac" useruntimeengine="false">
|
||||
<arg value="-XDignore.symbol.file" />
|
||||
<arg value="-g" />
|
||||
<arg value="-nowarn" />
|
||||
<arg value="-implicit:none" />
|
||||
<arg value="-cp" />
|
||||
<arg path="mscorlib.jar;../runtime/IKVM.Runtime.jar" />
|
||||
<arg value="${OpenJDK.dir}/nashorn/src/jdk/nashorn/internal/objects/*.java" />
|
||||
</exec>
|
||||
<exec program="java" useruntimeengine="false">
|
||||
<arg line="-cp ${OpenJDK.dir}/nashorn/buildtools/nasgen/src" />
|
||||
<arg value="jdk.nashorn.internal.tools.nasgen.Main" />
|
||||
<arg value="${OpenJDK.dir}/nashorn/src" />
|
||||
<arg value="jdk.nashorn.internal.objects" />
|
||||
<arg value="${OpenJDK.dir}/nashorn/src" />
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
<target name="vfs">
|
||||
<!-- This file is generated here, but it is added as a resource to IKVM.Runtime.dll, because Ref.Emit on .NET 1.1 doesn't support adding a raw resource. -->
|
||||
<zip zipfile="vfs.zip">
|
||||
<fileset basedir="${OpenJDK7.dir}/build/linux-amd64/j2re-image">
|
||||
<fileset basedir="${OpenJDK.dir}/build/linux-x86_64-normal-server-release/jdk">
|
||||
<include name="lib/calendars.properties" />
|
||||
<include name="lib/logging.properties" />
|
||||
<include name="lib/management/management.properties" />
|
||||
@ -158,7 +242,7 @@
|
||||
<include name="lib/psfontj2d.properties" />
|
||||
<include name="lib/sound.properties" />
|
||||
<include name="lib/cmm/*" />
|
||||
<include name="lib/zi/**/*" />
|
||||
<include name="lib/tzdb.dat" />
|
||||
<include name="lib/currency.data" />
|
||||
<include name="lib/security/java.policy" />
|
||||
<include name="lib/security/java.security" />
|
||||
@ -169,7 +253,7 @@
|
||||
-->
|
||||
<include name="lib/security/US_export_policy.jar" />
|
||||
</fileset>
|
||||
<fileset basedir="${OpenJDK7.dir}/jdk/src/windows">
|
||||
<fileset basedir="${OpenJDK.dir}/jdk/src/windows">
|
||||
<include name="lib/flavormap.properties" />
|
||||
<include name="lib/content-types.properties" />
|
||||
</fileset>
|
||||
@ -177,13 +261,42 @@
|
||||
</target>
|
||||
|
||||
<target name="resources">
|
||||
<!-- resources that are not in @OPENJDK7@/build/linux-amd64/j2re-image/lib/resources.jar -->
|
||||
<!-- collect the resources in a zip to make it easier to include them in the right assemblies -->
|
||||
<zip zipfile="resources.zip">
|
||||
<fileset basedir="${OpenJDK7.dir}/jdk/src/share/classes">
|
||||
<fileset basedir="${OpenJDK.dir}/build/linux-x86_64-normal-server-release/jdk/classes">
|
||||
<include name="com/sun/corba/se/impl/orbutil/resources/*.properties" />
|
||||
<include name="com/sun/rowset/*.properties" />
|
||||
<include name="javax/swing/text/html/parser/html32.bdtd" />
|
||||
<include name="sun/rmi/registry/resources/*.properties" />
|
||||
<include name="sun/rmi/server/resources/*.properties" />
|
||||
<include name="sun/text/resources/*IteratorData" />
|
||||
<include name="sun/text/resources/th/*IteratorData_th" />
|
||||
<include name="sun/text/resources/th/thai_dict" />
|
||||
</fileset>
|
||||
<fileset basedir="${OpenJDK.dir}/corba/src/share/classes">
|
||||
<include name="**/*.properties" />
|
||||
</fileset>
|
||||
<fileset basedir="${OpenJDK.dir}/jdk/src/share/classes">
|
||||
<include name="**/*.properties" />
|
||||
<include name="**/*.gif" />
|
||||
<include name="**/*.png" />
|
||||
<include name="**/*.wav" />
|
||||
<include name="com/sun/org/apache/xml/internal/security/resource/config.*" />
|
||||
<include name="com/sun/swing/internal/plaf/**/*" />
|
||||
<include name="com/sun/java/swing/plaf/**/*.properties" />
|
||||
<include name="com/sun/java/swing/plaf/**/*.gif" />
|
||||
<include name="sun/launcher/resources/*.properties" />
|
||||
<include name="javax/swing/text/html/default.css" />
|
||||
<include name="javax/swing/text/rtf/charsets/*.txt" />
|
||||
<include name="sun/text/resources/**/*.icu" />
|
||||
</fileset>
|
||||
<fileset basedir="${OpenJDK.dir}/jaxp/src">
|
||||
<include name="**/*.properties" />
|
||||
<include name="**/*.res" />
|
||||
</fileset>
|
||||
<fileset basedir="${OpenJDK.dir}/jaxws/src/share/jaf_classes">
|
||||
<include name="**/*.properties" />
|
||||
</fileset>
|
||||
<fileset basedir="${OpenJDK.dir}/jaxws/src/share/jaxws_classes">
|
||||
<include name="**/*.properties" />
|
||||
<include name="**/*.xml" />
|
||||
</fileset>
|
||||
</zip>
|
||||
</target>
|
||||
@ -192,13 +305,35 @@
|
||||
<copy file="response.txt" tofile="response.gen.txt" outputencoding="ascii" overwrite="true">
|
||||
<filterchain>
|
||||
<replacetokens>
|
||||
<token key="OPENJDK7" value="${OpenJDK7.dir}" />
|
||||
<token key="OPENJDK" value="${OpenJDK.dir}" />
|
||||
</replacetokens>
|
||||
</filterchain>
|
||||
</copy>
|
||||
</target>
|
||||
|
||||
<target name="core" depends="version response.gen.txt">
|
||||
<target name="MANIFEST.MF">
|
||||
<copy file="MANIFEST.MF.in" tofile="MANIFEST.MF" outputencoding="ascii" overwrite="true">
|
||||
<filterchain>
|
||||
<replacetokens>
|
||||
<token key="IMPLEMENTATION_VERSION" value="${IMPLEMENTATION_VERSION}" />
|
||||
<token key="SPECIFICATION_VERSION" value="${SPECIFICATION_VERSION}" />
|
||||
</replacetokens>
|
||||
</filterchain>
|
||||
</copy>
|
||||
</target>
|
||||
|
||||
<target name="nashorn-version">
|
||||
<copy file="resources/nashorn/version.properties.in" tofile="resources/nashorn/version.properties" outputencoding="ascii" overwrite="true">
|
||||
<filterchain>
|
||||
<replacetokens>
|
||||
<token key="FULL_VERSION" value="${FULL_VERSION}" />
|
||||
<token key="IMPLEMENTATION_VERSION" value="${IMPLEMENTATION_VERSION}" />
|
||||
</replacetokens>
|
||||
</filterchain>
|
||||
</copy>
|
||||
</target>
|
||||
|
||||
<target name="core" depends="version response.gen.txt MANIFEST.MF nashorn-version">
|
||||
<copy file="../bin/IKVM.Runtime.dll" todir="." />
|
||||
<copy file="../bin/IKVM.AWT.WinForms.dll" todir="." />
|
||||
<exec program="${project::get-base-directory()}/../bin/ikvmc.exe" useruntimeengine="true">
|
||||
@ -217,6 +352,8 @@
|
||||
<arg value="-r:IKVM.Runtime.dll" />
|
||||
<!-- we already know that the JNI assembly is not available, so suppress the warning -->
|
||||
<arg value="-nowarn:110" />
|
||||
<arg value="-w4" />
|
||||
<arg value="-noparameterreflection" />
|
||||
<arg value="-warnaserror" />
|
||||
<arg value="@response.gen.txt" />
|
||||
</exec>
|
||||
@ -225,11 +362,14 @@
|
||||
<exec program="${peverify}" commandline="-nologo IKVM.OpenJDK.Charsets.dll" />
|
||||
<exec program="${peverify}" commandline="-nologo IKVM.OpenJDK.Corba.dll" />
|
||||
<exec program="${peverify}" commandline="-nologo IKVM.OpenJDK.Core.dll" />
|
||||
<exec program="${peverify}" commandline="-nologo IKVM.OpenJDK.Cldrdata.dll" />
|
||||
<exec program="${peverify}" commandline="-nologo IKVM.OpenJDK.Jdbc.dll" />
|
||||
<exec program="${peverify}" commandline="-nologo IKVM.OpenJDK.Localedata.dll" />
|
||||
<exec program="${peverify}" commandline="-nologo IKVM.OpenJDK.Management.dll" />
|
||||
<exec program="${peverify}" commandline="-nologo IKVM.OpenJDK.Media.dll" />
|
||||
<exec program="${peverify}" commandline="-nologo IKVM.OpenJDK.Misc.dll" />
|
||||
<exec program="${peverify}" commandline="-nologo IKVM.OpenJDK.Naming.dll" />
|
||||
<exec program="${peverify}" commandline="-nologo IKVM.OpenJDK.Nashorn.dll" />
|
||||
<exec program="${peverify}" commandline="-nologo IKVM.OpenJDK.Remoting.dll" />
|
||||
<exec program="${peverify}" commandline="-nologo IKVM.OpenJDK.Security.dll" />
|
||||
<exec program="${peverify}" commandline="-nologo IKVM.OpenJDK.SwingAWT.dll" />
|
||||
@ -268,7 +408,7 @@
|
||||
<copy file="tools.rsp" tofile="tools.gen.rsp" outputencoding="ascii" overwrite="true">
|
||||
<filterchain>
|
||||
<replacetokens>
|
||||
<token key="OPENJDK7" value="${OpenJDK7.dir}" />
|
||||
<token key="OPENJDK" value="${OpenJDK.dir}" />
|
||||
</replacetokens>
|
||||
</filterchain>
|
||||
</copy>
|
||||
@ -280,6 +420,8 @@
|
||||
<arg value="-version:${VERSION}" />
|
||||
<arg value="${signoption}" />
|
||||
<arg value="-warnaserror" />
|
||||
<arg value="-w4" />
|
||||
<arg value="-noparameterreflection" />
|
||||
<arg value="@tools.gen.rsp" />
|
||||
</exec>
|
||||
</target>
|
||||
@ -300,9 +442,14 @@
|
||||
<exec program="${project::get-base-directory()}/../bin/ikvmc.exe" useruntimeengine="true">
|
||||
<arg value="-version:${VERSION}" />
|
||||
<arg value="-out:../bin/javap.exe" />
|
||||
<arg value="-main:sun.tools.javap.Main" />
|
||||
<arg value="-main:com.sun.tools.javap.Main" />
|
||||
<arg value="-r:../bin/IKVM.OpenJDK.Tools.dll" />
|
||||
</exec>
|
||||
<exec program="${project::get-base-directory()}/../bin/ikvmc.exe" useruntimeengine="true">
|
||||
<arg value="-version:${VERSION}" />
|
||||
<arg value="-out:../bin/jjs.exe" />
|
||||
<arg value="-main:jdk.nashorn.tools.Shell" />
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
</project>
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user