Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 22 additions & 12 deletions vm/cmake/mac_osx.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ endif()
set(SELF_OSX_INFO_PLIST Info)

if(SELF_QUARTZ)
message(STATUS "Using Quartz plaform windows.")
message(STATUS "Using Quartz platform windows.")
list(APPEND _defines -DQUARTZ_LIB)
endif()

Expand All @@ -23,7 +23,7 @@ if(SELF_OSX_COCOA)
endif()

set(SELF_PREFIX_PREFIX_THRESHOLD_INIT
"20" # DO NOT SET ABVOE 20. Breaks X-includes!
"20" # DO NOT SET ABOVE 20. Breaks X-includes!
)


Expand All @@ -35,18 +35,28 @@ set(GUI_TYPE MACOSX_BUNDLE)
if(NOT CONFIG_HAS_BEEN_RUN_BEFORE)
# no x86_64 atm,
# so forcibly overwrite
set(CMAKE_OSX_ARCHITECTURES i386 CACHE STRING
"Build architectures for OSX"
FORCE)
# we need to be 10.6 compliant.
# so forcibly overwrite
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.6" CACHE STRING
"Minimum OS X version to target for deployment (at runtime); newer APIs weak linked. Set to empty string for default value."
set(CMAKE_OSX_ARCHITECTURES ${platform_processor} CACHE STRING
"Build architectures for OSX"
FORCE)

if(${platform_processor} STREQUAL "i386")
# we need to be 10.6 compliant.
# so forcibly overwrite
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.6" CACHE STRING
"Minimum OS X version to target for deployment (at runtime); newer APIs weak linked. Set to empty string for default value."
FORCE)
set(_sdk_list "macosx10.10" "macosx10.9" "macosx10.8" "macosx10.7" "macosx10.6")
elseif(${platform_processor} STREQUAL "ppc")
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.5" CACHE STRING
"Minimum OS X version to target for deployment (at runtime); newer APIs weak linked. Set to empty string for default value."
FORCE)
set(_sdk_list "macosx10.5")
endif()

# see if we can get a matching SDK
# first, unset this because it is probably set to the latest SDK
unset(CMAKE_OSX_SYSROOT CACHE)
foreach(sdk "macosx10.9" "macosx10.8" "macosx10.7" "macosx10.6")
foreach(sdk ${_sdk_list})
execute_process(
COMMAND xcodebuild -version -sdk "${sdk}" Path
OUTPUT_VARIABLE _sdkpath
Expand Down Expand Up @@ -200,7 +210,7 @@ macro(setup_target target)
endif()
endif()

# These are the XCode-equivalendts for the flags/warnings in setup.
# These are the XCode-equivalents for the flags/warnings in setup.
# we hence remove the respective flag, it gets added anyways at compile time
set(CMAKE_XCODE_ATTRIBUTE_GCC_WARN_CHECK_SWITCH_STATEMENTS "YES")
remove_definitions(-Wswitch)
Expand Down Expand Up @@ -237,7 +247,7 @@ macro(setup_target target)
set(CMAKE_XCODE_ATTRIBUTE_COPY_PHASE_STRIP "NO")
set(CMAKE_XCODE_ATTRIBUTE_DEBUG_INFORMATION_FORMAT "dwarf-with-dsym")

# cmake adds warnings hardcoded which we dont want.
# cmake adds warnings hardcoded which we don't want.
# mess with the warnings
set_target_properties(${target} PROPERTIES XCODE_ATTRIBUTE_WARNING_CFLAGS "")
endif()
Expand Down
69 changes: 44 additions & 25 deletions vm/cmake/setup.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -51,30 +51,18 @@ endif()
if (clang)
list(APPEND _flags -Wabi)
elseif(gcc)
list(APPEND _flags -Wabi=11)
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0)
list(APPEND _flags -Wabi=11)
endif()
endif()

# These warning options are accepted by the latest xcode for MacOS X
# 10.5 with gcc 4.2. The compiler versions for the rest of them were
# picked from inspecting the gcc docs and should not be too wrong.
list(APPEND _flags
-Wall
-Wextra

# probably ok, but needs auditing
-Wno-delete-non-virtual-dtor

# old use of "volatile" in lieu of attribute((noreturn))
-Wno-ignored-qualifiers

# TODO: just add FALLTHROUGH annotation comments
-Wno-implicit-fallthrough

# these are often hit or miss...
-Wno-maybe-uninitialized

# complains about a few cases of existing idiomatic layout
-Wno-misleading-indentation

# cf. -fno-delete-null-pointer-checks above
-Wno-nonnull

# these are a pain to fix properly...
-Wno-sign-compare

Expand All @@ -85,15 +73,46 @@ list(APPEND _flags
# vm/src/any/parser/parser.cpp uses some literal chars not in enum
-Wno-switch

# there are few, marked "for debugging", and they probably need to
# be marked volatile so that those assignments are not elided and
# the values are actually available to be inspected from the
# debugger
-Wno-unused-but-set-variable

# mostly spammy for C++, needs a rainy day cleanup round
-Wno-unused-parameter

# needs a rainy day cleanup round
-Wno-unused-variable
)

# NB: XXX: For now this only handles gcc. Recent clang cannot be used
# to compile Self b/c they insist on this != null. Older clang
# versions should probably be fine, but I currently don't have
# bandwidth spelunking throgh clang docs/rtfs in search of the right
# versions.
macro(VersionedFlag FirstVersion)
if (gcc)
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL ${FirstVersion})
list(APPEND _flags ${ARGN})
endif()
endif()
endmacro()

# probably ok, but needs auditing
VersionedFlag(4.7 -Wno-delete-non-virtual-dtor)

# old use of "volatile" in lieu of attribute((noreturn))
VersionedFlag(4.3 -Wno-ignored-qualifiers)

# TODO: just add FALLTHROUGH annotation comments
VersionedFlag(7.0 -Wno-implicit-fallthrough)

# these are often hit or miss...
VersionedFlag(4.7 -Wno-maybe-uninitialized)

# complains about a few cases of existing idiomatic layout
VersionedFlag(6.0 -Wno-misleading-indentation)

# cf. -fno-delete-null-pointer-checks above
# (it was supported in earlier gcc versions, but not for C++)
VersionedFlag(5.0 -Wno-nonnull)

# there are few, marked "for debugging", and they probably need to be
# marked volatile so that those assignments are not elided and the
# values are actually available to be inspected from the debugger
VersionedFlag(4.6 -Wno-unused-but-set-variable)
4 changes: 4 additions & 0 deletions vm/src/i386/runtime/asmDefs_gcc_i386.hh
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,12 @@
.global C_SYM(name) ; \
C_SYM(name):

#ifdef __ELF__
#define end_exported_function(name) \
.size C_SYM(name), . - C_SYM(name)
#else
#define end_exported_function(name) /* no .size directive for macho */
#endif


// LinkageArea record:
Expand Down
2 changes: 1 addition & 1 deletion vm/src/ppc/memory/search_ppc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# pragma implementation "search_ppc.hh"
# include "_search_ppc.cpp.incl"

#if TARGET_OS_VERSION == NETBSD_VERSION
#if TARGET_OS_VERSION == MACOSX_VERSION || TARGET_OS_VERSION == NETBSD_VERSION
#include <altivec.h>
#endif

Expand Down
67 changes: 33 additions & 34 deletions vm/src/ppc/prims/asmPrims_gcc_ppc.S
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,28 @@
// some integer primitives


// .include "../../src/ppc/runtime/asmDefs_gcc_ppc.hh"
# include "asmDefs_gcc_ppc.hh"
# include "_asmPrims_ppc.S.incl"



#define ret_prim_error(error_code) \
import_data_address(r3, VMString) ; \
lwz r3, error_code(r3) ; \
addi r3, r3, Mark_Tag - Mem_Tag ; \
#define ret_prim_error(error_code) \
import_data_address(r3, VMString) __ \
lwz r3, error_code(r3) __ \
addi r3, r3, Mark_Tag - Mem_Tag __ \
blr


#define arith_prim(name, opcode) \
start_exported_function(name) ; \
or r0, rcv, arg ; \
andi. r0, r0, Tag_Mask ; \
beq name ## _OK ; \
ret_prim_error(badTypeOffset) ; \
name ## _OK: \
/* clear sum ovfl bit */ \
mcrxr 0 ; \
opcode rcv, rcv, arg ; \
bnslr ; \
#define arith_prim(name, opcode) \
start_exported_function(name) __ \
or r0, rcv, arg __ \
andi. r0, r0, Tag_Mask __ \
beq name ## _OK __ \
ret_prim_error(badTypeOffset) __ \
name ## _OK: \
/* clear sum ovfl bit */ \
mcrxr 0 __ \
opcode rcv, rcv, arg __ \
bnslr __ \
ret_prim_error(overflowOffset)

arith_prim(smi_add_prim, addo. )
Expand All @@ -51,14 +50,14 @@ smi_mul_prim_OK:
ret_prim_error(overflowOffset)


#define log_prim(name, opcode) \
start_exported_function(name) ; \
or r0, rcv, arg ; \
andi. r0, r0, Tag_Mask ; \
beq name ## _OK ; \
ret_prim_error(badTypeOffset) ; \
name ## _OK: \
opcode rcv, rcv, arg ; \
#define log_prim(name, opcode) \
start_exported_function(name) __ \
or r0, rcv, arg __ \
andi. r0, r0, Tag_Mask __ \
beq name ## _OK __ \
ret_prim_error(badTypeOffset) __ \
name ## _OK: \
opcode rcv, rcv, arg __ \
blr

log_prim(smi_and_prim, and)
Expand Down Expand Up @@ -90,15 +89,15 @@ smi_arithmetic_shift_left_prim_OK:
ret_prim_error(overflowOffset)


#define simple_shift_prim(name, opcode) \
start_exported_function(name) ; \
or r0, rcv, arg ; \
andi. r0, r0, Tag_Mask ; \
beq 1f ; \
ret_prim_error(badTypeOffset) ; \
1: \
/* shift out tag */ \
srawi arg, arg, 2 ; \
#define simple_shift_prim(name, opcode) \
start_exported_function(name) __ \
or r0, rcv, arg __ \
andi. r0, r0, Tag_Mask __ \
beq 1f __ \
ret_prim_error(badTypeOffset) __ \
1: \
/* shift out tag */ \
srawi arg, arg, 2 __ \
opcode rcv, rcv, arg

simple_shift_prim(smi_logical_shift_left_prim, slw)
Expand Down
47 changes: 21 additions & 26 deletions vm/src/ppc/runtime/asmDefs_gcc_ppc.hh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
// Copyright 1992-9 Sun Microsystems, Inc. and Stanford University.
// See the LICENSE file for license information.

#if TARGET_OS_VERSION == NETBSD_VERSION
// can't include config.hh in asm files, so FOO_VERSION are not defined
#if !defined(__APPLE__) // TARGET_OS_VERSION == NETBSD_VERSION
#define r0 0
#define r1 1
#define r2 2
Expand Down Expand Up @@ -152,21 +153,23 @@ non_local_return_offset = 8 // offset of NLR instruction from call
// ---------------------------------------------------------

# if defined(__APPLE__)
# define __ @
# define C_SYM(name) _##name
# elif defined(__ELF__)
# define __ ;
# define C_SYM(name) name
# else
# error what?
# endif


#define start_exported_function(name) \
.globl C_SYM(name); \
#define start_exported_function(name) \
.globl C_SYM(name) __ \
C_SYM(name):


#define load_global_address(tmp_reg, data_sym) \
.globl C_SYM(data_sym); \
#define load_global_address(tmp_reg, data_sym) \
.globl C_SYM(data_sym) __ \
load_addr(tmp_reg, C_SYM(data_sym))

#define import_data_address(tmp_reg, data_sym) \
Expand Down Expand Up @@ -194,35 +197,27 @@ badTypeOffset = 8
divisionByZeroOffset = 16
overflowOffset = 20

// Warning: Duplicated in tag.hh
Int_Tag = 0
Mem_Tag = 1
Float_Tag = 2
Mark_Tag = 3

Tag_Mask = 3

// =====================================================

// call untested DOES NOT QUITE WORK
#define Untested(string, tmp) \
b 3f ; \
1: .asciz string ; \
2: C_SYM(Untested_Stub) ; \
\
3: mflr r0 ; \
import_function_address(tmp, C_SYM(Untested_stub)); \
mtctr tmp ; \
bctrl ; \
#define Untested(string, tmp) \
b 3f __ \
1: .asciz string __ \
2: C_SYM(Untested_Stub) __ \
\
3: mflr r0 __ \
import_function_address(tmp, C_SYM(Untested_stub)) __ \
mtctr tmp __ \
bctrl __ \
mtlr r0


#define load_addr(targ, val) \
addis targ, 0, hi16(val) ; \
#define load_addr(targ, val) \
addis targ, 0, hi16(val) __ \
ori targ, targ, lo16(val)

#define load_val(targ, val) \
addis targ, 0, ha16(val) ; \
#define load_val(targ, val) \
addis targ, 0, ha16(val) __ \
lwz targ, lo16(val)

# endif // __ppc__
12 changes: 6 additions & 6 deletions vm/src/ppc/runtime/runtime_asm_gcc_ppc.S
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
/* remove me from MW project when compiling under MW */


# include "asmDefs_gcc_ppc.hh"
# include "_runtime_asm_gcc_ppc.S.incl"

start_exported_function(currentFrame)
mr r3, sp
blr
Expand Down Expand Up @@ -464,10 +464,10 @@ base_fr_size = LinkageArea_size/oopSize + NumRcvrAndArgRegisters + -SaveSelfNo
# define vol_reg_count r30


#define load_global_nonvol_regs \
import_data_address(ByteMapBaseReg, byte_map_base) ; \
import_data_address(SPLimitReg, SPLimit) ; \
lwz ByteMapBaseReg, 0(ByteMapBaseReg) ; \
#define load_global_nonvol_regs \
import_data_address(ByteMapBaseReg, byte_map_base) __ \
import_data_address(SPLimitReg, SPLimit) __ \
lwz ByteMapBaseReg, 0(ByteMapBaseReg) __ \
lwz SPLimitReg, 0(SPLimitReg)


Expand Down
Loading