LuaJIT on Android fixes (#7094)

* Don't flag Android as should_restrict_JIT

And allow disabling the C blitter, to put the workaround to the test...

* Add a -d, --debug flag to the log function

Catches KOReader's debug, as well as (our) dlopen & luajit logging

* Bump android-luajit-launcher

https://github.com/koreader/android-luajit-launcher/pull/283
https://github.com/koreader/android-luajit-launcher/pull/282

* Bump base

(https://github.com/koreader/koreader-base/pull/1279)
pull/7104/head
NiLuJe 3 years ago committed by GitHub
parent 048b0b2d83
commit 5756f1f43e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1 +1 @@
Subproject commit 7c1057f8e9c54265938a10364342dbfeb0b36e6b
Subproject commit 395936d25688e8bb19d67133ce1c24206f602f8e

@ -355,7 +355,7 @@ function FileManagerMenu:setUpdateItemTable()
end,
})
end
if not (Device.should_restrict_JIT or Device:isAndroid()) then
if not Device.should_restrict_JIT then
local Blitbuffer = require("ffi/blitbuffer")
table.insert(self.menu_items.developer_options.sub_item_table, {
text = _("Disable C blitter"),

@ -119,7 +119,9 @@ local Device = Generic:new{
-- required for those modules where it *really* matters (e.g., ffi/blitbuffer.lua).
-- This is also why we try to actually avoid entering actual loops in the Lua blitter on Android,
-- and instead attempt to do most of everything via the C implementation.
should_restrict_JIT = true,
-- NOTE: Since https://github.com/koreader/android-luajit-launcher/pull/283, we've patched LuaJIT
-- to ensure that the initial mcode alloc works, and sticks around, which is why this is no longer enabled.
should_restrict_JIT = false,
}
function Device:init()
@ -387,9 +389,9 @@ local function processEvents()
if poll_state >= 0 then
if source[0] ~= nil then
if source[0].id == C.LOOPER_ID_MAIN then
local cmd = C.android_app_read_cmd(android.app)
C.android_app_pre_exec_cmd(android.app, cmd)
C.android_app_post_exec_cmd(android.app, cmd)
local cmd = android.glue.android_app_read_cmd(android.app)
android.glue.android_app_pre_exec_cmd(android.app, cmd)
android.glue.android_app_post_exec_cmd(android.app, cmd)
elseif source[0].id == C.LOOPER_ID_INPUT then
local event = ffi.new("AInputEvent*[1]")
while android.lib.AInputQueue_getEvent(android.app.inputQueue, event) >= 0 do

56
kodev

@ -1073,7 +1073,11 @@ OPTIONS:
function kodev-log() {
LOG_HELP_MSG="
usage: log <TARGET>
usage: log <OPTIONS> <TARGET>
OPTIONS:
-d, --debug more verbose logs (e.g., debug builds)
TARGET:
@ -1084,13 +1088,53 @@ TARGET:
exit 1
}
# Defaults
ignore_translation=0
declare opt
declare -r E_OPTERR=85
declare -r short_opts="dh"
declare -r long_opts="debug, help"
if ! opt=$(getopt -o "${short_opts}" --long "${long_opts}" --name "kodev" -- "${@}"); then
echo "${LOG_HELP_MSG}"
exit ${E_OPTERR}
fi
eval set -- "${opt}"
while true; do
PARAM="${1}"
# Support using an = assignment with short options (e.g., -f=blah instead of -f blah).
VALUE="${2/#=/}"
case "${PARAM}" in
-d | --debug)
export KODEBUG=1
;;
-h | --help)
echo "${LOG_HELP_MSG}"
exit 0
;;
--)
break
;;
*)
echo "ERROR: unknown option \"${PARAM}\""
echo "${RELEASE_HELP_MSG}"
exit 1
;;
esac
shift
done
shift
case "${1}" in
-h | --help)
echo "${LOG_HELP_MSG}"
exit 0
;;
android)
adb logcat 'KOReader:I ActivityManager:* AndroidRuntime:* DEBUG:* *:F'
if [ -n "${KODEBUG}" ]; then
adb logcat 'KOReader:* ActivityManager:* AndroidRuntime:* DEBUG:* *:F dlopen:* LuaJIT:*'
else
adb logcat 'KOReader:I ActivityManager:* AndroidRuntime:* DEBUG:* *:F'
fi
;;
*)
echo "Unsupported target: $1."

@ -1 +1 @@
Subproject commit 9099a388a09259285bcc9f96dde2149005113d36
Subproject commit af9b9d30c10451a3be423d8fb55f05945a3133f6
Loading…
Cancel
Save