Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
c704b758
D
dragonwell8_jdk
项目概览
openanolis
/
dragonwell8_jdk
通知
3
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_jdk
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
c704b758
编写于
8月 11, 2011
作者:
C
coffeys
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
7047325: Internal API to improve management of direct buffers
Reviewed-by: alanb, mduigou
上级
3633c027
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
71 addition
and
58 deletion
+71
-58
make/com/oracle/Makefile
make/com/oracle/Makefile
+10
-5
make/com/oracle/net/Makefile
make/com/oracle/net/Makefile
+0
-39
make/common/Release.gmk
make/common/Release.gmk
+2
-1
src/share/classes/java/nio/Bits.java
src/share/classes/java/nio/Bits.java
+9
-1
src/share/classes/java/nio/Buffer.java
src/share/classes/java/nio/Buffer.java
+8
-1
src/share/classes/java/nio/Direct-X-Buffer.java.template
src/share/classes/java/nio/Direct-X-Buffer.java.template
+22
-8
src/share/classes/sun/misc/JavaNioAccess.java
src/share/classes/sun/misc/JavaNioAccess.java
+18
-1
src/share/classes/sun/nio/ch/DirectBuffer.java
src/share/classes/sun/nio/ch/DirectBuffer.java
+2
-2
未找到文件。
make/com/oracle/Makefile
浏览文件 @
c704b758
#
# Copyright (c) 201
0
, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 201
1
, 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
...
...
@@ -27,8 +27,13 @@ BUILDDIR = ../..
PRODUCT
=
oracle
include
$(BUILDDIR)/common/Defs.gmk
SUBDIRS
=
net
include
$(BUILDDIR)/common/Subdirs.gmk
#
# Files to compile
#
AUTO_FILES_JAVA_DIRS
=
com/oracle
#
# Rules
#
include
$(BUILDDIR)/common/Classes.gmk
all build clean clobber
::
$
(
SUBDIRS-loop
)
make/com/oracle/net/Makefile
已删除
100644 → 0
浏览文件 @
3633c027
#
# Copyright (c) 2010, 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
# 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.
#
BUILDDIR
=
../../..
PRODUCT
=
oracle
include
$(BUILDDIR)/common/Defs.gmk
#
# Files to compile
#
AUTO_FILES_JAVA_DIRS
=
com/oracle/net
#
# Rules
#
include
$(BUILDDIR)/common/Classes.gmk
make/common/Release.gmk
浏览文件 @
c704b758
...
...
@@ -60,7 +60,8 @@ EXCLUDE_PROPWARN_PKGS = com.sun.java.swing.plaf.windows \
# with a new module system (being discussed for JDK 8).
#
EXPORTED_PRIVATE_PKGS = com.sun.servicetag \
com.oracle.net
com.oracle.net \
com.oracle.nio
# 64-bit solaris has a few special cases. We define the variable
# SOLARIS64 for use in this Makefile to easily test those cases
...
...
src/share/classes/java/nio/Bits.java
浏览文件 @
c704b758
/*
* Copyright (c) 2000, 201
0
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 201
1
, 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
...
...
@@ -699,6 +699,14 @@ class Bits { // package-private
}
};
}
@Override
public
ByteBuffer
newDirectByteBuffer
(
long
addr
,
int
cap
,
Object
ob
)
{
return
new
DirectByteBuffer
(
addr
,
cap
,
ob
);
}
@Override
public
void
truncate
(
Buffer
buf
)
{
buf
.
truncate
();
}
});
}
...
...
src/share/classes/java/nio/Buffer.java
浏览文件 @
c704b758
/*
* Copyright (c) 2000, 20
08
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 20
11
, 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
...
...
@@ -543,6 +543,13 @@ public abstract class Buffer {
return
mark
;
}
final
void
truncate
()
{
// package-private
mark
=
-
1
;
position
=
0
;
limit
=
0
;
capacity
=
0
;
}
final
void
discardMark
()
{
// package-private
mark
=
-
1
;
}
...
...
src/share/classes/java/nio/Direct-X-Buffer.java.template
浏览文件 @
c704b758
/*
*
Copyright
(
c
)
2000
,
201
0
,
Oracle
and
/
or
its
affiliates
.
All
rights
reserved
.
*
Copyright
(
c
)
2000
,
201
1
,
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
...
...
@@ -58,12 +58,13 @@ class Direct$Type$Buffer$RW$$BO$
//
NOTE
:
moved
up
to
Buffer
.
java
for
speed
in
JNI
GetDirectBufferAddress
//
protected
long
address
;
//
If
this
buffer
is
a
view
of
another
buffer
then
we
keep
a
reference
to
//
that
buffer
so
that
its
memory
isn
't freed before we'
re
done
with
it
protected
Object
viewedBuffer
=
null
;
//
An
object
attached
to
this
buffer
.
If
this
buffer
is
a
view
of
another
//
buffer
then
we
use
this
field
to
keep
a
reference
to
that
buffer
to
//
ensure
that
its
memory
isn
't freed before we are done with it.
private final Object att;
public
Object
viewedBuffer
()
{
return
viewedBuffer
;
public Object
attachment
() {
return
att
;
}
#if[byte]
...
...
@@ -136,6 +137,7 @@ class Direct$Type$Buffer$RW$$BO$
address = base;
}
cleaner = Cleaner.create(this, new Deallocator(base, size, cap));
att = null;
#else[rw]
super(cap);
#end[rw]
...
...
@@ -143,12 +145,24 @@ class Direct$Type$Buffer$RW$$BO$
#if[rw]
// Invoked to construct a direct ByteBuffer referring to the block of
// memory. A given arbitrary object may also be attached to the buffer.
//
Direct$Type$Buffer(long addr, int cap, Object ob) {
super(-1, 0, cap, cap);
address = addr;
cleaner = null;
att = ob;
}
// Invoked only by JNI: NewDirectByteBuffer(void*, long)
//
private Direct$Type$Buffer(long addr, int cap) {
super(-1, 0, cap, cap);
address = addr;
cleaner = null;
att = null;
}
#end[rw]
...
...
@@ -162,8 +176,8 @@ class Direct$Type$Buffer$RW$$BO$
#if[rw]
super(-1, 0, cap, cap, fd);
address = addr;
viewedBuffer
=
null
;
cleaner = Cleaner.create(this, unmapper);
att = null;
#else[rw]
super(cap, addr, fd, unmapper);
#end[rw]
...
...
@@ -180,10 +194,10 @@ class Direct$Type$Buffer$RW$$BO$
#if[rw]
super(mark, pos, lim, cap);
address = db.address() + off;
viewedBuffer
=
db
;
#if[byte]
cleaner = null;
#end[byte]
att = db;
#else[rw]
super(db, mark, pos, lim, cap, off);
#end[rw]
...
...
src/share/classes/sun/misc/JavaNioAccess.java
浏览文件 @
c704b758
/*
* Copyright (c) 2007, 20
08
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 20
11
, 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
...
...
@@ -25,6 +25,9 @@
package
sun.misc
;
import
java.nio.Buffer
;
import
java.nio.ByteBuffer
;
public
interface
JavaNioAccess
{
/**
* Provides access to information on buffer usage.
...
...
@@ -36,4 +39,18 @@ public interface JavaNioAccess {
long
getMemoryUsed
();
}
BufferPool
getDirectBufferPool
();
/**
* Constructs a direct ByteBuffer referring to the block of memory starting
* at the given memory address and and extending {@code cap} bytes.
* The {@code ob} parameter is an arbitrary object that is attached
* to the resulting buffer.
*/
ByteBuffer
newDirectByteBuffer
(
long
addr
,
int
cap
,
Object
ob
);
/**
* Truncates a buffer by changing its capacity to 0.
*/
void
truncate
(
Buffer
buf
);
}
src/share/classes/sun/nio/ch/DirectBuffer.java
浏览文件 @
c704b758
/*
* Copyright (c) 2000, 20
03
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 20
11
, 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
...
...
@@ -32,7 +32,7 @@ public interface DirectBuffer {
public
long
address
();
public
Object
viewedBuffer
();
public
Object
attachment
();
public
Cleaner
cleaner
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录