Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Restores jre_emul directory in public build, erased by repository-syn…
…c script. Change on 2014/10/07 by tball <tball@google.com> ------------- Created by MOE: http://code.google.com/p/moe-java MOE_MIGRATED_REVID=77180693
- Loading branch information
Showing
1,486 changed files
with
430,314 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
// | ||
// BufferUtils.h | ||
// JreEmulation | ||
// | ||
// Created by Tom Ball on 2/13/14. | ||
// | ||
|
||
#ifndef JreEmulation_BufferUtils_h | ||
#define JreEmulation_BufferUtils_h | ||
|
||
#import "JreEmulation.h" | ||
#import "IOSPrimitiveArray.h" | ||
#import "java/nio/ByteArrayBuffer.h" | ||
|
||
static inline char *BytesRW(id object) { | ||
nil_chk(object); | ||
if ([object isKindOfClass:[IOSByteArray class]]) { | ||
return (char *)IOSByteArray_GetRef(object, 0); | ||
} else if ([object isKindOfClass:[JavaNioBuffer class]]) { | ||
// All buffer concrete classes have byteBuffer at the same | ||
// offset by explicit design. | ||
JavaNioBuffer *buffer = (JavaNioBuffer *) object; | ||
return (char *)buffer->effectiveDirectAddress_; | ||
} | ||
return NULL; // Unknown type. | ||
} | ||
|
||
static inline const char *BytesRO(id object) { | ||
return (const char *) BytesRW(object); | ||
} | ||
|
||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
// | ||
// DebugUtils.h: low-level functions to aid debugging. | ||
// JreEmulation | ||
// | ||
// Created by Tom Ball on 3/4/14. | ||
// | ||
|
||
#ifndef JreEmulation_DebugUtils_h | ||
#define JreEmulation_DebugUtils_h | ||
|
||
#import "JreEmulation.h" | ||
|
||
@interface DebugUtils : NSObject { | ||
} | ||
|
||
+(void)logStack:(NSUInteger)nFrames; | ||
+(void)logStack:(NSUInteger)nFrames withMessage:(NSString *)msg; | ||
|
||
@end | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
// | ||
// DebugUtils.m: low-level functions to aid debugging. | ||
// JreEmulation | ||
// | ||
// Created by Tom Ball on 3/4/14. | ||
// | ||
|
||
#include "DebugUtils.h" | ||
|
||
#include <execinfo.h> | ||
|
||
#define FRAMES_TO_IGNORE 2 | ||
|
||
@implementation DebugUtils | ||
|
||
static void LogStack(NSUInteger nFrames) { | ||
if (nFrames == 0) { | ||
return; | ||
} | ||
|
||
void *callStack[nFrames + FRAMES_TO_IGNORE]; | ||
NSUInteger callFrames = backtrace(callStack, (int) nFrames + FRAMES_TO_IGNORE); | ||
|
||
for (NSUInteger i = FRAMES_TO_IGNORE; i <= callFrames; i++) { | ||
void *shortStack[1]; | ||
shortStack[0] = callStack[i]; | ||
char **stackSymbol = backtrace_symbols(shortStack, 1); | ||
NSLog(@" %s", *stackSymbol); | ||
free(stackSymbol); | ||
} | ||
} | ||
|
||
+(void)logStack:(NSUInteger)nFrames { | ||
@synchronized ([DebugUtils getClass]) { | ||
LogStack(nFrames); | ||
} | ||
} | ||
|
||
+(void)logStack:(NSUInteger)nFrames withMessage:(NSString *)msg { | ||
@synchronized ([DebugUtils getClass]) { | ||
NSLog(@"%@", msg); | ||
LogStack(nFrames); | ||
} | ||
} | ||
|
||
@end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
// Copyright 2011 Google Inc. All Rights Reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
// | ||
// IOSArray.h | ||
// JreEmulation | ||
// | ||
// Created by Tom Ball on 6/21/11. | ||
// | ||
|
||
#ifndef _IOSARRAY_H | ||
#define _IOSARRAY_H | ||
|
||
#import "J2ObjC_common.h" | ||
|
||
@class IOSClass; | ||
|
||
// An abstract class that represents a Java array. Like a Java array, | ||
// an IOSArray is fixed-size but its elements are mutable. | ||
@interface IOSArray : NSObject < NSCopying > { | ||
@public | ||
jint size_; | ||
} | ||
|
||
// Create an empty multi-dimensional array. | ||
+ (id)arrayWithDimensions:(NSUInteger)dimensionCount | ||
lengths:(const jint *)dimensionLengths; | ||
// We must set the method family to "none" because as a "new" method family | ||
// clang will assume the return type to be the same type as the class being | ||
// called. | ||
+ (id)newArrayWithDimensions:(NSUInteger)dimensionCount | ||
lengths:(const jint *)dimensionLengths | ||
__attribute__((objc_method_family(none), ns_returns_retained)); | ||
|
||
+ (id)iosClass; | ||
+ (id)iosClassWithDimensions:(NSUInteger)dimensions; | ||
|
||
// Returns the size of this array. | ||
- (jint)length; | ||
// DEPRECATED: Use length instead. | ||
- (NSUInteger)count __attribute__((deprecated)); | ||
|
||
- (NSString *)descriptionOfElementAtIndex:(jint)index; | ||
|
||
// Returns the element type of this array. | ||
- (IOSClass *)elementType; | ||
|
||
// Creates and returns an array containing the values from this array. | ||
- (id)clone; | ||
|
||
// Copies a range of elements from this array into another. This method is | ||
// only called from java.lang.System.arraycopy(), which verifies that the | ||
// destination array is the same type as this array. | ||
- (void)arraycopy:(jint)offset | ||
destination:(IOSArray *)destination | ||
dstOffset:(jint)dstOffset | ||
length:(jint)length; | ||
|
||
@end | ||
|
||
extern void IOSArray_throwOutOfBounds(); | ||
extern void IOSArray_throwOutOfBoundsWithMsg(jint size, jint index); | ||
|
||
// Implement IOSArray |checkIndex| and |checkRange| methods as C functions. This | ||
// allows IOSArray index and range checks to be completely removed via the | ||
// J2OBJC_DISABLE_ARRAY_CHECKS macro to improve performance. | ||
__attribute__ ((unused)) | ||
static inline void IOSArray_checkIndex(jint size, jint index) { | ||
#if !defined(J2OBJC_DISABLE_ARRAY_CHECKS) | ||
if (index < 0 || index >= size) { | ||
IOSArray_throwOutOfBoundsWithMsg(size, index); | ||
} | ||
#endif | ||
} | ||
__attribute__ ((unused)) | ||
static inline void IOSArray_checkRange(jint size, jint offset, jint length) { | ||
#if !defined(J2OBJC_DISABLE_ARRAY_CHECKS) | ||
if (length < 0 || offset < 0 || offset + length > size) { | ||
IOSArray_throwOutOfBounds(); | ||
} | ||
#endif | ||
} | ||
|
||
#endif // _IOSARRAY_H |
Oops, something went wrong.